summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--applications/kube/main.cpp17
-rw-r--r--components/kube/qml/upgrade.qml11
2 files changed, 20 insertions, 8 deletions
diff --git a/applications/kube/main.cpp b/applications/kube/main.cpp
index 2feb8dc9..6cb1f769 100644
--- a/applications/kube/main.cpp
+++ b/applications/kube/main.cpp
@@ -39,6 +39,7 @@
39#include <QFont> 39#include <QFont>
40#include <QDebug> 40#include <QDebug>
41#include <QTimer> 41#include <QTimer>
42#include <QQmlContext>
42#include <sink/store.h> 43#include <sink/store.h>
43 44
44#include "framework/src/keyring.h" 45#include "framework/src/keyring.h"
@@ -184,16 +185,20 @@ int main(int argc, char *argv[])
184 } 185 }
185 186
186 { 187 {
188 QQmlContext *rootContext = nullptr;
187 bool upgradeComplete = false; 189 bool upgradeComplete = false;
188 Sink::Store::upgrade().then([&] { 190 Sink::Store::upgrade().then([&] (Sink::Store::UpgradeResult upgradeExecuted) {
189 upgradeComplete = true; 191 upgradeComplete = !upgradeExecuted.upgradeExecuted;
190 app.quit(); 192 if (rootContext) {
193 rootContext->setContextProperty("upgradeComplete", true);
194 }
191 }).exec(); 195 }).exec();
192 if (!upgradeComplete) { 196 if (!upgradeComplete) {
193 QQmlApplicationEngine engine; 197 QQmlApplicationEngine engine;
194 const auto file = findFile("/org/kube/components/kube/upgrade.qml", engine.importPathList()); 198 engine.rootContext()->setContextProperty("upgradeComplete", false);
195 engine.load(QUrl::fromLocalFile(file)); 199 rootContext = engine.rootContext();
196 app.exec(); 200 engine.load(QUrl::fromLocalFile(findFile("/org/kube/components/kube/upgrade.qml", engine.importPathList())));
201 return app.exec();
197 } 202 }
198 } 203 }
199 204
diff --git a/components/kube/qml/upgrade.qml b/components/kube/qml/upgrade.qml
index 8548b54d..3ce1c63b 100644
--- a/components/kube/qml/upgrade.qml
+++ b/components/kube/qml/upgrade.qml
@@ -37,11 +37,18 @@ Controls2.ApplicationWindow {
37 } 37 }
38 spacing: 0 38 spacing: 0
39 Kube.Heading { 39 Kube.Heading {
40 text: qsTr("Please wait while Kube is upgrading...") 40 text: !upgradeComplete ? qsTr("Please wait while Kube is upgrading...") : qsTr("Kube has upgraded the storage layer.")
41 color: Kube.Colors.highlightColor 41 color: Kube.Colors.highlightColor
42 } 42 }
43 Kube.Label { 43 Kube.Label {
44 text: qsTr("This might take a while.") 44 text: !upgradeComplete ? qsTr("This might take a while.") : qsTr("Please exit and restart Kube.")
45 }
46 Kube.Button {
47 anchors.topMargin: Kube.Units.largeSpacing
48 text: qsTr("Exit")
49 onClicked: {
50 app.close()
51 }
45 } 52 }
46 } 53 }
47} 54}