1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-15 01:58:05 -05:00

Warn-on-close is now configurable off

[originally from svn r273]
This commit is contained in:
Simon Tatham 1999-11-05 09:50:49 +00:00
parent 7205ae9199
commit 97994b235d
5 changed files with 18 additions and 5 deletions

View File

@ -97,6 +97,7 @@ typedef struct {
int port;
enum { PROT_RAW, PROT_TELNET, PROT_SSH } protocol;
int close_on_exit;
int warn_on_close;
/* SSH options */
int nopty;
enum { CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DES } cipher;

View File

@ -42,6 +42,7 @@
#define IDC0_SESSSAVE 1013
#define IDC0_SESSDEL 1014
#define IDC0_CLOSEEXIT 1015
#define IDC0_CLOSEWARN 1016
#define IDC1_DELSTATIC 1001
#define IDC1_DEL008 1002

View File

@ -52,23 +52,24 @@ BEGIN
EDITTEXT IDC0_PORT, 131, 11, 34, 12
#ifdef FWHACK
RTEXT "Protocol:", IDC0_PROTSTATIC, 3, 29, 42, 8
AUTORADIOBUTTON "R&aw", IDC0_PROTRAW, 51, 29, 33, 10, WS_GROUP
AUTORADIOBUTTON "&Raw", IDC0_PROTRAW, 51, 29, 33, 10, WS_GROUP
AUTORADIOBUTTON "&Telnet", IDC0_PROTTELNET, 86, 29, 33, 10
AUTORADIOBUTTON "SS&H/hack", IDC0_PROTSSH, 122, 29, 43, 10
#else
RTEXT "Protocol:", IDC0_PROTSTATIC, 3, 29, 52, 8
AUTORADIOBUTTON "R&aw", IDC0_PROTRAW, 61, 29, 33, 10, WS_GROUP
AUTORADIOBUTTON "&Raw", IDC0_PROTRAW, 61, 29, 33, 10, WS_GROUP
AUTORADIOBUTTON "&Telnet", IDC0_PROTTELNET, 96, 29, 33, 10
AUTORADIOBUTTON "SS&H", IDC0_PROTSSH, 132, 29, 33, 10
#endif
LTEXT "Sto&red Sessions", IDC0_SESSSTATIC, 3, 40, 122, 8
LTEXT "Stor&ed Sessions", IDC0_SESSSTATIC, 3, 40, 122, 8
EDITTEXT IDC0_SESSEDIT, 3, 48, 122, 12, ES_AUTOHSCROLL
LISTBOX IDC0_SESSLIST, 3, 63, 122, 81,
LBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Load", IDC0_SESSLOAD, 131, 63, 34, 14
PUSHBUTTON "&Save", IDC0_SESSSAVE, 131, 80, 34, 14
PUSHBUTTON "&Delete", IDC0_SESSDEL, 131, 97, 34, 14
AUTOCHECKBOX "Close &Window on Exit", IDC0_CLOSEEXIT, 3, 147, 162, 10
AUTOCHECKBOX "Close &Window on Exit", IDC0_CLOSEEXIT, 3, 147, 91, 10
AUTOCHECKBOX "Warn on C&lose", IDC0_CLOSEWARN, 96, 147, 69, 10
END
IDD_PANEL1 DIALOG DISCARDABLE 6, 30, 168, 163

View File

@ -120,6 +120,7 @@ static void save_settings (char *section, int do_host) {
cfg.protocol == PROT_TELNET ? "telnet" : "raw" );
}
wppi (sesskey, "CloseOnExit", !!cfg.close_on_exit);
wppi (sesskey, "WarnOnClose", !!cfg.warn_on_close);
wpps (sesskey, "TerminalType", cfg.termtype);
wpps (sesskey, "TerminalSpeed", cfg.termspeed);
{
@ -235,6 +236,7 @@ static void load_settings (char *section, int do_host) {
cfg.protocol = default_protocol;
gppi (sesskey, "CloseOnExit", 1, &cfg.close_on_exit);
gppi (sesskey, "WarnOnClose", 1, &cfg.warn_on_close);
gpps (sesskey, "TerminalType", "xterm", cfg.termtype,
sizeof(cfg.termtype));
gpps (sesskey, "TerminalSpeed", "38400,38400", cfg.termspeed,
@ -454,6 +456,7 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg,
cfg.protocol==PROT_SSH ? IDC0_PROTSSH :
cfg.protocol==PROT_TELNET ? IDC0_PROTTELNET : IDC0_PROTRAW );
CheckDlgButton (hwnd, IDC0_CLOSEEXIT, cfg.close_on_exit);
CheckDlgButton (hwnd, IDC0_CLOSEWARN, cfg.warn_on_close);
break;
case WM_LBUTTONUP:
/*
@ -495,6 +498,11 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg,
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.close_on_exit = IsDlgButtonChecked (hwnd, IDC0_CLOSEEXIT);
break;
case IDC0_CLOSEWARN:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.warn_on_close = IsDlgButtonChecked (hwnd, IDC0_CLOSEWARN);
break;
case IDC0_SESSEDIT:
if (HIWORD(wParam) == EN_CHANGE)
SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL,
@ -553,6 +561,7 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg,
(cfg.protocol==PROT_SSH ? IDC0_PROTSSH :
cfg.protocol==PROT_TELNET ? IDC0_PROTTELNET : IDC0_PROTRAW));
CheckDlgButton (hwnd, IDC0_CLOSEEXIT, cfg.close_on_exit);
CheckDlgButton (hwnd, IDC0_CLOSEWARN, cfg.warn_on_close);
SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL,
(WPARAM) -1, 0);
}

View File

@ -617,7 +617,8 @@ static int WINAPI WndProc (HWND hwnd, UINT message,
case WM_CREATE:
break;
case WM_CLOSE:
if (MessageBox(hwnd, "Are you sure you want to close this session?",
if (!cfg.warn_on_close ||
MessageBox(hwnd, "Are you sure you want to close this session?",
"PuTTY Exit Confirmation",
MB_ICONWARNING | MB_OKCANCEL) == IDOK)
DestroyWindow(hwnd);