Replace other references to the open action with the file provider model

This adds a function 'triggerFirst' to the file provider that triggers the first file provider in the model. That should then be the local file provider, but if the plug-in is disabled for some reason it would use another plug-in.

Contributes to issue CURA-7868.
This commit is contained in:
Ghostkeeper 2021-01-04 17:45:16 +01:00
parent de80461954
commit b266904d76
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A
3 changed files with 5 additions and 24 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018 Ultimaker B.V.
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
@ -96,7 +96,7 @@ Item
id: openFileButton
height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height
onClicked: Cura.Actions.open.trigger()
onClicked: CuraApplication.getFileProviderModel().triggerFirst()
hoverEnabled: true
contentItem: Item

View File

@ -627,12 +627,6 @@ UM.MainWindow
modality: Qt.ApplicationModal
}
Connections
{
target: Cura.Actions.open
onTriggered: openDialog.open()
}
Connections
{
target: Cura.Actions.showProfileFolder

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 Ultimaker B.V.
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -21,21 +21,8 @@ Menu
model: CuraApplication.getFileProviderModel()
MenuItem
{
text:
{
return model.displayText;
}
onTriggered:
{
if (model.index == 0) // The 0th element is the "From Disk" option, which should activate the open local file dialog
{
Cura.Actions.open.trigger()
}
else
{
CuraApplication.getFileProviderModel().trigger(model.name);
}
}
text: model.displayText
onTriggered: CuraApplication.getFileProviderModel().trigger(model.name)
shortcut: model.shortcut
}
onObjectAdded: openFilesMenu.insertItem(index, object)