CSV import: add checkbox option for keeping dialog open after successful import, so the user may process multiple files with less clicks

This commit is contained in:
Ansgar Becker
2024-07-23 19:39:56 +02:00
parent 322b78b8b4
commit e521f7ab0c
4 changed files with 74 additions and 52 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: 2024-06-29 09:34+0200\n"
"PO-Revision-Date: 2024-07-23 19:36+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"
@ -1099,6 +1099,9 @@ msgstr "Input file contains local formatted numbers, e.g. 1.234,56 in Germany"
msgid "Truncate destination table before import"
msgstr "Truncate destination table before import"
msgid "Keep dialog open after import"
msgstr "Keep dialog open after import"
#. loaddataform..grpDuplicates..Caption
#: loaddata.dfm:272
msgid "Handling of duplicate rows"

View File

@ -201,7 +201,7 @@ type
asCSVImportSeparator, asCSVImportEncloser, asCSVImportTerminator, asCSVImportFieldEscaper, asCSVImportWindowWidth, asCSVImportWindowHeight,
asCSVImportFilename, asCSVImportFieldsEnclosedOptionally, asCSVImportIgnoreLines, asCSVImportLowPriority, asCSVImportLocalNumbers,
asCSVImportDuplicateHandling, asCSVImportParseMethod,
asCSVImportDuplicateHandling, asCSVImportParseMethod, asCSVKeepDialogOpen,
asUpdatecheck, asUpdatecheckBuilds, asUpdatecheckInterval, asUpdatecheckLastrun, asUpdateCheckWindowWidth, asUpdateCheckWindowHeight,
asTableToolsWindowWidth, asTableToolsWindowHeight, asTableToolsTreeWidth,
asTableToolsFindTextTab, asTableToolsFindText, asTableToolsFindSQL, asTableToolsDatatype, asTableToolsFindCaseSensitive, asTableToolsFindMatchType, asFileImportWindowWidth, asFileImportWindowHeight,
@ -3784,7 +3784,7 @@ begin
InitSetting(asCSVImportTerminator, 'CSVTerminator', 0, False, '\r\n');
InitSetting(asCSVImportFieldEscaper, 'CSVImportFieldEscaperV2', 0, False, '"');
InitSetting(asCSVImportWindowWidth, 'CSVImportWindowWidth', 530);
InitSetting(asCSVImportWindowHeight, 'CSVImportWindowHeight', 530);
InitSetting(asCSVImportWindowHeight, 'CSVImportWindowHeight', 550);
InitSetting(asCSVImportFilename, 'loadfilename', 0, False, '');
InitSetting(asCSVImportFieldsEnclosedOptionally, 'CSVImportFieldsEnclosedOptionallyV2', 0, True);
InitSetting(asCSVImportIgnoreLines, 'CSVImportIgnoreLines', 1);
@ -3792,6 +3792,7 @@ begin
InitSetting(asCSVImportLocalNumbers, 'CSVImportLocalNumbers', 0, False);
InitSetting(asCSVImportDuplicateHandling, 'CSVImportDuplicateHandling', 2);
InitSetting(asCSVImportParseMethod, 'CSVImportParseMethod', 0);
InitSetting(asCSVKeepDialogOpen, 'CSVKeepDialogOpen', 0, False);
InitSetting(asUpdatecheck, 'Updatecheck', 0, False);
InitSetting(asUpdatecheckBuilds, 'UpdatecheckBuilds', 0, False);
InitSetting(asUpdatecheckInterval, 'UpdatecheckInterval', 3);

View File

@ -2,10 +2,10 @@ object loaddataform: Tloaddataform
Left = 212
Top = 111
Caption = 'Import text file'
ClientHeight = 494
ClientWidth = 509
ClientHeight = 548
ClientWidth = 513
Color = clBtnFace
Constraints.MinHeight = 530
Constraints.MinHeight = 550
Constraints.MinWidth = 525
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
@ -18,12 +18,12 @@ object loaddataform: Tloaddataform
OnResize = FormResize
OnShow = FormShow
DesignSize = (
509
494)
513
548)
TextHeight = 14
object btnImport: TButton
Left = 345
Top = 461
Top = 515
Width = 75
Height = 25
Anchors = [akRight, akBottom]
@ -36,7 +36,7 @@ object loaddataform: Tloaddataform
end
object btnCancel: TButton
Left = 426
Top = 461
Top = 515
Width = 75
Height = 25
Anchors = [akRight, akBottom]
@ -59,23 +59,23 @@ object loaddataform: Tloaddataform
object lblFilename: TLabel
Left = 10
Top = 27
Width = 46
Height = 13
Width = 51
Height = 14
Caption = 'Filename:'
FocusControl = editFilename
end
object lblEncoding: TLabel
Left = 10
Top = 54
Width = 47
Height = 13
Width = 54
Height = 14
Caption = 'Encoding:'
end
object editFilename: TButtonedEdit
Left = 88
Top = 24
Width = 395
Height = 21
Height = 22
Anchors = [akLeft, akTop, akRight]
Images = MainForm.VirtualImageListMain
RightButton.ImageIndex = 51
@ -90,7 +90,7 @@ object loaddataform: Tloaddataform
Left = 88
Top = 51
Width = 395
Height = 21
Height = 22
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
DropDownCount = 16
@ -112,36 +112,36 @@ object loaddataform: Tloaddataform
object lblFieldTerminater: TLabel
Left = 10
Top = 26
Width = 97
Height = 13
Width = 110
Height = 14
Caption = 'Fields terminated by'
end
object lblFieldEncloser: TLabel
Left = 10
Top = 51
Width = 87
Height = 13
Width = 98
Height = 14
Caption = 'Fields enclosed by'
end
object lblFieldEscaper: TLabel
Left = 10
Top = 75
Width = 85
Height = 13
Width = 95
Height = 14
Caption = 'Fields escaped by'
end
object lblLineTerminator: TLabel
Left = 10
Top = 100
Width = 94
Height = 13
Width = 108
Height = 14
Caption = 'Lines terminated by'
end
object editFieldEscaper: TEdit
Left = 145
Top = 72
Width = 49
Height = 21
Height = 22
TabOrder = 3
Text = '"'
end
@ -149,7 +149,7 @@ object loaddataform: Tloaddataform
Left = 145
Top = 48
Width = 49
Height = 21
Height = 22
TabOrder = 1
Text = '"'
end
@ -157,7 +157,7 @@ object loaddataform: Tloaddataform
Left = 145
Top = 23
Width = 49
Height = 21
Height = 22
TabOrder = 0
Text = ';'
end
@ -176,7 +176,7 @@ object loaddataform: Tloaddataform
Left = 145
Top = 97
Width = 49
Height = 21
Height = 22
TabOrder = 4
Text = '\r\n'
end
@ -185,32 +185,32 @@ object loaddataform: Tloaddataform
Left = 8
Top = 98
Width = 209
Height = 135
Height = 175
Anchors = [akLeft, akTop, akRight]
Caption = 'Options'
TabOrder = 1
DesignSize = (
209
135)
175)
object lblIgnoreLinesCount: TLabel
Left = 143
Top = 26
Width = 21
Height = 13
Width = 23
Height = 14
Caption = 'lines'
end
object lblIgnoreLines: TLabel
Left = 10
Top = 26
Width = 54
Height = 13
Width = 60
Height = 14
Caption = 'Ignore first'
end
object updownIgnoreLines: TUpDown
Left = 121
Top = 23
Width = 16
Height = 21
Height = 22
Associate = editIgnoreLines
Max = 32767
Position = 1
@ -220,7 +220,7 @@ object loaddataform: Tloaddataform
Left = 88
Top = 23
Width = 33
Height = 21
Height = 22
TabOrder = 0
Text = '1'
end
@ -257,10 +257,19 @@ object loaddataform: Tloaddataform
Caption = 'Truncate destination table before import'
TabOrder = 4
end
object chkKeepDialogOpen: TCheckBox
Left = 10
Top = 138
Width = 196
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Keep dialog open after import'
TabOrder = 5
end
end
object grpDuplicates: TRadioGroup
Left = 8
Top = 239
Top = 279
Width = 209
Height = 123
Anchors = [akLeft, akTop, akRight]
@ -274,9 +283,9 @@ object loaddataform: Tloaddataform
end
object grpParseMethod: TRadioGroup
Left = 8
Top = 368
Top = 408
Width = 209
Height = 87
Height = 101
Anchors = [akLeft, akTop, akRight, akBottom]
Caption = 'Method'
ItemIndex = 0
@ -291,39 +300,39 @@ object loaddataform: Tloaddataform
Left = 223
Top = 239
Width = 278
Height = 216
Height = 270
Anchors = [akTop, akRight, akBottom]
Caption = 'Destination'
TabOrder = 5
DesignSize = (
278
216)
270)
object lblDatabase: TLabel
Left = 10
Top = 24
Width = 50
Height = 13
Width = 54
Height = 14
Caption = 'Database:'
end
object lblTable: TLabel
Left = 10
Top = 48
Width = 30
Height = 13
Width = 34
Height = 14
Caption = 'Table:'
end
object lblColumns: TLabel
Left = 10
Top = 72
Width = 44
Height = 13
Width = 49
Height = 14
Caption = 'Columns:'
end
object comboDatabase: TComboBox
Left = 112
Top = 21
Width = 156
Height = 21
Height = 22
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
TabOrder = 0
@ -333,7 +342,7 @@ object loaddataform: Tloaddataform
Left = 112
Top = 45
Width = 156
Height = 21
Height = 22
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
TabOrder = 1
@ -343,9 +352,9 @@ object loaddataform: Tloaddataform
Left = 112
Top = 72
Width = 153
Height = 129
Height = 183
Anchors = [akLeft, akTop, akRight, akBottom]
ItemHeight = 13
ItemHeight = 14
TabOrder = 2
OnClick = chklistColumnsClick
end
@ -355,7 +364,7 @@ object loaddataform: Tloaddataform
Width = 87
Height = 66
Align = alNone
ButtonWidth = 54
ButtonWidth = 59
Caption = 'ToolBarColMove'
Images = MainForm.VirtualImageListMain
List = True

View File

@ -53,6 +53,7 @@ type
chkLocalNumbers: TCheckBox;
chkTruncateTable: TCheckBox;
btnCheckAll: TToolButton;
chkKeepDialogOpen: TCheckBox;
const ProgressBarSteps=100;
procedure FormCreate(Sender: TObject);
procedure editFilenameChange(Sender: TObject);
@ -104,6 +105,7 @@ begin
updownIgnoreLines.Position := AppSettings.ReadInt(asCSVImportIgnoreLines);
chkLowPriority.Checked := AppSettings.ReadBool(asCSVImportLowPriority);
chkLocalNumbers.Checked := AppSettings.ReadBool(asCSVImportLocalNumbers);
chkKeepDialogOpen.Checked := AppSettings.ReadBool(asCSVKeepDialogOpen);
// Uncheck critical "Truncate table" checkbox, to avoid accidental data removal
chkTruncateTable.Checked := False;
grpDuplicates.ItemIndex := AppSettings.ReadInt(asCSVImportDuplicateHandling);
@ -172,6 +174,7 @@ begin
AppSettings.WriteInt(asCSVImportIgnoreLines, updownIgnoreLines.Position);
AppSettings.WriteBool(asCSVImportLowPriority, chkLowPriority.Checked);
AppSettings.WriteBool(asCSVImportLocalNumbers, chkLocalNumbers.Checked);
AppSettings.WriteBool(asCSVKeepDialogOpen, chkKeepDialogOpen.Checked);
AppSettings.WriteInt(asCSVImportDuplicateHandling, grpDuplicates.ItemIndex);
AppSettings.WriteInt(asCSVImportParseMethod, grpParseMethod.ItemIndex);
end;
@ -330,6 +333,9 @@ begin
FLineTerm := FConnection.UnescapeString(editLineTerminator.Text);
FEscp := FConnection.UnescapeString(editFieldEscaper.Text);
if chkKeepDialogOpen.Checked then
ModalResult := mrNone;
try
case grpParseMethod.ItemIndex of
0: ServerParse(Sender);
@ -362,6 +368,9 @@ begin
end;
end;
if ModalResult = mrNone then
btnCancel.Caption := _('Close');
Mainform.ShowStatusMsg;
MainForm.DisableProgress;
Screen.Cursor := crDefault;