mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-22 13:35:03 -05:00
Warn-on-close is now configurable off
[originally from svn r273]
This commit is contained in:
parent
7205ae9199
commit
97994b235d
1
putty.h
1
putty.h
@ -97,6 +97,7 @@ typedef struct {
|
|||||||
int port;
|
int port;
|
||||||
enum { PROT_RAW, PROT_TELNET, PROT_SSH } protocol;
|
enum { PROT_RAW, PROT_TELNET, PROT_SSH } protocol;
|
||||||
int close_on_exit;
|
int close_on_exit;
|
||||||
|
int warn_on_close;
|
||||||
/* SSH options */
|
/* SSH options */
|
||||||
int nopty;
|
int nopty;
|
||||||
enum { CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DES } cipher;
|
enum { CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DES } cipher;
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#define IDC0_SESSSAVE 1013
|
#define IDC0_SESSSAVE 1013
|
||||||
#define IDC0_SESSDEL 1014
|
#define IDC0_SESSDEL 1014
|
||||||
#define IDC0_CLOSEEXIT 1015
|
#define IDC0_CLOSEEXIT 1015
|
||||||
|
#define IDC0_CLOSEWARN 1016
|
||||||
|
|
||||||
#define IDC1_DELSTATIC 1001
|
#define IDC1_DELSTATIC 1001
|
||||||
#define IDC1_DEL008 1002
|
#define IDC1_DEL008 1002
|
||||||
|
@ -52,23 +52,24 @@ BEGIN
|
|||||||
EDITTEXT IDC0_PORT, 131, 11, 34, 12
|
EDITTEXT IDC0_PORT, 131, 11, 34, 12
|
||||||
#ifdef FWHACK
|
#ifdef FWHACK
|
||||||
RTEXT "Protocol:", IDC0_PROTSTATIC, 3, 29, 42, 8
|
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 "&Telnet", IDC0_PROTTELNET, 86, 29, 33, 10
|
||||||
AUTORADIOBUTTON "SS&H/hack", IDC0_PROTSSH, 122, 29, 43, 10
|
AUTORADIOBUTTON "SS&H/hack", IDC0_PROTSSH, 122, 29, 43, 10
|
||||||
#else
|
#else
|
||||||
RTEXT "Protocol:", IDC0_PROTSTATIC, 3, 29, 52, 8
|
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 "&Telnet", IDC0_PROTTELNET, 96, 29, 33, 10
|
||||||
AUTORADIOBUTTON "SS&H", IDC0_PROTSSH, 132, 29, 33, 10
|
AUTORADIOBUTTON "SS&H", IDC0_PROTSSH, 132, 29, 33, 10
|
||||||
#endif
|
#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
|
EDITTEXT IDC0_SESSEDIT, 3, 48, 122, 12, ES_AUTOHSCROLL
|
||||||
LISTBOX IDC0_SESSLIST, 3, 63, 122, 81,
|
LISTBOX IDC0_SESSLIST, 3, 63, 122, 81,
|
||||||
LBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
|
LBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON "&Load", IDC0_SESSLOAD, 131, 63, 34, 14
|
PUSHBUTTON "&Load", IDC0_SESSLOAD, 131, 63, 34, 14
|
||||||
PUSHBUTTON "&Save", IDC0_SESSSAVE, 131, 80, 34, 14
|
PUSHBUTTON "&Save", IDC0_SESSSAVE, 131, 80, 34, 14
|
||||||
PUSHBUTTON "&Delete", IDC0_SESSDEL, 131, 97, 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
|
END
|
||||||
|
|
||||||
IDD_PANEL1 DIALOG DISCARDABLE 6, 30, 168, 163
|
IDD_PANEL1 DIALOG DISCARDABLE 6, 30, 168, 163
|
||||||
|
9
windlg.c
9
windlg.c
@ -120,6 +120,7 @@ static void save_settings (char *section, int do_host) {
|
|||||||
cfg.protocol == PROT_TELNET ? "telnet" : "raw" );
|
cfg.protocol == PROT_TELNET ? "telnet" : "raw" );
|
||||||
}
|
}
|
||||||
wppi (sesskey, "CloseOnExit", !!cfg.close_on_exit);
|
wppi (sesskey, "CloseOnExit", !!cfg.close_on_exit);
|
||||||
|
wppi (sesskey, "WarnOnClose", !!cfg.warn_on_close);
|
||||||
wpps (sesskey, "TerminalType", cfg.termtype);
|
wpps (sesskey, "TerminalType", cfg.termtype);
|
||||||
wpps (sesskey, "TerminalSpeed", cfg.termspeed);
|
wpps (sesskey, "TerminalSpeed", cfg.termspeed);
|
||||||
{
|
{
|
||||||
@ -235,6 +236,7 @@ static void load_settings (char *section, int do_host) {
|
|||||||
cfg.protocol = default_protocol;
|
cfg.protocol = default_protocol;
|
||||||
|
|
||||||
gppi (sesskey, "CloseOnExit", 1, &cfg.close_on_exit);
|
gppi (sesskey, "CloseOnExit", 1, &cfg.close_on_exit);
|
||||||
|
gppi (sesskey, "WarnOnClose", 1, &cfg.warn_on_close);
|
||||||
gpps (sesskey, "TerminalType", "xterm", cfg.termtype,
|
gpps (sesskey, "TerminalType", "xterm", cfg.termtype,
|
||||||
sizeof(cfg.termtype));
|
sizeof(cfg.termtype));
|
||||||
gpps (sesskey, "TerminalSpeed", "38400,38400", cfg.termspeed,
|
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_SSH ? IDC0_PROTSSH :
|
||||||
cfg.protocol==PROT_TELNET ? IDC0_PROTTELNET : IDC0_PROTRAW );
|
cfg.protocol==PROT_TELNET ? IDC0_PROTTELNET : IDC0_PROTRAW );
|
||||||
CheckDlgButton (hwnd, IDC0_CLOSEEXIT, cfg.close_on_exit);
|
CheckDlgButton (hwnd, IDC0_CLOSEEXIT, cfg.close_on_exit);
|
||||||
|
CheckDlgButton (hwnd, IDC0_CLOSEWARN, cfg.warn_on_close);
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
/*
|
/*
|
||||||
@ -495,6 +498,11 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg,
|
|||||||
HIWORD(wParam) == BN_DOUBLECLICKED)
|
HIWORD(wParam) == BN_DOUBLECLICKED)
|
||||||
cfg.close_on_exit = IsDlgButtonChecked (hwnd, IDC0_CLOSEEXIT);
|
cfg.close_on_exit = IsDlgButtonChecked (hwnd, IDC0_CLOSEEXIT);
|
||||||
break;
|
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:
|
case IDC0_SESSEDIT:
|
||||||
if (HIWORD(wParam) == EN_CHANGE)
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL,
|
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_SSH ? IDC0_PROTSSH :
|
||||||
cfg.protocol==PROT_TELNET ? IDC0_PROTTELNET : IDC0_PROTRAW));
|
cfg.protocol==PROT_TELNET ? IDC0_PROTTELNET : IDC0_PROTRAW));
|
||||||
CheckDlgButton (hwnd, IDC0_CLOSEEXIT, cfg.close_on_exit);
|
CheckDlgButton (hwnd, IDC0_CLOSEEXIT, cfg.close_on_exit);
|
||||||
|
CheckDlgButton (hwnd, IDC0_CLOSEWARN, cfg.warn_on_close);
|
||||||
SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL,
|
SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL,
|
||||||
(WPARAM) -1, 0);
|
(WPARAM) -1, 0);
|
||||||
}
|
}
|
||||||
|
3
window.c
3
window.c
@ -617,7 +617,8 @@ static int WINAPI WndProc (HWND hwnd, UINT message,
|
|||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
break;
|
break;
|
||||||
case WM_CLOSE:
|
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",
|
"PuTTY Exit Confirmation",
|
||||||
MB_ICONWARNING | MB_OKCANCEL) == IDOK)
|
MB_ICONWARNING | MB_OKCANCEL) == IDOK)
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user