Merge lp:~unity-team/unity-api/scopes-v4 into lp:unity-api

Proposed by Michal Hruby
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 172
Merged at revision: 152
Proposed branch: lp:~unity-team/unity-api/scopes-v4
Merge into: lp:unity-api
Prerequisite: lp:~unity-team/unity-api/scopes-v3
Diff against target: 943 lines (+233/-124)
14 files modified
debian/changelog (+6/-0)
include/unity/shell/scopes/CMakeLists.txt (+1/-1)
include/unity/shell/scopes/NavigationInterface.h (+28/-21)
include/unity/shell/scopes/ScopeInterface.h (+65/-28)
include/unity/shell/scopes/ScopesInterface.h (+7/-2)
test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt (+1/-1)
test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp (+9/-4)
test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.h (+5/-4)
test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp (+49/-18)
test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h (+16/-8)
test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.cpp (+9/-6)
test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.h (+1/-0)
test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp (+2/-2)
test/qmltest/unity/shell/scopes/tst_Scopes.qml (+34/-29)
To merge this branch: bzr merge lp:~unity-team/unity-api/scopes-v4
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+228346@code.launchpad.net

Commit message

Scopes interface v4.

Description of the change

Scopes interface v4.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
157. By Michal Hruby

Added one more property

158. By Michal Hruby

Merge status addition

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
159. By Pete Woods

Just the one status code, simplified list of statuses

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Looks fine.

review: Approve
lp:~unity-team/unity-api/scopes-v4 updated
160. By Michal Hruby

Added interface for favouriting a scope

161. By Michal Hruby

Fix tests

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
162. By Michal Hruby

s/isFavorited/favorite/

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Still good.

review: Approve
lp:~unity-team/unity-api/scopes-v4 updated
163. By Michal Hruby

Added parentQuery property

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
164. By Michal Hruby

Fix docs

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
165. By Michal Hruby

Change the favoriting to a single property

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
166. By Michal Hruby

Added hidden property to NavigationInterface

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
167. By Michal Hruby

Bump version

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
168. By Michal Hruby

Drop the visible role and property

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
169. By Michal Hruby

Added count property on the Scopes model

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Please drop activateApplication signal as per discussions on IRC.

review: Needs Fixing
lp:~unity-team/unity-api/scopes-v4 updated
170. By Michal Hruby

Revert addition of the query properties

171. By Michal Hruby

Added setNavigationState

Revision history for this message
Michał Sawicz (saviq) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~unity-team/unity-api/scopes-v4 updated
172. By Michal Hruby

Added Scope::refresh() method

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Yeah, good.

review: Approve
Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks sane :)

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 2014-07-31 11:14:00 +0000
3+++ debian/changelog 2014-08-04 15:59:28 +0000
4@@ -1,3 +1,9 @@
5+unity-api (7.88-0ubuntu1) UNRELEASED; urgency=medium
6+
7+ * Define scopes interface version 4
8+
9+ -- Michal Hruby <michal.hruby@canonical.com> Fri, 01 Aug 2014 08:39:21 +0100
10+
11 unity-api (7.87+14.10.20140731-0ubuntu1) utopic; urgency=medium
12
13 [ Michal Hruby ]
14
15=== modified file 'include/unity/shell/scopes/CMakeLists.txt'
16--- include/unity/shell/scopes/CMakeLists.txt 2014-07-18 12:15:12 +0000
17+++ include/unity/shell/scopes/CMakeLists.txt 2014-08-04 15:59:28 +0000
18@@ -7,7 +7,7 @@
19
20 set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
21
22-set(VERSION 3)
23+set(VERSION 4)
24 set(PKGCONFIG_NAME "unity-shell-scopes")
25 set(PKGCONFIG_DESCRIPTION "Unity shell Scopes APIs")
26 set(PKGCONFIG_REQUIRES "Qt5Core")
27
28=== renamed file 'include/unity/shell/scopes/DepartmentInterface.h' => 'include/unity/shell/scopes/NavigationInterface.h'
29--- include/unity/shell/scopes/DepartmentInterface.h 2014-05-29 10:24:53 +0000
30+++ include/unity/shell/scopes/NavigationInterface.h 2014-08-04 15:59:28 +0000
31@@ -14,8 +14,8 @@
32 * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 */
34
35-#ifndef UNITY_SHELL_SCOPES_DEPARTMENTINTERFACE_H
36-#define UNITY_SHELL_SCOPES_DEPARTMENTINTERFACE_H
37+#ifndef UNITY_SHELL_SCOPES_NAVIGATIONINTERFACE_H
38+#define UNITY_SHELL_SCOPES_NAVIGATIONINTERFACE_H
39
40 #include <unity/SymbolExport.h>
41
42@@ -31,55 +31,60 @@
43 /**
44 * @brief Object representing department instance, which exposes model(s) with results.
45 */
46-class UNITY_API DepartmentInterface : public QAbstractListModel
47+class UNITY_API NavigationInterface : public QAbstractListModel
48 {
49 Q_OBJECT
50
51 Q_ENUMS(Roles)
52
53 /**
54- * @brief Id of the department.
55+ * @brief Id of the navigation.
56 */
57- Q_PROPERTY(QString departmentId READ departmentId NOTIFY departmentIdChanged)
58+ Q_PROPERTY(QString navigationId READ navigationId NOTIFY navigationIdChanged)
59
60 /**
61- * @brief Label of the department.
62+ * @brief Label of the navigation.
63 */
64 Q_PROPERTY(QString label READ label NOTIFY labelChanged)
65
66 /**
67- * @brief Label for "All Button" of the department.
68+ * @brief Label for "All Button" of the navigation.
69 */
70 Q_PROPERTY(QString allLabel READ allLabel NOTIFY allLabelChanged)
71
72 /**
73- * @brief Parent Id of the department.
74+ * @brief Parent Id of the navigation.
75 */
76- Q_PROPERTY(QString parentDepartmentId READ parentDepartmentId NOTIFY parentDepartmentIdChanged)
77+ Q_PROPERTY(QString parentNavigationId READ parentNavigationId NOTIFY parentNavigationIdChanged)
78
79 /**
80- * @brief Parent label of the department.
81+ * @brief Parent label of the navigation.
82 */
83 Q_PROPERTY(QString parentLabel READ parentLabel NOTIFY parentLabelChanged)
84
85 /**
86- * @brief Is the model of the deparment completely loaded?
87+ * @brief Is the model of the navigation completely loaded?
88 */
89 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
90
91 /**
92- * @brief Is this deparment the root deparment?
93+ * @brief Is this deparment the root navigation?
94 */
95 Q_PROPERTY(bool isRoot READ isRoot NOTIFY isRootChanged)
96
97 /**
98- * @brief Number of items of the deparment.
99+ * @brief Is this a hidden navigation?
100+ */
101+ Q_PROPERTY(bool hidden READ hidden NOTIFY hiddenChanged)
102+
103+ /**
104+ * @brief Number of items of the navigation.
105 */
106 Q_PROPERTY(int count READ count NOTIFY countChanged)
107
108 protected:
109 /// @cond
110- explicit DepartmentInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
111+ explicit NavigationInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
112 /// @endcond
113
114 public:
115@@ -87,25 +92,26 @@
116 * @brief The roles supported by this model.
117 */
118 enum Roles {
119- RoleDepartmentId,
120+ RoleNavigationId,
121 RoleLabel,
122 RoleHasChildren,
123 RoleIsActive
124 };
125
126 // @cond
127- virtual QString departmentId() const = 0;
128+ virtual QString navigationId() const = 0;
129 virtual QString label() const = 0;
130 virtual QString allLabel() const = 0;
131- virtual QString parentDepartmentId() const = 0;
132+ virtual QString parentNavigationId() const = 0;
133 virtual QString parentLabel() const = 0;
134 virtual bool loaded() const = 0;
135 virtual bool isRoot() const = 0;
136+ virtual bool hidden() const = 0;
137 virtual int count() const = 0;
138 QHash<int, QByteArray> roleNames() const override
139 {
140 QHash<int, QByteArray> roles;
141- roles[RoleDepartmentId] = "departmentId";
142+ roles[RoleNavigationId] = "navigationId";
143 roles[RoleLabel] = "label";
144 roles[RoleHasChildren] = "hasChildren";
145 roles[RoleIsActive] = "isActive";
146@@ -115,13 +121,14 @@
147
148 Q_SIGNALS:
149 // @cond
150- void departmentIdChanged();
151+ void navigationIdChanged();
152 void labelChanged();
153 void allLabelChanged();
154- void parentDepartmentIdChanged();
155+ void parentNavigationIdChanged();
156 void parentLabelChanged();
157 void loadedChanged();
158 void isRootChanged();
159+ void hiddenChanged();
160 void countChanged();
161 // @endcond
162 };
163@@ -130,6 +137,6 @@
164 }
165 }
166
167-Q_DECLARE_METATYPE(unity::shell::scopes::DepartmentInterface*)
168+Q_DECLARE_METATYPE(unity::shell::scopes::NavigationInterface*)
169
170 #endif
171
172=== modified file 'include/unity/shell/scopes/ScopeInterface.h'
173--- include/unity/shell/scopes/ScopeInterface.h 2014-07-08 08:51:32 +0000
174+++ include/unity/shell/scopes/ScopeInterface.h 2014-08-04 15:59:28 +0000
175@@ -31,7 +31,7 @@
176
177 class CategoriesInterface;
178 class PreviewStackInterface;
179-class DepartmentInterface;
180+class NavigationInterface;
181 class SettingsModelInterface;
182
183 /**
184@@ -41,6 +41,8 @@
185 {
186 Q_OBJECT
187
188+ Q_ENUMS(Status)
189+
190 /**
191 * @brief Id of the scope.
192 */
193@@ -72,10 +74,9 @@
194 Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged)
195
196 /**
197- * @brief Boolean specifying whether the scope should be visible.
198+ * @brief Boolean specifying whether the scope is favourited.
199 */
200- Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
201-
202+ Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged)
203 /**
204 * @brief Keyboard shortcut used to summon the scope.
205 */
206@@ -113,31 +114,56 @@
207 Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged)
208
209 /**
210- * @brief Boolean specifying whether the scope is currently visible.
211+ * @brief Boolean specifying whether the scope is currently active.
212 */
213 Q_PROPERTY(bool isActive READ isActive WRITE setActive NOTIFY isActiveChanged)
214
215 /**
216 * @brief String specifying currently selected department
217 */
218- Q_PROPERTY(QString currentDepartmentId READ currentDepartmentId NOTIFY currentDepartmentIdChanged)
219+ Q_PROPERTY(QString currentNavigationId READ currentNavigationId NOTIFY currentNavigationIdChanged)
220
221 /**
222 * @brief Boolean specifying whether current query has departments.
223 */
224- Q_PROPERTY(bool hasDepartments READ hasDepartments NOTIFY hasDepartmentsChanged)
225+ Q_PROPERTY(bool hasNavigation READ hasNavigation NOTIFY hasNavigationChanged)
226+
227+ /**
228+ * @brief String specifying currently selected sort order
229+ */
230+ Q_PROPERTY(QString currentAltNavigationId READ currentAltNavigationId NOTIFY currentAltNavigationIdChanged)
231+
232+ /**
233+ * @brief Boolean specifying whether current query has sort order.
234+ */
235+ Q_PROPERTY(bool hasAltNavigation READ hasAltNavigation NOTIFY hasAltNavigationChanged)
236
237 /**
238 * @brief VariantMap with customization properties
239 */
240 Q_PROPERTY(QVariantMap customizations READ customizations NOTIFY customizationsChanged)
241
242+ /**
243+ * @brief Enum representing the status of the scope.
244+ */
245+ Q_PROPERTY(unity::shell::scopes::ScopeInterface::Status status READ status NOTIFY statusChanged)
246+
247 protected:
248 /// @cond
249 explicit ScopeInterface(QObject* parent = 0) : QObject(parent) { }
250 /// @endcond
251
252 public:
253+ /**
254+ * @brief Status info code following the last operation
255+ */
256+ enum class Status
257+ {
258+ Okay, // Everything is fine
259+ NoInternet, // No Internet access
260+ NoLocationData, // No location data available
261+ Unknown, // A code unknown to the run-time was used
262+ };
263
264 // @cond
265 virtual QString id() const = 0;
266@@ -145,17 +171,20 @@
267 virtual QString iconHint() const = 0;
268 virtual QString description() const = 0;
269 virtual QString searchHint() const = 0;
270- virtual bool visible() const = 0;
271 virtual QString shortcut() const = 0;
272 virtual bool searchInProgress() const = 0;
273+ virtual bool favorite() const = 0;
274 virtual CategoriesInterface* categories() const = 0;
275 virtual SettingsModelInterface* settings() const = 0;
276 virtual QString searchQuery() const = 0;
277 virtual QString noResultsHint() const = 0;
278 virtual QString formFactor() const = 0;
279 virtual bool isActive() const = 0;
280- virtual QString currentDepartmentId() const = 0;
281- virtual bool hasDepartments() const = 0;
282+ virtual QString currentNavigationId() const = 0;
283+ virtual bool hasNavigation() const = 0;
284+ virtual QString currentAltNavigationId() const = 0;
285+ virtual bool hasAltNavigation() const = 0;
286+ virtual Status status() const = 0;
287 virtual QVariantMap customizations() const = 0;
288
289 /* setters */
290@@ -163,6 +192,7 @@
291 virtual void setNoResultsHint(const QString& hint) = 0;
292 virtual void setFormFactor(const QString& form_factor) = 0;
293 virtual void setActive(const bool) = 0;
294+ virtual void setFavorite(const bool) = 0;
295 // @endcond
296
297 /**
298@@ -189,22 +219,30 @@
299 Q_INVOKABLE virtual void closeScope(unity::shell::scopes::ScopeInterface* scope) = 0;
300
301 /**
302- * @brief Get a DepartmentInterface instance for the passed departmentId.
303- */
304- Q_INVOKABLE virtual unity::shell::scopes::DepartmentInterface* getDepartment(QString const& departmentId) = 0;
305-
306- /**
307- * @brief Activate department by its id.
308- *
309- * This effectively runs a new query.
310- */
311- Q_INVOKABLE virtual void loadDepartment(QString const& departmentId) = 0;
312+ * @brief Get a NavigationInterface instance for the passed navigationId.
313+ */
314+ Q_INVOKABLE virtual unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) = 0;
315+
316+ /**
317+ * @brief Get a NavigationInterface instance for the passed altNavigationId.
318+ */
319+ Q_INVOKABLE virtual unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) = 0;
320+
321+ /**
322+ * @brief Request change to the current navigation or altNavigation id.
323+ */
324+ Q_INVOKABLE virtual void setNavigationState(QString const& navId, bool altNavigation) = 0;
325
326 /**
327 * @brief Execute canned query.
328 */
329 Q_INVOKABLE virtual void performQuery(QString const& cannedQuery) = 0;
330
331+ /**
332+ * @brief Force refresh of the scope contents.
333+ */
334+ Q_INVOKABLE virtual void refresh() = 0;
335+
336 Q_SIGNALS:
337 // @cond
338 void idChanged();
339@@ -213,7 +251,7 @@
340 void descriptionChanged();
341 void searchHintChanged();
342 void searchInProgressChanged();
343- void visibleChanged();
344+ void favoriteChanged();
345 void shortcutChanged();
346 void categoriesChanged();
347 void settingsChanged();
348@@ -221,9 +259,13 @@
349 void noResultsHintChanged();
350 void formFactorChanged();
351 void isActiveChanged();
352- void hasDepartmentsChanged();
353- void currentDepartmentIdChanged();
354+ void hasNavigationChanged();
355+ void currentNavigationIdChanged();
356+ void hasAltNavigationChanged();
357+ void currentAltNavigationIdChanged();
358 void customizationsChanged();
359+ void statusChanged();
360+ void detailsChanged();
361 // @endcond
362
363 // signals triggered by activate(..) or preview(..) requests.
364@@ -264,11 +306,6 @@
365 * @brief Signal requesting to show a temporary scope.
366 */
367 void openScope(unity::shell::scopes::ScopeInterface* scope);
368-
369- /**
370- * @brief Signal requesting activation of an application.
371- */
372- void activateApplication(QString const& desktop);
373 };
374
375 }
376
377=== modified file 'include/unity/shell/scopes/ScopesInterface.h'
378--- include/unity/shell/scopes/ScopesInterface.h 2014-07-18 12:14:43 +0000
379+++ include/unity/shell/scopes/ScopesInterface.h 2014-08-04 15:59:28 +0000
380@@ -47,6 +47,11 @@
381 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
382
383 /**
384+ * @brief Interger specifying how many items are in the model.
385+ */
386+ Q_PROPERTY(int count READ count NOTIFY countChanged)
387+
388+ /**
389 * @brief Scope instance representing the overview scope.
390 *
391 * Scope instance representing the overview scope, note that it might be null while scopes are not loaded.
392@@ -65,7 +70,6 @@
393 enum Roles {
394 RoleScope,
395 RoleId,
396- RoleVisible,
397 RoleTitle
398 };
399
400@@ -86,13 +90,13 @@
401
402 // @cond
403 virtual bool loaded() const = 0;
404+ virtual int count() const = 0;
405 virtual unity::shell::scopes::ScopeInterface* overviewScope() const = 0;
406 QHash<int, QByteArray> roleNames() const override
407 {
408 QHash<int, QByteArray> roles;
409 roles[RoleScope] = "scope";
410 roles[RoleId] = "id";
411- roles[RoleVisible] = "visible";
412 roles[RoleTitle] = "title";
413 return roles;
414 }
415@@ -101,6 +105,7 @@
416 Q_SIGNALS:
417 // @cond
418 void loadedChanged();
419+ void countChanged();
420 void overviewScopeChanged();
421 // @endcond
422 };
423
424=== modified file 'test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt'
425--- test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt 2014-07-03 10:21:34 +0000
426+++ test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt 2014-08-04 15:59:28 +0000
427@@ -21,7 +21,7 @@
428 Mocks/MockScopes.cpp
429 Mocks/MockSettingsModel.cpp
430 ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/CategoriesInterface.h
431- ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/DepartmentInterface.h
432+ ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/NavigationInterface.h
433 ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ResultsModelInterface.h
434 ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewModelInterface.h
435 ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewWidgetModelInterface.h
436
437=== modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp'
438--- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp 2014-05-29 10:24:53 +0000
439+++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp 2014-08-04 15:59:28 +0000
440@@ -18,11 +18,11 @@
441 #include "MockDepartment.h"
442
443 MockDepartment::MockDepartment(QObject* parent)
444- : unity::shell::scopes::DepartmentInterface(parent)
445+ : unity::shell::scopes::NavigationInterface(parent)
446 {
447 }
448
449-QString MockDepartment::departmentId() const
450+QString MockDepartment::navigationId() const
451 {
452 return "root";
453 }
454@@ -37,7 +37,7 @@
455 return "All Departments";
456 }
457
458-QString MockDepartment::parentDepartmentId() const
459+QString MockDepartment::parentNavigationId() const
460 {
461 return QString();
462 }
463@@ -57,6 +57,11 @@
464 return true;
465 }
466
467+bool MockDepartment::hidden() const
468+{
469+ return false;
470+}
471+
472 int MockDepartment::count() const
473 {
474 return rowCount();
475@@ -70,7 +75,7 @@
476 QVariant MockDepartment::data(const QModelIndex& /*index*/, int role) const
477 {
478 switch (role) {
479- case RoleDepartmentId:
480+ case RoleNavigationId:
481 return "child";
482 case RoleLabel:
483 return "Child Clothes";
484
485=== modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.h'
486--- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.h 2014-05-29 10:24:53 +0000
487+++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.h 2014-08-04 15:59:28 +0000
488@@ -18,24 +18,25 @@
489 #ifndef MOCKDEPARTMENT_H
490 #define MOCKDEPARTMENT_H
491
492-#include <unity/shell/scopes/DepartmentInterface.h>
493+#include <unity/shell/scopes/NavigationInterface.h>
494
495 #include <QSharedPointer>
496
497-class MockDepartment : public unity::shell::scopes::DepartmentInterface
498+class MockDepartment : public unity::shell::scopes::NavigationInterface
499 {
500 Q_OBJECT
501
502 public:
503 explicit MockDepartment(QObject* parent = 0);
504
505- QString departmentId() const override;
506+ QString navigationId() const override;
507 QString label() const override;
508 QString allLabel() const override;
509- QString parentDepartmentId() const override;
510+ QString parentNavigationId() const override;
511 QString parentLabel() const override;
512 bool loaded() const override;
513 bool isRoot() const override;
514+ bool hidden() const override;
515 int count() const override;
516
517 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
518
519=== modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp'
520--- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp 2014-07-08 08:51:32 +0000
521+++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp 2014-08-04 15:59:28 +0000
522@@ -20,15 +20,15 @@
523 #include "MockDepartment.h"
524 #include "MockSettingsModel.h"
525
526-MockScope::MockScope(QObject* parent) : MockScope(QString(), QString(), false, parent)
527+MockScope::MockScope(QObject* parent) : MockScope(QString(), QString(), parent)
528 {
529 }
530
531-MockScope::MockScope(QString const& id, QString const& name, bool visible, QObject* parent)
532+MockScope::MockScope(QString const& id, QString const& name, QObject* parent)
533 : unity::shell::scopes::ScopeInterface(parent)
534 , m_id(id)
535 , m_name(name)
536- , m_visible(visible)
537+ , m_favorite(false)
538 , m_searching(false)
539 , m_isActive(false)
540 , m_previewRendererName("preview-generic")
541@@ -65,10 +65,14 @@
542 return QString("");
543 }
544
545-QString MockScope::currentDepartmentId() const {
546+QString MockScope::currentNavigationId() const {
547 return m_currentDepartmentId;
548 }
549
550+QString MockScope::currentAltNavigationId() const {
551+ return m_currentAltDepartmentId;
552+}
553+
554 bool MockScope::searchInProgress() const {
555 return m_searching;
556 }
557@@ -89,22 +93,30 @@
558 return m_formFactor;
559 }
560
561-bool MockScope::visible() const {
562- return m_visible;
563+bool MockScope::favorite() const {
564+ return m_favorite;
565 }
566
567 bool MockScope::isActive() const {
568 return m_isActive;
569 }
570
571-bool MockScope::hasDepartments() const {
572- return m_hasDepartments;
573+bool MockScope::hasNavigation() const {
574+ return m_hasNavigation;
575+}
576+
577+bool MockScope::hasAltNavigation() const {
578+ return m_hasAltNavigation;
579 }
580
581 QVariantMap MockScope::customizations() const {
582 return m_customizations;
583 }
584
585+unity::shell::scopes::ScopeInterface::Status MockScope::status() const {
586+ return ScopeInterface::Status::Okay;
587+}
588+
589 void MockScope::setName(const QString &str) {
590 if (str != m_name) {
591 m_name = str;
592@@ -133,6 +145,13 @@
593 }
594 }
595
596+void MockScope::setFavorite(const bool value) {
597+ if (value != m_favorite) {
598+ m_favorite = value;
599+ Q_EMIT favoriteChanged();
600+ }
601+}
602+
603 void MockScope::setNoResultsHint(const QString& str) {
604 if (str != m_noResultsHint) {
605 m_noResultsHint = str;
606@@ -154,16 +173,24 @@
607 return new MockPreviewStack;
608 }
609
610-unity::shell::scopes::DepartmentInterface* MockScope::getDepartment(QString const& departmentId)
611-{
612- Q_UNUSED(departmentId);
613-
614- return new MockDepartment();
615-}
616-
617-void MockScope::loadDepartment(QString const& departmentId)
618-{
619- Q_UNUSED(departmentId);
620+unity::shell::scopes::NavigationInterface* MockScope::getNavigation(QString const& navigationId)
621+{
622+ Q_UNUSED(navigationId);
623+
624+ return new MockDepartment();
625+}
626+
627+unity::shell::scopes::NavigationInterface* MockScope::getAltNavigation(QString const& navigationId)
628+{
629+ Q_UNUSED(navigationId);
630+
631+ return new MockDepartment();
632+}
633+
634+void MockScope::setNavigationState(QString const& navId, bool altNavigation)
635+{
636+ Q_UNUSED(navId);
637+ Q_UNUSED(altNavigation);
638 }
639
640 void MockScope::cancelActivation()
641@@ -179,3 +206,7 @@
642 {
643 Q_UNUSED(cannedQuery);
644 }
645+
646+void MockScope::refresh()
647+{
648+}
649
650=== modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h'
651--- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h 2014-07-08 08:51:32 +0000
652+++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h 2014-08-04 15:59:28 +0000
653@@ -25,7 +25,7 @@
654
655 public:
656 MockScope(QObject* parent = 0);
657- MockScope(QString const& id, QString const& name, bool visible, QObject* parent);
658+ MockScope(QString const& id, QString const& name, QObject* parent);
659
660 /* getters */
661 QString id() const override;
662@@ -33,7 +33,7 @@
663 QString iconHint() const override;
664 QString description() const override;
665 QString searchHint() const override;
666- bool visible() const override;
667+ bool favorite() const override;
668 QString shortcut() const override;
669 bool searchInProgress() const override;
670 unity::shell::scopes::CategoriesInterface* categories() const override;
671@@ -42,9 +42,12 @@
672 QString noResultsHint() const override;
673 QString formFactor() const override;
674 bool isActive() const override;
675- bool hasDepartments() const override;
676- QString currentDepartmentId() const override;
677+ bool hasNavigation() const override;
678+ QString currentNavigationId() const override;
679+ bool hasAltNavigation() const override;
680+ QString currentAltNavigationId() const override;
681 QVariantMap customizations() const override;
682+ Status status() const override;
683
684 /* setters */
685 void setName(const QString& name);
686@@ -52,14 +55,17 @@
687 void setNoResultsHint(const QString& hint) override;
688 void setFormFactor(const QString& form_factor) override;
689 void setActive(const bool) override;
690+ void setFavorite(const bool) override;
691
692 Q_INVOKABLE void activate(QVariant const& result) override;
693 Q_INVOKABLE unity::shell::scopes::PreviewStackInterface* preview(QVariant const& result) override;
694 Q_INVOKABLE void cancelActivation() override;
695 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
696- Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(QString const& departmentId) override;
697- Q_INVOKABLE void loadDepartment(QString const& departmentId) override;
698+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& departmentId) override;
699+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& departmentId) override;
700+ Q_INVOKABLE void setNavigationState(QString const& navId, bool altNavigation) override;
701 Q_INVOKABLE void performQuery(QString const& cannedQuery) override;
702+ Q_INVOKABLE void refresh() override;
703
704 protected:
705 QString m_id;
706@@ -70,10 +76,12 @@
707 QString m_noResultsHint;
708 QString m_formFactor;
709 QString m_currentDepartmentId;
710- bool m_visible;
711+ QString m_currentAltDepartmentId;
712+ bool m_favorite;
713 bool m_searching;
714 bool m_isActive;
715- bool m_hasDepartments;
716+ bool m_hasNavigation;
717+ bool m_hasAltNavigation;
718 QVariantMap m_customizations;
719
720 QString m_previewRendererName;
721
722=== modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.cpp'
723--- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.cpp 2014-07-18 12:56:46 +0000
724+++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.cpp 2014-08-04 15:59:28 +0000
725@@ -23,10 +23,10 @@
726 MockScopes::MockScopes(QObject *parent)
727 : unity::shell::scopes::ScopesInterface(parent)
728 {
729- m_scopes << new MockScope("MockScope1", "People", true, this);
730- m_scopes << new MockScope("MockScope2", "Music", false, this);
731- m_scopes << new MockScope("MockScope3", "Apps", true, this);
732- m_scopes << new MockScope("MockScope4", "Videos", true, this);
733+ m_scopes << new MockScope("MockScope1", "People", this);
734+ m_scopes << new MockScope("MockScope2", "Music", this);
735+ m_scopes << new MockScope("MockScope3", "Apps", this);
736+ m_scopes << new MockScope("MockScope4", "Videos", this);
737 }
738
739 bool MockScopes::loaded() const
740@@ -44,6 +44,11 @@
741 return m_scopes.count();
742 }
743
744+int MockScopes::count() const
745+{
746+ return m_scopes.count();
747+}
748+
749 QVariant MockScopes::data(const QModelIndex& index, int role) const
750 {
751 if (!index.isValid() || index.row() >= m_scopes.size()) {
752@@ -56,8 +61,6 @@
753 return QVariant::fromValue(scope);
754 } else if (role == MockScopes::RoleId) {
755 return QVariant::fromValue(scope->id());
756- } else if (role == MockScopes::RoleVisible) {
757- return QVariant::fromValue(scope->visible());
758 } else if (role == MockScopes::RoleTitle) {
759 return QVariant::fromValue(scope->name());
760 } else {
761
762=== modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.h'
763--- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.h 2014-07-18 12:56:46 +0000
764+++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScopes.h 2014-08-04 15:59:28 +0000
765@@ -40,6 +40,7 @@
766 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
767
768 bool loaded() const override;
769+ int count() const override;
770 unity::shell::scopes::ScopeInterface* overviewScope() const override;
771
772 private:
773
774=== modified file 'test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp'
775--- test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp 2014-07-03 10:21:34 +0000
776+++ test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp 2014-08-04 15:59:28 +0000
777@@ -20,7 +20,7 @@
778 #include <QtQml/qqml.h>
779
780 #include "CategoriesInterface.h"
781-#include "DepartmentInterface.h"
782+#include "NavigationInterface.h"
783 #include "ResultsModelInterface.h"
784 #include "PreviewModelInterface.h"
785 #include "PreviewWidgetModelInterface.h"
786@@ -34,7 +34,7 @@
787 qmlRegisterType<MockScopes>(uri, 0, 2, "Scopes");
788 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Categories object in QML. Get them from Scopes instance.");
789 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML. Get them from Scope instance.");
790- qmlRegisterUncreatableType<unity::shell::scopes::DepartmentInterface>(uri, 0, 2, "Department", "Can't create Department object in QML. Get them from Scope instance.");
791+ qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML. Get them from Scope instance.");
792 qmlRegisterUncreatableType<unity::shell::scopes::ResultsModelInterface>(uri, 0, 2, "ResultsModel", "Can't create new ResultsModel in QML. Get them from Categories instance.");
793 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
794 qmlRegisterUncreatableType<unity::shell::scopes::PreviewWidgetModelInterface>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance.");
795
796=== modified file 'test/qmltest/unity/shell/scopes/tst_Scopes.qml'
797--- test/qmltest/unity/shell/scopes/tst_Scopes.qml 2014-07-18 12:56:46 +0000
798+++ test/qmltest/unity/shell/scopes/tst_Scopes.qml 2014-08-04 15:59:28 +0000
799@@ -28,7 +28,7 @@
800 }
801 property var scope: scopes.getScope(0)
802 property var preview: root.scope.preview("")
803- property var department: root.scope.getDepartment("root")
804+ property var navigation: root.scope.getNavigation("root")
805
806 Verifier {
807 id: scopesVerifier
808@@ -58,7 +58,6 @@
809 return [
810 { tag: "Model.roles[scope]", role: "scope", type: "object" },
811 { tag: "Model.roles[id]", role: "id", type: "string" },
812- { tag: "Model.roles[visible]", role: "visible", type: "boolean" },
813 { tag: "Model.roles[title]", role: "title", type: "string" },
814 ];
815 }
816@@ -72,6 +71,7 @@
817 function test_scopes_properties_data() {
818 return [
819 { tag: "Item.properties[loaded]", constant: "loaded", type: "boolean" },
820+ { tag: "Item.properties[count]", constant: "count", type: "number" },
821 { tag: "Item.properties[overviewScope]", constant: "overviewScope", type: "object" }
822 ];
823 }
824@@ -119,16 +119,19 @@
825 { tag: "Item.properties[description]", constant: "description", type: "string" },
826 { tag: "Item.properties[searchHint]", constant: "searchHint", type: "string" },
827 { tag: "Item.properties[searchInProgress]", constant: "searchInProgress", type: "boolean" },
828- { tag: "Item.properties[visible]", constant: "visible", type: "boolean" },
829+ { tag: "Item.properties[favorite]", constant: "favorite", type: "boolean" },
830 { tag: "Item.properties[shortcut]", constant: "shortcut", type: "string" },
831 { tag: "Item.properties[categories]", constant: "categories", type: "object" },
832 { tag: "Item.properties[searchQuery]", constant: "searchQuery", type: "string" },
833 { tag: "Item.properties[noResultsHint]", constant: "noResultsHint", type: "string" },
834 { tag: "Item.properties[formFactor]", constant: "formFactor", type: "string" },
835 { tag: "Item.properties[isActive]", constant: "isActive", type: "boolean" },
836- { tag: "Item.properties[currentDepartmentId]", constant: "currentDepartmentId", type: "string" },
837- { tag: "Item.properties[hasDepartments]", constant: "hasDepartments", type: "boolean" },
838- { tag: "Item.properties[customizations]", constant: "customizations", type: "object" }
839+ { tag: "Item.properties[currentNavigationId]", constant: "currentNavigationId", type: "string" },
840+ { tag: "Item.properties[hasNavigation]", constant: "hasNavigation", type: "boolean" },
841+ { tag: "Item.properties[currentAltNavigationId]", constant: "currentAltNavigationId", type: "string" },
842+ { tag: "Item.properties[hasAltNavigation]", constant: "hasAltNavigation", type: "boolean" },
843+ { tag: "Item.properties[customizations]", constant: "customizations", type: "object" },
844+ { tag: "Item.properties[status]", constant: "status", type: "number" }
845 ];
846 }
847
848@@ -151,9 +154,10 @@
849 { tag: "Model.methods[gotoScope]", method: "gotoScope" },
850 { tag: "Model.methods[openScope]", method: "openScope" },
851 { tag: "Model.methods[performQuery]", method: "performQuery" },
852- { tag: "Model.methods[activateApplication]", method: "activateApplication" },
853- { tag: "Model.methods[getDepartment]", method: "getDepartment" },
854- { tag: "Model.methods[loadDepartment]", method: "loadDepartment" }
855+ { tag: "Model.methods[refresh]", method: "refresh" },
856+ { tag: "Model.methods[getNavigation]", method: "getNavigation" },
857+ { tag: "Model.methods[getAltNavigation]", method: "getAltNavigation" },
858+ { tag: "Model.methods[setNavigationState]", method: "setNavigationState" },
859 ];
860 }
861
862@@ -505,60 +509,61 @@
863
864
865 Verifier {
866- id: departmentVerifier
867+ id: navigationVerifier
868
869 Repeater {
870- id: departmentRepeater
871- model: root.department
872+ id: navigationRepeater
873+ model: root.navigation
874 delegate: Item {
875 property var roles: model
876 }
877 }
878
879- function test_department_data() {
880+ function test_navigation_data() {
881 return [
882- { tag: "Department[object]", type: "object" },
883- { tag: "Department[DepartmentInterface]", type: "unity::shell::scopes::DepartmentInterface" },
884+ { tag: "Navigation[object]", type: "object" },
885+ { tag: "Navigation[NavigationInterface]", type: "unity::shell::scopes::NavigationInterface" },
886 ];
887 }
888
889- function test_department(data) {
890- object = departmentRepeater.model;
891- name = "Department";
892+ function test_navigation(data) {
893+ object = navigationRepeater.model;
894+ name = "Navigation";
895 verifyData(data);
896 }
897
898- function test_department_roles_data() {
899+ function test_navigation_roles_data() {
900 return [
901- { tag: "Model.roles[departmentId]", role: "departmentId", type: "string" },
902+ { tag: "Model.roles[navigationId]", role: "navigationId", type: "string" },
903 { tag: "Model.roles[label]", role: "label", type: "string" },
904 { tag: "Model.roles[hasChildren]", role: "hasChildren", type: "boolean" },
905 { tag: "Model.roles[isActive]", role: "isActive", type: "boolean" }
906 ];
907 }
908
909- function test_department_roles(data) {
910- object = departmentRepeater.itemAt(0).roles;
911- name = "Department";
912+ function test_navigation_roles(data) {
913+ object = navigationRepeater.itemAt(0).roles;
914+ name = "Navigation";
915 verifyData(data);
916 }
917
918- function test_department_properties_data() {
919+ function test_navigation_properties_data() {
920 return [
921- { tag: "Model.properties[departmentId]", constant: "departmentId", type: "string" },
922+ { tag: "Model.properties[navigationId]", constant: "navigationId", type: "string" },
923 { tag: "Model.properties[label]", constant: "label", type: "string" },
924 { tag: "Model.properties[allLabel]", constant: "allLabel", type: "string" },
925- { tag: "Model.properties[parentDepartmentId]", constant: "parentDepartmentId", type: "string" },
926+ { tag: "Model.properties[parentNavigationId]", constant: "parentNavigationId", type: "string" },
927 { tag: "Model.properties[parentLabel]", constant: "parentLabel", type: "string" },
928 { tag: "Model.properties[loaded]", constant: "loaded", type: "boolean" },
929 { tag: "Model.properties[isRoot]", constant: "isRoot", type: "boolean" },
930+ { tag: "Model.properties[hidden]", constant: "hidden", type: "boolean" },
931 { tag: "Model.properties[count]", constant: "count", type: "number" }
932 ];
933 }
934
935- function test_department_properties(data) {
936- object = departmentRepeater.model;
937- name = "Department";
938+ function test_navigation_properties(data) {
939+ object = navigationRepeater.model;
940+ name = "Navigation";
941 verifyData(data);
942 }
943 }

Subscribers

People subscribed via source and target branches

to all changes: