Skip to content
Permalink
Browse files

Add new menu item "Duplicate row with keys" to grid context menu, and…

… rename "Duplicate row" to "Duplicate row without keys". Closes #396
  • Loading branch information...
ansgarbecker committed Apr 17, 2019
1 parent 91c8ff1 commit 2a37a943584dd46922285d4e963a6fc2c77277ba
Showing with 28 additions and 12 deletions.
  1. +8 −5 out/locale/en/LC_MESSAGES/default.po
  2. +13 −3 source/main.dfm
  3. +7 −4 source/main.pas
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2019-04-16 19:42+0200\n"
"PO-Revision-Date: 2019-04-17 08:21+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"
@@ -1925,10 +1925,13 @@ msgstr "&Insert row"
msgid "Insert row into table"
msgstr "Insert row into table"

#. MainForm..ActionList1..actDataDuplicateRow..Caption
#: main.dfm:2086
msgid "Duplicate row"
msgstr "Duplicate row"
#. Result grid context menu
msgid "Duplicate row without keys"
msgstr "Duplicate row without keys"

#. "keys" are actually "primary and unique keys", which is too long for a context menu
msgid "Duplicate row with keys"
msgstr "Duplicate row with keys"

#. MainForm..ActionList1..actDataDelete..Caption
#: main.dfm:2094
@@ -2167,14 +2167,21 @@ object MainForm: TMainForm
ShortCut = 45
OnExecute = actDataInsertExecute
end
object actDataDuplicateRow: TAction
object actDataDuplicateRowWithoutKeys: TAction
Category = 'Data'
Caption = 'Duplicate row'
Caption = 'Duplicate row without keys'
Enabled = False
ImageIndex = 45
ShortCut = 16429
OnExecute = actDataInsertExecute
end
object actDataDuplicateRowWithKeys: TAction
Category = 'Data'
Caption = 'Duplicate row with keys'
Enabled = False
ImageIndex = 45
OnExecute = actDataInsertExecute
end
object actDataDelete: TAction
Category = 'Data'
Caption = '&Delete selected row(s)'
@@ -3104,7 +3111,10 @@ object MainForm: TMainForm
Action = actDataInsert
end
object Duplicaterow1: TMenuItem
Action = actDataDuplicateRow
Action = actDataDuplicateRowWithoutKeys
end
object Duplicaterowwithkeys1: TMenuItem
Action = actDataDuplicateRowWithKeys
end
object DataPost1: TMenuItem
Action = actDataPostChanges
@@ -493,7 +493,8 @@ TMainForm = class(TForm)
menuCreateTrigger: TMenuItem;
menuQueryCut: TMenuItem;
menuQuerySelectall: TMenuItem;
actDataDuplicateRow: TAction;
actDataDuplicateRowWithoutKeys: TAction;
actDataDuplicateRowWithKeys: TAction;
Duplicaterow1: TMenuItem;
Bulktableeditor1: TMenuItem;
actSelectInverse: TAction;
@@ -646,6 +647,7 @@ TMainForm = class(TForm)
treeQueryHelpers: TVirtualStringTree;
filterQueryHelpers: TButtonedEdit;
TimerStoreTabs: TTimer;
Duplicaterowwithkeys1: TMenuItem;
procedure actCreateDBObjectExecute(Sender: TObject);
procedure menuConnectionsPopup(Sender: TObject);
procedure actExitApplicationExecute(Sender: TObject);
@@ -4769,7 +4771,7 @@ procedure TMainForm.actDataInsertExecute(Sender: TObject);
try
Results.CheckEditable;
DupeNode := nil;
if Sender = actDataDuplicateRow then
if (Sender = actDataDuplicateRowWithoutKeys) or (Sender = actDataDuplicateRowWithKeys) then
DupeNode := Grid.FocusedNode;
RowNum := Results.InsertRow;
NewNode := Grid.InsertNode(Grid.FocusedNode, amInsertAfter, PInt64(RowNum));
@@ -4781,7 +4783,7 @@ procedure TMainForm.actDataInsertExecute(Sender: TObject);
for i:=0 to Grid.Header.Columns.Count-1 do begin
if not (coVisible in Grid.Header.Columns[i].Options) then
continue; // Ignore invisible key column
if Results.ColIsPrimaryKeyPart(i) then
if Results.ColIsPrimaryKeyPart(i) and (Sender = actDataDuplicateRowWithoutKeys) then
continue; // Empty value for primary key column
if Results.ColIsVirtual(i) then
continue; // Don't copy virtual column value
@@ -5626,7 +5628,8 @@ procedure TMainForm.ValidateControls(Sender: TObject);

actFullRefresh.Enabled := HasConnection and (PageControlMain.ActivePage = tabDatabase);
actDataInsert.Enabled := HasConnection and inGrid and Assigned(Results);
actDataDuplicateRow.Enabled := HasConnection and inGrid and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
actDataDuplicateRowWithoutKeys.Enabled := HasConnection and inGrid and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
actDataDuplicateRowWithKeys.Enabled := actDataDuplicateRowWithoutKeys.Enabled;
actDataDelete.Enabled := HasConnection and inGrid and (Grid.SelectedCount > 0);
actDataFirst.Enabled := HasConnection and inDataOrQueryTabNotEmpty and inGrid;
actDataLast.Enabled := HasConnection and inDataOrQueryTabNotEmpty and inGrid;

0 comments on commit 2a37a94

Please sign in to comment.
You can’t perform that action at this time.