Make prompt to save modified SQL text customizable. See http://www.heidisql.com/forum.php?t=6373

This commit is contained in:
Ansgar Becker
2010-09-19 18:52:22 +00:00
parent 22f9fa176b
commit 243a553d9d
4 changed files with 25 additions and 9 deletions

View File

@ -205,6 +205,8 @@ const
DEFAULT_DISPLAYBARS = true;
REGNAME_BARCOLOR = 'BarColor';
DEFAULT_BARCOLOR = $00BBFFDD;
REGNAME_PROMPTFILESAVE = 'PromptSaveFileOnTabClose';
DEFAULT_PROMPTFILESAVE = True;
REGNAME_COMPLETIONPROPOSAL = 'CompletionProposal';
DEFAULT_COMPLETIONPROPOSAL = True;
REGNAME_FILTERACTIVE = 'FilterPanel';

View File

@ -8792,7 +8792,7 @@ var
Tab: TQueryTab;
begin
Tab := QueryTabs[PageIndex-tabQuery.PageIndex];
if not Tab.Memo.Modified then
if (not Tab.Memo.Modified) or (not GetRegValue(REGNAME_PROMPTFILESAVE, DEFAULT_PROMPTFILESAVE)) then
Result := True
else begin
// Unhide tabsheet so the user sees the memo content

View File

@ -35,7 +35,7 @@ object optionsform: Toptionsform
object chkAutoReconnect: TCheckBox
Left = 16
Top = 32
Width = 353
Width = 417
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Automatically reconnect to last session-account on startup'
@ -45,7 +45,7 @@ object optionsform: Toptionsform
object chkRestoreLastDB: TCheckBox
Left = 16
Top = 56
Width = 316
Width = 417
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Restore last used database on startup'
@ -68,7 +68,7 @@ object optionsform: Toptionsform
OnClick = chkUpdatecheckClick
end
object editUpdatecheckInterval: TEdit
Left = 335
Left = 374
Top = 78
Width = 43
Height = 21
@ -79,7 +79,7 @@ object optionsform: Toptionsform
OnChange = Modified
end
object updownUpdatecheckInterval: TUpDown
Left = 378
Left = 417
Top = 78
Width = 16
Height = 21
@ -94,7 +94,7 @@ object optionsform: Toptionsform
object chkUpdateCheckBuilds: TCheckBox
Left = 34
Top = 112
Width = 266
Width = 399
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Also check for updated nightly builds'
@ -105,7 +105,7 @@ object optionsform: Toptionsform
object chkDoStatistics: TCheckBox
Left = 16
Top = 135
Width = 398
Width = 417
Height = 48
Anchors = [akLeft, akTop, akRight]
Caption =
@ -119,7 +119,7 @@ object optionsform: Toptionsform
object chkAllowMultiInstances: TCheckBox
Left = 16
Top = 9
Width = 398
Width = 417
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Allow multiple application instances'
@ -139,13 +139,24 @@ object optionsform: Toptionsform
object cboxColorBars: TColorBox
Left = 249
Top = 187
Width = 145
Width = 184
Height = 22
Style = [cbStandardColors, cbExtendedColors, cbCustomColor, cbPrettyNames, cbCustomColors]
Anchors = [akTop, akRight]
TabOrder = 9
OnClick = Modified
end
object chkAskFileSave: TCheckBox
Left = 16
Top = 213
Width = 417
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Prompt to save modified files on tab close'
Checked = True
State = cbChecked
TabOrder = 10
end
end
object tabLogging: TTabSheet
Caption = 'Logging'

View File

@ -137,6 +137,7 @@ type
lblMaxQueryResults: TLabel;
editMaxQueryResults: TEdit;
updownMaxQueryResults: TUpDown;
chkAskFileSave: TCheckBox;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject);
@ -228,6 +229,7 @@ begin
MainReg.WriteBool(REGNAME_AUTORECONNECT, chkAutoReconnect.Checked);
MainReg.WriteBool(REGNAME_MULTI_INSTANCES, chkAllowMultiInstances.Checked);
MainReg.WriteBool(REGNAME_RESTORELASTUSEDDB, chkRestoreLastDB.Checked);
MainReg.WriteBool(REGNAME_PROMPTFILESAVE, chkAskFileSave.Checked);
MainReg.WriteString(REGNAME_FONTNAME, comboSQLFontName.Text);
MainReg.WriteInteger(REGNAME_FONTSIZE, updownSQLFontSize.Position);
MainReg.WriteInteger(REGNAME_TABWIDTH, updownSQLTabWidth.Position);
@ -430,6 +432,7 @@ begin
chkDoStatistics.Checked := GetRegValue(REGNAME_DO_STATISTICS, DEFAULT_DO_STATISTICS);
chkColorBars.Checked := GetRegValue(REGNAME_DISPLAYBARS, DEFAULT_DISPLAYBARS);
cboxColorBars.Selected := GetRegValue(REGNAME_BARCOLOR, DEFAULT_BARCOLOR);
chkAskFileSave.Checked := GetRegValue(REGNAME_PROMPTFILESAVE, DEFAULT_PROMPTFILESAVE);
// Logging
updownLogLines.Position := GetRegValue(REGNAME_LOGSQLNUM, DEFAULT_LOGSQLNUM);