diff options
author | Kostas Karmas <konskarm@gmail.com> | 2021-01-11 19:50:26 +0300 |
---|---|---|
committer | Kostas Karmas <konskarm@gmail.com> | 2021-01-11 19:50:26 +0300 |
commit | fd3c9854406e9a655d7076307bf91d8ca4840a1f (patch) | |
tree | 965b633e6870299ae83947404ebf4a0e4c039046 | |
parent | 96c4d66029011df9f70ac54ba023d3be53ea67d2 (diff) |
Fix ambiguous Ctrl+O shortcut not opening the local file dialogCURA-7868_Introduce_file_provider_plugin_type
Ctrl+O was assigned as a shortcut in two places:
1. To the "File->Open File(s)" menu item, which is visible when only the local file
provider is enabled (i.e. the DF file provider is disabled)
2. To the "File->Open File(s)->From Disk" menu item, which is visible when there are
more than one file providers enabled.
This was creating an ambiguous shortcut, thus never opening the local file dialog.
This is now fixed by disabling the shortcuts when the respective items are not visible.
CURA-7868
-rw-r--r-- | resources/qml/Actions.qml | 6 | ||||
-rw-r--r-- | resources/qml/Menus/OpenFilesMenu.qml | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index c62b0cb89a..78c4958598 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -416,9 +416,13 @@ Item Action { id: openAction; + property var fileProviderModel: CuraApplication.getFileProviderModel() + text: catalog.i18nc("@action:inmenu menubar:file","&Open File(s)..."); iconName: "document-open"; - shortcut: StandardKey.Open; + // Unassign the shortcut when there are more than one file providers, since then the file provider's shortcut is + // enabled instead, and Ctrl+O is assigned to the local file provider + shortcut: fileProviderModel.count == 1 ? StandardKey.Open : ""; } Action diff --git a/resources/qml/Menus/OpenFilesMenu.qml b/resources/qml/Menus/OpenFilesMenu.qml index 60fb507b34..3c2b64ee62 100644 --- a/resources/qml/Menus/OpenFilesMenu.qml +++ b/resources/qml/Menus/OpenFilesMenu.qml @@ -36,7 +36,9 @@ Menu CuraApplication.getFileProviderModel().trigger(model.name); } } - shortcut: model.shortcut + // Unassign the shortcuts when the submenu is invisible (i.e. when there is only one file provider) to avoid ambiguous shortcuts. + // When there is a signle file provider, the openAction is assigned with the Ctrl+O shortcut instead. + shortcut: openFilesMenu.visible ? model.shortcut : "" } onObjectAdded: openFilesMenu.insertItem(index, object) onObjectRemoved: openFilesMenu.removeItem(object) |