mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Let user accept/decline a plugin license if present
CURA-4222 If a downloaded plugin contains a license file, a dialog which contains the license information will pop up. The user has to accept the license before he/she can install the plugin. If a plugin doesn't have a license file, after it is downloaded, it will be installed directly just like before.
This commit is contained in:
parent
ac6f50e686
commit
679c7dcfda
2 changed files with 164 additions and 17 deletions
|
@ -58,7 +58,7 @@ UM.Dialog
|
|||
id: bottomBar
|
||||
width: parent.width
|
||||
height: closeButton.height
|
||||
anchors.bottom:parent.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
ProgressBar
|
||||
{
|
||||
|
@ -177,6 +177,84 @@ UM.Dialog
|
|||
|
||||
}
|
||||
}
|
||||
UM.I18nCatalog { id: catalog; name:"cura" }
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
|
||||
Connections
|
||||
{
|
||||
target: manager
|
||||
onShowLicenseDialog:
|
||||
{
|
||||
licenseDialog.pluginName = manager.getLicenseDialogPluginName();
|
||||
licenseDialog.licenseContent = manager.getLicenseDialogLicenseContent();
|
||||
licenseDialog.pluginFileLocation = manager.getLicenseDialogPluginFileLocation();
|
||||
licenseDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
UM.Dialog
|
||||
{
|
||||
id: licenseDialog
|
||||
title: catalog.i18nc("@title:window", "Plugin License Agreement")
|
||||
|
||||
minimumWidth: UM.Theme.getSize("modal_window_minimum").width
|
||||
minimumHeight: UM.Theme.getSize("modal_window_minimum").height
|
||||
width: minimumWidth
|
||||
height: minimumHeight
|
||||
|
||||
property var pluginName;
|
||||
property var licenseContent;
|
||||
property var pluginFileLocation;
|
||||
|
||||
Item
|
||||
{
|
||||
anchors.fill: parent
|
||||
|
||||
Label
|
||||
{
|
||||
id: licenseTitle
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: licenseDialog.pluginName + catalog.i18nc("@label", " plugin contains a license.\nYou need to accept this license to install this plugin.\nDo you agree with the terms below?")
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
TextArea
|
||||
{
|
||||
id: licenseText
|
||||
anchors.top: licenseTitle.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
readOnly: true
|
||||
text: licenseDialog.licenseContent
|
||||
}
|
||||
}
|
||||
|
||||
rightButtons: [
|
||||
Button
|
||||
{
|
||||
id: acceptButton
|
||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||
text: catalog.i18nc("@action:button", "Accept")
|
||||
onClicked:
|
||||
{
|
||||
licenseDialog.close();
|
||||
manager.installPlugin(licenseDialog.pluginFileLocation);
|
||||
}
|
||||
},
|
||||
Button
|
||||
{
|
||||
id: declineButton
|
||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||
text: catalog.i18nc("@action:button", "Decline")
|
||||
onClicked:
|
||||
{
|
||||
licenseDialog.close();
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue