on xenial help sign in
Added a setting to enable/disable the indicator dropdown menu.

Approved by: Michael Zanetti, Unity8 CI Bot

commit15e940b891d3ad0d108c1a3733fc12692bc919f3 authorBrian Douglass <bhdouglass@gmail.com> dateTue 29 Nov 2016, 09:39 (10 years ago) parent30ca5f389d8cad
6 files changed+83
data/com.canonical.Unity8.gschema.xml+5 qml/Shell.qml+1 tests/mocks/GSettings.1.0/fake_gsettings.cpp+33 tests/mocks/GSettings.1.0/fake_gsettings.h+9 tests/qmltests/Panel/tst_IndicatorsMenu.qml+17 tests/qmltests/tst_Shell.qml+18
data/com.canonical.Unity8.gschema.xml+5
@@ -48,6 +48,11 @@
4848 <summary>Enable or disable the launcher</summary>
4949 <description>Toggle the availability of the launcher</description>
5050 </key>
51+ <key type="b" name="enable-indicator-menu">
52+ <default>true</default>
53+ <summary>Enable or disable the indicator pull down menus</summary>
54+ <description>Toggle the availability of the indicator pull down menus</description>
55+ </key>
5156 </schema>
5257
5358 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
qml/Shell.qml+1
@@ -465,6 +465,7 @@ StyledItem {
465465 && ((!greeter || !greeter.locked) || AccountsService.enableIndicatorsWhileLocked)
466466 && (!greeter || !greeter.hasLockedApp)
467467 && !shell.waitingOnGreeter
468+ && settings.enableIndicatorMenu
468469 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
469470
470471 minimizedPanelHeight: units.gu(3)
tests/mocks/GSettings.1.0/fake_gsettings.cpp+33
@@ -28,6 +28,7 @@ GSettingsControllerQml::GSettingsControllerQml()
2828 , m_launcherWidth(8)
2929 , m_edgeDragWidth(2)
3030 , m_enableLauncher(true)
31+ , m_enableIndicatorMenu(true)
3132{
3233}
3334
@@ -159,6 +160,19 @@ bool GSettingsControllerQml::enableLauncher() const
159160 return m_enableLauncher;
160161}
161162
163+bool GSettingsControllerQml::enableIndicatorMenu() const
164+{
165+ return m_enableIndicatorMenu;
166+}
167+
168+void GSettingsControllerQml::setEnableIndicatorMenu(bool enableIndicatorMenu)
169+{
170+ if (m_enableIndicatorMenu != enableIndicatorMenu) {
171+ m_enableIndicatorMenu = enableIndicatorMenu;
172+ Q_EMIT enableIndicatorMenuChanged(enableIndicatorMenu);
173+ }
174+}
175+
162176GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
163177}
164178
@@ -225,6 +239,8 @@ void GSettingsQml::componentComplete()
225239 this, &GSettingsQml::edgeDragWidthChanged);
226240 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::enableLauncherChanged,
227241 this, &GSettingsQml::enableLauncherChanged);
242+ connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::enableIndicatorMenuChanged,
243+ this, &GSettingsQml::enableIndicatorMenuChanged);
228244
229245 Q_EMIT disableHeightChanged();
230246 Q_EMIT pictureUriChanged();
@@ -235,6 +251,7 @@ void GSettingsQml::componentComplete()
235251 Q_EMIT launcherWidthChanged();
236252 Q_EMIT edgeDragWidthChanged();
237253 Q_EMIT enableLauncherChanged();
254+ Q_EMIT enableIndicatorMenuChanged();
238255}
239256
240257GSettingsSchemaQml * GSettingsQml::schema() const {
@@ -350,6 +367,15 @@ QVariant GSettingsQml::enableLauncher() const
350367 }
351368}
352369
370+QVariant GSettingsQml::enableIndicatorMenu() const
371+{
372+ if (m_valid && m_schema->id() == "com.canonical.Unity8") {
373+ return GSettingsControllerQml::instance()->enableIndicatorMenu();
374+ } else {
375+ return QVariant();
376+ }
377+}
378+
353379void GSettingsQml::setLifecycleExemptAppids(const QVariant &appIds)
354380{
355381 if (m_valid && m_schema->id() == "com.canonical.qtmir") {
@@ -384,3 +410,10 @@ void GSettingsQml::setEnableLauncher(const QVariant &enableLauncher)
384410 GSettingsControllerQml::instance()->setEnableLauncher(enableLauncher.toBool());
385411 }
386412}
413+
414+void GSettingsQml::setEnableIndicatorMenu(const QVariant &enableIndicatorMenu)
415+{
416+ if (m_valid && m_schema->id() == "com.canonical.Unity8") {
417+ GSettingsControllerQml::instance()->setEnableIndicatorMenu(enableIndicatorMenu.toBool());
418+ }
419+}
tests/mocks/GSettings.1.0/fake_gsettings.h+9
@@ -58,6 +58,7 @@ class GSettingsQml: public QObject, public QQmlParserStatus
5858 Q_PROPERTY(QVariant launcherWidth READ launcherWidth WRITE setLauncherWidth NOTIFY launcherWidthChanged)
5959 Q_PROPERTY(QVariant edgeDragWidth READ edgeDragWidth WRITE setEdgeDragWidth NOTIFY edgeDragWidthChanged)
6060 Q_PROPERTY(QVariant enableLauncher READ enableLauncher WRITE setEnableLauncher NOTIFY enableLauncherChanged)
61+ Q_PROPERTY(QVariant enableIndicatorMenu READ enableIndicatorMenu WRITE setEnableIndicatorMenu NOTIFY enableIndicatorMenuChanged)
6162
6263public:
6364 GSettingsQml(QObject *parent = nullptr);
@@ -75,6 +76,7 @@ public:
7576 QVariant launcherWidth() const;
7677 QVariant edgeDragWidth() const;
7778 QVariant enableLauncher() const;
79+ QVariant enableIndicatorMenu() const;
7880
7981 void setDisableHeight(const QVariant &val);
8082 void setPictureUri(const QVariant &str);
@@ -85,6 +87,7 @@ public:
8587 void setLauncherWidth(const QVariant &launcherWidth);
8688 void setEdgeDragWidth(const QVariant &edgeDragWidth);
8789 void setEnableLauncher(const QVariant &enableLauncher);
90+ void setEnableIndicatorMenu(const QVariant &enableIndicatorMenu);
8891
8992Q_SIGNALS:
9093 void disableHeightChanged();
@@ -97,6 +100,7 @@ Q_SIGNALS:
97100 void launcherWidthChanged();
98101 void edgeDragWidthChanged();
99102 void enableLauncherChanged();
103+ void enableIndicatorMenuChanged();
100104
101105private:
102106 GSettingsSchemaQml* m_schema;
@@ -140,6 +144,9 @@ public:
140144 bool enableLauncher() const;
141145 Q_INVOKABLE void setEnableLauncher(bool enableLauncher);
142146
147+ bool enableIndicatorMenu() const;
148+ Q_INVOKABLE void setEnableIndicatorMenu(bool enableIndicatorMenu);
149+
143150Q_SIGNALS:
144151 void disableHeightChanged();
145152 void pictureUriChanged(const QString&);
@@ -150,6 +157,7 @@ Q_SIGNALS:
150157 void launcherWidthChanged(int launcherWidth);
151158 void edgeDragWidthChanged(uint edgeDragWidth);
152159 void enableLauncherChanged(bool enableLauncher);
160+ void enableIndicatorMenuChanged(bool enableIndicatorMenu);
153161
154162private:
155163 GSettingsControllerQml();
@@ -163,6 +171,7 @@ private:
163171 int m_launcherWidth;
164172 uint m_edgeDragWidth;
165173 bool m_enableLauncher;
174+ bool m_enableIndicatorMenu;
166175
167176 static GSettingsControllerQml* s_controllerInstance;
168177 QList<GSettingsQml *> m_registeredGSettings;
tests/qmltests/Panel/tst_IndicatorsMenu.qml+17
@@ -286,5 +286,22 @@ IndicatorTest {
286286 mouseClick(indicatorsMenu, indicatorsMenu.width/2, indicatorsMenu.height/2, Qt.RightButton);
287287 tryCompare(clickThroughSpy, "count", 0);
288288 }
289+
290+ function test_enableMenuSetting_data() {
291+ return [
292+ {tag: "menu enabled", enabled: true},
293+ {tag: "menu disabled", enabled: false}
294+ ]
295+ }
296+
297+ function test_enableMenuSetting(data) {
298+ indicatorsMenu.available = data.enabled;
299+
300+ indicatorsMenu.show();
301+ tryCompare(indicatorsMenu, data.enabled ? "fullyOpened" : "fullyClosed", true);
302+
303+ indicatorsMenu.available = true;
304+ indicatorsMenu.hide();
305+ }
289306 }
290307}
tests/qmltests/tst_Shell.qml+18
@@ -2779,5 +2779,23 @@ Rectangle {
27792779
27802780 GSettingsController.setEnableLauncher(true);
27812781 }
2782+
2783+ function test_indicatorMenuEnabledSetting_data() {
2784+ return [
2785+ {tag: "indicator menu enabled", enabled: true},
2786+ {tag: "indicator menu disabled", enabled: false}
2787+ ]
2788+ }
2789+
2790+ function test_indicatorMenuEnabledSetting(data) {
2791+ loadShell("phone");
2792+
2793+ GSettingsController.setEnableIndicatorMenu(data.enabled);
2794+
2795+ var panel = findChild(shell, "panel");
2796+ compare(panel.indicators.available, data.enabled);
2797+
2798+ GSettingsController.setEnableIndicatorMenu(true);
2799+ }
27822800 }
27832801}