Keyboard shortcuts: allow the user to accept duplicate assignments per ignore button. Useful in case of F9 for "Run SQL" and "Apply filter".

This commit is contained in:
Ansgar Becker
2023-11-03 11:41:59 +01:00
parent b1ddfc5234
commit a1ebf37021
2 changed files with 22 additions and 11 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: HeidiSQL\n" "Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n" "POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2023-10-27 13:06+0200\n" "PO-Revision-Date: 2023-11-03 11:39+0100\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n" "Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n" "Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"Language: en\n" "Language: en\n"
@ -6489,6 +6489,10 @@ msgstr "Keyboard shortcut [%s] is already assigned to \"%s\"."
msgid "Remove it there and assign to \"%s\" instead?" msgid "Remove it there and assign to \"%s\" instead?"
msgstr "Remove it there and assign to \"%s\" instead?" msgstr "Remove it there and assign to \"%s\" instead?"
#. Keyboard shortcut settings
msgid "Press ignore to keep both and ignore all conflicts."
msgstr "Press ignore to keep both and ignore all conflicts."
msgid "Really auto-detect file encoding?" msgid "Really auto-detect file encoding?"
msgstr "Really auto-detect file encoding?" msgstr "Really auto-detect file encoding?"

View File

@ -1314,28 +1314,35 @@ begin
if RequestShortcut = 0 then if RequestShortcut = 0 then
Exit; Exit;
MsgFormat := _('Keyboard shortcut [%s] is already assigned to "%s".') + sLineBreak + sLineBreak + MsgFormat := _('Keyboard shortcut [%s] is already assigned to "%s".') + sLineBreak + sLineBreak +
_('Remove it there and assign to "%s" instead?'); _('Remove it there and assign to "%s" instead?') + sLineBreak + sLineBreak +
_('Press ignore to keep both and ignore all conflicts.');
Tree := TreeShortcutItems; Tree := TreeShortcutItems;
NodeWantsIt := Tree.FocusedNode; NodeWantsIt := Tree.FocusedNode;
Node := GetNextNode(Tree, nil, False); Node := GetNextNode(Tree, nil, False);
while Assigned(Node) do begin while Assigned(Node) do begin
if Tree.GetNodeLevel(Node) = 1 then begin if Tree.GetNodeLevel(Node) = 1 then begin
Data := Tree.GetNodeData(Node); Data := Tree.GetNodeData(Node);
Msg := Format(MsgFormat, [ShortCutToText(RequestShortcut), Tree.Text[Node, 0], Tree.Text[NodeWantsIt, 0]]); Msg := Format(MsgFormat, [
ShortCutToText(RequestShortcut),
Tree.Text[Node, 0],
Tree.Text[NodeWantsIt, 0]
]);
if Node = NodeWantsIt then begin if Node = NodeWantsIt then begin
// Ignore requesting node // Ignore requesting node
end else begin end else begin
if Data.ShortCut1 = RequestShortcut then begin if Data.ShortCut1 = RequestShortcut then begin
if MessageDialog(Msg, mtConfirmation, [mbYes, mbNo]) = mrYes then case MessageDialog(Msg, mtConfirmation, [mbYes, mbNo, mbIgnore]) of
Data.ShortCut1 := 0 // Unassign shortcut 1 mrYes: Data.ShortCut1 := 0; // Unassign shortcut 1
else mrNo: Result := False;
Result := False; mrIgnore: Break; // Keep Result=True and exit loop, ignore further conflicts
end;
end; end;
if Data.ShortCut2 = RequestShortcut then begin if Data.ShortCut2 = RequestShortcut then begin
if MessageDialog(Msg, mtConfirmation, [mbYes, mbNo]) = mrYes then case MessageDialog(Msg, mtConfirmation, [mbYes, mbNo, mbIgnore]) of
Data.ShortCut2 := 0 // Unassign shortcut 2 mrYes: Data.ShortCut2 := 0; // Unassign shortcut 2
else mrNo: Result := False;
Result := False; mrIgnore: Break;
end;
end; end;
end; end;
end; end;