on xenial help sign in
mark the wizard to skip until the last page temporarily
2500732Lukáš Tinkl
plugins/Wizard/PageList.cpp+16
@@ -34,6 +34,7 @@
34#include <QDir>
34#include <QDir>
35#include <QSet>
35#include <QSet>
36#include <QStandardPaths>
36#include <QStandardPaths>
37+#include <QSettings>
37
38
38PageList::PageList(QObject *parent)
39PageList::PageList(QObject *parent)
39 : QObject(parent),
40 : QObject(parent),
@@ -66,6 +67,21 @@ PageList::PageList(QObject *parent)
66 Q_FOREACH(const QString &page, disabledPages) {
67 Q_FOREACH(const QString &page, disabledPages) {
67 m_pages.remove(page);
68 m_pages.remove(page);
68 }
69 }
70+
71+ // If there was a system update installed, skip until the last page to just greet the user
72+ QSettings settings;
73+
74+ if (settings.value(QStringLiteral("Wizard/SkipUntilFinishedPage")).toBool()) {
75+ const QString lastPage = m_pages.lastKey();
76+ Q_FOREACH(const QString &page, m_pages.keys()) {
77+ if (Q_UNLIKELY(page != lastPage)) {
78+ m_pages.remove(page);
79+ }
80+ }
81+
82+ // ... and reset it again for the next run
83+ settings.remove(QStringLiteral("Wizard/SkipUntilFinishedPage"));
84+ }
69}
85}
70
86
71QStringList PageList::entries() const
87QStringList PageList::entries() const
plugins/Wizard/System.cpp+8
@@ -26,6 +26,7 @@
26#include <QMap>
26#include <QMap>
27#include <QProcess>
27#include <QProcess>
28#include <QDebug>
28#include <QDebug>
29+#include <QSettings>
29
30
30System::System()
31System::System()
31 : QObject()
32 : QObject()
@@ -109,3 +110,10 @@ void System::updateSessionLocale(const QString &locale)
109 initctl restart --no-wait indicator-messages; \
110 initctl restart --no-wait indicator-messages; \
110 initctl restart --no-wait unity8-dash\""));
111 initctl restart --no-wait unity8-dash\""));
111}
112}
113+
114+void System::skipUntilFinishedPage()
115+{
116+ QSettings settings;
117+ settings.setValue(QStringLiteral("Wizard/SkipUntilFinishedPage"), true);
118+ settings.sync();
119+}
plugins/Wizard/System.h+4
@@ -35,6 +35,10 @@ public:
35
35
36public Q_SLOTS:
36public Q_SLOTS:
37 void updateSessionLocale(const QString &locale);
37 void updateSessionLocale(const QString &locale);
38+ /**
39+ * Mark the wizard to skip all the pages and just show the last (welcome to ubuntu) page
40+ */
41+ void skipUntilFinishedPage();
38
42
39Q_SIGNALS:
43Q_SIGNALS:
40 void wizardEnabledChanged();
44 void wizardEnabledChanged();
qml/Wizard/Pages/77-system-update.qml+3−1
@@ -18,6 +18,7 @@ import QtQuick 2.4
18import QtQuick.Layouts 1.1
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20import Ubuntu.SystemImage 0.1
20import Ubuntu.SystemImage 0.1
21+import Wizard 0.1
21import ".." as LocalComponents
22import ".." as LocalComponents
22
23
23LocalComponents.Page {
24LocalComponents.Page {
@@ -122,7 +123,8 @@ LocalComponents.Page {
122 objectName: "installButton"
123 objectName: "installButton"
123 anchors.fill: parent
124 anchors.fill: parent
124 onClicked: {
125 onClicked: {
126+ System.skipUntilFinishedPage();
125− SystemImage.applyUpdate(); // TODO mark the wizard to skip until the finished page for the next boot
127+ SystemImage.applyUpdate();
126 }
128 }
127 }
129 }
128
130
tests/mocks/Wizard/MockSystem.cpp+8
@@ -15,6 +15,7 @@
15 */
15 */
16
16
17#include <QDebug>
17#include <QDebug>
18+#include <QSettings>
18
19
19#include "MockSystem.h"
20#include "MockSystem.h"
20
21
@@ -39,3 +40,10 @@ void MockSystem::updateSessionLocale(const QString &locale)
39{
40{
40 Q_EMIT updateSessionLocaleCalled(locale);
41 Q_EMIT updateSessionLocaleCalled(locale);
41}
42}
43+
44+void MockSystem::skipUntilFinishedPage()
45+{
46+ QSettings settings;
47+ settings.setValue(QStringLiteral("Wizard/SkipUntilFinishedPage"), true);
48+ settings.sync();
49+}
tests/mocks/Wizard/MockSystem.h+4
@@ -33,6 +33,10 @@ public:
33
33
34public Q_SLOTS:
34public Q_SLOTS:
35 void updateSessionLocale(const QString &locale);
35 void updateSessionLocale(const QString &locale);
36+ /**
37+ * Mark the wizard to skip all the pages and just show the last (welcome to ubuntu) page
38+ */
39+ void skipUntilFinishedPage();
36
40
37Q_SIGNALS:
41Q_SIGNALS:
38 void wizardEnabledChanged();
42 void wizardEnabledChanged();