on xenial help sign in
First pass at making wizard a plugin
6f03af2Michael Terry
CMakeLists.txt+5−1
@@ -60,6 +60,11 @@ include(GNUInstallDirs)
60set(SHELL_APP_DIR ${CMAKE_INSTALL_DATADIR}/unity8)
60set(SHELL_APP_DIR ${CMAKE_INSTALL_DATADIR}/unity8)
61set(SHELL_PRIVATE_LIBDIR ${CMAKE_INSTALL_LIBDIR}/unity8)
61set(SHELL_PRIVATE_LIBDIR ${CMAKE_INSTALL_LIBDIR}/unity8)
62
62
63+execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=plugin_private_module_dir SystemSettings OUTPUT_VARIABLE USS_PRIVATE_PLUGINDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
64+if(USS_PRIVATE_PLUGINDIR STREQUAL "")
65+ message(FATAL_ERROR "Could not determine USS private plugin installation dir.")
66+endif()
67+
63execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=plugindir_suffix unity-shell-api OUTPUT_VARIABLE SHELL_INSTALL_QML OUTPUT_STRIP_TRAILING_WHITESPACE)
68execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=plugindir_suffix unity-shell-api OUTPUT_VARIABLE SHELL_INSTALL_QML OUTPUT_STRIP_TRAILING_WHITESPACE)
64if(SHELL_INSTALL_QML STREQUAL "")
69if(SHELL_INSTALL_QML STREQUAL "")
65 message(FATAL_ERROR "Could not determine plugin installation dir.")
70 message(FATAL_ERROR "Could not determine plugin installation dir.")
@@ -116,7 +121,6 @@ add_subdirectory(tools)
116add_subdirectory(qml)
121add_subdirectory(qml)
117add_subdirectory(tests)
122add_subdirectory(tests)
118add_subdirectory(plugins)
123add_subdirectory(plugins)
119−add_subdirectory(wizard)
120
124
121#
125#
122# Data files
126# Data files
build.sh+1
@@ -54,6 +54,7 @@ install_dependencies() {
54 qtdeclarative5-unity-notifications-plugin \
54 qtdeclarative5-unity-notifications-plugin \
55 qml-module-ubuntu-connectivity \
55 qml-module-ubuntu-connectivity \
56 ubuntu-mobile-icons \
56 ubuntu-mobile-icons \
57+ ubuntu-system-settings \
57 unity-plugin-scopes \
58 unity-plugin-scopes \
58 xvfb \
59 xvfb \
59 || exit 5
60 || exit 5
debian/control+1−1
@@ -23,7 +23,6 @@ Build-Depends: cmake,
23 libpulse-dev,
23 libpulse-dev,
24 libqmenumodel-dev (>= 0.2.8),
24 libqmenumodel-dev (>= 0.2.8),
25 libqt5xmlpatterns5-dev,
25 libqt5xmlpatterns5-dev,
26− libsystemsettings-dev,
27 libunity-api-dev (>= 7.93),
26 libunity-api-dev (>= 7.93),
28 libusermetricsoutput1-dev,
27 libusermetricsoutput1-dev,
29 libxcb1-dev,
28 libxcb1-dev,
@@ -47,6 +46,7 @@ Build-Depends: cmake,
47 qtdeclarative5-ubuntu-settings-components (>= 0.4),
46 qtdeclarative5-ubuntu-settings-components (>= 0.4),
48 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.49) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.49),
47 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.49) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.49),
49 ttf-ubuntu-font-family,
48 ttf-ubuntu-font-family,
49+ ubuntu-system-settings,
50Standards-Version: 3.9.4
50Standards-Version: 3.9.4
51Homepage: http://launchpad.net/unity
51Homepage: http://launchpad.net/unity
52# If you aren't a member of ~unity-team but need to upload
52# If you aren't a member of ~unity-team but need to upload
include/paths.h.in+2
@@ -71,9 +71,11 @@ inline QStringList fallbackImportPaths() {
71 QStringList paths;
71 QStringList paths;
72 if (isRunningInstalled()) {
72 if (isRunningInstalled()) {
73 paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@");
73 paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@");
74+ paths << QString("@USS_PRIVATE_PLUGINDIR@");
74 paths << QString("@SHELL_PLUGINDIR@");
75 paths << QString("@SHELL_PLUGINDIR@");
75 paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
76 paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
76 } else {
77 } else {
78+ paths << QString("@USS_PRIVATE_PLUGINDIR@");
77 paths << QString("@SHELL_PLUGINDIR@");
79 paths << QString("@SHELL_PLUGINDIR@");
78 paths << QString("@CMAKE_BINARY_DIR@/tests/mocks");
80 paths << QString("@CMAKE_BINARY_DIR@/tests/mocks");
79 }
81 }
plugins/AccountsService/AccountsService.cpp+45−1
@@ -30,7 +30,9 @@ AccountsService::AccountsService(QObject* parent)
30 m_enableIndicatorsWhileLocked(false),
30 m_enableIndicatorsWhileLocked(false),
31 m_statsWelcomeScreen(false),
31 m_statsWelcomeScreen(false),
32 m_passwordDisplayHint(Keyboard),
32 m_passwordDisplayHint(Keyboard),
33− m_failedLogins(0)
33+ m_failedLogins(0),
34+ m_hereEnabled(false),
35+ m_hereLicensePath(" ") // blank space means not set yet
34{
36{
35 connect(m_service, SIGNAL(propertiesChanged(const QString &, const QString &, const QStringList &)),
37 connect(m_service, SIGNAL(propertiesChanged(const QString &, const QString &, const QStringList &)),
36 this, SLOT(propertiesChanged(const QString &, const QString &, const QStringList &)));
38 this, SLOT(propertiesChanged(const QString &, const QString &, const QStringList &)));
@@ -55,6 +57,8 @@ void AccountsService::setUser(const QString &user)
55 updateStatsWelcomeScreen();
57 updateStatsWelcomeScreen();
56 updatePasswordDisplayHint();
58 updatePasswordDisplayHint();
57 updateFailedLogins();
59 updateFailedLogins();
60+ updateHereEnabled();
61+ updateHereLicensePath();
58}
62}
59
63
60bool AccountsService::demoEdges() const
64bool AccountsService::demoEdges() const
@@ -93,6 +97,21 @@ AccountsService::PasswordDisplayHint AccountsService::passwordDisplayHint() cons
93 return m_passwordDisplayHint;
97 return m_passwordDisplayHint;
94}
98}
95
99
100+bool AccountsService::hereEnabled() const
101+{
102+ return m_hereEnabled;
103+}
104+
105+void AccountsService::setHereEnabled(bool enabled)
106+{
107+ m_service->setUserProperty(m_user, "com.ubuntu.location.providers.here.AccountsService", "LicenseAccepted", enabled);
108+}
109+
110+QString AccountsService::hereLicensePath() const
111+{
112+ return m_hereLicensePath;
113+}
114+
96void AccountsService::updateDemoEdges()
115void AccountsService::updateDemoEdges()
97{
116{
98 auto demoEdges = m_service->getUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges").toBool();
117 auto demoEdges = m_service->getUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges").toBool();
@@ -156,6 +175,24 @@ void AccountsService::updateFailedLogins()
156 }
175 }
157}
176}
158
177
178+void AccountsService::updateHereEnabled()
179+{
180+ bool hereEnabled = m_service->getUserProperty(m_user, "com.ubuntu.location.providers.here.AccountsService", "LicenseAccepted").toBool();
181+ if (m_hereEnabled != hereEnabled) {
182+ m_hereEnabled = hereEnabled;
183+ Q_EMIT hereEnabledChanged();
184+ }
185+}
186+
187+void AccountsService::updateHereLicensePath()
188+{
189+ QString hereLicensePath = m_service->getUserProperty(m_user, "com.ubuntu.location.providers.here.AccountsService", "LicenseBasePath").toString();
190+ if (m_hereLicensePath != hereLicensePath) {
191+ m_hereLicensePath = hereLicensePath;
192+ Q_EMIT hereLicensePathChanged();
193+ }
194+}
195+
159uint AccountsService::failedLogins() const
196uint AccountsService::failedLogins() const
160{
197{
161 return m_failedLogins;
198 return m_failedLogins;
@@ -195,6 +232,13 @@ void AccountsService::propertiesChanged(const QString &user, const QString &inte
195 if (changed.contains("EnableIndicatorsWhileLocked")) {
232 if (changed.contains("EnableIndicatorsWhileLocked")) {
196 updateEnableIndicatorsWhileLocked();
233 updateEnableIndicatorsWhileLocked();
197 }
234 }
235+ } else if (interface == "com.ubuntu.location.providers.here.AccountsService") {
236+ if (changed.contains("LicenseAccepted")) {
237+ updateHereEnabled();
238+ }
239+ if (changed.contains("LicenseBasePath")) {
240+ updateHereLicensePath();
241+ }
198 }
242 }
199}
243}
200
244
plugins/AccountsService/AccountsService.h+16
@@ -55,6 +55,13 @@ class AccountsService: public QObject
55 READ failedLogins
55 READ failedLogins
56 WRITE setFailedLogins
56 WRITE setFailedLogins
57 NOTIFY failedLoginsChanged)
57 NOTIFY failedLoginsChanged)
58+ Q_PROPERTY(bool hereEnabled
59+ READ hereEnabled
60+ WRITE setHereEnabled
61+ NOTIFY hereEnabledChanged)
62+ Q_PROPERTY(QString hereLicensePath
63+ READ hereLicensePath
64+ NOTIFY hereLicensePathChanged)
58
65
59public:
66public:
60 enum PasswordDisplayHint {
67 enum PasswordDisplayHint {
@@ -75,6 +82,9 @@ public:
75 PasswordDisplayHint passwordDisplayHint() const;
82 PasswordDisplayHint passwordDisplayHint() const;
76 uint failedLogins() const;
83 uint failedLogins() const;
77 void setFailedLogins(uint failedLogins);
84 void setFailedLogins(uint failedLogins);
85+ bool hereEnabled() const;
86+ void setHereEnabled(bool enabled);
87+ QString hereLicensePath() const;
78
88
79Q_SIGNALS:
89Q_SIGNALS:
80 void userChanged();
90 void userChanged();
@@ -85,6 +95,8 @@ Q_SIGNALS:
85 void statsWelcomeScreenChanged();
95 void statsWelcomeScreenChanged();
86 void passwordDisplayHintChanged();
96 void passwordDisplayHintChanged();
87 void failedLoginsChanged();
97 void failedLoginsChanged();
98+ void hereEnabledChanged();
99+ void hereLicensePathChanged();
88
100
89private Q_SLOTS:
101private Q_SLOTS:
90 void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed);
102 void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed);
@@ -98,6 +110,8 @@ private:
98 void updateStatsWelcomeScreen();
110 void updateStatsWelcomeScreen();
99 void updatePasswordDisplayHint();
111 void updatePasswordDisplayHint();
100 void updateFailedLogins();
112 void updateFailedLogins();
113+ void updateHereEnabled();
114+ void updateHereLicensePath();
101
115
102 AccountsServiceDBusAdaptor *m_service;
116 AccountsServiceDBusAdaptor *m_service;
103 QString m_user;
117 QString m_user;
@@ -108,6 +122,8 @@ private:
108 bool m_statsWelcomeScreen;
122 bool m_statsWelcomeScreen;
109 PasswordDisplayHint m_passwordDisplayHint;
123 PasswordDisplayHint m_passwordDisplayHint;
110 uint m_failedLogins;
124 uint m_failedLogins;
125+ bool m_hereEnabled;
126+ QString m_hereLicensePath;
111};
127};
112
128
113#endif
129#endif
plugins/CMakeLists.txt+1
@@ -21,3 +21,4 @@ add_subdirectory(ScreenGrabber)
21add_subdirectory(Ubuntu)
21add_subdirectory(Ubuntu)
22add_subdirectory(Unity)
22add_subdirectory(Unity)
23add_subdirectory(Utils)
23add_subdirectory(Utils)
24+add_subdirectory(Wizard)
wizard/50-com.ubuntu.system-settings.wizard.pkla → plugins/Wizard/50-com.canonical.unity.wizard.pklarenamed

The content is the same.

plugins/Wizard/CMakeLists.txtnew file+11
@@ -0,0 +1,11 @@
1+add_library(Wizard-qml MODULE
2+ plugin.cpp
3+ PageList.cpp
4+ System.cpp
5+)
6+
7+qt5_use_modules(Wizard-qml DBus Qml)
8+add_unity8_plugin(Wizard 0.1 Wizard TARGETS Wizard-qml)
9+
10+set(POLKIT_LIB_DIR "${CMAKE_INSTALL_LOCALSTATEDIR}/lib/polkit-1")
11+install(FILES 50-com.canonical.unity.wizard.pkla DESTINATION ${POLKIT_LIB_DIR}/localauthority/10-vendor.d)
wizard/PageList.cpp → plugins/Wizard/PageList.cpprenamed+10−9
@@ -1,6 +1,4 @@
1/*
1/*
2− * This file is part of system-settings
3− *
4 * Copyright (C) 2014 Canonical Ltd.
2 * Copyright (C) 2014 Canonical Ltd.
5 *
3 *
6 * This program is free software: you can redistribute it and/or modify it
4 * This program is free software: you can redistribute it and/or modify it
@@ -19,7 +17,7 @@
19/**
17/**
20 * This class lets the list of wizard pages be dynamic.
18 * This class lets the list of wizard pages be dynamic.
21 * - To add new ones, drop them into
19 * - To add new ones, drop them into
22− * $XDG_DATA_DIRS/ubuntu/settings/wizard/qml/Pages with a numbered prefix,
20+ * $XDG_DATA_DIRS/Wizard/Pages with a numbered prefix,
23 * like "21-custom-page.qml". The number determines the order in the page
21 * like "21-custom-page.qml". The number determines the order in the page
24 * sequence that your page will appear.
22 * sequence that your page will appear.
25 * - To disable an existing page, add a file like "21-custom-page.qml.disabled"
23 * - To disable an existing page, add a file like "21-custom-page.qml.disabled"
@@ -32,10 +30,11 @@
32 */
30 */
33
31
34#include "PageList.h"
32#include "PageList.h"
33+#include <paths.h>
35#include <QDir>
34#include <QDir>
35+#include <QSet>
36#include <QStandardPaths>
36#include <QStandardPaths>
37
37
38−#include <QDebug>
39PageList::PageList(QObject *parent)
38PageList::PageList(QObject *parent)
40 : QObject(parent),
39 : QObject(parent),
41 m_index(-1),
40 m_index(-1),
@@ -44,14 +43,16 @@ PageList::PageList(QObject *parent)
44 QString qmlSuffix = ".qml";
43 QString qmlSuffix = ".qml";
45 QString disabledSuffix = ".disabled";
44 QString disabledSuffix = ".disabled";
46 QSet<QString> disabledPages;
45 QSet<QString> disabledPages;
47− QStringList dataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
46+ QStringList dataDirs;
48
47
49− QString rootDir = qgetenv("UBUNTU_SYSTEM_SETTINGS_WIZARD_ROOT"); // for testing
48+ if (isRunningInstalled()) {
50− if (!rootDir.isEmpty())
49+ dataDirs = shellDataDirs();
50+ } else {
51− dataDirs = QStringList() << rootDir;
51+ dataDirs = QStringList() << qmlDirectory();
52+ }
52
53
53 Q_FOREACH(const QString &dataDir, dataDirs) {
54 Q_FOREACH(const QString &dataDir, dataDirs) {
54− QDir dir(dataDir + "/ubuntu/settings/wizard/qml/Pages");
55+ QDir dir(dataDir + "/Wizard/Pages");
55 QStringList entries = dir.entryList(QStringList("[0-9]*"), QDir::Files | QDir::Readable);
56 QStringList entries = dir.entryList(QStringList("[0-9]*"), QDir::Files | QDir::Readable);
56 Q_FOREACH(const QString &entry, entries) {
57 Q_FOREACH(const QString &entry, entries) {
57 if (!m_pages.contains(entry) && entry.endsWith(qmlSuffix))
58 if (!m_pages.contains(entry) && entry.endsWith(qmlSuffix))
wizard/PageList.h → plugins/Wizard/PageList.hrenamed+3−5
@@ -1,6 +1,4 @@
1/*
1/*
2− * This file is part of system-settings
3− *
4 * Copyright (C) 2014 Canonical Ltd.
2 * Copyright (C) 2014 Canonical Ltd.
5 *
3 *
6 * This program is free software: you can redistribute it and/or modify it
4 * This program is free software: you can redistribute it and/or modify it
@@ -16,8 +14,8 @@
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
15 */
18
16
19−#ifndef PAGELIST_H
17+#ifndef WIZARD_PAGELIST_H
20−#define PAGEList_H
18+#define WIZARD_PAGELIST_H
21
19
22#include <QMap>
20#include <QMap>
23#include <QObject>
21#include <QObject>
@@ -52,4 +50,4 @@ private:
52 QMap<QString, QString> m_pages;
50 QMap<QString, QString> m_pages;
53};
51};
54
52
55−#endif // PAGELIST_H
53+#endif // WIZARD_PAGELIST_H
plugins/Wizard/System.cppnew file+87
@@ -0,0 +1,87 @@
1+/*
2+ * Copyright (C) 2014 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License along
14+ * with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "System.h"
18+
19+#include <QDBusInterface>
20+#include <QDBusMetaType>
21+#include <QDir>
22+#include <QFile>
23+#include <QMap>
24+#include <QProcess>
25+
26+System::System()
27+ : QObject(),
28+ m_fsWatcher()
29+{
30+ // Register the argument needed for UpdateActivationEnvironment below
31+ qDBusRegisterMetaType<QMap<QString,QString>>();
32+
33+ m_fsWatcher.addPath(wizardEnabledPath());
34+ connect(&m_fsWatcher, SIGNAL(fileChanged(const QString &)),
35+ this, SIGNAL(wizardEnabledChanged()));
36+}
37+
38+QString System::wizardEnabledPath()
39+{
40+ // Uses ubuntu-system-settings namespace for historic compatibility reasons
41+ return QDir::home().filePath(".config/ubuntu-system-settings/wizard-has-run");
42+}
43+
44+bool System::wizardEnabled() const
45+{
46+ return !QFile::exists(wizardEnabledPath());
47+}
48+
49+void System::setWizardEnabled(bool enabled)
50+{
51+ if (enabled) {
52+ QFile::remove(wizardEnabledPath());
53+ } else {
54+ QDir(wizardEnabledPath()).mkpath("..");
55+ QFile(wizardEnabledPath()).open(QIODevice::WriteOnly);
56+ }
57+}
58+
59+void System::setSessionVariable(const QString &variable, const QString &value)
60+{
61+ // We need to update both upstart's and DBus's environment
62+ QProcess::execute(QString("initctl set-env --global %1=%2").arg(variable, value));
63+
64+ QDBusInterface iface("org.freedesktop.DBus",
65+ "/org/freedesktop/DBus",
66+ "org.freedesktop.DBus",
67+ QDBusConnection::sessionBus());
68+
69+ QMap<QString,QString> valueMap;
70+ valueMap.insert(variable, value);
71+ iface.call("UpdateActivationEnvironment", QVariant::fromValue(valueMap));
72+}
73+
74+void System::updateSessionLanguage(const QString &locale)
75+{
76+ QString language = locale.split(".")[0];
77+
78+ setSessionVariable("LANGUAGE", language);
79+ setSessionVariable("LANG", locale);
80+ setSessionVariable("LC_ALL", locale);
81+
82+ // Indicators and OSK need to pick up new language
83+ QProcess::startDetached("sh -c \"initctl emit indicator-services-end; \
84+ stop maliit-server; \
85+ initctl emit --no-wait indicator-services-start; \
86+ initctl start --no-wait maliit-server\"");
87+}
plugins/Wizard/System.hnew file+50
@@ -0,0 +1,50 @@
1+/*
2+ * Copyright (C) 2014 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License along
14+ * with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#ifndef WIZARD_SYSTEM_H
18+#define WIZARD_SYSTEM_H
19+
20+#include <QFileSystemWatcher>
21+#include <QObject>
22+#include <QString>
23+
24+class System : public QObject
25+{
26+ Q_OBJECT
27+ Q_PROPERTY(bool wizardEnabled READ wizardEnabled WRITE setWizardEnabled NOTIFY wizardEnabledChanged)
28+
29+public:
30+ System();
31+
32+ bool wizardEnabled() const;
33+ void setWizardEnabled(bool enabled);
34+
35+public Q_SLOTS:
36+ void updateSessionLanguage(const QString &locale);
37+
38+Q_SIGNALS:
39+ void wizardEnabledChanged();
40+
41+private:
42+ Q_DISABLE_COPY(System)
43+
44+ static QString wizardEnabledPath();
45+ static void setSessionVariable(const QString &variable, const QString &value);
46+
47+ QFileSystemWatcher m_fsWatcher;
48+};
49+
50+#endif
wizard/Unity/Application/CMakeLists.txt → plugins/Wizard/Unity/Application/CMakeLists.txtrenamed

The content is the same.

wizard/Unity/Application/OSKController.qml → plugins/Wizard/Unity/Application/OSKController.qmlrenamed

The content is the same.

wizard/Unity/Application/qmldir → plugins/Wizard/Unity/Application/qmldirrenamed

The content is the same.

wizard/Unity/CMakeLists.txt → plugins/Wizard/Unity/CMakeLists.txtrenamed

The content is the same.

wizard/Utils/CMakeLists.txt → plugins/Wizard/Utils/CMakeLists.txtrenamed

The content is the same.

wizard/Utils/plugin.cpp → plugins/Wizard/Utils/plugin.cpprenamed

The content is the same.

wizard/Utils/plugin.h → plugins/Wizard/Utils/plugin.hrenamed

The content is the same.

wizard/Utils/qmldir → plugins/Wizard/Utils/qmldirrenamed

The content is the same.

wizard/Utils/qsortfilterproxymodelqml.cpp → plugins/Wizard/Utils/qsortfilterproxymodelqml.cpprenamed

The content is the same.

wizard/Utils/qsortfilterproxymodelqml.h → plugins/Wizard/Utils/qsortfilterproxymodelqml.hrenamed

The content is the same.

plugins/Wizard/Wizard.qmltypesnew file+36
@@ -0,0 +1,36 @@
1+import QtQuick.tooling 1.1
2+
3+// This file describes the plugin-supplied types contained in the library.
4+// It is used for QML tooling purposes only.
5+//
6+// This file was auto-generated by:
7+// 'qmlplugindump -notrelocatable Wizard 0.1 plugins'
8+
9+Module {
10+ Component {
11+ name: "PageList"
12+ prototype: "QObject"
13+ exports: ["Wizard/PageList 0.1"]
14+ isCreatable: false
15+ isSingleton: true
16+ exportMetaObjectRevisions: [0]
17+ Property { name: "index"; type: "int"; isReadonly: true }
18+ Property { name: "numPages"; type: "int"; isReadonly: true }
19+ Method { name: "prev"; type: "string" }
20+ Method { name: "next"; type: "string" }
21+ }
22+ Component {
23+ name: "System"
24+ prototype: "QObject"
25+ exports: ["Wizard/System 0.1"]
26+ isCreatable: false
27+ isSingleton: true
28+ exportMetaObjectRevisions: [0]
29+ Property { name: "wizardEnabled"; type: "bool" }
30+ Method {
31+ name: "updateSessionLanguage"
32+ Parameter { name: "locale"; type: "string" }
33+ }
34+ }
35+}
36+
wizard/main.cpp → plugins/Wizard/main.cpprenamed

The content is the same.

plugins/Wizard/plugin.cppnew file+42
@@ -0,0 +1,42 @@
1+/*
2+ * Copyright (C) 2014 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License along
14+ * with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "plugin.h"
18+#include "PageList.h"
19+#include "System.h"
20+
21+#include <QtQml/qqml.h>
22+
23+static QObject *pagelist_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
24+{
25+ Q_UNUSED(engine)
26+ Q_UNUSED(scriptEngine)
27+ return new PageList();
28+}
29+
30+static QObject *system_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
31+{
32+ Q_UNUSED(engine)
33+ Q_UNUSED(scriptEngine)
34+ return new System();
35+}
36+
37+void WizardPlugin::registerTypes(const char *uri)
38+{
39+ Q_ASSERT(uri == QLatin1String("Wizard"));
40+ qmlRegisterSingletonType<PageList>(uri, 0, 1, "PageList", pagelist_provider);
41+ qmlRegisterSingletonType<System>(uri, 0, 1, "System", system_provider);
42+}
plugins/Wizard/plugin.hnew file+34
@@ -0,0 +1,34 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
17+ */
18+
19+#ifndef WIZARD_PLUGIN_H
20+#define WIZARD_PLUGIN_H
21+
22+#include <QtQml/QQmlEngine>
23+#include <QtQml/QQmlExtensionPlugin>
24+
25+class WizardPlugin : public QQmlExtensionPlugin
26+{
27+ Q_OBJECT
28+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29+
30+public:
31+ void registerTypes(const char *uri);
32+};
33+
34+#endif
plugins/Wizard/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Wizard
2+plugin Wizard-qml
3+typeinfo Wizard.qmltypes
wizard/test.sh → plugins/Wizard/test.shrenamed

The content is the same.

wizard/ubuntu-system-settings-wizard-cleanup.conf → plugins/Wizard/ubuntu-system-settings-wizard-cleanup.confrenamed

The content is the same.

wizard/ubuntu-system-settings-wizard-set-lang.conf → plugins/Wizard/ubuntu-system-settings-wizard-set-lang.confrenamed

The content is the same.

wizard/ubuntu-system-settings-wizard.conf → plugins/Wizard/ubuntu-system-settings-wizard.confrenamed

The content is the same.

qml/Shell.qml+7
@@ -37,6 +37,7 @@ import "Components"
37import "Notifications"
37import "Notifications"
38import "Stages"
38import "Stages"
39import "Panel/Indicators"
39import "Panel/Indicators"
40+import "Wizard"
40import Unity.Notifications 1.0 as NotificationBackend
41import Unity.Notifications 1.0 as NotificationBackend
41import Unity.Session 0.1
42import Unity.Session 0.1
42import Unity.DashCommunicator 0.1
43import Unity.DashCommunicator 0.1
@@ -726,6 +727,12 @@ Item {
726 }
727 }
727 }
728 }
728
729
730+ Wizard {
731+ id: wizard
732+ anchors.fill: parent
733+ background: shell.background
734+ }
735+
729 Rectangle {
736 Rectangle {
730 id: modalNotificationBackground
737 id: modalNotificationBackground
731
738
wizard/qml/Components/CheckableSetting.qml → qml/Wizard/CheckableSetting.qmlrenamed−1
@@ -15,7 +15,6 @@
15 */
15 */
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18−import QMenuModel 0.1
19import Ubuntu.Components 1.1
18import Ubuntu.Components 1.1
20import Ubuntu.Components.ListItems 1.0 as ListItem
19import Ubuntu.Components.ListItems 1.0 as ListItem
21
20
wizard/qml/Components/InputMethod.qml → qml/Wizard/Components/InputMethod.qmlrenamed

The content is the same.

wizard/qml/Components/Page.qml → qml/Wizard/Page.qmlrenamed+1−2
@@ -16,7 +16,6 @@
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18import Ubuntu.Components 1.1
18import Ubuntu.Components 1.1
19−import "." as LocalComponents
20
19
21Item {
20Item {
22 readonly property real buttonMargin: units.gu(2)
21 readonly property real buttonMargin: units.gu(2)
@@ -76,7 +75,7 @@ Item {
76 }
75 }
77 }
76 }
78
77
79− LocalComponents.StackButton {
78+ StackButton {
80 id: backButton
79 id: backButton
81 width: buttonWidth
80 width: buttonWidth
82 anchors {
81 anchors {
qml/Wizard/Pages.qmlnew file+132
@@ -0,0 +1,132 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+import Ubuntu.Components 1.1
19+import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20+import Wizard 0.1
21+import "../Components"
22+
23+Showable {
24+ // The background wallpaper to use
25+ property string background
26+
27+ ////
28+
29+ id: root
30+ focus: true
31+
32+ // These should be set by a security page and we apply the settings when
33+ // the user exits the wizard.
34+ property int passwordMethod: UbuntuSecurityPrivacyPanel.Passcode
35+ property string password: ""
36+
37+ hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
38+
39+ UbuntuSecurityPrivacyPanel {
40+ id: securityPrivacy
41+ }
42+
43+ function quitWizard() {
44+ var errorMsg = "" //securityPrivacy.setSecurity("", password, passwordMethod)
45+ if (errorMsg !== "") {
46+ // Ignore (but log) any errors, since we're past where the user set
47+ // the method. Worst case, we just leave the user with a swipe
48+ // security method and they fix it in the system settings.
49+ console.log("Error setting security method:", errorMsg)
50+ }
51+
52+ System.wizardEnabled = false;
53+ hide();
54+ }
55+
56+ MouseArea { // eat anything that gets past widgets
57+ anchors.fill: parent
58+ }
59+
60+ Image {
61+ id: image
62+ // Use x/y/height/width instead of anchors so that we don't adjust
63+ // the image when the OSK appears.
64+ x: 0
65+ y: 0
66+ height: root.height
67+ width: root.width
68+ sourceSize.height: height
69+ sourceSize.width: width
70+ source: root.background
71+ fillMode: Image.PreserveAspectCrop
72+ visible: status === Image.Ready
73+ }
74+
75+ PageStack {
76+ id: pageStack
77+ anchors.fill: parent
78+
79+ function next() {
80+ // If we've opened any extra (non-main) pages, pop them before
81+ // continuing so back button returns to the previous main page.
82+ while (PageList.index < pageStack.depth - 1)
83+ pop()
84+ load(PageList.next())
85+ }
86+
87+ function prev() {
88+ if (PageList.index >= pageStack.depth - 1)
89+ PageList.prev() // update PageList.index, but not for extra pages
90+ pop()
91+ if (!currentPage || currentPage.opacity === 0) { // undo skipped pages
92+ prev()
93+ } else {
94+ currentPage.enabled = true
95+ }
96+ }
97+
98+ function load(path) {
99+ if (currentPage) {
100+ currentPage.enabled = false
101+ }
102+
103+ // First load it invisible, check that we should actually use
104+ // this page, and either skip it or continue.
105+ push(path, {"opacity": 0, "enabled": false})
106+
107+ // Check for immediate skip or not. We may have to wait for
108+ // skipValid to be assigned (see Connections object below)
109+ _checkSkip()
110+ }
111+
112+ function _checkSkip() {
113+ if (!currentPage) { // may have had a parse error
114+ next()
115+ } else if (currentPage.skipValid) {
116+ if (currentPage.skip) {
117+ next()
118+ } else {
119+ currentPage.opacity = 1
120+ currentPage.enabled = true
121+ }
122+ }
123+ }
124+
125+ Connections {
126+ target: pageStack.currentPage
127+ onSkipValidChanged: pageStack._checkSkip()
128+ }
129+
130+ Component.onCompleted: next()
131+ }
132+}
wizard/qml/Pages/10-welcome.qml → qml/Wizard/Pages/10-welcome.qmlrenamed+3−3
@@ -18,8 +18,8 @@ import QtQuick 2.3
18import Ubuntu.Components 1.1
18import Ubuntu.Components 1.1
19import Ubuntu.Components.ListItems 0.1
19import Ubuntu.Components.ListItems 0.1
20import Ubuntu.SystemSettings.LanguagePlugin 1.0
20import Ubuntu.SystemSettings.LanguagePlugin 1.0
21−import Ubuntu.SystemSettings.Wizard.Utils 0.1
21+import Wizard 0.1
22−import "../Components" as LocalComponents
22+import ".." as LocalComponents
23
23
24LocalComponents.Page {
24LocalComponents.Page {
25 title: i18n.tr("Hi!")
25 title: i18n.tr("Hi!")
@@ -85,7 +85,7 @@ LocalComponents.Page {
85 text: i18n.tr("Continue")
85 text: i18n.tr("Continue")
86 onClicked: {
86 onClicked: {
87 plugin.currentLanguage = listview.currentIndex
87 plugin.currentLanguage = listview.currentIndex
88− System.updateSessionLanguage()
88+ System.updateSessionLanguage(plugin.languageCodes[listview.currentIndex]);
89 pageStack.next()
89 pageStack.next()
90 }
90 }
91 }
91 }
wizard/qml/Pages/20-sim.qml → qml/Wizard/Pages/20-sim.qmlrenamed+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import MeeGo.QOfono 0.2
18import MeeGo.QOfono 0.2
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20−import "../Components" as LocalComponents
20+import ".." as LocalComponents
21
21
22LocalComponents.Page {
22LocalComponents.Page {
23 title: i18n.tr("Add a SIM card and restart your device")
23 title: i18n.tr("Add a SIM card and restart your device")
wizard/qml/Pages/30-passwd-type.qml → qml/Wizard/Pages/30-passwd-type.qmlrenamed+13−1
@@ -18,7 +18,7 @@ import QtQuick 2.3
18import Ubuntu.Components 1.1
18import Ubuntu.Components 1.1
19import Ubuntu.Components.ListItems 1.0
19import Ubuntu.Components.ListItems 1.0
20import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20import Ubuntu.SystemSettings.SecurityPrivacy 1.0
21−import "../Components" as LocalComponents
21+import ".." as LocalComponents
22
22
23/**
23/**
24 * One quirk with this page: we don't actually set the password. We avoid
24 * One quirk with this page: we don't actually set the password. We avoid
@@ -77,6 +77,7 @@ LocalComponents.Page {
77 expanded: true
77 expanded: true
78 anchors.left: parent.left
78 anchors.left: parent.left
79 anchors.right: parent.right
79 anchors.right: parent.right
80+ property color originalBackground
80
81
81 model: ["", "", ""] // otherwise the delegate will show the text itself and we only want subText
82 model: ["", "", ""] // otherwise the delegate will show the text itself and we only want subText
82
83
@@ -103,6 +104,17 @@ LocalComponents.Page {
103 }
104 }
104
105
105 style: Item {}
106 style: Item {}
107+
108+ Component.onCompleted: {
109+ // A visible selected background looks bad in ListItem widgets with our theme
110+ originalBackground = Theme.palette.selected.background
111+ Theme.palette.selected.background = "transparent"
112+ }
113+
114+ Component.onDestruction: {
115+ // Restore original theme background
116+ Theme.palette.selected.background = originalBackground
117+ }
106 }
118 }
107 }
119 }
108
120
wizard/qml/Pages/40-wifi.qml → qml/Wizard/Pages/40-wifi.qmlrenamed+1−2
@@ -18,9 +18,8 @@ import QtQuick 2.0
18import QMenuModel 0.1 as QMenuModel
18import QMenuModel 0.1 as QMenuModel
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20import Ubuntu.Components.ListItems 0.1 as ListItem
20import Ubuntu.Components.ListItems 0.1 as ListItem
21−import Ubuntu.SystemSettings.Wizard.Utils 0.1
22import Ubuntu.Settings.Menus 0.1 as Menus
21import Ubuntu.Settings.Menus 0.1 as Menus
23−import "../Components" as LocalComponents
22+import ".." as LocalComponents
24
23
25LocalComponents.Page {
24LocalComponents.Page {
26 id: wifiPage
25 id: wifiPage
wizard/qml/Pages/50-location.qml → qml/Wizard/Pages/50-location.qmlrenamed+12−7
@@ -15,29 +15,34 @@
15 */
15 */
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18+import AccountsService 0.1
18import QMenuModel 0.1 as QMenuModel
19import QMenuModel 0.1 as QMenuModel
19import Qt.labs.folderlistmodel 2.1
20import Qt.labs.folderlistmodel 2.1
20import Ubuntu.Components 1.1
21import Ubuntu.Components 1.1
21−import Ubuntu.SystemSettings.Wizard.Utils 0.1
22−import "../Components" as LocalComponents
22+import ".." as LocalComponents
23
23
24LocalComponents.Page {
24LocalComponents.Page {
25 title: i18n.tr("Location")
25 title: i18n.tr("Location")
26 forwardButtonSourceComponent: forwardButton
26 forwardButtonSourceComponent: forwardButton
27
27
28− property bool pathSet: System.hereLicensePath !== " " // single space means it's unassigned
28+ property bool pathSet: AccountsService.hereLicensePath !== " " // single space means it's unassigned
29 property bool countSet: false
29 property bool countSet: false
30− skipValid: pathSet && (System.hereLicensePath === "" || countSet)
30+ skipValid: pathSet && (AccountsService.hereLicensePath === "" || countSet)
31− skip: skipValid && (System.hereLicensePath === "" || termsModel.count === 0)
31+ skip: skipValid && (AccountsService.hereLicensePath === "" || termsModel.count === 0)
32
32
33 Connections {
33 Connections {
34 target: termsModel
34 target: termsModel
35 onCountChanged: if (pathSet) countSet = true
35 onCountChanged: if (pathSet) countSet = true
36 }
36 }
37
37
38+ Connections {
39+ target: AccountsService
40+ onHereLicensePathChanged: console.log("MIKE path is", AccountsService.hereLicensePath)
41+ }
42+
38 FolderListModel {
43 FolderListModel {
39 id: termsModel
44 id: termsModel
40− folder: System.hereLicensePath
45+ folder: AccountsService.hereLicensePath
41 nameFilters: ["*.html"]
46 nameFilters: ["*.html"]
42 showDirs: false
47 showDirs: false
43 showOnlyReadable: true
48 showOnlyReadable: true
@@ -141,7 +146,7 @@ LocalComponents.Page {
141 if (locationActionGroup.gps.state != gpsOn) {
146 if (locationActionGroup.gps.state != gpsOn) {
142 locationActionGroup.gps.activate();
147 locationActionGroup.gps.activate();
143 }
148 }
144− System.hereEnabled = hereOn;
149+ AccountsService.hereEnabled = hereOn;
145 pageStack.next()
150 pageStack.next()
146 }
151 }
147 }
152 }
wizard/qml/Pages/60-reporting.qml → qml/Wizard/Pages/60-reporting.qmlrenamed+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19−import "../Components" as LocalComponents
19+import ".." as LocalComponents
20
20
21LocalComponents.Page {
21LocalComponents.Page {
22 title: i18n.tr("Improving your experience")
22 title: i18n.tr("Improving your experience")
wizard/qml/Pages/80-finished.qml → qml/Wizard/Pages/80-finished.qmlrenamed+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19−import "../Components" as LocalComponents
19+import ".." as LocalComponents
20
20
21LocalComponents.Page {
21LocalComponents.Page {
22 title: i18n.tr("All done")
22 title: i18n.tr("All done")
wizard/qml/Pages/data/meet_ubuntu_simcard@30.png → qml/Wizard/Pages/data/meet_ubuntu_simcard@30.pngrenamed

Binary file not shown.

wizard/qml/Pages/here-terms.qml → qml/Wizard/Pages/here-terms.qmlrenamed+4−4
@@ -15,11 +15,11 @@
15 */
15 */
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18+import AccountsService 0.1
18import Qt.labs.folderlistmodel 2.1
19import Qt.labs.folderlistmodel 2.1
19import Ubuntu.Components 1.1
20import Ubuntu.Components 1.1
20−import Ubuntu.SystemSettings.Wizard.Utils 0.1
21import Ubuntu.Web 0.2
21import Ubuntu.Web 0.2
22−import "../Components" as LocalComponents
22+import ".." as LocalComponents
23
23
24LocalComponents.Page {
24LocalComponents.Page {
25 title: i18n.tr("Terms & Conditions")
25 title: i18n.tr("Terms & Conditions")
@@ -27,7 +27,7 @@ LocalComponents.Page {
27
27
28 FolderListModel {
28 FolderListModel {
29 id: termsModel
29 id: termsModel
30− folder: System.hereLicensePath
30+ folder: AccountsService.hereLicensePath
31 nameFilters: ["*.html"]
31 nameFilters: ["*.html"]
32 showDirs: false
32 showDirs: false
33 showOnlyReadable: true
33 showOnlyReadable: true
@@ -73,7 +73,7 @@ LocalComponents.Page {
73
73
74 function loadFileContent() {
74 function loadFileContent() {
75 var xhr = new XMLHttpRequest
75 var xhr = new XMLHttpRequest
76− xhr.open("GET", System.hereLicensePath + "/" + determineFileName())
76+ xhr.open("GET", AccountsService.hereLicensePath + "/" + determineFileName())
77 xhr.onreadystatechange = function() {
77 xhr.onreadystatechange = function() {
78 if (xhr.readyState == XMLHttpRequest.DONE) {
78 if (xhr.readyState == XMLHttpRequest.DONE) {
79 termsLabel.text = xhr.responseText
79 termsLabel.text = xhr.responseText
wizard/qml/Pages/passwd-confirm.qml → qml/Wizard/Pages/passwd-confirm.qmlrenamed+2−2
@@ -17,8 +17,8 @@
17import QtQuick 2.3
17import QtQuick 2.3
18import Ubuntu.Components 1.1
18import Ubuntu.Components 1.1
19import Ubuntu.SystemSettings.SecurityPrivacy 1.0
19import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20−import "../Components" as LocalComponents
20+import ".." as LocalComponents
21−import "file:///usr/share/unity8/Components" as UnityComponents
21+import "../../Components" as UnityComponents
22
22
23/**
23/**
24 * See the main passwd-type page for an explanation of why we don't actually
24 * See the main passwd-type page for an explanation of why we don't actually
wizard/qml/Pages/passwd-set.qml → qml/Wizard/Pages/passwd-set.qmlrenamed+2−2
@@ -17,8 +17,8 @@
17import QtQuick 2.3
17import QtQuick 2.3
18import Ubuntu.Components 1.1
18import Ubuntu.Components 1.1
19import Ubuntu.SystemSettings.SecurityPrivacy 1.0
19import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20−import "../Components" as LocalComponents
20+import ".." as LocalComponents
21−import "file:///usr/share/unity8/Components" as UnityComponents
21+import "../../Components" as UnityComponents
22
22
23/**
23/**
24 * See the main passwd-type page for an explanation of why we don't actually
24 * See the main passwd-type page for an explanation of why we don't actually
wizard/qml/Components/StackButton.qml → qml/Wizard/StackButton.qmlrenamed

The content is the same.

qml/Wizard/Wizard.qmlnew file+40
@@ -0,0 +1,40 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+import Ubuntu.Components 1.1
19+import Wizard 0.1
20+
21+Item {
22+ // The background wallpaper to use
23+ property string background
24+
25+ ////
26+
27+ id: root
28+
29+ Loader {
30+ id: loader
31+ anchors.fill: parent
32+ property bool itemRequired // avoids a binding loop on item.required
33+ active: System.wizardEnabled || itemRequired
34+ sourceComponent: Pages {
35+ anchors.fill: parent
36+ background: root.background
37+ onRequiredChanged: loader.itemRequired = required
38+ }
39+ }
40+}
tests/CMakeLists.txt−1
@@ -14,4 +14,3 @@ add_subdirectory(whitespace)
14add_subdirectory(plugins)
14add_subdirectory(plugins)
15add_subdirectory(utils)
15add_subdirectory(utils)
16add_subdirectory(uqmlscene)
16add_subdirectory(uqmlscene)
17−add_subdirectory(wizard)
tests/mocks/AccountsService/AccountsService.cpp+25−1
@@ -27,7 +27,9 @@ AccountsService::AccountsService(QObject* parent)
27 m_backgroundFile(qmlDirectory() + "graphics/phone_background.jpg"),
27 m_backgroundFile(qmlDirectory() + "graphics/phone_background.jpg"),
28 m_statsWelcomeScreen(true),
28 m_statsWelcomeScreen(true),
29 m_failedLogins(0),
29 m_failedLogins(0),
30− m_demoEdges(false)
30+ m_demoEdges(false),
31+ m_hereEnabled(false),
32+ m_hereLicensePath("")
31{
33{
32}
34}
33
35
@@ -116,3 +118,25 @@ void AccountsService::setFailedLogins(uint failedLogins)
116 m_failedLogins = failedLogins;
118 m_failedLogins = failedLogins;
117 failedLoginsChanged();
119 failedLoginsChanged();
118}
120}
121+
122+bool AccountsService::hereEnabled() const
123+{
124+ return m_hereEnabled;
125+}
126+
127+void AccountsService::setHereEnabled(bool enabled)
128+{
129+ m_hereEnabled = enabled;
130+ hereEnabledChanged();
131+}
132+
133+QString AccountsService::hereLicensePath() const
134+{
135+ return m_hereLicensePath;
136+}
137+
138+void AccountsService::setHereLicensePath(const QString &path)
139+{
140+ m_hereLicensePath = path;
141+ hereLicensePathChanged();
142+}
tests/mocks/AccountsService/AccountsService.h+16
@@ -59,6 +59,14 @@ class AccountsService: public QObject
59 READ failedLogins
59 READ failedLogins
60 WRITE setFailedLogins
60 WRITE setFailedLogins
61 NOTIFY failedLoginsChanged)
61 NOTIFY failedLoginsChanged)
62+ Q_PROPERTY(bool hereEnabled
63+ READ hereEnabled
64+ WRITE setHereEnabled
65+ NOTIFY hereEnabledChanged)
66+ Q_PROPERTY(QString hereLicensePath
67+ READ hereLicensePath
68+ WRITE setHereLicensePath // only available in mock
69+ NOTIFY hereLicensePathChanged)
62
70
63public:
71public:
64 enum PasswordDisplayHint {
72 enum PasswordDisplayHint {
@@ -83,6 +91,10 @@ public:
83 PasswordDisplayHint passwordDisplayHint() const;
91 PasswordDisplayHint passwordDisplayHint() const;
84 uint failedLogins() const;
92 uint failedLogins() const;
85 void setFailedLogins(uint failedLogins);
93 void setFailedLogins(uint failedLogins);
94+ bool hereEnabled() const;
95+ void setHereEnabled(bool enabled);
96+ QString hereLicensePath() const;
97+ void setHereLicensePath(const QString &path);
86
98
87Q_SIGNALS:
99Q_SIGNALS:
88 void userChanged();
100 void userChanged();
@@ -93,6 +105,8 @@ Q_SIGNALS:
93 void statsWelcomeScreenChanged();
105 void statsWelcomeScreenChanged();
94 void passwordDisplayHintChanged();
106 void passwordDisplayHintChanged();
95 void failedLoginsChanged();
107 void failedLoginsChanged();
108+ void hereEnabledChanged();
109+ void hereLicensePathChanged();
96
110
97private:
111private:
98 bool m_enableLauncherWhileLocked;
112 bool m_enableLauncherWhileLocked;
@@ -102,6 +116,8 @@ private:
102 bool m_statsWelcomeScreen;
116 bool m_statsWelcomeScreen;
103 uint m_failedLogins;
117 uint m_failedLogins;
104 bool m_demoEdges;
118 bool m_demoEdges;
119+ bool m_hereEnabled;
120+ QString m_hereLicensePath;
105};
121};
106
122
107#endif
123#endif
tests/mocks/CMakeLists.txt+1
@@ -37,6 +37,7 @@ add_subdirectory(QMenuModel)
37add_subdirectory(Ubuntu)
37add_subdirectory(Ubuntu)
38add_subdirectory(Unity)
38add_subdirectory(Unity)
39add_subdirectory(QtMultimedia)
39add_subdirectory(QtMultimedia)
40+add_subdirectory(Wizard)
40
41
41install(
42install(
42 DIRECTORY data
43 DIRECTORY data
tests/mocks/QMenuModel/CMakeLists.txt+1
@@ -5,6 +5,7 @@ include_directories(
5
5
6set(QMenuModelQml_SOURCES
6set(QMenuModelQml_SOURCES
7 actionstateparser.cpp
7 actionstateparser.cpp
8+ dbus-enums.h
8 plugin.cpp
9 plugin.cpp
9 unitymenumodel.cpp
10 unitymenumodel.cpp
10)
11)
tests/mocks/QMenuModel/dbus-enums.hnew file+52
@@ -0,0 +1,52 @@
1+/*
2+ * Copyright 2012 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Olivier Tilloy <olivier.tilloy@canonical.com>
18+ */
19+
20+#ifndef __DBUS_ENUMS__
21+#define __DBUS_ENUMS__
22+
23+#include <QObject>
24+
25+// This class acts as a namespace only, with the addition that its enums
26+// are registered to be exposed on the QML side.
27+class DBusEnums : public QObject
28+{
29+ Q_OBJECT
30+
31+ Q_ENUMS(BusType)
32+ Q_ENUMS(ConnectionStatus)
33+
34+public:
35+ enum BusType {
36+ None = 0,
37+ SessionBus,
38+ SystemBus,
39+ LastBusType
40+ };
41+
42+ enum ConnectionStatus {
43+ Disconnected = 0,
44+ Connecting,
45+ Connected
46+ };
47+
48+private:
49+ DBusEnums() {}
50+};
51+
52+#endif // __DBUS_ENUMS__
tests/mocks/QMenuModel/plugin.cpp+3
@@ -19,12 +19,15 @@
19#include "plugin.h"
19#include "plugin.h"
20#include "unitymenumodel.h"
20#include "unitymenumodel.h"
21#include "actionstateparser.h"
21#include "actionstateparser.h"
22+#include "dbus-enums.h"
22
23
23#include <QtQml/qqml.h>
24#include <QtQml/qqml.h>
24
25
25void QMenuModelPlugin::registerTypes(const char *uri)
26void QMenuModelPlugin::registerTypes(const char *uri)
26{
27{
27 Q_ASSERT(uri == QLatin1String("QMenuModel"));
28 Q_ASSERT(uri == QLatin1String("QMenuModel"));
29+ qmlRegisterUncreatableType<DBusEnums>(uri, 0, 1, "DBus",
30+ "DBus is only a namespace");
28 qmlRegisterType<UnityMenuModel>(uri, 0, 1, "UnityMenuModel");
31 qmlRegisterType<UnityMenuModel>(uri, 0, 1, "UnityMenuModel");
29 qmlRegisterType<ActionStateParser>(uri, 0, 1, "ActionStateParser");
32 qmlRegisterType<ActionStateParser>(uri, 0, 1, "ActionStateParser");
30}
33}
tests/mocks/Wizard/CMakeLists.txtnew file+12
@@ -0,0 +1,12 @@
1+include_directories(
2+ ${CMAKE_SOURCE_DIR}/plugins/Wizard
3+)
4+
5+add_library(MockWizard-qml MODULE
6+ mockplugin.cpp
7+ MockSystem.cpp
8+ ${CMAKE_SOURCE_DIR}/plugins/Wizard/PageList.cpp
9+)
10+
11+qt5_use_modules(MockWizard-qml Qml)
12+add_unity8_mock(Wizard 0.1 Wizard TARGETS MockWizard-qml)
tests/mocks/Wizard/MockSystem.cppnew file+38
@@ -0,0 +1,38 @@
1+/*
2+ * Copyright (C) 2014 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License along
14+ * with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "MockSystem.h"
18+
19+MockSystem::MockSystem()
20+ : QObject(),
21+ m_wizardEnabled(false)
22+{
23+}
24+
25+bool MockSystem::wizardEnabled() const
26+{
27+ return m_wizardEnabled;
28+}
29+
30+void MockSystem::setWizardEnabled(bool enabled)
31+{
32+ m_wizardEnabled = enabled;
33+ Q_EMIT wizardEnabledChanged();
34+}
35+
36+void MockSystem::updateSessionLanguage(const QString &)
37+{
38+}
tests/mocks/Wizard/MockSystem.hnew file+46
@@ -0,0 +1,46 @@
1+/*
2+ * Copyright (C) 2014 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License along
14+ * with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#ifndef WIZARD_MOCK_SYSTEM_H
18+#define WIZARD_MOCK_SYSTEM_H
19+
20+#include <QObject>
21+#include <QString>
22+
23+class MockSystem : public QObject
24+{
25+ Q_OBJECT
26+ Q_PROPERTY(bool wizardEnabled READ wizardEnabled WRITE setWizardEnabled NOTIFY wizardEnabledChanged)
27+
28+public:
29+ MockSystem();
30+
31+ bool wizardEnabled() const;
32+ void setWizardEnabled(bool enabled);
33+
34+public Q_SLOTS:
35+ void updateSessionLanguage(const QString &locale);
36+
37+Q_SIGNALS:
38+ void wizardEnabledChanged();
39+
40+private:
41+ Q_DISABLE_COPY(MockSystem)
42+
43+ bool m_wizardEnabled;
44+};
45+
46+#endif
tests/mocks/Wizard/Wizard.qmltypesnew file+36
@@ -0,0 +1,36 @@
1+import QtQuick.tooling 1.1
2+
3+// This file describes the plugin-supplied types contained in the library.
4+// It is used for QML tooling purposes only.
5+//
6+// This file was auto-generated by:
7+// 'qmlplugindump -notrelocatable Wizard 0.1 tests/mocks'
8+
9+Module {
10+ Component {
11+ name: "MockSystem"
12+ prototype: "QObject"
13+ exports: ["Wizard/System 0.1"]
14+ isCreatable: false
15+ isSingleton: true
16+ exportMetaObjectRevisions: [0]
17+ Property { name: "wizardEnabled"; type: "bool" }
18+ Method {
19+ name: "updateSessionLanguage"
20+ Parameter { name: "locale"; type: "string" }
21+ }
22+ }
23+ Component {
24+ name: "PageList"
25+ prototype: "QObject"
26+ exports: ["Wizard/PageList 0.1"]
27+ isCreatable: false
28+ isSingleton: true
29+ exportMetaObjectRevisions: [0]
30+ Property { name: "index"; type: "int"; isReadonly: true }
31+ Property { name: "numPages"; type: "int"; isReadonly: true }
32+ Method { name: "prev"; type: "string" }
33+ Method { name: "next"; type: "string" }
34+ }
35+}
36+
tests/mocks/Wizard/mockplugin.cppnew file+42
@@ -0,0 +1,42 @@
1+/*
2+ * Copyright (C) 2012,2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "mockplugin.h"
18+#include "MockSystem.h"
19+#include "PageList.h"
20+
21+#include <QtQml/qqml.h>
22+
23+static QObject *pagelist_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
24+{
25+ Q_UNUSED(engine)
26+ Q_UNUSED(scriptEngine)
27+ return new PageList();
28+}
29+
30+static QObject *system_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
31+{
32+ Q_UNUSED(engine)
33+ Q_UNUSED(scriptEngine)
34+ return new MockSystem();
35+}
36+
37+void MockWizardPlugin::registerTypes(const char *uri)
38+{
39+ Q_ASSERT(uri == QLatin1String("Wizard"));
40+ qmlRegisterSingletonType<PageList>(uri, 0, 1, "PageList", pagelist_provider);
41+ qmlRegisterSingletonType<MockSystem>(uri, 0, 1, "System", system_provider);
42+}
tests/mocks/Wizard/mockplugin.hnew file+32
@@ -0,0 +1,32 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#ifndef MOCK_WIZARD_PLUGIN_H
18+#define MOCK_WIZARD_PLUGIN_H
19+
20+#include <QtQml/QQmlEngine>
21+#include <QtQml/QQmlExtensionPlugin>
22+
23+class MockWizardPlugin : public QQmlExtensionPlugin
24+{
25+ Q_OBJECT
26+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
27+
28+public:
29+ void registerTypes(const char *uri);
30+};
31+
32+#endif
tests/mocks/Wizard/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Wizard
2+plugin MockWizard-qml
3+typeinfo Wizard.qmltypes
tests/plugins/CMakeLists.txt+1
@@ -4,3 +4,4 @@ add_subdirectory(Dash)
4add_subdirectory(Ubuntu)
4add_subdirectory(Ubuntu)
5add_subdirectory(Unity)
5add_subdirectory(Unity)
6add_subdirectory(Utils)
6add_subdirectory(Utils)
7+add_subdirectory(Wizard)
tests/plugins/Wizard/CMakeLists.txtnew file+11
@@ -0,0 +1,11 @@
1+include_directories(
2+ ${CMAKE_CURRENT_BINARY_DIR}
3+ ${CMAKE_SOURCE_DIR}/plugins/Wizard
4+)
5+
6+add_executable(tst-pagelist
7+ tst_pagelist.cpp
8+ ${CMAKE_SOURCE_DIR}/plugins/Wizard/PageList.cpp
9+)
10+qt5_use_modules(tst-pagelist Core Qml Test)
11+add_test(tst-pagelist tst-pagelist)
tests/wizard/tst_pagelist.cpp → tests/plugins/Wizard/tst_pagelist.cpprenamed+1−3
@@ -1,6 +1,4 @@
1/*
1/*
2− * This file is part of system-settings
3− *
4 * Copyright (C) 2014 Canonical Ltd.
2 * Copyright (C) 2014 Canonical Ltd.
5 *
3 *
6 * This program is free software: you can redistribute it and/or modify it
4 * This program is free software: you can redistribute it and/or modify it
@@ -23,7 +21,7 @@
23#include <QTemporaryDir>
21#include <QTemporaryDir>
24#include <QTest>
22#include <QTest>
25
23
26−#define PAGES_PATH "ubuntu/settings/wizard/qml/Pages"
24+#define PAGES_PATH "Wizard/Pages"
27
25
28class PageListTest: public QObject
26class PageListTest: public QObject
29{
27{
tests/wizard/CMakeLists.txtdeleted−5
@@ -1,5 +0,0 @@
1−add_executable(tst-pagelist tst_pagelist.cpp ${CMAKE_SOURCE_DIR}/wizard/PageList.cpp)
2−set_target_properties(tst-pagelist PROPERTIES
3− INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_SOURCE_DIR}/wizard")
4−qt5_use_modules(tst-pagelist Core Test)
5−add_test(tst-pagelist tst-pagelist)
wizard/CMakeLists.txtdeleted−65
@@ -1,65 +0,0 @@
1−# This file uses a lot of namespacing like "ubuntu-system-settings" instead of
2−# "unity8". This is because we have imported it from ubuntu-system-settings
3−# and haven't fully integrated it yet.
4−
5−include_directories(
6− ${CMAKE_CURRENT_BINARY_DIR}
7− ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
8−)
9−
10−set(PLUGIN_MANIFEST_DIR_BASE share/ubuntu/settings/system)
11−set(PLUGIN_MODULE_DIR_BASE ubuntu-system-settings)
12−set(PLUGIN_PRIVATE_MODULE_DIR_BASE "${PLUGIN_MODULE_DIR_BASE}/private")
13−set(PLUGIN_QML_DIR_BASE share/ubuntu/settings/system/qml-plugins)
14−
15−set(PLUGIN_MANIFEST_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_MANIFEST_DIR_BASE}")
16−set(PLUGIN_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${PLUGIN_MODULE_DIR_BASE}")
17−set(PLUGIN_PRIVATE_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${PLUGIN_PRIVATE_MODULE_DIR_BASE}")
18−set(PLUGIN_QML_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_QML_DIR_BASE}")
19−
20−add_definitions(-DI18N_DOMAIN="unity8")
21−add_definitions(-DPLUGIN_MANIFEST_DIR="${PLUGIN_MANIFEST_DIR}")
22−add_definitions(-DPLUGIN_MODULE_DIR="${PLUGIN_MODULE_DIR}")
23−add_definitions(-DPLUGIN_PRIVATE_MODULE_DIR="${PLUGIN_PRIVATE_MODULE_DIR}")
24−add_definitions(-DPLUGIN_QML_DIR="${PLUGIN_QML_DIR}")
25−
26−execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=plugindir unity-shell-api OUTPUT_VARIABLE SHELL_PLUGINDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
27−if(SHELL_PLUGINDIR STREQUAL "")
28− message(FATAL_ERROR "Could not determine plugin import dir.")
29−endif()
30−
31−add_definitions(-DSHELL_PLUGINDIR="${SHELL_PLUGINDIR}")
32−
33−set(WIZARD_ROOT "${CMAKE_INSTALL_PREFIX}/share")
34−add_definitions(-DWIZARD_ROOT="${WIZARD_ROOT}")
35−
36−file(GLOB_RECURSE QML_FILES
37− qml/*
38−)
39−
40−set(WIZARD_SOURCES
41− main.cpp
42− PageList.cpp
43−)
44−
45−add_executable(system-settings-wizard
46− ${WIZARD_SOURCES}
47− ${system-settings-wizard-resources}
48− ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
49−)
50−
51−qt5_use_modules(system-settings-wizard Core Gui Quick Qml)
52−
53−add_subdirectory(Unity)
54−add_subdirectory(Utils)
55−
56−install(TARGETS system-settings-wizard RUNTIME DESTINATION bin)
57−install(FILES ubuntu-system-settings-wizard.conf
58− ubuntu-system-settings-wizard-cleanup.conf
59− ubuntu-system-settings-wizard-set-lang.conf
60− DESTINATION share/upstart/sessions)
61−
62−set(POLKIT_LIB_DIR "${CMAKE_INSTALL_LOCALSTATEDIR}/lib/polkit-1")
63−install(FILES 50-com.ubuntu.system-settings.wizard.pkla DESTINATION ${POLKIT_LIB_DIR}/localauthority/10-vendor.d)
64−
65−install(DIRECTORY qml DESTINATION ${WIZARD_ROOT}/ubuntu/settings/wizard)
wizard/Utils/system.cppdeleted−118
@@ -1,118 +0,0 @@
1−/*
2− * This file is part of system-settings
3− *
4− * Copyright (C) 2014 Canonical Ltd.
5− *
6− * This program is free software: you can redistribute it and/or modify it
7− * under the terms of the GNU General Public License version 3, as published
8− * by the Free Software Foundation.
9− *
10− * This program is distributed in the hope that it will be useful, but
11− * WITHOUT ANY WARRANTY; without even the implied warranties of
12− * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13− * PURPOSE. See the GNU General Public License for more details.
14− *
15− * You should have received a copy of the GNU General Public License along
16− * with this program. If not, see <http://www.gnu.org/licenses/>.
17− */
18−
19−#include "system.h"
20−#include <QDBusInterface>
21−#include <QDBusPendingCall>
22−#include <QDBusPendingReply>
23−#include <QFile>
24−#include <QProcess>
25−#include <unistd.h>
26−
27−#define HERE_IFACE "com.ubuntu.location.providers.here.AccountsService"
28−#define ENABLED_PROP "LicenseAccepted"
29−#define PATH_PROP "LicenseBasePath"
30−
31−System::System()
32− : QObject(),
33− m_accounts(nullptr),
34− m_hereEnabled(false),
35− m_hereLicensePath(" ") // use a single space to indicate it is unasssigned
36−{
37− m_accounts = new QDBusInterface("org.freedesktop.Accounts",
38− "/org/freedesktop/Accounts/User" + QString::number(geteuid()),
39− "org.freedesktop.DBus.Properties",
40− QDBusConnection::systemBus(),
41− this);
42−
43− m_accounts->connection().connect(m_accounts->service(),
44− m_accounts->path(),
45− m_accounts->interface(),
46− "PropertiesChanged",
47− this,
48− SLOT(propertiesChanged(QString, QVariantMap, QStringList)));
49−
50− QDBusPendingCall call = m_accounts->asyncCall("Get", HERE_IFACE, PATH_PROP);
51− QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
52− QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)),
53− this, SLOT(getHereLicensePathFinished(QDBusPendingCallWatcher *)));
54−}
55−
56−void System::propertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalid)
57−{
58− if (interface == HERE_IFACE) {
59− if (changed.contains(ENABLED_PROP)) {
60− m_hereEnabled = changed[ENABLED_PROP].toBool();
61− Q_EMIT hereEnabledChanged();
62− } else if (invalid.contains(ENABLED_PROP)) {
63− QDBusPendingCall call = m_accounts->asyncCall("Get", HERE_IFACE, ENABLED_PROP);
64− QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
65− QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)),
66− this, SLOT(getHereEnabledFinished(QDBusPendingCallWatcher *)));
67− }
68− }
69−}
70−
71−void System::getHereEnabledFinished(QDBusPendingCallWatcher *watcher)
72−{
73− QDBusPendingReply<QVariant> reply = *watcher;
74− if (!reply.isError()) {
75− QVariant value = reply.argumentAt<0>();
76− m_hereEnabled = value.toBool();
77− Q_EMIT hereEnabledChanged();
78− }
79− watcher->deleteLater();
80−}
81−
82−void System::getHereLicensePathFinished(QDBusPendingCallWatcher *watcher)
83−{
84− QDBusPendingReply<QVariant> reply = *watcher;
85−
86− m_hereLicensePath = "";
87−
88− if (!reply.isError()) {
89− QVariant value = reply.argumentAt<0>();
90− if (QFile::exists(value.toString())) {
91− m_hereLicensePath = value.toString();
92− }
93− }
94−
95− Q_EMIT hereLicensePathChanged();
96−
97− watcher->deleteLater();
98−}
99−
100−bool System::hereEnabled() const
101−{
102− return m_hereEnabled;
103−}
104−
105−void System::setHereEnabled(bool enabled)
106−{
107− m_accounts->asyncCall("Set", HERE_IFACE, ENABLED_PROP, QVariant::fromValue(QDBusVariant(enabled)));
108−}
109−
110−QString System::hereLicensePath() const
111−{
112− return m_hereLicensePath;
113−}
114−
115−void System::updateSessionLanguage()
116−{
117− QProcess::startDetached("sh -c \"initctl start ubuntu-system-settings-wizard-set-lang; initctl emit --no-wait indicator-services-start; initctl start --no-wait maliit-server\"");
118−}
wizard/Utils/system.hdeleted−57
@@ -1,57 +0,0 @@
1−/*
2− * This file is part of system-settings
3− *
4− * Copyright (C) 2014 Canonical Ltd.
5− *
6− * This program is free software: you can redistribute it and/or modify it
7− * under the terms of the GNU General Public License version 3, as published
8− * by the Free Software Foundation.
9− *
10− * This program is distributed in the hope that it will be useful, but
11− * WITHOUT ANY WARRANTY; without even the implied warranties of
12− * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13− * PURPOSE. See the GNU General Public License for more details.
14− *
15− * You should have received a copy of the GNU General Public License along
16− * with this program. If not, see <http://www.gnu.org/licenses/>.
17− */
18−
19−#include <QObject>
20−#include <QString>
21−
22−class QDBusInterface;
23−class QDBusPendingCallWatcher;
24−
25−class System : public QObject
26−{
27− Q_OBJECT
28− Q_PROPERTY(bool hereEnabled READ hereEnabled WRITE setHereEnabled NOTIFY hereEnabledChanged)
29− Q_PROPERTY(QString hereLicensePath READ hereLicensePath NOTIFY hereLicensePathChanged)
30−
31−public:
32− System();
33−
34− bool hereEnabled() const;
35− void setHereEnabled(bool enabled);
36−
37− QString hereLicensePath() const;
38−
39−public Q_SLOTS:
40− void updateSessionLanguage();
41−
42−Q_SIGNALS:
43− void hereEnabledChanged();
44− void hereLicensePathChanged();
45−
46−private Q_SLOTS:
47− void propertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalid);
48− void getHereEnabledFinished(QDBusPendingCallWatcher *watcher);
49− void getHereLicensePathFinished(QDBusPendingCallWatcher *watcher);
50−
51−private:
52− Q_DISABLE_COPY(System)
53−
54− QDBusInterface *m_accounts;
55− bool m_hereEnabled;
56− QString m_hereLicensePath;
57−};
wizard/qml/main.qmldeleted−246
@@ -1,246 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.3
18−import GSettings 1.0
19−import Ubuntu.Components 1.1
20−import Ubuntu.SystemSettings.SecurityPrivacy 1.0
21−import Unity.Application 0.1
22−import Unity.Notifications 1.0 as NotificationBackend
23−import Unity.Session 0.1
24−import "Components"
25−import "file:///usr/share/unity8/Notifications" as Notifications // FIXME This should become a module or go away
26−import "file:///usr/share/unity8/Components" as UnityComponents
27−
28−Item {
29− id: root
30− width: units.gu(40)
31− height: units.gu(71)
32− focus: true
33−
34− // These should be set by a security page and we apply the settings when
35− // the user exits the wizard.
36− property int passwordMethod: UbuntuSecurityPrivacyPanel.Passcode
37− property string password: ""
38−
39− Component.onCompleted: {
40− Theme.name = "Ubuntu.Components.Themes.SuruGradient"
41− // A visible selected background looks bad in ListItem widgets with our theme
42− Theme.palette.selected.background = "#00000000"
43− i18n.domain = "unity8"
44− }
45−
46− UbuntuSecurityPrivacyPanel {
47− id: securityPrivacy
48− }
49−
50− function quitWizard() {
51− // Immediately go to black to give quick feedback
52− blackCover.visible = true
53−
54− var errorMsg = securityPrivacy.setSecurity("", password, passwordMethod)
55− if (errorMsg !== "") {
56− // Ignore (but log) any errors, since we're past where the user set
57− // the method. Worst case, we just leave the user with a swipe
58− // security method and they fix it in the system settings.
59− console.log("Error setting security method:", errorMsg)
60− }
61−
62− Qt.quit()
63− }
64−
65− // This is just a little screen to immediately go to black once the wizard
66− // is done, to give quick feedback to the user.
67− Rectangle {
68− id: blackCover
69− color: "#000000"
70− anchors.fill: parent
71− z: 1
72− visible: false
73− }
74−
75− MainView {
76− anchors.fill: parent
77− headerColor: "#57365E"
78− backgroundColor: "#A55263"
79− footerColor: "#D75669"
80− anchorToKeyboard: true
81− useDeprecatedToolbar: false
82−
83− GSettings {
84− id: background
85− schema.id: "org.gnome.desktop.background"
86− }
87−
88− Image {
89− id: image
90− // Use x/y/height/width instead of anchors so that we don't adjust
91− // the image when the OSK appears.
92− x: 0
93− y: 0
94− height: root.height
95− width: root.width
96− source: background.pictureUri
97− fillMode: Image.PreserveAspectCrop
98− visible: status === Image.Ready
99− }
100−
101− PageStack {
102− id: pageStack
103−
104− function next() {
105− // If we've opened any extra (non-main) pages, pop them before
106− // continuing so back button returns to the previous main page.
107− while (pageList.index < pageStack.depth - 1)
108− pop()
109− load(pageList.next())
110− }
111−
112− function prev() {
113− if (pageList.index >= pageStack.depth - 1)
114− pageList.prev() // update pageList.index, but not for extra pages
115− pop()
116− if (!currentPage || currentPage.opacity === 0) { // undo skipped pages
117− prev()
118− } else {
119− currentPage.enabled = true
120− }
121− }
122−
123− function load(path) {
124− if (currentPage) {
125− currentPage.enabled = false
126− }
127−
128− // First load it invisible, check that we should actually use
129− // this page, and either skip it or continue.
130− push(path, {"opacity": 0, "enabled": false})
131−
132− // Check for immediate skip or not. We may have to wait for
133− // skipValid to be assigned (see Connections object below)
134− _checkSkip()
135− }
136−
137− function _checkSkip() {
138− if (!currentPage) { // may have had a parse error
139− next()
140− } else if (currentPage.skipValid) {
141− if (currentPage.skip) {
142− next()
143− } else {
144− currentPage.opacity = 1
145− currentPage.enabled = true
146− }
147− }
148− }
149−
150− Connections {
151− target: pageStack.currentPage
152− onSkipValidChanged: pageStack._checkSkip()
153− }
154−
155− Component.onCompleted: next()
156− }
157− }
158−
159− Rectangle {
160− id: modalNotificationBackground
161− visible: notifications.useModal && (notifications.state == "narrow")
162− anchors.fill: parent
163− color: "#80000000"
164−
165− MouseArea {
166− anchors.fill: parent
167− }
168− }
169−
170− InputMethod {
171− anchors.fill: parent
172− }
173−
174− Notifications.Notifications {
175− id: notifications
176− model: NotificationBackend.Model
177− margin: units.gu(1)
178− anchors {
179− top: parent.top
180− right: parent.right
181− bottom: parent.bottom
182− }
183− states: [
184− State {
185− name: "narrow"
186− when: parent.width <= units.gu(60)
187− AnchorChanges { target: notifications; anchors.left: parent.left }
188− },
189− State {
190− name: "wide"
191− when: parent.width > units.gu(60)
192− AnchorChanges { target: notifications; anchors.left: undefined }
193− PropertyChanges { target: notifications; width: units.gu(38) }
194− }
195− ]
196− }
197−
198− UnityComponents.Dialogs {
199− id: dialogs
200− anchors.fill: parent
201− z: 10
202− onPowerOffClicked: {
203− shutdownFadeOutRectangle.enabled = true;
204− shutdownFadeOutRectangle.visible = true;
205− shutdownFadeOut.start();
206− }
207− }
208−
209− Rectangle {
210− id: shutdownFadeOutRectangle
211− z: dialogs.z + 10
212− enabled: false
213− visible: false
214− color: "black"
215− anchors.fill: parent
216− opacity: 0.0
217− NumberAnimation on opacity {
218− id: shutdownFadeOut
219− from: 0.0
220− to: 1.0
221− onStopped: {
222− if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
223− DBusUnitySessionService.Shutdown();
224− }
225− }
226− }
227− }
228−
229− Keys.onPressed: {
230− if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
231− dialogs.onPowerKeyPressed();
232− event.accepted = true;
233− } else {
234− event.accepted = false;
235− }
236− }
237−
238− Keys.onReleased: {
239− if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
240− dialogs.onPowerKeyReleased();
241− event.accepted = true;
242− } else {
243− event.accepted = false;
244− }
245− }
246−}