Add some question popups before doing upgrading

This commit is contained in:
Michael Zanetti 2019-05-16 01:40:21 +02:00
parent e0d14b8c92
commit afc0332e74
3 changed files with 29 additions and 3 deletions

View File

@ -304,7 +304,7 @@ void JsonRpcClient::sendRequest(const QVariantMap &request)
{
QVariantMap newRequest = request;
newRequest.insert("token", m_token);
// qDebug() << "Sending request" << qUtf8Printable(QJsonDocument::fromVariant(newRequest).toJson());
qDebug() << "Sending request" << qUtf8Printable(QJsonDocument::fromVariant(newRequest).toJson());
m_connection->sendData(QJsonDocument::fromVariant(newRequest).toJson(QJsonDocument::Compact) + "\n");
}

View File

@ -158,6 +158,7 @@ Page {
Pane {
Layout.fillWidth: true
Material.elevation: layout.isGrid ? 1 : 0
visible: engine.jsonRpcClient.ensureServerVersion("2.1")
padding: 0
MeaListItemDelegate {

View File

@ -52,7 +52,15 @@ Page {
text: qsTr("Update system")
visible: engine.systemController.updateAvailable
onClicked: {
engine.systemController.startUpdate()
var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml"));
var text = settings.showHiddenOptions
? qsTr("Developer options are now enabled. If you have found this by accident, it is most likely not of any use for you. It will just enable some nerdy developer gibberish in the app. Tap the icon another 10 times to disable it again.")
: qsTr("Developer options are now disabled.")
var popup = dialog.createObject(app, {headerIcon: "../images/dialog-warning-symbolic.svg", title: qsTr("Howdy cowboy!"), text: text})
popup.open();
popup.accepted.connect(function() {
engine.systemController.startUpdate()
})
}
}
@ -75,7 +83,23 @@ Page {
model: engine.systemController.availableChannels
currentIndex: model.indexOf(engine.systemController.currentChannel)
onActivated: {
engine.systemController.selectChannel(model[index])
var dialog = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml"));
var text = qsTr("Changing the update channel allows to install unreleased software. This can potentially harm your system and lead to problems. Please only use this if you are sure you want this and consider reporting the issues you find when testing unreleased channels. Thank you.")
var popup = dialog.createObject(app,
{
headerIcon: "../images/dialog-warning-symbolic.svg",
title: qsTr("Switch update channel"),
text: text,
standardButtons: Dialog.Ok | Dialog.Cancel
});
popup.open();
popup.accepted.connect(function() {
engine.systemController.selectChannel(model[index])
})
popup.rejected.connect(function() {
currentIndex = model.indexOf(engine.systemController.currentChannel)
})
}
}
}
@ -84,4 +108,5 @@ Page {
BusyOverlay {
visible: engine.systemController.updateInProgress
}
}