Newer
Older
// Still support Qt 5.2, so doesn't use QtQuick.Dialogs 1.2
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import "ui" as Ui
width: 400
height: 200
minimumWidth: 400
minimumHeight: 200
maximumWidth: 800
maximumHeight: 400
"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")
ocsUrlHandler.finishedWithSuccess.connect(function(result) {
infoDialog.informativeText = metadata.filename;
ocsUrlHandler.finishedWithError.connect(function(result) {
errorDialog.primaryText = primaryMessages[result.status];
errorDialog.informativeText = metadata.filename;
ocsUrlHandler.downloadProgress.connect(function(id, bytesReceived, bytesTotal) {
progressDialog.primaryText = qsTr("Downloading");
progressDialog.informativeText = metadata.filename;
progressDialog.progress = bytesReceived / bytesTotal;
progressDialog.progressText
= Utility.convertByteToHumanReadable(bytesReceived)
+ " / " + Utility.convertByteToHumanReadable(bytesTotal);
confirmDialog.primaryText = qsTr("Do you want to download?");
confirmDialog.primaryText = qsTr("Do you want to install?");
/*
confirmDialog.detailedText
= qsTr("URL") + ": " + metadata.url + "\n\n"
+ qsTr("File") + ": " + metadata.filename + "\n\n"
+ qsTr("Type") + ": " + configHandler.getAppConfigInstallTypes()[metadata.type].name;
*/
errorDialog.primaryText = primaryMessages["error_validation"];
errorDialog.informativeText = qsTr("Invalid OCS-URL");
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Ui.Dialog {
id: confirmDialog
//icon: StandardIcon.Question
acceptButton.text: qsTr("OK")
acceptButton.onClicked: ocsUrlHandler.process()
rejectButton.text: qsTr("Cancel")
rejectButton.onClicked: Qt.quit()
}
Ui.Dialog {
id: infoDialog
//icon: StandardIcon.Information
acceptButton.text: qsTr("Open")
acceptButton.onClicked: {
ocsUrlHandler.openDestination();
Qt.quit();
}
rejectButton.text: qsTr("Close")
rejectButton.onClicked: Qt.quit()
}
Ui.Dialog {
id: errorDialog
//icon: StandardIcon.Warning
rejectButton.text: qsTr("Close")
rejectButton.onClicked: Qt.quit()
}
Ui.Dialog {
id: progressDialog
rejectButton.text: qsTr("Cancel")
rejectButton.onClicked: Qt.quit()
property alias progress: progressBar.value
property alias progressText: progressText.text
content: ColumnLayout {
spacing: 8
ProgressBar {
id: progressBar
minimumValue: 0
maximumValue: 1
value: 0
Layout.fillWidth: true
}
Label {
id: progressText
text: ""
anchors.right: parent.right
}
}
}
Component.onCompleted: {
app.init();
}