mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Change the Open File(s) option according to the file providers count
When there is only one file provider (i.e. the local file provider), the Open File(s) will be a simple item in the File menu. When there are more than one file providers, the Open File(s) will become a submenu in the File menu, which will contain all the file providers as submenu items. CURA-7868
This commit is contained in:
parent
43615a57b6
commit
71994eaaf9
3 changed files with 31 additions and 9 deletions
|
|
@ -22,11 +22,23 @@ Menu
|
|||
{
|
||||
id: openMenu
|
||||
action: Cura.Actions.open
|
||||
visible: CuraApplication.fileProviders.length > 0 // DEBUG: It's > 0 so that both options are visible for debugging purposes
|
||||
visible: (CuraApplication.getFileProviderModel().count == 1)
|
||||
}
|
||||
|
||||
OpenFilesMenu {
|
||||
visible: CuraApplication.fileProviders.length > 0 // DEBUG: It's > 0 so that both options are visible for debugging purposes
|
||||
OpenFilesMenu
|
||||
{
|
||||
id: openFilesMenu
|
||||
visible: (CuraApplication.getFileProviderModel().count > 1)
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: CuraApplication.getFileProviderModel()
|
||||
onItemsChanged:
|
||||
{
|
||||
openMenu.visible = (CuraApplication.getFileProviderModel().count == 1) // 1 because the open local files menu should always exist in the model
|
||||
openFilesMenu.visible = (CuraApplication.getFileProviderModel().count > 1)
|
||||
}
|
||||
}
|
||||
|
||||
RecentFilesMenu { }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue