Issue #140: add "Files" tab to preferences dialog, move "Prompt for file save" checkbox there, and introduce two new checkboxes for restoring opened and unsaved query tab contents (both new yet without functionality in their back)

This commit is contained in:
Ansgar Becker
2019-03-17 11:57:09 +01:00
parent 3975db0a1c
commit 0fb341bb88
5 changed files with 97 additions and 46 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: HeidiSQL\n" "Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n" "POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2019-03-14 21:10+0100\n" "PO-Revision-Date: 2019-03-17 11:54+0100\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n" "Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n" "Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -2743,6 +2743,12 @@ msgstr "Tabs to spaces"
msgid "Prompt to save modified files on tab close" msgid "Prompt to save modified files on tab close"
msgstr "Prompt to save modified files on tab close" msgstr "Prompt to save modified files on tab close"
msgid "Reopen previously used SQL files in tabs"
msgstr "Reopen previously used SQL files in tabs"
msgid "Automatically backup and restore unsaved content (up to %s per file)"
msgstr "Automatically backup and restore unsaved content (up to %s per file)"
msgid "Show query warnings dialog" msgid "Show query warnings dialog"
msgstr "Show query warnings dialog" msgstr "Show query warnings dialog"

View File

@ -168,7 +168,7 @@ type
asCopyTableData, asCopyTableRecentFilter, asServerVersion, asServerVersionFull, asLastConnect, asCopyTableData, asCopyTableRecentFilter, asServerVersion, asServerVersionFull, asLastConnect,
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics, asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asMySQLBinaries, asCustomSnippetsDirectory, asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asMySQLBinaries, asCustomSnippetsDirectory,
asPromptSaveFileOnTabClose, asWarnUnsafeUpdates, asQueryWarningsMessage, asPromptSaveFileOnTabClose, asReopenFiles, asBackupRestoreFiles, asWarnUnsafeUpdates, asQueryWarningsMessage,
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase, asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize, asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asTheme, asIconPack, asTheme, asIconPack,
@ -3615,6 +3615,8 @@ begin
DefaultSnippetsDirectory := DefaultSnippetsDirectory + 'Snippets\'; DefaultSnippetsDirectory := DefaultSnippetsDirectory + 'Snippets\';
InitSetting(asCustomSnippetsDirectory, 'CustomSnippetsDirectory', 0, False, DefaultSnippetsDirectory); InitSetting(asCustomSnippetsDirectory, 'CustomSnippetsDirectory', 0, False, DefaultSnippetsDirectory);
InitSetting(asPromptSaveFileOnTabClose, 'PromptSaveFileOnTabClose', 0, True); InitSetting(asPromptSaveFileOnTabClose, 'PromptSaveFileOnTabClose', 0, True);
InitSetting(asReopenFiles, 'ReopenFiles', 0, True);
InitSetting(asBackupRestoreFiles, 'BackupRestoreFiles', 0, True);
InitSetting(asWarnUnsafeUpdates, 'WarnUnsafeUpdates', 0, True); InitSetting(asWarnUnsafeUpdates, 'WarnUnsafeUpdates', 0, True);
InitSetting(asQueryWarningsMessage, 'QueryWarningsMessage', 0, True); InitSetting(asQueryWarningsMessage, 'QueryWarningsMessage', 0, True);
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True); InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);

View File

@ -82,6 +82,8 @@ const
// Data grid: How many bytes to fetch from data fields that are potentially large. // Data grid: How many bytes to fetch from data fields that are potentially large.
GRIDMAXDATA: Integer = 256; GRIDMAXDATA: Integer = 256;
BACKUP_MAXFILESIZE: Integer = 10 * SIZE_MB;
VTREE_NOTLOADED = 0; VTREE_NOTLOADED = 0;
VTREE_NOTLOADED_PURGECACHE = 1; VTREE_NOTLOADED_PURGECACHE = 1;
VTREE_LOADED = 2; VTREE_LOADED = 2;

View File

@ -568,28 +568,28 @@ object optionsform: Toptionsform
end end
object lblSQLColElement: TLabel object lblSQLColElement: TLabel
Left = 8 Left = 8
Top = 220 Top = 186
Width = 42 Width = 42
Height = 13 Height = 13
Caption = 'Element:' Caption = 'Element:'
end end
object lblSQLColBackground: TLabel object lblSQLColBackground: TLabel
Left = 180 Left = 180
Top = 314 Top = 280
Width = 60 Width = 60
Height = 13 Height = 13
Caption = 'Background:' Caption = 'Background:'
end end
object lblSQLColForeground: TLabel object lblSQLColForeground: TLabel
Left = 180 Left = 180
Top = 267 Top = 233
Width = 60 Width = 60
Height = 13 Height = 13
Caption = 'Foreground:' Caption = 'Foreground:'
end end
object lblEditorColorsPreset: TLabel object lblEditorColorsPreset: TLabel
Left = 8 Left = 8
Top = 193 Top = 159
Width = 68 Width = 68
Height = 13 Height = 13
Caption = 'Colors preset:' Caption = 'Colors preset:'
@ -659,18 +659,6 @@ object optionsform: Toptionsform
TabOrder = 4 TabOrder = 4
OnClick = updownSQLFontSizeClick OnClick = updownSQLFontSizeClick
end end
object chkAskFileSave: TCheckBox
Left = 180
Top = 111
Width = 506
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Prompt to save modified files on tab close'
Checked = True
State = cbChecked
TabOrder = 9
OnClick = Modified
end
object editMaxQueryResults: TEdit object editMaxQueryResults: TEdit
Left = 180 Left = 180
Top = 61 Top = 61
@ -693,55 +681,55 @@ object optionsform: Toptionsform
end end
object comboSQLColElement: TComboBox object comboSQLColElement: TComboBox
Left = 180 Left = 180
Top = 217 Top = 183
Width = 145 Width = 145
Height = 21 Height = 21
Style = csDropDownList Style = csDropDownList
TabOrder = 13 TabOrder = 12
OnChange = comboSQLColElementChange OnChange = comboSQLColElementChange
end end
object chkSQLBold: TCheckBox object chkSQLBold: TCheckBox
Left = 180 Left = 180
Top = 244 Top = 210
Width = 61 Width = 61
Height = 17 Height = 17
Caption = 'Bold' Caption = 'Bold'
TabOrder = 14 TabOrder = 13
OnClick = SQLFontChange OnClick = SQLFontChange
end end
object chkSQLItalic: TCheckBox object chkSQLItalic: TCheckBox
Left = 254 Left = 254
Top = 244 Top = 210
Width = 50 Width = 50
Height = 17 Height = 17
Caption = 'Italic' Caption = 'Italic'
TabOrder = 15 TabOrder = 14
OnClick = SQLFontChange OnClick = SQLFontChange
end end
object cboxSQLColForeground: TColorBox object cboxSQLColForeground: TColorBox
Left = 180 Left = 180
Top = 286 Top = 252
Width = 145
Height = 22
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
TabOrder = 15
OnChange = SQLFontChange
end
object cboxSQLColBackground: TColorBox
Left = 180
Top = 299
Width = 145 Width = 145
Height = 22 Height = 22
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors] Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
TabOrder = 16 TabOrder = 16
OnChange = SQLFontChange OnChange = SQLFontChange
end end
object cboxSQLColBackground: TColorBox
Left = 180
Top = 333
Width = 145
Height = 22
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
TabOrder = 17
OnChange = SQLFontChange
end
object SynMemoSQLSample: TSynMemo object SynMemoSQLSample: TSynMemo
AlignWithMargins = True AlignWithMargins = True
Left = 331 Left = 331
Top = 190 Top = 156
Width = 364 Width = 364
Height = 191 Height = 229
Cursor = crHandPoint Cursor = crHandPoint
SingleLineMode = False SingleLineMode = False
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
@ -750,7 +738,7 @@ object optionsform: Toptionsform
Font.Height = -13 Font.Height = -13
Font.Name = 'Courier New' Font.Name = 'Courier New'
Font.Style = [] Font.Style = []
TabOrder = 18 TabOrder = 17
OnClick = SynMemoSQLSampleClick OnClick = SynMemoSQLSampleClick
CodeFolding.GutterShapeSize = 11 CodeFolding.GutterShapeSize = 11
CodeFolding.CollapsedLineColor = clGrayText CodeFolding.CollapsedLineColor = clGrayText
@ -780,32 +768,32 @@ object optionsform: Toptionsform
end end
object chkQueryWarningsMessage: TCheckBox object chkQueryWarningsMessage: TCheckBox
Left = 180 Left = 180
Top = 134 Top = 110
Width = 508 Width = 508
Height = 17 Height = 17
Anchors = [akLeft, akTop, akRight] Anchors = [akLeft, akTop, akRight]
Caption = 'Show query warnings dialog' Caption = 'Show query warnings dialog'
TabOrder = 10 TabOrder = 9
OnClick = Modified OnClick = Modified
end end
object chkAutoUppercase: TCheckBox object chkAutoUppercase: TCheckBox
Left = 180 Left = 180
Top = 159 Top = 133
Width = 508 Width = 508
Height = 17 Height = 17
Anchors = [akLeft, akTop, akRight] Anchors = [akLeft, akTop, akRight]
Caption = 'Auto uppercase reserved words and functions' Caption = 'Auto uppercase reserved words and functions'
TabOrder = 11 TabOrder = 10
OnClick = Modified OnClick = Modified
end end
object comboEditorColorsPreset: TComboBox object comboEditorColorsPreset: TComboBox
Left = 180 Left = 180
Top = 190 Top = 156
Width = 145 Width = 145
Height = 21 Height = 21
Style = csDropDownList Style = csDropDownList
ItemIndex = 0 ItemIndex = 0
TabOrder = 12 TabOrder = 11
Text = 'Current custom settings' Text = 'Current custom settings'
OnChange = comboEditorColorsPresetChange OnChange = comboEditorColorsPresetChange
Items.Strings = ( Items.Strings = (
@ -1250,6 +1238,45 @@ object optionsform: Toptionsform
end end
end end
end end
object tabFiles: TTabSheet
Caption = 'Files'
ImageIndex = 10
DesignSize = (
700
388)
object chkReopenFiles: TCheckBox
Left = 190
Top = 31
Width = 496
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Reopen previously used SQL files in tabs'
TabOrder = 0
end
object chkAskFileSave: TCheckBox
Left = 190
Top = 8
Width = 496
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Prompt to save modified files on tab close'
Checked = True
State = cbChecked
TabOrder = 1
OnClick = Modified
end
object chkBackupRestoreFiles: TCheckBox
Left = 190
Top = 54
Width = 496
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption =
'Automatically backup and restore unsaved content (up to %s per f' +
'ile)'
TabOrder = 2
end
end
end end
object btnCancel: TButton object btnCancel: TButton
Left = 561 Left = 561

View File

@ -98,7 +98,6 @@ type
editSQLTabWidth: TEdit; editSQLTabWidth: TEdit;
updownSQLTabWidth: TUpDown; updownSQLTabWidth: TUpDown;
Label1: TLabel; Label1: TLabel;
chkAskFileSave: TCheckBox;
lblMaxQueryResults: TLabel; lblMaxQueryResults: TLabel;
editMaxQueryResults: TEdit; editMaxQueryResults: TEdit;
updownMaxQueryResults: TUpDown; updownMaxQueryResults: TUpDown;
@ -169,6 +168,10 @@ type
comboGridTextColorsPreset: TComboBox; comboGridTextColorsPreset: TComboBox;
lblIconPack: TLabel; lblIconPack: TLabel;
comboIconPack: TComboBox; comboIconPack: TComboBox;
tabFiles: TTabSheet;
chkReopenFiles: TCheckBox;
chkAskFileSave: TCheckBox;
chkBackupRestoreFiles: TCheckBox;
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject); procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject); procedure Apply(Sender: TObject);
@ -279,7 +282,6 @@ begin
AppSettings.WriteBool(asAutoReconnect, chkAutoReconnect.Checked); AppSettings.WriteBool(asAutoReconnect, chkAutoReconnect.Checked);
AppSettings.WriteBool(asAllowMultipleInstances, chkAllowMultiInstances.Checked); AppSettings.WriteBool(asAllowMultipleInstances, chkAllowMultiInstances.Checked);
AppSettings.WriteBool(asRestoreLastUsedDB, chkRestoreLastDB.Checked); AppSettings.WriteBool(asRestoreLastUsedDB, chkRestoreLastDB.Checked);
AppSettings.WriteBool(asPromptSaveFileOnTabClose, chkAskFileSave.Checked);
AppSettings.WriteBool(asQueryWarningsMessage, chkQueryWarningsMessage.Checked); AppSettings.WriteBool(asQueryWarningsMessage, chkQueryWarningsMessage.Checked);
AppSettings.WriteString(asFontName, comboSQLFontName.Text); AppSettings.WriteString(asFontName, comboSQLFontName.Text);
AppSettings.WriteInt(asFontSize, updownSQLFontSize.Position); AppSettings.WriteInt(asFontSize, updownSQLFontSize.Position);
@ -398,6 +400,11 @@ begin
// Populate SynMemo settings to all instances // Populate SynMemo settings to all instances
Mainform.SetupSynEditors; Mainform.SetupSynEditors;
// Files
AppSettings.WriteBool(asPromptSaveFileOnTabClose, chkAskFileSave.Checked);
AppSettings.WriteBool(asReopenFiles, chkReopenFiles.Checked);
AppSettings.WriteBool(asBackupRestoreFiles, chkBackupRestoreFiles.Checked);
// Set relevant properties in mainform // Set relevant properties in mainform
MainForm.ApplyFontToGrids; MainForm.ApplyFontToGrids;
MainForm.PrepareImageList; MainForm.PrepareImageList;
@ -591,6 +598,9 @@ begin
FShortcutCategories.Add(_('SQL editing')); FShortcutCategories.Add(_('SQL editing'));
TreeShortcutItems.RootNodeCount := FShortcutCategories.Count; TreeShortcutItems.RootNodeCount := FShortcutCategories.Count;
comboLineBreakStyle.Items := Explode(',', _('Windows linebreaks')+','+_('UNIX linebreaks')+','+_('Mac OS linebreaks')); comboLineBreakStyle.Items := Explode(',', _('Windows linebreaks')+','+_('UNIX linebreaks')+','+_('Mac OS linebreaks'));
// Files
chkBackupRestoreFiles.Caption := f_('Automatically backup and restore unsaved content (up to %s per file)', [FormatByteNumber(BACKUP_MAXFILESIZE,0)]);
end; end;
@ -644,7 +654,6 @@ begin
comboGUIFont.OnChange(comboGUIFont); comboGUIFont.OnChange(comboGUIFont);
comboTheme.ItemIndex := comboTheme.Items.IndexOf(AppSettings.ReadString(asTheme)); comboTheme.ItemIndex := comboTheme.Items.IndexOf(AppSettings.ReadString(asTheme));
comboIconPack.ItemIndex := comboIconPack.Items.IndexOf(AppSettings.ReadString(asIconPack)); comboIconPack.ItemIndex := comboIconPack.Items.IndexOf(AppSettings.ReadString(asIconPack));
chkAskFileSave.Checked := AppSettings.ReadBool(asPromptSaveFileOnTabClose);
chkQueryWarningsMessage.Checked := AppSettings.ReadBool(asQueryWarningsMessage); chkQueryWarningsMessage.Checked := AppSettings.ReadBool(asQueryWarningsMessage);
// Logging // Logging
@ -718,6 +727,11 @@ begin
TreeShortcutItems.ReinitChildren(nil, True); TreeShortcutItems.ReinitChildren(nil, True);
SelectNode(TreeShortcutItems, nil); SelectNode(TreeShortcutItems, nil);
// Files
chkAskFileSave.Checked := AppSettings.ReadBool(asPromptSaveFileOnTabClose);
chkReopenFiles.Checked := AppSettings.ReadBool(asReopenFiles);
chkBackupRestoreFiles.Checked := AppSettings.ReadBool(asBackupRestoreFiles);
FRestartOptionTouched := False; FRestartOptionTouched := False;
btnApply.Enabled := False; btnApply.Enabled := False;
screen.Cursor := crdefault; screen.Cursor := crdefault;