diff --git a/out/locale/en/LC_MESSAGES/default.po b/out/locale/en/LC_MESSAGES/default.po index 4bf35069..9b692931 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: 2017-03-07 21:07+0100\n" +"PO-Revision-Date: 2017-03-13 21:17+0100\n" "Last-Translator: Ansgar Becker \n" "Language-Team: English (http://www.transifex.com/projects/p/heidisql/" "language/en/)\n" @@ -2720,6 +2720,9 @@ msgstr "Debug messages" msgid "Enable query history" msgstr "Enable query history" +msgid "days to keep queries before removing them" +msgstr "days to keep queries before removing them" + #. optionsform..pagecontrolMain..tabSQL..lblFont..Caption #: options.dfm:357 msgid "Editor font:" diff --git a/source/helpers.pas b/source/helpers.pas index 0304b5fb..7126c24d 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -174,7 +174,8 @@ type asFieldEditorSet, asFieldNullBackground, asRowBackgroundEven, asRowBackgroundOdd, asGroupTreeObjects, asDisplayObjectSizeColumn, asSQLfile, asActionShortcut1, asActionShortcut2, asHighlighterForeground, asHighlighterBackground, asHighlighterStyle, asListColWidths, asListColsVisible, asListColPositions, asListColSort, asSessionFolder, - asRecentFilter, asTimestampColumns, asDateTimeEditorCursorPos, asAppLanguage, asAutoExpand, asDoubleClickInsertsNodeText, asForeignDropDown, asQueryHistoryEnabled, + asRecentFilter, asTimestampColumns, asDateTimeEditorCursorPos, asAppLanguage, asAutoExpand, asDoubleClickInsertsNodeText, asForeignDropDown, + asQueryHistoryEnabled, asQueryHistoryKeepDays, asColumnSelectorWidth, asColumnSelectorHeight, asDonatedEmail, asFavoriteObjects, asFavoriteObjectsOnly, asFullTableStatus, asLineBreakStyle, asFileDialogEncoding, asUnused); @@ -3427,6 +3428,7 @@ begin InitSetting(asDoubleClickInsertsNodeText, 'DoubleClickInsertsNodeText', 0, True); InitSetting(asForeignDropDown, 'ForeignDropDown', 0, True); InitSetting(asQueryHistoryEnabled, 'QueryHistory', 0, True); + InitSetting(asQueryHistoryKeepDays, 'QueryHistoryKeeypDays', 30); InitSetting(asColumnSelectorWidth, 'ColumnSelectorWidth', 200, False, ''); InitSetting(asColumnSelectorHeight, 'ColumnSelectorHeight', 270, False, ''); InitSetting(asDonatedEmail, 'DonatedEmail', 0, False, ''); diff --git a/source/main.pas b/source/main.pas index 59547d45..330f56f7 100644 --- a/source/main.pas +++ b/source/main.pas @@ -2754,7 +2754,7 @@ var History: TQueryHistory; HistoryItem: TQueryHistoryItem; Warnings: TDBQuery; - HistoryNum, MaxWarnings, RegItemsSize: Integer; + HistoryNum, MaxWarnings, RegItemsSize, KeepDays: Integer; DoDelete, ValueFound: Boolean; MinDate: TDateTime; @@ -2877,6 +2877,7 @@ begin and (Thread.Batch.Size <= SIZE_MB) then begin ShowStatusMsg(_('Updating query history ...')); + KeepDays := AppSettings.ReadInt(asQueryHistoryKeepDays); // Load all items so we can clean up History := TQueryHistory.Create(Thread.Connection.Parameters.SessionPath); @@ -2901,7 +2902,7 @@ begin // Delete old items // Delete items which exceed a max datasize barrier AppSettings.SessionPath := Thread.Connection.Parameters.SessionPath + '\' + REGKEY_QUERYHISTORY; - MinDate := IncDay(Now, -30); + MinDate := IncDay(Now, -KeepDays); RegItemsSize := Thread.Batch.Size; for HistoryItem in History do begin Inc(RegItemsSize, Length(HistoryItem.SQL)); diff --git a/source/options.dfm b/source/options.dfm index fe9946e9..c8d64ffa 100644 --- a/source/options.dfm +++ b/source/options.dfm @@ -304,6 +304,13 @@ object optionsform: Toptionsform Height = 13 Caption = 'Log events:' end + object lblQueryHistoryKeepDays: TLabel + Left = 278 + Top = 201 + Width = 209 + Height = 13 + Caption = 'days to keep queries before removing them' + end object editLogLines: TEdit Left = 202 Top = 8 @@ -421,11 +428,11 @@ object optionsform: Toptionsform object chkQueryHistory: TCheckBox Left = 8 Top = 200 - Width = 429 + Width = 176 Height = 17 Caption = 'Enable query history' TabOrder = 11 - OnClick = Modified + OnClick = chkQueryHistoryClick end object chkHorizontalScrollbar: TCheckBox Left = 8 @@ -436,6 +443,29 @@ object optionsform: Toptionsform TabOrder = 12 OnClick = Modified end + object editQueryHistoryKeepDays: TEdit + Left = 202 + Top = 198 + Width = 53 + Height = 21 + Enabled = False + TabOrder = 13 + Text = '1' + OnChange = Modified + end + object updownQueryHistoryKeepDays: TUpDown + Left = 255 + Top = 198 + Width = 16 + Height = 21 + Associate = editQueryHistoryKeepDays + Enabled = False + Min = 1 + Max = 365 + Position = 1 + TabOrder = 14 + OnChanging = anyUpDownLimitChanging + end end object tabSQL: TTabSheet Caption = 'SQL' diff --git a/source/options.pas b/source/options.pas index 26e90fcb..a2073094 100644 --- a/source/options.pas +++ b/source/options.pas @@ -136,6 +136,9 @@ type updownGUIFontSize: TUpDown; lblGUIFontSize: TLabel; chkHorizontalScrollbar: TCheckBox; + editQueryHistoryKeepDays: TEdit; + updownQueryHistoryKeepDays: TUpDown; + lblQueryHistoryKeepDays: TLabel; procedure FormShow(Sender: TObject); procedure Modified(Sender: TObject); procedure Apply(Sender: TObject); @@ -174,6 +177,7 @@ type procedure editGridRowCountExit(Sender: TObject); procedure editCustomSnippetsDirectoryRightButtonClick(Sender: TObject); procedure comboGUIFontChange(Sender: TObject); + procedure chkQueryHistoryClick(Sender: TObject); private { Private declarations } FWasModified: Boolean; @@ -248,6 +252,7 @@ begin AppSettings.WriteBool(asLogInfos, chkLogEventInfo.Checked); AppSettings.WriteBool(asLogDebug, chkLogEventDebug.Checked); AppSettings.WriteBool(asQueryHistoryEnabled, chkQueryHistory.Checked); + AppSettings.WriteInt(asQueryHistoryKeepDays, updownQueryHistoryKeepDays.Position); AppSettings.WriteBool(asLogHorizontalScrollbar, chkHorizontalScrollbar.Checked); for i:=0 to SynSQLSynSQLSample.AttrCount - 1 do begin Attri := SynSQLSynSQLSample.Attribute[i]; @@ -488,6 +493,7 @@ begin chkLogEventInfo.Checked := AppSettings.ReadBool(asLogInfos); chkLogEventDebug.Checked := AppSettings.ReadBool(asLogDebug); chkQueryHistory.Checked := AppSettings.ReadBool(asQueryHistoryEnabled); + updownQueryHistoryKeepDays.Position := AppSettings.ReadInt(asQueryHistoryKeepDays); chkHorizontalScrollbar.Checked := AppSettings.ReadBool(asLogHorizontalScrollbar); // Default column width in grids: @@ -672,6 +678,15 @@ begin end; +procedure Toptionsform.chkQueryHistoryClick(Sender: TObject); +begin + editQueryHistoryKeepDays.Enabled := chkQueryHistory.Checked; + updownQueryHistoryKeepDays.Enabled := chkQueryHistory.Checked; + lblQueryHistoryKeepDays.Enabled := chkQueryHistory.Checked; + Modified(Sender); +end; + + procedure Toptionsform.comboGridTextColorsSelect(Sender: TObject); begin // Data type category selected