Merge lp:~mzanetti/unity-api/appdrawermodelinterface into lp:unity-api

Proposed by Michael Zanetti
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 263
Merged at revision: 257
Proposed branch: lp:~mzanetti/unity-api/appdrawermodelinterface
Merge into: lp:unity-api
Prerequisite: lp:~ci-train-bot/unity-api/unity-api-ubuntu-zesty-2202
Diff against target: 471 lines (+273/-11)
11 files modified
debian/changelog (+6/-0)
include/unity/shell/launcher/AppDrawerModelInterface.h (+71/-0)
include/unity/shell/launcher/CMakeLists.txt (+1/-1)
include/unity/shell/launcher/LauncherItemInterface.h (+10/-6)
test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt (+2/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp (+89/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h (+38/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp (+14/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h (+6/-0)
test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp (+4/-0)
test/qmltest/unity/shell/launcher/tst_Launcher.qml (+32/-4)
To merge this branch: bzr merge lp:~mzanetti/unity-api/appdrawermodelinterface
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Approve
Unity8 CI Bot continuous-integration Approve
Ubuntu Unity PS integration team Pending
Review via email: mp+312140@code.launchpad.net

This proposal supersedes a proposal from 2016-11-04.

Commit message

Add AppDrawerModelInterface

Description of the change

Requires: lp:~mzanetti/unity8/appdrawer

See silo 2150 for working builds.

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:261
https://unity8-jenkins.ubuntu.com/job/lp-unity-api-ci/111/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/3382/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3410
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3261/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3261/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3261/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3261/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3261/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3261/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3261/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3261
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3261/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3261/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

LGTM, works fine with the u8 appdrawer branch

CI failing because of lp:1642673, passing locally

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

PASSED: Continuous integration, rev:263
https://unity8-jenkins.ubuntu.com/job/lp-unity-api-ci/115/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3427
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3455
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3302/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3302
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3302/artifact/output/*zip*/output.zip

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

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

Re-approving after after having been resubmitted

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-11-30 10:47:05 +0000
3+++ debian/changelog 2016-11-30 10:47:05 +0000
4@@ -1,3 +1,9 @@
5+unity-api (7.121) UNRELEASED; urgency=medium
6+
7+ * Add AppDrawerModelInterface
8+
9+ -- Michael Zanetti <michael.zanetti@canonical.com> Thu, 10 Nov 2016 19:14:25 +0100
10+
11 unity-api (7.120+17.04.20161123-0ubuntu1) zesty; urgency=medium
12
13 [ Andrea Azzarone ]
14
15=== added file 'include/unity/shell/launcher/AppDrawerModelInterface.h'
16--- include/unity/shell/launcher/AppDrawerModelInterface.h 1970-01-01 00:00:00 +0000
17+++ include/unity/shell/launcher/AppDrawerModelInterface.h 2016-11-30 10:47:05 +0000
18@@ -0,0 +1,71 @@
19+/*
20+ * Copyright 2016 Canonical Ltd.
21+ *
22+ * This program is free software; you can redistribute it and/or modify
23+ * it under the terms of the GNU Lesser General Public License as published by
24+ * the Free Software Foundation; version 3.
25+ *
26+ * This program is distributed in the hope that it will be useful,
27+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+ * GNU Lesser General Public License for more details.
30+ *
31+ * You should have received a copy of the GNU Lesser General Public License
32+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33+ */
34+
35+#pragma once
36+
37+#include <unity/SymbolExport.h>
38+
39+#include <QAbstractListModel>
40+
41+namespace unity {
42+namespace shell {
43+namespace launcher {
44+
45+/**
46+ * @brief A list of app drawer items to be displayed
47+ *
48+ * This model exposes all the items that should be shown in the app drawer.
49+ */
50+class UNITY_API AppDrawerModelInterface: public QAbstractListModel
51+{
52+ Q_OBJECT
53+ Q_ENUMS(Roles)
54+public:
55+ /**
56+ * @brief The Roles supported by the model
57+ *
58+ * See LauncherItemInterface properties for details.
59+ */
60+ enum Roles {
61+ RoleAppId,
62+ RoleName,
63+ RoleIcon,
64+ RoleKeywords,
65+ RoleUsage
66+ };
67+
68+ /// @cond
69+ AppDrawerModelInterface(QObject* parent = nullptr): QAbstractListModel(parent) {}
70+ /// @endcond
71+
72+ virtual ~AppDrawerModelInterface() {}
73+
74+ /// @cond
75+ QHash<int, QByteArray> roleNames() const override {
76+ QHash<int, QByteArray> roles;
77+ roles.insert(RoleAppId, "appId");
78+ roles.insert(RoleName, "name");
79+ roles.insert(RoleIcon, "icon");
80+ roles.insert(RoleKeywords, "keywords");
81+ roles.insert(RoleUsage, "usage");
82+ return roles;
83+ }
84+ /// @endcond
85+};
86+
87+}
88+}
89+}
90
91=== modified file 'include/unity/shell/launcher/CMakeLists.txt'
92--- include/unity/shell/launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000
93+++ include/unity/shell/launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000
94@@ -7,7 +7,7 @@
95
96 set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
97
98-set(VERSION 10)
99+set(VERSION 11)
100 set(PKGCONFIG_NAME "unity-shell-launcher")
101 set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs")
102 set(PKGCONFIG_REQUIRES "Qt5Core")
103
104=== modified file 'include/unity/shell/launcher/LauncherItemInterface.h'
105--- include/unity/shell/launcher/LauncherItemInterface.h 2016-05-11 10:48:13 +0000
106+++ include/unity/shell/launcher/LauncherItemInterface.h 2016-11-30 10:47:05 +0000
107@@ -1,5 +1,5 @@
108 /*
109- * Copyright 2013 Canonical Ltd.
110+ * Copyright 2013-2106 Canonical Ltd.
111 *
112 * This program is free software; you can redistribute it and/or modify
113 * it under the terms of the GNU Lesser General Public License as published by
114@@ -12,9 +12,6 @@
115 *
116 * You should have received a copy of the GNU Lesser General Public License
117 * along with this program. If not, see <http://www.gnu.org/licenses/>.
118- *
119- * Authors:
120- * Michael Zanetti <michael.zanetti@canonical.com>
121 */
122
123 #ifndef UNITY_SHELL_LAUNCHER_LAUNCHERITEM_H
124@@ -52,12 +49,17 @@
125 /**
126 * @brief The user visible name of the item.
127 */
128- Q_PROPERTY(QString name READ name CONSTANT)
129+ Q_PROPERTY(QString name READ name NOTIFY nameChanged)
130
131 /**
132 * @brief The full path to the icon to be shown for the item.
133 */
134- Q_PROPERTY(QString icon READ icon CONSTANT)
135+ Q_PROPERTY(QString icon READ icon NOTIFY iconChanged)
136+
137+ /**
138+ * @brief The keywords for this item.
139+ */
140+ Q_PROPERTY(QStringList keywords READ keywords NOTIFY keywordsChanged)
141
142 /**
143 * @brief A flag whether the item is pinned or not
144@@ -137,6 +139,7 @@
145 virtual QString appId() const = 0;
146 virtual QString name() const = 0;
147 virtual QString icon() const = 0;
148+ virtual QStringList keywords() const = 0;
149 virtual bool pinned() const = 0;
150 virtual bool running() const = 0;
151 virtual bool recent() const = 0;
152@@ -151,6 +154,7 @@
153 Q_SIGNALS:
154 void nameChanged(const QString &name);
155 void iconChanged(const QString &icon);
156+ void keywordsChanged(const QStringList &keywords);
157 void pinnedChanged(bool pinned);
158 void runningChanged(bool running);
159 void recentChanged(bool running);
160
161=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt'
162--- test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2014-09-03 22:59:26 +0000
163+++ test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000
164@@ -16,11 +16,13 @@
165 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherModelInterface.h
166 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherItemInterface.h
167 ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/QuickListModelInterface.h
168+ ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/AppDrawerModelInterface.h
169 ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationManagerInterface.h
170 ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationInfoInterface.h
171 Mocks/MockLauncherModel.cpp
172 Mocks/MockLauncherItem.cpp
173 Mocks/MockQuickListModel.cpp
174+ Mocks/MockAppDrawerModel.cpp
175 ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationManager.cpp
176 ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationInfo.cpp
177 )
178
179=== added file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp'
180--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp 1970-01-01 00:00:00 +0000
181+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp 2016-11-30 10:47:05 +0000
182@@ -0,0 +1,89 @@
183+/*
184+ * Copyright 2016 Canonical Ltd.
185+ *
186+ * This program is free software; you can redistribute it and/or modify
187+ * it under the terms of the GNU Lesser General Public License as published by
188+ * the Free Software Foundation; version 3.
189+ *
190+ * This program is distributed in the hope that it will be useful,
191+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
192+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
193+ * GNU Lesser General Public License for more details.
194+ *
195+ * You should have received a copy of the GNU Lesser General Public License
196+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
197+ */
198+
199+#include <Mocks/MockAppDrawerModel.h>
200+#include <Mocks/MockLauncherItem.h>
201+
202+using namespace unity::shell::launcher;
203+
204+MockAppDrawerModel::MockAppDrawerModel(QObject* parent): AppDrawerModelInterface(parent)
205+{
206+ MockLauncherItem *item = new MockLauncherItem("phone-app", "/usr/share/applications/phone-app.desktop", "Phone", "phone-app", this);
207+ item->setKeywords({"keyword1", "keyword2"});
208+ m_list.append(item);
209+ item = new MockLauncherItem("camera-app", "/usr/share/applications/camera-app.desktop", "Camera", "camera", this);
210+ item->setKeywords({"keyword1", "keyword2"});
211+ m_list.append(item);
212+ item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery", this);
213+ item->setKeywords({"keyword1", "keyword2"});
214+ m_list.append(item);
215+ item = new MockLauncherItem("facebook-webapp", "/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook", this);
216+ item->setKeywords({"keyword1", "keyword2"});
217+ m_list.append(item);
218+ item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser", this);
219+ item->setKeywords({"keyword1", "keyword2"});
220+ m_list.append(item);
221+ item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter", this);
222+ item->setKeywords({"keyword1", "keyword2"});
223+ m_list.append(item);
224+ item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail", this);
225+ item->setKeywords({"keyword1", "keyword2"});
226+ m_list.append(item);
227+ item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this);
228+ item->setKeywords({"keyword1", "keyword2"});
229+ m_list.append(item);
230+ item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this);
231+ item->setKeywords({"keyword1", "keyword2"});
232+ m_list.append(item);
233+ item = new MockLauncherItem("ubuntu-calendar-app", "/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar", this);
234+ item->setKeywords({"keyword1", "keyword2"});
235+ m_list.append(item);
236+}
237+
238+MockAppDrawerModel::~MockAppDrawerModel()
239+{
240+ while (!m_list.empty())
241+ {
242+ m_list.takeFirst()->deleteLater();
243+ }
244+}
245+
246+// cppcheck-suppress unusedFunction
247+int MockAppDrawerModel::rowCount(const QModelIndex& parent) const
248+{
249+ Q_UNUSED(parent)
250+ return m_list.count();
251+}
252+
253+QVariant MockAppDrawerModel::data(const QModelIndex& index, int role) const
254+{
255+ LauncherItemInterface *item = m_list.at(index.row());
256+ switch(role)
257+ {
258+ case RoleAppId:
259+ return item->appId();
260+ case RoleName:
261+ return item->name();
262+ case RoleIcon:
263+ return item->icon();
264+ case RoleKeywords:
265+ return item->keywords();
266+ case RoleUsage:
267+ return 1;
268+ }
269+
270+ return QVariant();
271+}
272
273=== added file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h'
274--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h 1970-01-01 00:00:00 +0000
275+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h 2016-11-30 10:47:05 +0000
276@@ -0,0 +1,38 @@
277+/*
278+ * Copyright 2016 Canonical Ltd.
279+ *
280+ * This program is free software; you can redistribute it and/or modify
281+ * it under the terms of the GNU Lesser General Public License as published by
282+ * the Free Software Foundation; version 3.
283+ *
284+ * This program is distributed in the hope that it will be useful,
285+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
286+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
287+ * GNU Lesser General Public License for more details.
288+ *
289+ * You should have received a copy of the GNU Lesser General Public License
290+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
291+ */
292+
293+#pragma once
294+
295+#include <AppDrawerModelInterface.h>
296+
297+class MockLauncherItem;
298+
299+using namespace unity::shell::launcher;
300+
301+class UNITY_API MockAppDrawerModel: public AppDrawerModelInterface
302+{
303+ Q_OBJECT
304+
305+public:
306+ MockAppDrawerModel(QObject* parent = 0);
307+ ~MockAppDrawerModel();
308+
309+ int rowCount(const QModelIndex& parent) const override;
310+ QVariant data(const QModelIndex& index, int role) const override;
311+
312+private:
313+ QList<MockLauncherItem*> m_list;
314+};
315
316=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp'
317--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-05-18 13:43:40 +0000
318+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-11-30 10:47:05 +0000
319@@ -61,6 +61,20 @@
320 return m_icon;
321 }
322
323+QStringList MockLauncherItem::keywords() const
324+{
325+ return m_keywords;
326+}
327+
328+void MockLauncherItem::setKeywords(const QStringList &keywords)
329+{
330+ if (m_keywords != keywords)
331+ {
332+ m_keywords = keywords;
333+ Q_EMIT keywordsChanged(m_keywords);
334+ }
335+}
336+
337 bool MockLauncherItem::pinned() const
338 {
339 return m_pinned;
340
341=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h'
342--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-05-18 13:43:40 +0000
343+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-11-30 10:47:05 +0000
344@@ -22,6 +22,8 @@
345
346 #include <LauncherItemInterface.h>
347
348+#include <QStringList>
349+
350 using namespace unity::shell::launcher;
351
352 class UNITY_API MockLauncherItem: public LauncherItemInterface
353@@ -35,6 +37,9 @@
354 QString name() const;
355 QString icon() const;
356
357+ QStringList keywords() const;
358+ void setKeywords(const QStringList &keywords);
359+
360 bool pinned() const;
361 void setPinned(bool pinned);
362
363@@ -67,6 +72,7 @@
364 QString m_desktopFile;
365 QString m_name;
366 QString m_icon;
367+ QStringList m_keywords;
368 bool m_pinned;
369 bool m_running;
370 bool m_recent;
371
372=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp'
373--- test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp 2013-09-11 15:28:22 +0000
374+++ test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp 2016-11-30 10:47:05 +0000
375@@ -21,9 +21,11 @@
376 #include <Mocks/MockLauncherModel.h>
377 #include <Mocks/MockLauncherItem.h>
378 #include <Mocks/MockQuickListModel.h>
379+#include <Mocks/MockAppDrawerModel.h>
380
381 #include <LauncherModelInterface.h>
382 #include <LauncherItemInterface.h>
383+#include <AppDrawerModelInterface.h>
384
385 #include <QtQml/qqml.h>
386
387@@ -42,10 +44,12 @@
388 qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Interface for the LauncherModel");
389 qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Interface for the LauncherItem");
390 qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListModelInterface", "Interface for the QuickListModel");
391+ qmlRegisterUncreatableType<AppDrawerModelInterface>(uri, 0, 1, "AppDrawerModelInterface", "Interface for the AppDrawerModel");
392
393 qmlRegisterSingletonType<MockLauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);
394 qmlRegisterUncreatableType<MockLauncherItem>(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel");
395 qmlRegisterUncreatableType<MockQuickListModel>(uri, 0, 1, "QuickListModel", "Can't create QuickListModels in QML. Get them from the LauncherItems");
396+ qmlRegisterType<MockAppDrawerModel>(uri, 0, 1, "AppDrawerModel");
397
398 // Need to register the appmanager here ourselves as there won't be a real AppManager plugin in this test
399 qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager");
400
401=== modified file 'test/qmltest/unity/shell/launcher/tst_Launcher.qml'
402--- test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-11-30 10:47:05 +0000
403+++ test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-11-30 10:47:05 +0000
404@@ -1,5 +1,5 @@
405 /*
406- * Copyright 2013 Canonical Ltd.
407+ * Copyright 2013-2016 Canonical Ltd.
408 *
409 * This program is free software; you can redistribute it and/or modify
410 * it under the terms of the GNU Lesser General Public License as published by
411@@ -12,9 +12,6 @@
412 *
413 * You should have received a copy of the GNU Lesser General Public License
414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
415- *
416- * Authors:
417- * Michael Zanetti <michael.zanetti@canonical.com>
418 */
419
420 import QtQuick 2.0
421@@ -67,6 +64,15 @@
422 }
423 }
424
425+
426+ Repeater {
427+ id: appDrawerRepeater
428+ model: AppDrawerModel {}
429+ delegate: Item {
430+ property var roles: model
431+ }
432+ }
433+
434 function initTestCase() {
435 if (repeater.count < 5) {
436 print("This Test Suite requires at least 5 items in the model.")
437@@ -138,6 +144,7 @@
438 { tag: "Item.properties[appId]", constant: "appId", type: "string" },
439 { tag: "Item.properties[name]", constant: "name", type: "string" },
440 { tag: "Item.properties[icon]", constant: "icon", type: "string" },
441+ { tag: "Item.properties[keywords]", constant: "keywords", type: "object" },
442 { tag: "Item.properties[pinned]", property: "pinned", type: "boolean" },
443 { tag: "Item.properties[recent]", property: "recent", type: "boolean" },
444 { tag: "Item.properties[running]", property: "running", type: "boolean" },
445@@ -182,5 +189,26 @@
446
447 verifyData(data);
448 }
449+
450+ function test_appdrawer_model_roles_data() {
451+ return [
452+ { tag: "Model.roles[appId]", role: "appId", type: "string" },
453+ { tag: "Model.roles[name]", role: "name", type: "string" },
454+ { tag: "Model.roles[icon]", role: "icon", type: "string" },
455+ { tag: "Model.roles[keywords]", role: "keywords", type: "object" },
456+ { tag: "Model.roles[usage]", role: "usage", type: "number" },
457+ ];
458+ }
459+
460+ function test_appdrawer_model_roles(data) {
461+ name = "AppDrawerModel"
462+ try {
463+ object = appDrawerRepeater.itemAt(0).roles;
464+ } catch(err) {
465+ object = undefined;
466+ }
467+
468+ verifyData(data);
469+ }
470 }
471 }

Subscribers

People subscribed via source and target branches

to all changes: