on xenial help sign in
move the app store uri to a gsetting
commitcfcde217398c76d3f8180d69ca37c4da994826fb authorMichael Zanetti <michael.zanetti@canonical.com> dateSat 10 Dec 2016, 15:06 (10 years ago) parentcb15c25
4 files changed+33−2
data/com.canonical.Unity8.gschema.xml+5 qml/Launcher/MoreAppsHeader.qml+7−2 tests/mocks/GSettings.1.0/fake_gsettings.cpp+14 tests/mocks/GSettings.1.0/fake_gsettings.h+7
data/com.canonical.Unity8.gschema.xml+5
@@ -53,6 +53,11 @@
5353 <summary>Enable or disable the indicator pull down menus</summary>
5454 <description>Toggle the availability of the indicator pull down menus</description>
5555 </key>
56+ <key type="s" name="appstore-uri">
57+ <default>'scope://com.canonical.scopes.clickstore'</default>
58+ <summary>The uri to the app store</summary>
59+ <description>This will be used whenever the user triggers an action to open the app store.</description>
60+ </key>
5661 </schema>
5762
5863 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
qml/Launcher/MoreAppsHeader.qml+7−2
@@ -1,12 +1,17 @@
11import QtQuick 2.4
22import Ubuntu.Components 1.3
3+import GSettings 1.0
34
45AbstractButton {
56 id: root
67
8+ GSettings {
9+ id: settings
10+ schema.id: "com.canonical.Unity8"
11+ }
12+
713 onClicked: {
8− // TODO: Make this point to the snappy store as soon as we stop landing to vivid
9− Qt.openUrlExternally("scope://com.canonical.scopes.clickstore")
14+ Qt.openUrlExternally(settings.appstoreUri)
1015 }
1116
1217 UbuntuShape {
tests/mocks/GSettings.1.0/fake_gsettings.cpp+14
@@ -29,6 +29,7 @@ GSettingsControllerQml::GSettingsControllerQml()
2929 , m_edgeDragWidth(2)
3030 , m_enableLauncher(true)
3131 , m_enableIndicatorMenu(true)
32+ , m_appstoreUri("http://uappexplorer.com")
3233{
3334}
3435
@@ -173,6 +174,11 @@ void GSettingsControllerQml::setEnableIndicatorMenu(bool enableIndicatorMenu)
173174 }
174175}
175176
177+QString GSettingsControllerQml::appstoreUri() const
178+{
179+ return m_appstoreUri;
180+}
181+
176182GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
177183}
178184
@@ -376,6 +382,14 @@ QVariant GSettingsQml::enableIndicatorMenu() const
376382 }
377383}
378384
385+QVariant GSettingsQml::appstoreUri() const
386+{
387+ if (m_valid && m_schema->id() == "com.canonical.Unity8") {
388+ return GSettingsControllerQml::instance()->appstoreUri();
389+ }
390+ return QVariant();
391+}
392+
379393void GSettingsQml::setLifecycleExemptAppids(const QVariant &appIds)
380394{
381395 if (m_valid && m_schema->id() == "com.canonical.qtmir") {
tests/mocks/GSettings.1.0/fake_gsettings.h+7
@@ -59,6 +59,7 @@ class GSettingsQml: public QObject, public QQmlParserStatus
5959 Q_PROPERTY(QVariant edgeDragWidth READ edgeDragWidth WRITE setEdgeDragWidth NOTIFY edgeDragWidthChanged)
6060 Q_PROPERTY(QVariant enableLauncher READ enableLauncher WRITE setEnableLauncher NOTIFY enableLauncherChanged)
6161 Q_PROPERTY(QVariant enableIndicatorMenu READ enableIndicatorMenu WRITE setEnableIndicatorMenu NOTIFY enableIndicatorMenuChanged)
62+ Q_PROPERTY(QVariant appstoreUri READ appstoreUri NOTIFY appstoreUriChanged)
6263
6364public:
6465 GSettingsQml(QObject *parent = nullptr);
@@ -77,6 +78,7 @@ public:
7778 QVariant edgeDragWidth() const;
7879 QVariant enableLauncher() const;
7980 QVariant enableIndicatorMenu() const;
81+ QVariant appstoreUri() const;
8082
8183 void setDisableHeight(const QVariant &val);
8284 void setPictureUri(const QVariant &str);
@@ -101,6 +103,7 @@ Q_SIGNALS:
101103 void edgeDragWidthChanged();
102104 void enableLauncherChanged();
103105 void enableIndicatorMenuChanged();
106+ void appstoreUriChanged();
104107
105108private:
106109 GSettingsSchemaQml* m_schema;
@@ -147,6 +150,8 @@ public:
147150 bool enableIndicatorMenu() const;
148151 Q_INVOKABLE void setEnableIndicatorMenu(bool enableIndicatorMenu);
149152
153+ QString appstoreUri() const;
154+
150155Q_SIGNALS:
151156 void disableHeightChanged();
152157 void pictureUriChanged(const QString&);
@@ -158,6 +163,7 @@ Q_SIGNALS:
158163 void edgeDragWidthChanged(uint edgeDragWidth);
159164 void enableLauncherChanged(bool enableLauncher);
160165 void enableIndicatorMenuChanged(bool enableIndicatorMenu);
166+ void appstoreUriChanged(const QString &appstoreUri);
161167
162168private:
163169 GSettingsControllerQml();
@@ -172,6 +178,7 @@ private:
172178 uint m_edgeDragWidth;
173179 bool m_enableLauncher;
174180 bool m_enableIndicatorMenu;
181+ QString m_appstoreUri;
175182
176183 static GSettingsControllerQml* s_controllerInstance;
177184 QList<GSettingsQml *> m_registeredGSettings;