mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 12:23:11 +08:00
Fix ambiguous Ctrl+O shortcut not opening the local file dialog
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
This commit is contained in:
parent
96c4d66029
commit
fd3c985440
@ -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
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user