Skip to content

Commit

Permalink
Issue #140: Auto-backup unsaved query tab contents to C:\Users\<usern…
Browse files Browse the repository at this point in the history
…ame>\AppData\Roaming\HeidiSQL\Backups\*.sql, and tab setup in C:\Users\<username>\AppData\Roaming\HeidiSQL\tabs.ini
  • Loading branch information
ansgarbecker committed Apr 7, 2019
1 parent e56371e commit 3069456
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 94 deletions.
5 changes: 4 additions & 1 deletion out/locale/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2019-03-30 09:56+0100\n"
"PO-Revision-Date: 2019-04-07 13:11+0200\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -6352,3 +6352,6 @@ msgstr "Plugin directory %s could not be set."

msgid "Background color:"
msgstr "Background color:"

msgid "Backup file could not be deleted: %s"
msgstr "Backup file could not be deleted: %s"
6 changes: 3 additions & 3 deletions source/apphelpers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ TQueryThread = class(TThread)
asCopyTableData, asCopyTableRecentFilter, asServerVersion, asServerVersionFull, asLastConnect,
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asMySQLBinaries, asCustomSnippetsDirectory,
asPromptSaveFileOnTabClose, asReopenFiles, asBackupRestoreFiles, asWarnUnsafeUpdates, asQueryWarningsMessage,
asPromptSaveFileOnTabClose, asRestoreTabs, asBackupDirectory, asWarnUnsafeUpdates, asQueryWarningsMessage,
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asTheme, asIconPack,
Expand Down Expand Up @@ -3615,8 +3615,8 @@ constructor TAppSettings.Create;
DefaultSnippetsDirectory := DefaultSnippetsDirectory + 'Snippets\';
InitSetting(asCustomSnippetsDirectory, 'CustomSnippetsDirectory', 0, False, DefaultSnippetsDirectory);
InitSetting(asPromptSaveFileOnTabClose, 'PromptSaveFileOnTabClose', 0, True);
InitSetting(asReopenFiles, 'ReopenFiles', 0, True);
InitSetting(asBackupRestoreFiles, 'BackupRestoreFiles', 0, True);
InitSetting(asRestoreTabs, 'RestoreTabs', 0, True);
InitSetting(asBackupDirectory, 'BackupDirectory', 0, False, DirnameUserAppData + 'Backups\');
InitSetting(asWarnUnsafeUpdates, 'WarnUnsafeUpdates', 0, True);
InitSetting(asQueryWarningsMessage, 'QueryWarningsMessage', 0, True);
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);
Expand Down
1 change: 1 addition & 0 deletions source/const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const
GRIDMAXDATA: Integer = 256;

BACKUP_MAXFILESIZE: Integer = 10 * SIZE_MB;
BACKUP_FILEPATTERN: String = 'query-tab-%d.sql';

VTREE_NOTLOADED = 0;
VTREE_NOTLOADED_PURGECACHE = 1;
Expand Down
7 changes: 7 additions & 0 deletions source/main.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -21704,4 +21704,11 @@ object MainForm: TMainForm
Left = 689
Top = 339
end
object TimerStoreTabs: TTimer
Enabled = False
Interval = 10000
OnTimer = TimerStoreTabsTimer
Left = 689
Top = 299
end
end
Loading

0 comments on commit 3069456

Please sign in to comment.