mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-28 23:04:34 +08:00
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:
parent
de80461954
commit
b266904d76
@ -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
|
||||
|
@ -627,12 +627,6 @@ UM.MainWindow
|
||||
modality: Qt.ApplicationModal
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.Actions.open
|
||||
onTriggered: openDialog.open()
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.Actions.showProfileFolder
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user