Issue #912: add checkbox "Open file after creation" to grid export dialog

This commit is contained in:
Ansgar Becker
2025-10-13 20:35:43 +02:00
parent 564f77d9d1
commit 13233a2bc0
4 changed files with 25 additions and 6 deletions

View File

@@ -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 <anse@heidisql.com>\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"

View File

@@ -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');

View File

@@ -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

View File

@@ -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