diff --git a/out/locale/en/LC_MESSAGES/default.po b/out/locale/en/LC_MESSAGES/default.po index b3a861f7..987d0a0b 100644 --- a/out/locale/en/LC_MESSAGES/default.po +++ b/out/locale/en/LC_MESSAGES/default.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: HeidiSQL\n" "POT-Creation-Date: 2012-11-05 21:40\n" -"PO-Revision-Date: 2013-02-25 18:39+0100\n" +"PO-Revision-Date: 2013-02-26 21:22+0100\n" "Last-Translator: Ansgar Becker \n" "Language-Team: English (http://www.transifex.com/projects/p/heidisql/" "language/en/)\n" @@ -2613,6 +2613,10 @@ msgstr "Information messages" msgid "Debug messages" msgstr "Debug messages" +#. Preferences +msgid "Enable query history" +msgstr "Enable query history" + #. optionsform..pagecontrolMain..tabSQL..lblFont..Caption #: options.dfm:357 msgid "Editor font:" diff --git a/source/helpers.pas b/source/helpers.pas index 011864d9..4e6de949 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -172,7 +172,8 @@ type asFieldEditorSet, asFieldNullBackground, asGroupTreeObjects, asDisplayObjectSizeColumn, asSQLfile, asActionShortcut1, asActionShortcut2, asHighlighterForeground, asHighlighterBackground, asHighlighterStyle, asListColWidths, asListColsVisible, asListColPositions, asListColSort, asSessionFolder, - asRecentFilter, asDateTimeEditorCursorPos, asAppLanguage, asAutoExpand, asForeignDropDown, asUnused); + asRecentFilter, asDateTimeEditorCursorPos, asAppLanguage, asAutoExpand, asForeignDropDown, asQueryHistoryEnabled, + asUnused); TAppSetting = record Name: String; Session: Boolean; @@ -3211,6 +3212,7 @@ begin InitSetting(asAppLanguage, 'Language', 0, False, ''); InitSetting(asAutoExpand, 'AutoExpand', 0, False); InitSetting(asForeignDropDown, 'ForeignDropDown', 0, True); + InitSetting(asQueryHistoryEnabled, 'QueryHistory', 0, True); end; diff --git a/source/main.pas b/source/main.pas index f8b96b8b..dd18d370 100644 --- a/source/main.pas +++ b/source/main.pas @@ -2391,7 +2391,12 @@ begin // Store successful query packet in history if it's not a batch. // Assume that a bunch of up to 5 queries is not a batch. - if IsEmpty(Thread.ErrorMessage) and (Thread.Batch.Count <= 5) and (Thread.Batch.Size <= SIZE_MB) then begin + AppSettings.ResetPath; + if AppSettings.ReadBool(asQueryHistoryEnabled) + and IsEmpty(Thread.ErrorMessage) + and (Thread.Batch.Count <= 5) + and (Thread.Batch.Size <= SIZE_MB) + then begin ShowStatusMsg(_('Updating query history ...')); // Load all items so we can clean up @@ -10496,7 +10501,8 @@ begin Node.CheckType := ctCheckbox; end; 1: begin - if Node.Parent.Index = HELPERNODE_HISTORY then + AppSettings.ResetPath; + if (Node.Parent.Index = HELPERNODE_HISTORY) and AppSettings.ReadBool(asQueryHistoryEnabled) then Include(InitialStates, ivsHasChildren); end; end; @@ -10531,19 +10537,22 @@ begin HELPERNODE_KEYWORDS: ChildCount := MySQLKeywords.Count; HELPERNODE_SNIPPETS: ChildCount := FSnippetFilenames.Count; HELPERNODE_HISTORY: begin - // Find all unique days in history - if not Assigned(Tab.HistoryDays) then - Tab.HistoryDays := TStringList.Create; - Tab.HistoryDays.Clear; - History := TQueryHistory.Create(ActiveConnection.Parameters.SessionPath); - for Item in History do begin - QueryDay := DateToStr(Item.Time); - if Tab.HistoryDays.IndexOf(QueryDay) = -1 then - Tab.HistoryDays.Add(QueryDay); + AppSettings.ResetPath; + if AppSettings.ReadBool(asQueryHistoryEnabled) then begin + // Find all unique days in history + if not Assigned(Tab.HistoryDays) then + Tab.HistoryDays := TStringList.Create; + Tab.HistoryDays.Clear; + History := TQueryHistory.Create(ActiveConnection.Parameters.SessionPath); + for Item in History do begin + QueryDay := DateToStr(Item.Time); + if Tab.HistoryDays.IndexOf(QueryDay) = -1 then + Tab.HistoryDays.Add(QueryDay); + end; + History.Free; + Tab.HistoryDays.CustomSort(StringListCompareAnythingDesc); + ChildCount := Tab.HistoryDays.Count; end; - History.Free; - Tab.HistoryDays.CustomSort(StringListCompareAnythingDesc); - ChildCount := Tab.HistoryDays.Count; end; HELPERNODE_PROFILE: if not Assigned(Tab.QueryProfile) then ChildCount := 0 else ChildCount := Tab.QueryProfile.RecordCount; diff --git a/source/options.dfm b/source/options.dfm index 16fc9106..7cfcdff8 100644 --- a/source/options.dfm +++ b/source/options.dfm @@ -344,6 +344,14 @@ object optionsform: Toptionsform OnDblClick = editLogDirRightButtonClick OnRightButtonClick = editLogDirRightButtonClick end + object chkQueryHistory: TCheckBox + Left = 8 + Top = 200 + Width = 429 + Height = 17 + Caption = 'Enable query history' + TabOrder = 11 + end end object tabSQL: TTabSheet Caption = 'SQL' diff --git a/source/options.pas b/source/options.pas index e3d3e1a8..7cf17db4 100644 --- a/source/options.pas +++ b/source/options.pas @@ -120,6 +120,7 @@ type lblLanguage: TLabel; comboAppLanguage: TComboBox; chkForeignDropDown: TCheckBox; + chkQueryHistory: TCheckBox; procedure FormShow(Sender: TObject); procedure Modified(Sender: TObject); procedure Apply(Sender: TObject); @@ -228,6 +229,7 @@ begin AppSettings.WriteBool(asLogSQL, chkLogEventSQL.Checked); AppSettings.WriteBool(asLogInfos, chkLogEventInfo.Checked); AppSettings.WriteBool(asLogDebug, chkLogEventDebug.Checked); + AppSettings.WriteBool(asQueryHistoryEnabled, chkQueryHistory.Checked); for i:=0 to SynSQLSynSQLSample.AttrCount - 1 do begin Attri := SynSQLSynSQLSample.Attribute[i]; AppSettings.WriteInt(asHighlighterForeground, Attri.Foreground, Attri.Name); @@ -441,6 +443,7 @@ begin chkLogEventSQL.Checked := AppSettings.ReadBool(asLogSQL); chkLogEventInfo.Checked := AppSettings.ReadBool(asLogInfos); chkLogEventDebug.Checked := AppSettings.ReadBool(asLogDebug); + chkQueryHistory.Checked := AppSettings.ReadBool(asQueryHistoryEnabled); // Default Column-Width in DBGrids: updownMaxColWidth.Position := AppSettings.ReadInt(asMaxColWidth);