Merge lp:~mzanetti/unity8/stripped-down-quicklist into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 2845
Merged at revision: 2878
Proposed branch: lp:~mzanetti/unity8/stripped-down-quicklist
Merge into: lp:unity8
Diff against target: 520 lines (+214/-7)
20 files modified
CMakeLists.txt (+1/-1)
debian/control (+3/-3)
plugins/Greeter/Unity/Launcher/quicklistmodel.cpp (+2/-0)
plugins/Unity/Launcher/launcheritem.cpp (+3/-0)
plugins/Unity/Launcher/quicklistentry.cpp (+11/-0)
plugins/Unity/Launcher/quicklistentry.h (+4/-0)
plugins/Unity/Launcher/quicklistmodel.cpp (+2/-0)
plugins/Utils/CMakeLists.txt (+1/-0)
plugins/Utils/plugin.cpp (+2/-0)
plugins/Utils/quicklistproxymodel.cpp (+72/-0)
plugins/Utils/quicklistproxymodel.h (+52/-0)
qml/Launcher/Launcher.qml (+1/-0)
qml/Launcher/LauncherPanel.qml (+7/-1)
qml/Shell.qml (+1/-0)
tests/mocks/Unity/Launcher/MockLauncherModel.h (+1/-1)
tests/mocks/Unity/Launcher/MockQuickListModel.cpp (+3/-1)
tests/mocks/Unity/Launcher/MockQuickListModel.h (+2/-0)
tests/mocks/Utils/CMakeLists.txt (+2/-0)
tests/mocks/Utils/plugin.cpp (+2/-0)
tests/qmltests/Launcher/tst_Launcher.qml (+42/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/stripped-down-quicklist
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Approve
Unity8 CI Bot continuous-integration Needs Fixing
Ubuntu Unity PS integration team Pending
Review via email: mp+318219@code.launchpad.net

Commit message

hide "private" launcher quicklist entries when the greeter is locked

Description of the change

Prereq-archive: ppa:ci-train-ppa-service/2514

* Are there any related MPs required for this MP to build/function as expected? Please list.

https://code.launchpad.net/~mzanetti/unity-api/private-quicklist-entries/+merge/318220

 * Did you perform an exploratory manual test run of your code change and any related functionality?

yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

yes

 * If you changed the UI, has there been a design review?

no

To post a comment you must log in.
2839. By Michael Zanetti

fix clicking label in tryLauncher

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2839
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3206/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3206/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2839
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3245/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4262
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2534
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2534
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4290
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4124
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4124/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4124
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4124/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4124
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4124/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4124
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4124/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4124
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4124/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4124
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4124/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3245/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Code looks good except:

debian/control:
libunity-api-dev (>= 8.4)

the corresponding unity-api branch has 8.5

review: Needs Fixing
2840. By Michael Zanetti

bump version

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Code looks good except:
>
> debian/control:
> libunity-api-dev (>= 8.4)
>
> the corresponding unity-api branch has 8.5

fixed, thanks

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2840
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3279/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/4318/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4346
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4180
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4180/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4180
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4180/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4180/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4180
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4180/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4180
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4180/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4180
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4180/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3279/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Code looks good, just drop this from the test please:

+ print("model is", LauncherModel)

review: Needs Fixing
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2840
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3358/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4425
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2652
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2652
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4453
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4286
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4286/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4286
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4286/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4286
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4286/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4286
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4286/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4286
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4286/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4286
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4286/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3358/rebuild

review: Needs Fixing (continuous-integration)
2841. By Michael Zanetti

drop debug print

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Code looks good, just drop this from the test please:
>
> + print("model is", LauncherModel)

fixed, but looks like the tests have regressed, will fix that too

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2842. By Michael Zanetti

fix test

Revision history for this message
Michael Zanetti (mzanetti) wrote :

fixed the test

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2843. By Michael Zanetti

merge trunk

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

On a locked screen, the whole popup is hidden (is that intended?), but still you can remnants of it on screen (a little black arrow pointing from the hidden menu to the launcher icon)

review: Needs Fixing
2844. By Michael Zanetti

add a custom proxy model for the quicklist

UnitySortFilterProxyModel doesn't seem to be reliable enough with the RegExp(boolean)

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> On a locked screen, the whole popup is hidden (is that intended?), but still
> you can remnants of it on screen (a little black arrow pointing from the
> hidden menu to the launcher icon)

fixed

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

The "Unpin" menu entry is still present, although it should be hidden

review: Needs Fixing
2845. By Michael Zanetti

make pin/unpin private too

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Yup, this works fine now, only the CI run needs fixing

* Did you perform an exploratory manual test run of the code change and any related functionality?

Yes

* Did CI run pass? If not, please explain why.

Waiting

review: Approve
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

The CI is passing fine in the toplevel branch (https://code.launchpad.net/~mzanetti/unity8/surfacetitles-in-quicklist/+merge/318771), so it will have to do here as well due to unity-api woes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2017-02-21 13:23:14 +0000
3+++ CMakeLists.txt 2017-03-16 11:53:52 +0000
4@@ -74,7 +74,7 @@
5 pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
6 pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
7 pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
8-pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=11)
9+pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=12)
10 pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)
11 pkg_check_modules(GD3 REQUIRED gnome-desktop-3.0)
12 pkg_check_modules(UAL REQUIRED ubuntu-app-launch-3)
13
14=== modified file 'debian/control'
15--- debian/control 2017-02-08 19:53:52 +0000
16+++ debian/control 2017-03-16 11:53:52 +0000
17@@ -38,7 +38,7 @@
18 libubuntugestures5-private-dev (>= 1.3.2030),
19 libudev-dev,
20 libudm-common-dev,
21- libunity-api-dev (>= 8.2),
22+ libunity-api-dev (>= 8.5),
23 libusermetricsoutput1-dev,
24 # Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
25 libx11-dev[!arm64 !armhf],
26@@ -132,7 +132,7 @@
27 qtdeclarative5-qtmir-plugin (>= 0.4.8),
28 qtdeclarative5-ubuntu-telephony0.1,
29 ubuntu-system-settings (>= 0.4),
30- unity-launcher-impl-10,
31+ unity-launcher-impl-12,
32 unity8-common (= ${source:Version}),
33 unity8-private (= ${binary:Version}),
34 unity8-private | unity-launcher-impl,
35@@ -235,7 +235,7 @@
36 ${misc:Depends},
37 ${shlibs:Depends},
38 Provides: unity-launcher-impl,
39- unity-launcher-impl-10,
40+ unity-launcher-impl-12,
41 Description: Unity 8 private libs
42 The Unity 8 shell is the primary user interface for Ubuntu devices.
43 .
44
45=== modified file 'plugins/Greeter/Unity/Launcher/quicklistmodel.cpp'
46--- plugins/Greeter/Unity/Launcher/quicklistmodel.cpp 2015-02-11 14:11:26 +0000
47+++ plugins/Greeter/Unity/Launcher/quicklistmodel.cpp 2017-03-16 11:53:52 +0000
48@@ -65,6 +65,8 @@
49 return m_list.at(index.row()).icon();
50 case RoleClickable:
51 return m_list.at(index.row()).clickable();
52+ case RoleIsPrivate:
53+ return false; // The greeter plugin would just not add any private entries
54 }
55 return QVariant();
56 }
57
58=== modified file 'plugins/Unity/Launcher/launcheritem.cpp'
59--- plugins/Unity/Launcher/launcheritem.cpp 2016-11-30 10:32:23 +0000
60+++ plugins/Unity/Launcher/launcheritem.cpp 2017-03-16 11:53:52 +0000
61@@ -48,11 +48,13 @@
62 QuickListEntry pinningAction;
63 pinningAction.setActionId(QStringLiteral("pin_item"));
64 pinningAction.setText(gettext("Pin shortcut"));
65+ pinningAction.setIsPrivate(true);
66 m_quickList->appendAction(pinningAction);
67
68 m_quitAction.setActionId(QStringLiteral("stop_item"));
69 m_quitAction.setIcon(QStringLiteral("application-exit"));
70 m_quitAction.setText(gettext("Quit"));
71+ m_quitAction.setIsPrivate(true);
72 }
73
74 QString LauncherItem::appId() const
75@@ -120,6 +122,7 @@
76 QuickListEntry entry;
77 entry.setActionId(QStringLiteral("pin_item"));
78 entry.setText(pinned ? gettext("Unpin shortcut") : gettext("Pin shortcut"));
79+ entry.setIsPrivate(true);
80 m_quickList->updateAction(entry);
81 }
82
83
84=== modified file 'plugins/Unity/Launcher/quicklistentry.cpp'
85--- plugins/Unity/Launcher/quicklistentry.cpp 2016-10-27 13:00:34 +0000
86+++ plugins/Unity/Launcher/quicklistentry.cpp 2017-03-16 11:53:52 +0000
87@@ -20,6 +20,7 @@
88
89 QuickListEntry::QuickListEntry()
90 : m_hasSeparator(false)
91+ , m_isPrivate(false)
92 {
93 }
94
95@@ -72,3 +73,13 @@
96 {
97 return !other.actionId().isEmpty() && other.actionId() == m_actionId;
98 }
99+
100+bool QuickListEntry::isPrivate() const
101+{
102+ return m_isPrivate;
103+}
104+
105+void QuickListEntry::setIsPrivate(bool isPrivate)
106+{
107+ m_isPrivate = isPrivate;
108+}
109
110=== modified file 'plugins/Unity/Launcher/quicklistentry.h'
111--- plugins/Unity/Launcher/quicklistentry.h 2016-10-27 13:00:34 +0000
112+++ plugins/Unity/Launcher/quicklistentry.h 2017-03-16 11:53:52 +0000
113@@ -42,11 +42,15 @@
114
115 bool operator==(const QuickListEntry & other);
116
117+ bool isPrivate() const;
118+ void setIsPrivate(bool isPrivate);
119+
120 private:
121 QString m_actionId;
122 QString m_text;
123 QString m_icon;
124 bool m_hasSeparator;
125+ bool m_isPrivate;
126 };
127
128 #endif // QUICKLISTENTRY
129
130=== modified file 'plugins/Unity/Launcher/quicklistmodel.cpp'
131--- plugins/Unity/Launcher/quicklistmodel.cpp 2016-10-27 13:00:34 +0000
132+++ plugins/Unity/Launcher/quicklistmodel.cpp 2017-03-16 11:53:52 +0000
133@@ -81,6 +81,8 @@
134 return m_list.at(index.row()).clickable();
135 case RoleHasSeparator:
136 return m_list.at(index.row()).hasSeparator();
137+ case RoleIsPrivate:
138+ return m_list.at(index.row()).isPrivate();
139 }
140 return QVariant();
141 }
142
143=== modified file 'plugins/Utils/CMakeLists.txt'
144--- plugins/Utils/CMakeLists.txt 2017-01-26 09:32:20 +0000
145+++ plugins/Utils/CMakeLists.txt 2017-03-16 11:53:52 +0000
146@@ -36,6 +36,7 @@
147 URLDispatcher.cpp
148 tabfocusfence.cpp
149 expressionfiltermodel.cpp
150+ quicklistproxymodel.cpp
151 plugin.cpp
152 )
153
154
155=== modified file 'plugins/Utils/plugin.cpp'
156--- plugins/Utils/plugin.cpp 2017-01-26 09:32:20 +0000
157+++ plugins/Utils/plugin.cpp 2017-03-16 11:53:52 +0000
158@@ -42,6 +42,7 @@
159 #include "appdrawerproxymodel.h"
160 #include "tabfocusfence.h"
161 #include "expressionfiltermodel.h"
162+#include "quicklistproxymodel.h"
163
164 static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
165 {
166@@ -88,4 +89,5 @@
167 qmlRegisterType<AppDrawerProxyModel>(uri, 0, 1, "AppDrawerProxyModel");
168 qmlRegisterType<TabFocusFenceItem>(uri, 0, 1, "TabFocusFence");
169 qmlRegisterType<ExpressionFilterModel>(uri, 0, 1, "ExpressionFilterModel");
170+ qmlRegisterType<QuickListProxyModel>(uri, 0, 1, "QuickListProxyModel");
171 }
172
173=== added file 'plugins/Utils/quicklistproxymodel.cpp'
174--- plugins/Utils/quicklistproxymodel.cpp 1970-01-01 00:00:00 +0000
175+++ plugins/Utils/quicklistproxymodel.cpp 2017-03-16 11:53:52 +0000
176@@ -0,0 +1,72 @@
177+/*
178+ * Copyright (C) 2017 Canonical, Ltd.
179+ *
180+ * This program is free software; you can redistribute it and/or modify
181+ * it under the terms of the GNU General Public License as published by
182+ * the Free Software Foundation; version 3.
183+ *
184+ * This program is distributed in the hope that it will be useful,
185+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
186+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
187+ * GNU General Public License for more details.
188+ *
189+ * You should have received a copy of the GNU General Public License
190+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
191+ */
192+
193+#include "quicklistproxymodel.h"
194+
195+#include <QDebug>
196+
197+QuickListProxyModel::QuickListProxyModel(QObject *parent):
198+ QSortFilterProxyModel(parent)
199+{
200+ connect(this, &QAbstractListModel::rowsInserted, this, &QuickListProxyModel::countChanged);
201+ connect(this, &QAbstractListModel::rowsRemoved, this, &QuickListProxyModel::countChanged);
202+ connect(this, &QAbstractListModel::layoutChanged, this, &QuickListProxyModel::countChanged);
203+}
204+
205+QAbstractItemModel *QuickListProxyModel::source() const
206+{
207+ return m_source;
208+}
209+
210+bool QuickListProxyModel::privateMode() const
211+{
212+ return m_privateMode;
213+}
214+
215+void QuickListProxyModel::setPrivateMode(bool privateMode)
216+{
217+ if (m_privateMode != privateMode) {
218+ m_privateMode = privateMode;
219+ invalidateFilter();
220+ Q_EMIT privateModeChanged();
221+ }
222+}
223+
224+void QuickListProxyModel::setSource(QAbstractItemModel *source)
225+{
226+ if (m_source != source) {
227+ m_source = source;
228+ setSourceModel(m_source);
229+ connect(m_source, &QAbstractItemModel::rowsRemoved, this, &QuickListProxyModel::invalidate);
230+ connect(m_source, &QAbstractItemModel::rowsInserted, this, &QuickListProxyModel::invalidate);
231+ Q_EMIT sourceChanged();
232+ }
233+}
234+
235+int QuickListProxyModel::count() const
236+{
237+ return rowCount();
238+}
239+
240+bool QuickListProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
241+{
242+ Q_UNUSED(source_parent)
243+
244+ if (m_privateMode) {
245+ return !m_source->data(m_source->index(source_row, 0), QuickListModelInterface::RoleIsPrivate).toBool();
246+ }
247+ return true;
248+}
249
250=== added file 'plugins/Utils/quicklistproxymodel.h'
251--- plugins/Utils/quicklistproxymodel.h 1970-01-01 00:00:00 +0000
252+++ plugins/Utils/quicklistproxymodel.h 2017-03-16 11:53:52 +0000
253@@ -0,0 +1,52 @@
254+/*
255+ * Copyright (C) 2017 Canonical, Ltd.
256+ *
257+ * This program is free software; you can redistribute it and/or modify
258+ * it under the terms of the GNU General Public License as published by
259+ * the Free Software Foundation; version 3.
260+ *
261+ * This program is distributed in the hope that it will be useful,
262+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
263+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
264+ * GNU General Public License for more details.
265+ *
266+ * You should have received a copy of the GNU General Public License
267+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
268+ */
269+
270+#include <QSortFilterProxyModel>
271+
272+#include <unity/shell/launcher/QuickListModelInterface.h>
273+
274+using namespace unity::shell::launcher;
275+
276+class QuickListProxyModel: public QSortFilterProxyModel
277+{
278+ Q_OBJECT
279+ Q_PROPERTY(QAbstractItemModel* source READ source WRITE setSource NOTIFY sourceChanged)
280+ Q_PROPERTY(bool privateMode READ privateMode WRITE setPrivateMode NOTIFY privateModeChanged)
281+ Q_PROPERTY(int count READ count NOTIFY countChanged)
282+
283+public:
284+ QuickListProxyModel(QObject* parent = nullptr);
285+
286+ QAbstractItemModel* source() const;
287+ void setSource(QAbstractItemModel* source);
288+
289+ bool privateMode() const;
290+ void setPrivateMode(bool privateMode);
291+
292+ int count() const;
293+
294+protected:
295+ bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
296+
297+Q_SIGNALS:
298+ void sourceChanged();
299+ void privateModeChanged();
300+ void countChanged();
301+
302+private:
303+ QAbstractItemModel* m_source = nullptr;
304+ bool m_privateMode;
305+};
306
307=== modified file 'qml/Launcher/Launcher.qml'
308--- qml/Launcher/Launcher.qml 2017-02-24 10:44:53 +0000
309+++ qml/Launcher/Launcher.qml 2017-03-16 11:53:52 +0000
310@@ -33,6 +33,7 @@
311 property Item blurSource: null
312 property int topPanelHeight: 0
313 property bool drawerEnabled: true
314+ property alias privateMode: panel.privateMode
315
316 property int panelWidth: units.gu(10)
317 property int dragAreaWidth: units.gu(1)
318
319=== modified file 'qml/Launcher/LauncherPanel.qml'
320--- qml/Launcher/LauncherPanel.qml 2017-02-28 12:58:42 +0000
321+++ qml/Launcher/LauncherPanel.qml 2017-03-16 11:53:52 +0000
322@@ -19,6 +19,7 @@
323 import Ubuntu.Components 1.3
324 import Unity.Launcher 0.1
325 import Ubuntu.Components.Popups 1.3
326+import Utils 0.1
327 import "../Components"
328
329 Rectangle {
330@@ -29,6 +30,7 @@
331
332 property var model
333 property bool inverted: false
334+ property bool privateMode: false
335 property bool dragging: false
336 property bool moving: launcherListView.moving || launcherListView.flicking
337 property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed
338@@ -811,7 +813,11 @@
339
340 Repeater {
341 id: popoverRepeater
342- model: quickList.model
343+ objectName: "popoverRepeater"
344+ model: QuickListProxyModel {
345+ source: quickList.model
346+ privateMode: root.privateMode
347+ }
348
349 ListItem {
350 objectName: "quickListEntry" + index
351
352=== modified file 'qml/Shell.qml'
353--- qml/Shell.qml 2017-02-21 16:21:34 +0000
354+++ qml/Shell.qml 2017-03-16 11:53:52 +0000
355@@ -559,6 +559,7 @@
356 blurSource: greeter.shown ? greeter : stages
357 topPanelHeight: panel.panelHeight
358 drawerEnabled: !greeter.active
359+ privateMode: greeter.active
360
361 onShowDashHome: showHome()
362 onLauncherApplicationSelected: {
363
364=== modified file 'tests/mocks/Unity/Launcher/MockLauncherModel.h'
365--- tests/mocks/Unity/Launcher/MockLauncherModel.h 2016-05-13 11:14:15 +0000
366+++ tests/mocks/Unity/Launcher/MockLauncherModel.h 2017-03-16 11:53:52 +0000
367@@ -28,7 +28,7 @@
368
369 class MockLauncherModel: public LauncherModelInterface
370 {
371- Q_OBJECT
372+ Q_OBJECT
373
374 public:
375 MockLauncherModel(QObject* parent = 0);
376
377=== modified file 'tests/mocks/Unity/Launcher/MockQuickListModel.cpp'
378--- tests/mocks/Unity/Launcher/MockQuickListModel.cpp 2016-10-27 13:00:34 +0000
379+++ tests/mocks/Unity/Launcher/MockQuickListModel.cpp 2017-03-16 11:53:52 +0000
380@@ -39,6 +39,8 @@
381 return index.row() == 1 ? false : true;
382 case RoleHasSeparator:
383 return index.row() <= 1 ? true : false;
384+ case RoleIsPrivate:
385+ return index.row() == 4 ? true : false;
386 }
387 return QVariant();
388 }
389@@ -46,5 +48,5 @@
390 int MockQuickListModel::rowCount(const QModelIndex &parent) const
391 {
392 Q_UNUSED(parent)
393- return 4;
394+ return 5;
395 }
396
397=== modified file 'tests/mocks/Unity/Launcher/MockQuickListModel.h'
398--- tests/mocks/Unity/Launcher/MockQuickListModel.h 2015-04-30 09:31:51 +0000
399+++ tests/mocks/Unity/Launcher/MockQuickListModel.h 2017-03-16 11:53:52 +0000
400@@ -27,6 +27,8 @@
401 class MockQuickListModel: public QuickListModelInterface
402 {
403 Q_OBJECT
404+ Q_PROPERTY(int count READ rowCount)
405+
406 public:
407 MockQuickListModel(QObject *parent = 0);
408
409
410=== modified file 'tests/mocks/Utils/CMakeLists.txt'
411--- tests/mocks/Utils/CMakeLists.txt 2017-01-26 09:32:20 +0000
412+++ tests/mocks/Utils/CMakeLists.txt 2017-03-16 11:53:52 +0000
413@@ -27,6 +27,7 @@
414 ${CMAKE_SOURCE_DIR}/plugins/Utils/appdrawerproxymodel.cpp
415 ${CMAKE_SOURCE_DIR}/plugins/Utils/tabfocusfence.cpp
416 ${CMAKE_SOURCE_DIR}/plugins/Utils/expressionfiltermodel.cpp
417+ ${CMAKE_SOURCE_DIR}/plugins/Utils/quicklistproxymodel.cpp
418 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
419 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
420 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceInterface.h
421@@ -35,6 +36,7 @@
422 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/AppDrawerModelInterface.h
423 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherModelInterface.h
424 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherItemInterface.h
425+ ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/QuickListModelInterface.h
426 constants.cpp
427 plugin.cpp
428 windowstatestorage.cpp
429
430=== modified file 'tests/mocks/Utils/plugin.cpp'
431--- tests/mocks/Utils/plugin.cpp 2017-01-26 09:32:20 +0000
432+++ tests/mocks/Utils/plugin.cpp 2017-03-16 11:53:52 +0000
433@@ -43,6 +43,7 @@
434 #include <appdrawerproxymodel.h>
435 #include <tabfocusfence.h>
436 #include <expressionfiltermodel.h>
437+#include <quicklistproxymodel.h>
438
439 static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
440 {
441@@ -88,4 +89,5 @@
442 qmlRegisterType<AppDrawerProxyModel>(uri, 0, 1, "AppDrawerProxyModel");
443 qmlRegisterType<TabFocusFenceItem>(uri, 0, 1, "TabFocusFence");
444 qmlRegisterType<ExpressionFilterModel>(uri, 0, 1, "ExpressionFilterModel");
445+ qmlRegisterType<QuickListProxyModel>(uri, 0, 1, "QuickListProxyModel");
446 }
447
448=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
449--- tests/qmltests/Launcher/tst_Launcher.qml 2017-01-26 09:09:18 +0000
450+++ tests/qmltests/Launcher/tst_Launcher.qml 2017-03-16 11:53:52 +0000
451@@ -97,6 +97,11 @@
452 }
453 Binding {
454 target: launcherLoader.item
455+ property: "privateMode"
456+ value: privateModeCheckBox.checked
457+ }
458+ Binding {
459+ target: launcherLoader.item
460 property: "panelWidth"
461 value: units.gu(Math.round(widthSlider.value))
462 }
463@@ -120,6 +125,20 @@
464 }
465 }
466
467+ RowLayout {
468+ CheckBox {
469+ id: privateModeCheckBox
470+ checked: false
471+ }
472+ Label {
473+ text: "Private mode (lockscreen locked)"
474+ AbstractButton {
475+ anchors.fill: parent
476+ onClicked: privateModeCheckBox.checked = !privateModeCheckBox.checked
477+ }
478+ }
479+ }
480+
481 Slider {
482 id: widthSlider
483 Layout.fillWidth: true
484@@ -1242,6 +1261,7 @@
485 keyClick(Qt.Key_Down);
486 keyClick(Qt.Key_Down);
487 keyClick(Qt.Key_Down);
488+ keyClick(Qt.Key_Down);
489 tryCompare(quickList, "selectedIndex", 0)
490
491 // Left gets us back to the launcher
492@@ -1493,6 +1513,28 @@
493 compare(launcher.state, "visibleTemporary");
494 }
495
496+ function test_hideQuicklistItemsInPrivateModel_data() {
497+ return [
498+ { tag: "private mode", private: true },
499+ { tag: "normal mode", private: false }
500+ ];
501+ }
502+
503+ function test_hideQuicklistItemsInPrivateModel(data) {
504+ privateModeCheckBox.checked = data.private;
505+
506+ revealByEdgePush();
507+
508+ var item = findChild(launcher, "launcherDelegate4");
509+ var quickListShape = findChild(launcher, "quickListShape")
510+
511+ mousePress(item)
512+ tryCompare(quickListShape, "visible", true)
513+
514+ var repeater = findChild(launcher, "popoverRepeater");
515+ tryCompare(repeater, "count", LauncherModel.get(4).quickList.count - (data.private ? 1 : 0))
516+ }
517+
518 function test_hintOnSizeChange() {
519 var oldSize = launcher.panelWidth;
520 launcher.maxPanelX = -launcher.panelWidth;

Subscribers

People subscribed via source and target branches