From 1facae9ba5deb5af12093d70674b1661b1685c3d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 11 Feb 2018 22:50:40 +0100 Subject: 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. --- applications/kube/main.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'applications') 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 @@ #include #include #include +#include #include #include "framework/src/keyring.h" @@ -184,16 +185,20 @@ int main(int argc, char *argv[]) } { + QQmlContext *rootContext = nullptr; bool upgradeComplete = false; - Sink::Store::upgrade().then([&] { - upgradeComplete = true; - app.quit(); + Sink::Store::upgrade().then([&] (Sink::Store::UpgradeResult upgradeExecuted) { + upgradeComplete = !upgradeExecuted.upgradeExecuted; + if (rootContext) { + rootContext->setContextProperty("upgradeComplete", true); + } }).exec(); if (!upgradeComplete) { QQmlApplicationEngine engine; - const auto file = findFile("/org/kube/components/kube/upgrade.qml", engine.importPathList()); - engine.load(QUrl::fromLocalFile(file)); - app.exec(); + engine.rootContext()->setContextProperty("upgradeComplete", false); + rootContext = engine.rootContext(); + engine.load(QUrl::fromLocalFile(findFile("/org/kube/components/kube/upgrade.qml", engine.importPathList()))); + return app.exec(); } } -- cgit v1.2.3