Merge branch 'CURA-7868_Introduce_file_provider_plugin_type' into CURA-7864_open_remote_files_mvp

This commit is contained in:
Kostas Karmas 2021-01-12 10:53:32 +01:00
commit b3e8f4d0e6
2 changed files with 8 additions and 2 deletions

View File

@ -416,9 +416,13 @@ Item
Action Action
{ {
id: openAction; id: openAction;
property var fileProviderModel: CuraApplication.getFileProviderModel()
text: catalog.i18nc("@action:inmenu menubar:file","&Open File(s)..."); text: catalog.i18nc("@action:inmenu menubar:file","&Open File(s)...");
iconName: "document-open"; 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 Action

View File

@ -36,7 +36,9 @@ Menu
CuraApplication.getFileProviderModel().trigger(model.name); 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) onObjectAdded: openFilesMenu.insertItem(index, object)
onObjectRemoved: openFilesMenu.removeItem(object) onObjectRemoved: openFilesMenu.removeItem(object)