1
0
Fork 0

Confirm aircraft uninstallation

This commit is contained in:
James Turner 2018-07-02 14:40:18 +01:00
parent 85024d0f75
commit f76be60459

View file

@ -21,7 +21,6 @@ Item {
implicitWidth: childrenRect.width implicitWidth: childrenRect.width
implicitHeight: childrenRect.height implicitHeight: childrenRect.height
state: "not-installed" state: "not-installed"
onInstallStatusChanged: { onInstallStatusChanged: {
@ -53,6 +52,7 @@ Item {
visible: true visible: true
} }
PropertyChanges { target: confirmUninstallPanel; visible: false }
}, },
State { State {
@ -68,6 +68,8 @@ Item {
target: sizeText target: sizeText
visible: true visible: true
} }
PropertyChanges { target: confirmUninstallPanel; visible: false }
}, },
State { State {
@ -83,6 +85,8 @@ Item {
target: sizeText target: sizeText
visible: true visible: true
} }
PropertyChanges { target: confirmUninstallPanel; visible: false }
}, },
State { State {
@ -98,6 +102,8 @@ Item {
text: "Queued" text: "Queued"
hoverText: "Cancel" hoverText: "Cancel"
} }
PropertyChanges { target: confirmUninstallPanel; visible: false }
}, },
State { State {
@ -122,6 +128,13 @@ Item {
text: "Downloading" text: "Downloading"
hoverText: "Cancel" hoverText: "Cancel"
} }
PropertyChanges { target: confirmUninstallPanel; visible: false }
},
State {
name: "confirm-uninstall"
PropertyChanges { target: confirmUninstallPanel; visible: true }
} }
] ]
@ -131,7 +144,7 @@ Item {
if ((root.state == "has-update") || (root.state == "not-installed")) { if ((root.state == "has-update") || (root.state == "not-installed")) {
_launcher.requestInstallUpdate(root.uri); _launcher.requestInstallUpdate(root.uri);
} else if (root.state == "installed") { } else if (root.state == "installed") {
_launcher.requestUninstall(root.uri) root.state = "confirm-uninstall"
} else { } else {
_launcher.requestInstallCancel(root.uri) _launcher.requestInstallCancel(root.uri)
} }
@ -188,4 +201,16 @@ Item {
"MB of " + (root.packageSize / 0x100000).toFixed(1) + "MB"; "MB of " + (root.packageSize / 0x100000).toFixed(1) + "MB";
} }
} // item container for progress bar and text } // item container for progress bar and text
YesNoPanel {
id: confirmUninstallPanel
anchors.fill: parent
promptText: qsTr("Are you sure you want to uninstall this aircraft?")
yesIsDestructive: true
yesText: qsTr("Uninstall")
noText: qsTr("Cancel")
onRejected: root.state = "installed"
onAccepted: _launcher.requestUninstall(root.uri)
}
} }