Commit 94aee349 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Folder View] Set shortcut on plasmoid.action

Ensures the shortcuts are shown in the menu.
We need to accept the event if we handled it or else the containment will trigger the action
leading to double activation.

BUG: 392730
FIXED-IN: 5.12.5

Differential Revision: https://phabricator.kde.org/D11953
parent eab41217
......@@ -896,6 +896,8 @@ FocusScope {
}
Keys.onPressed: {
event.accepted = true;
if (event.matches(StandardKey.Delete)) {
if (dir.hasSelection()) {
dir.action("trash").trigger();
......@@ -926,6 +928,8 @@ FocusScope {
dir.refresh();
} else if (event.matches(StandardKey.SelectAll)) {
positioner.setRangeSelected(0, count - 1);
} else {
event.accepted = false;
}
}
......
......@@ -395,14 +395,18 @@ Item {
modelAction = folderView.model.action(actionName);
plasmoid.setAction(actionName, modelAction.text, Folder.MenuHelper.iconName(modelAction));
var plasmoidAction = plasmoid.action(actionName);
plasmoidAction.shortcut = modelAction.shortcut;
plasmoidAction.shortcutContext = Qt.WidgetShortcut;
if (actionName == "newMenu") {
Folder.MenuHelper.setMenu(plasmoid.action(actionName), folderView.model.newMenu);
Folder.MenuHelper.setMenu(plasmoidAction, folderView.model.newMenu);
plasmoid.setActionSeparator("separator1");
plasmoid.setAction("viewProperties", i18n("Icons"), "preferences-desktop-icons");
Folder.MenuHelper.setMenu(plasmoid.action("viewProperties"), viewPropertiesMenu.menu);
} else {
plasmoid.action(actionName).triggered.connect(modelAction.trigger);
plasmoidAction.triggered.connect(modelAction.trigger);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment