Newer
Older
width: 400
height: 200
minimumWidth: 400
minimumHeight: 200
maximumWidth: 800
maximumHeight: 400
standardButtons: StandardButton.Ok | StandardButton.Cancel
onAccepted: xdgUrlHandler.process()
onRejected: Qt.quit()
}
MessageDialog {
id: infoDialog
standardButtons: StandardButton.Open | StandardButton.Close
onAccepted: {
xdgUrlHandler.openDestination();
Qt.quit();
}
onRejected: Qt.quit()
standardButtons: StandardButton.Close
onRejected: Qt.quit()
property alias primaryLabel: primaryLabel
property alias informativeLabel: informativeLabel
property alias progressBar: progressBar
property alias progressLabel: progressLabel
Column {
anchors.fill: parent
anchors.margins: 12
spacing: 8
Label {
id: primaryLabel
ProgressBar {
id: progressBar
maximumValue: 1
minimumValue: 0
value: 0
anchors.left: parent.left
anchors.right: parent.right
}
anchors.right: parent.right
onClicked: Qt.quit()
}
}
"success_download": qsTr("Download successfull"),
"success_install": qsTr("Installation successfull"),
"error_validation": qsTr("Validation error"),
"error_network": qsTr("Network error"),
"error_save": qsTr("Saving file failed"),
"error_install": qsTr("Installation failed")
};
xdgUrlHandler.started.connect(function() {
progressDialog.open();
});
xdgUrlHandler.finishedWithSuccess.connect(function(result) {
progressDialog.close();
infoDialog.text = primaryMessages[result.status];
infoDialog.informativeText = metadata.filename;
infoDialog.detailedText = result.message;
infoDialog.open();
});
progressDialog.close();
errorDialog.text = primaryMessages[result.status];
errorDialog.informativeText = metadata.filename;
errorDialog.detailedText = result.message;
errorDialog.open();
xdgUrlHandler.downloadProgress.connect(function(id, bytesReceived, bytesTotal) {
progressDialog.primaryLabel.text = qsTr("Downloading");
progressDialog.informativeLabel.text = metadata.filename;
progressDialog.progressBar.value = bytesReceived / bytesTotal;
progressDialog.progressLabel.text = Utility.convertByteToHumanReadable(bytesReceived)
if (metadata.command === "download") {
confirmDialog.text = qsTr("Do you want to download?");
}
else if (metadata.command === "install") {
confirmDialog.text = qsTr("Do you want to install?");
}
confirmDialog.detailedText = qsTr("URL") + ": " + metadata.url + "\n\n"
+ qsTr("File") + ": " + metadata.filename + "\n\n"
+ qsTr("Type") + ": " + metadata.type;
errorDialog.text = qsTr("Validation error");
errorDialog.detailedText = qsTr("Invalid XDG-URL") + " " + xdgUrlHandler.xdgUrl();