From 13233a2bc06998e475b9ace421a9bc358f9af1b2 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Mon, 13 Oct 2025 20:35:43 +0200 Subject: [PATCH] Issue #912: add checkbox "Open file after creation" to grid export dialog --- out/locale/en/LC_MESSAGES/default.po | 5 ++++- source/apphelpers.pas | 3 ++- source/exportgrid.dfm | 16 ++++++++++++---- source/exportgrid.pas | 7 +++++++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/out/locale/en/LC_MESSAGES/default.po b/out/locale/en/LC_MESSAGES/default.po index 8ce4c5cb..0186d417 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: 2025-09-17 18:46+0200\n" +"PO-Revision-Date: 2025-10-13 20:32+0200\n" "Last-Translator: Ansgar Becker \n" "Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n" "Language: en\n" @@ -6761,3 +6761,6 @@ msgstr "Select top %s rows" msgid "Selects the first %s rows in a new query tab" msgstr "Selects the first %s rows in a new query tab" + +msgid "Open file after creation" +msgstr "Open file after creation" diff --git a/source/apphelpers.pas b/source/apphelpers.pas index a3c8ca22..d3cb2230 100644 --- a/source/apphelpers.pas +++ b/source/apphelpers.pas @@ -193,7 +193,7 @@ type asExportSQLDatabase, asExportSQLServerDatabase, asExportSQLOutput, asExportSQLAddComments, asExportSQLRemoveAutoIncrement, asExportSQLRemoveDefiner, asGridExportWindowWidth, asGridExportWindowHeight, asGridExportOutputCopy, asGridExportOutputFile, asGridExportFilename, asGridExportRecentFiles, asGridExportEncoding, asGridExportFormat, asGridExportSelection, - asGridExportColumnNames, asGridExportIncludeAutoInc, asGridExportIncludeQuery, asGridExportRemoveLinebreaks, + asGridExportColumnNames, asGridExportIncludeAutoInc, asGridExportIncludeQuery, asGridExportRemoveLinebreaks, asGridExportOpenFile, asGridExportSeparator, asGridExportEncloser, asGridExportTerminator, asGridExportNull, asGridExportClpColumnNames, asGridExportClpIncludeAutoInc, asGridExportClpRemoveLinebreaks, @@ -3904,6 +3904,7 @@ begin InitSetting(asGridExportIncludeAutoInc, 'GridExportAutoInc', 0, True); InitSetting(asGridExportIncludeQuery, 'GridExportIncludeQuery', 0, False); InitSetting(asGridExportRemoveLinebreaks, 'GridExportRemoveLinebreaks', 0, False); + InitSetting(asGridExportOpenFile, 'GridExportOpenFile', 0, False); InitSetting(asGridExportSeparator, 'GridExportSeparator', 0, False, ';'); InitSetting(asGridExportEncloser, 'GridExportEncloser', 0, False, ''); InitSetting(asGridExportTerminator, 'GridExportTerminator', 0, False, '\r\n'); diff --git a/source/exportgrid.dfm b/source/exportgrid.dfm index 1842ac1c..470ebdbf 100644 --- a/source/exportgrid.dfm +++ b/source/exportgrid.dfm @@ -183,7 +183,7 @@ object frmExportGrid: TfrmExportGrid RightButton.DisabledImageIndex = 107 RightButton.ImageIndex = 108 RightButton.Visible = True - TabOrder = 4 + TabOrder = 5 Text = ';' OnChange = editCSVChange OnRightButtonClick = editCSVRightButtonClick @@ -198,7 +198,7 @@ object frmExportGrid: TfrmExportGrid RightButton.DisabledImageIndex = 107 RightButton.ImageIndex = 108 RightButton.Visible = True - TabOrder = 5 + TabOrder = 6 OnChange = editCSVChange OnRightButtonClick = editCSVRightButtonClick end @@ -212,7 +212,7 @@ object frmExportGrid: TfrmExportGrid RightButton.DisabledImageIndex = 107 RightButton.ImageIndex = 108 RightButton.Visible = True - TabOrder = 6 + TabOrder = 7 Text = '\r\n' OnChange = editCSVChange OnRightButtonClick = editCSVRightButtonClick @@ -243,7 +243,7 @@ object frmExportGrid: TfrmExportGrid RightButton.DisabledImageIndex = 107 RightButton.ImageIndex = 108 RightButton.Visible = True - TabOrder = 7 + TabOrder = 8 OnChange = editCSVChange OnRightButtonClick = editCSVRightButtonClick end @@ -255,6 +255,14 @@ object frmExportGrid: TfrmExportGrid Caption = 'Remove linebreaks from contents' TabOrder = 3 end + object chkOpenFile: TCheckBox + Left = 8 + Top = 110 + Width = 257 + Height = 17 + Caption = 'Open file after creation' + TabOrder = 4 + end end object btnSetClipboardDefaults: TButton Left = 8 diff --git a/source/exportgrid.pas b/source/exportgrid.pas index fda3aa45..d779f728 100644 --- a/source/exportgrid.pas +++ b/source/exportgrid.pas @@ -69,6 +69,7 @@ type chkRemoveLinebreaks: TCheckBox; grpFormat: TGroupBox; comboFormat: TComboBoxEx; + chkOpenFile: TCheckBox; procedure FormCreate(Sender: TObject); procedure CalcSize(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); @@ -202,6 +203,7 @@ begin chkIncludeAutoIncrement.Checked := AppSettings.ReadBool(asGridExportClpIncludeAutoInc); chkIncludeQuery.Checked := False; // Always off in copy mode chkRemoveLinebreaks.Checked := AppSettings.ReadBool(asGridExportClpRemoveLinebreaks); + chkOpenFile.Checked := False; // Always off in copy mode FCSVSeparator := AppSettings.ReadString(asGridExportClpSeparator); FCSVEncloser := AppSettings.ReadString(asGridExportClpEncloser); FCSVTerminator := AppSettings.ReadString(asGridExportClpTerminator); @@ -215,6 +217,7 @@ begin chkIncludeAutoIncrement.Checked := AppSettings.ReadBool(asGridExportIncludeAutoInc); chkIncludeQuery.Checked := AppSettings.ReadBool(asGridExportIncludeQuery); chkRemoveLinebreaks.Checked := AppSettings.ReadBool(asGridExportRemoveLinebreaks); + chkOpenFile.Checked := AppSettings.ReadBool(asGridExportOpenFile); FCSVSeparator := AppSettings.ReadString(asGridExportSeparator); FCSVEncloser := AppSettings.ReadString(asGridExportEncloser); FCSVTerminator := AppSettings.ReadString(asGridExportTerminator); @@ -251,6 +254,7 @@ begin AppSettings.WriteBool(asGridExportIncludeAutoInc, chkIncludeAutoIncrement.Checked); AppSettings.WriteBool(asGridExportIncludeQuery, chkIncludeQuery.Checked); AppSettings.WriteBool(asGridExportRemoveLinebreaks, chkRemoveLinebreaks.Checked); + AppSettings.WriteBool(asGridExportOpenFile, chkOpenFile.Checked); AppSettings.WriteString(asGridExportSeparator, FCSVSeparator); AppSettings.WriteString(asGridExportEncloser, FCSVEncloser); AppSettings.WriteString(asGridExportTerminator, FCSVTerminator); @@ -295,6 +299,7 @@ begin end; chkIncludeQuery.Enabled := ExportFormat in [efHTML, efXML, efMarkDown, efJSON]; + chkOpenFile.Enabled := radioOutputFile.Checked; Enable := ExportFormat = efCSV; lblSeparator.Enabled := Enable; editSeparator.Enabled := Enable; @@ -1217,6 +1222,8 @@ begin end else begin try S.SaveToFile(Filename); + if chkOpenFile.Checked then + ShellExec(editFilename.Text); except on E:EFCreateError do begin // Keep form open if file cannot be created