diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-11 22:50:40 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-11 23:01:39 +0100 |
commit | 1facae9ba5deb5af12093d70674b1661b1685c3d (patch) | |
tree | 19d58cdbd5afb6c3ba7a31596fb42759c136f669 /applications | |
parent | 57fe704546267048fe3d4dcc441a9b76c0f4e55a (diff) | |
download | kube-1facae9ba5deb5af12093d70674b1661b1685c3d.tar.gz kube-1facae9ba5deb5af12093d70674b1661b1685c3d.zip |
Restart kube after a storage upgrade.
We currently don't deal with disappearing databases, and the db's are
loaded on process initialization. Thus we have to restart Kube for now
when something was upgraded.
Diffstat (limited to 'applications')
-rw-r--r-- | applications/kube/main.cpp | 17 |
1 files changed, 11 insertions, 6 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 | ||