Disable copy paste when either 3mf reader or writer is disabled

CURA-7913
This commit is contained in:
c.lamboo 2023-08-08 12:17:08 +02:00
parent f8b3fb3d67
commit c393d915d7
2 changed files with 16 additions and 5 deletions

View file

@ -6,7 +6,7 @@ pragma Singleton
import QtQuick 2.10
import QtQuick.Controls 2.4
import UM 1.1 as UM
import Cura 1.0 as Cura
import Cura 1.5 as Cura
Item
{
@ -75,6 +75,11 @@ Item
property alias copy: copyAction
property alias cut: cutAction
readonly property bool copy_paste_enabled: {
const all_enabled_packages = CuraApplication.getPackageManager().allEnabledPackages;
return all_enabled_packages.includes("3MFReader") && all_enabled_packages.includes("3MFWriter");
}
UM.I18nCatalog{id: catalog; name: "cura"}
@ -318,7 +323,7 @@ Item
id: copyAction
text: catalog.i18nc("@action:inmenu menubar:edit", "Copy to clipboard")
onTriggered: CuraActions.copy()
enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection
enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection && copy_paste_enabled
shortcut: StandardKey.Copy
}
@ -327,7 +332,7 @@ Item
id: pasteAction
text: catalog.i18nc("@action:inmenu menubar:edit", "Paste from clipboard")
onTriggered: CuraActions.paste()
enabled: UM.Controller.toolsEnabled
enabled: UM.Controller.toolsEnabled && copy_paste_enabled
shortcut: StandardKey.Paste
}
@ -336,7 +341,7 @@ Item
id: cutAction
text: catalog.i18nc("@action:inmenu menubar:edit", "Cut")
onTriggered: CuraActions.cut()
enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection
enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection && copy_paste_enabled
shortcut: StandardKey.Cut
}