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

Proposed by Albert Astals Cid
Status: Superseded
Proposed branch: lp:~unity-team/unity8/scopes-v4
Merge into: lp:unity8
Diff against target: 1480 lines (+419/-328)
17 files modified
debian/control (+1/-1)
qml/Dash/Dash.qml (+9/-11)
qml/Dash/DashContent.qml (+3/-4)
qml/Dash/DashNavigation.qml (+50/-43)
qml/Dash/DashNavigationList.qml (+15/-14)
qml/Dash/GenericScopeView.qml (+4/-11)
qml/ScopeTool.qml (+1/-11)
tests/mocks/Unity/CMakeLists.txt (+3/-3)
tests/mocks/Unity/Unity.qmltypes (+73/-26)
tests/mocks/Unity/fake_navigation.cpp (+36/-44)
tests/mocks/Unity/fake_navigation.h (+13/-13)
tests/mocks/Unity/fake_scope.cpp (+73/-25)
tests/mocks/Unity/fake_scope.h (+16/-8)
tests/mocks/Unity/fake_scopes.cpp (+10/-2)
tests/mocks/Unity/fake_scopes.h (+1/-0)
tests/mocks/Unity/fake_unity_plugin.cpp (+2/-2)
tests/qmltests/Dash/tst_DashContent.qml (+109/-110)
To merge this branch: bzr merge lp:~unity-team/unity8/scopes-v4
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Abstain
Review via email: mp+229224@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-06.

Commit message

Work with the scopes-v4 branch + departments->navigation renaming

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
https://code.launchpad.net/~unity-team/unity-api/scopes-v4/+merge/228346

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

 * Did you make sure that your branch does not contain spurious tags?
Yes

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

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

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) :
review: Abstain
lp:~unity-team/unity8/scopes-v4 updated
1095. By Albert Astals Cid

Fix scope tool

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~unity-team/unity8/scopes-v4 updated
1096. By Albert Astals Cid

need new api-dev

1097. By Albert Astals Cid

Adapt to API changes

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: Needs Fixing (continuous-integration)
lp:~unity-team/unity8/scopes-v4 updated
1098. By Albert Astals Cid

Merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~unity-team/unity8/scopes-v4 updated
1099. By Albert Astals Cid

Dummy implement refresh()

1100. By Albert Astals Cid

Merge dashSepartmentsListTweaks

1101. By Albert Astals Cid

Merge unstable departments test

1102. By Albert Astals Cid

Fix merge/tests

1103. By Albert Astals Cid

more renaming

1104. By Albert Astals Cid

New need implementation

1105. By Albert Astals Cid

More updates

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-07-31 16:48:11 +0000
3+++ debian/control 2014-08-06 10:17:24 +0000
4@@ -24,7 +24,7 @@
5 libpulse-dev,
6 libqmenumodel-dev (>= 0.2.8),
7 libqt5xmlpatterns5-dev,
8- libunity-api-dev (>= 7.87),
9+ libunity-api-dev (>= 7.88),
10 libusermetricsoutput1-dev,
11 libxcb1-dev,
12 pkg-config,
13
14=== modified file 'qml/Dash/Dash.qml'
15--- qml/Dash/Dash.qml 2014-07-29 11:35:10 +0000
16+++ qml/Dash/Dash.qml 2014-08-06 10:17:24 +0000
17@@ -38,7 +38,13 @@
18 }
19
20 function setCurrentScope(scopeId, animate, reset) {
21- var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
22+ var scopeIndex = -1;
23+ for (var i = 0; i < scopes.count; ++i) {
24+ if (scopes.getScope(i).id == scopeId) {
25+ scopeIndex = i;
26+ break;
27+ }
28+ }
29
30 if (scopeIndex == -1) {
31 console.warn("No match for scope with id: %1".arg(scopeId))
32@@ -63,15 +69,8 @@
33 }
34 }
35
36- SortFilterProxyModel {
37- id: filteredScopes
38- model: Scopes {
39- id: scopes
40- }
41- dynamicSortFilter: true
42-
43- filterRole: Scopes.RoleVisible
44- filterRegExp: RegExp("^true$")
45+ Scopes {
46+ id: scopes
47 }
48
49 DashContent {
50@@ -79,7 +78,6 @@
51 objectName: "dashContent"
52 width: parent.width
53 height: parent.height
54- model: filteredScopes
55 scopes: scopes
56 visible: x != -width
57 onGotoScope: {
58
59=== modified file 'qml/Dash/DashContent.qml'
60--- qml/Dash/DashContent.qml 2014-07-24 23:31:44 +0000
61+++ qml/Dash/DashContent.qml 2014-08-06 10:17:24 +0000
62@@ -23,8 +23,7 @@
63 Item {
64 id: dashContent
65
66- property var model: null
67- property var scopes: null
68+ property alias scopes: dashContentList.model
69 readonly property alias currentIndex: dashContentList.currentIndex
70
71 signal scopeLoaded(string scopeId)
72@@ -89,10 +88,9 @@
73 id: dashContentList
74 objectName: "dashContentList"
75
76- interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving
77+ interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.departmentsShown
78
79 anchors.fill: parent
80- model: dashContent.model
81 orientation: ListView.Horizontal
82 boundsBehavior: Flickable.DragAndOvershootBounds
83 flickDeceleration: units.gu(625)
84@@ -130,6 +128,7 @@
85 objectName: scope.id + " loader"
86
87 readonly property bool moving: item ? item.moving : false
88+ readonly property bool departmentsShown: item ? item.departmentsShown : false
89 readonly property var categoryView: item ? item.categoryView : null
90 readonly property var theScope: scope
91
92
93=== renamed file 'qml/Dash/DashDepartments.qml' => 'qml/Dash/DashNavigation.qml'
94--- qml/Dash/DashDepartments.qml 2014-07-08 11:08:19 +0000
95+++ qml/Dash/DashNavigation.qml 2014-08-06 10:17:24 +0000
96@@ -15,17 +15,17 @@
97 */
98
99 import QtQuick 2.2
100-import Ubuntu.Components 0.1
101+import Ubuntu.Components 1.1
102
103 AbstractButton {
104 id: root
105- objectName: "dashDepartments"
106+ objectName: "dashNavigation"
107
108 property var scope: null
109
110 property bool showList: false
111
112- readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartmentId) : null
113+ readonly property var currentNavigation: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null
114
115 property alias windowWidth: blackRect.width
116 property alias windowHeight: blackRect.height
117@@ -34,20 +34,21 @@
118 // Are we drilling down the tree or up?
119 property bool isGoingBack: false
120
121- visible: root.currentDepartment != null
122+ visible: root.currentNavigation != null
123
124 height: visible ? units.gu(5) : 0
125
126 onClicked: {
127+ departmentListView.updateMaxHeight();
128 root.showList = !root.showList;
129 }
130
131 Rectangle {
132 id: blackRect
133 color: "black"
134- opacity: departmentListView.currentItem && departmentListView.currentItem.visible ? 0.3 : 0
135+ opacity: navigationListView.currentItem && navigationListView.currentItem.visible ? 0.3 : 0
136 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
137- anchors.top: departmentListView.top
138+ anchors.top: navigationListView.top
139 anchors.right: parent.right
140 visible: opacity != 0
141 }
142@@ -78,7 +79,7 @@
143 anchors.fill: parent
144 anchors.margins: units.gu(2)
145 verticalAlignment: Text.AlignVCenter
146- text: root.currentDepartment ? root.currentDepartment.label : ""
147+ text: root.currentNavigation ? root.currentNavigation.label : ""
148 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
149 }
150
151@@ -92,18 +93,18 @@
152 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
153 }
154
155- // departmentListView is outside root
156+ // navigationListView is outside root
157 ListView {
158- id: departmentListView
159- objectName: "departmentListView"
160+ id: navigationListView
161+ objectName: "navigationListView"
162 orientation: ListView.Horizontal
163 interactive: false
164 clip: root.width != windowWidth
165 model: ListModel {
166- id: departmentModel
167+ id: navigationModel
168 // We have two roles
169- // departmentId: the department id of the department the list represents
170- // nullifyDepartment: overrides departmentId to be null
171+ // navigationId: the navigation id of the navigation the list represents
172+ // nullifyNavigation: overrides navigationId to be null
173 // This is used to "clear" the delegate when going "right" on the tree
174 }
175 anchors {
176@@ -111,7 +112,12 @@
177 right: parent.right
178 top: root.bottom
179 }
180- readonly property int maxHeight: (windowHeight - mapToItem(null, root.x, root.y).y) - units.gu(8)
181+ property int maxHeight: -1
182+ Component.onCompleted: updateMaxHeight();
183+ function updateMaxHeight()
184+ {
185+ maxHeight = (windowHeight - mapToItem(null, 0, 0).y) - units.gu(8);
186+ }
187 property int prevHeight: maxHeight
188 height: currentItem ? currentItem.height : maxHeight
189 onHeightChanged: {
190@@ -120,83 +126,84 @@
191 }
192 }
193 highlightMoveDuration: UbuntuAnimation.FastDuration
194- delegate: DashDepartmentsList {
195- objectName: "department" + index
196+ delegate: DashNavigationList {
197+ objectName: "navigation" + index
198 visible: height != 0
199- width: departmentListView.width
200+ width: navigationListView.width
201 scopeStyle: root.scopeStyle
202 property real desiredHeight: {
203 if (root.showList) {
204- if (department && department.loaded && x == departmentListView.contentX)
205+ if (navigation && navigation.loaded && x == navigationListView.contentX)
206 {
207- return Math.min(implicitHeight, departmentListView.maxHeight);
208+ navigationListView.updateMaxHeight();
209+ return Math.min(implicitHeight, navigationListView.maxHeight);
210 } else {
211- return departmentListView.prevHeight;
212+ return navigationListView.prevHeight;
213 }
214 } else {
215 return 0;
216 }
217 }
218 height: desiredHeight
219- department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
220- currentDepartment: root.currentDepartment
221- onEnterDepartment: {
222- scope.loadDepartment(newDepartmentId);
223+ navigation: (nullifyNavigation || !scope) ? null : scope.getNavigation(navigationId)
224+ currentNavigation: root.currentNavigation
225+ onEnterNavigation: {
226+ scope.setNavigationState(newNavigationId, false);
227 // We only need to add a new item to the model
228 // if we have children, otherwise just load it
229 if (hasChildren) {
230 isGoingBack = false;
231- departmentModel.append({"departmentId": newDepartmentId, "nullifyDepartment": false});
232- departmentListView.currentIndex++;
233+ navigationModel.append({"navigationId": newNavigationId, "nullifyNavigation": false});
234+ navigationListView.currentIndex++;
235 } else {
236 showList = false;
237 }
238 }
239 onGoBackToParentClicked: {
240- scope.loadDepartment(department.parentDepartmentId);
241+ scope.setNavigationState(navigation.parentNavigationId, false);
242 isGoingBack = true;
243- departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
244- departmentListView.currentIndex--;
245+ navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
246+ navigationListView.currentIndex--;
247 }
248- onAllDepartmentClicked: {
249+ onAllNavigationClicked: {
250 showList = false;
251- if (root.currentDepartment.parentDepartmentId == department.departmentId) {
252+ if (root.currentNavigation.parentNavigationId == navigation.navigationId) {
253 // For leaves we have to go to the parent too
254- scope.loadDepartment(root.currentDepartment.parentDepartmentId);
255+ scope.setNavigationState(root.currentNavigation.parentNavigationId, false);
256 }
257 }
258 }
259 onContentXChanged: {
260- if (contentX == width * departmentListView.currentIndex) {
261+ if (contentX == width * navigationListView.currentIndex) {
262 if (isGoingBack) {
263- departmentModel.remove(departmentListView.currentIndex + 1);
264+ navigationModel.remove(navigationListView.currentIndex + 1);
265 } else {
266- departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", true);
267+ navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", true);
268 }
269 }
270 }
271 }
272
273 InverseMouseArea {
274- anchors.fill: departmentListView
275+ anchors.fill: navigationListView
276 enabled: root.showList
277 onClicked: root.showList = false
278 }
279
280 onScopeChanged: {
281- departmentModel.clear();
282- if (scope && scope.hasDepartments) {
283- departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
284+ navigationModel.clear();
285+ if (scope && scope.hasNavigation) {
286+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
287 }
288 }
289
290 Connections {
291 target: scope
292- onHasDepartmentsChanged: {
293- if (scope.hasDepartments) {
294- departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
295+ onHasNavigationChanged: {
296+ if (scope.hasNavigation) {
297+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
298 } else {
299- departmentModel.clear();
300+ navigationModel.clear();
301 }
302 }
303 }
304
305=== renamed file 'qml/Dash/DashDepartmentsList.qml' => 'qml/Dash/DashNavigationList.qml'
306--- qml/Dash/DashDepartmentsList.qml 2014-07-08 11:08:19 +0000
307+++ qml/Dash/DashNavigationList.qml 2014-08-06 10:17:24 +0000
308@@ -15,16 +15,16 @@
309 */
310
311 import QtQuick 2.2
312-import Ubuntu.Components 0.1
313+import Ubuntu.Components 1.1
314
315 Item {
316 id: root
317- property var department: null
318- property var currentDepartment: null
319+ property var navigation: null
320+ property var currentNavigation: null
321 property var scopeStyle: null
322- signal enterDepartment(var newDepartmentId, bool hasChildren)
323+ signal enterNavigation(var newNavigationId, bool hasChildren)
324 signal goBackToParentClicked()
325- signal allDepartmentClicked()
326+ signal allNavigationClicked()
327
328 readonly property int itemHeight: units.gu(5)
329 readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
330@@ -38,7 +38,7 @@
331 ActivityIndicator {
332 id: loadingIndicator
333 anchors.centerIn: parent
334- running: !(department && department.loaded)
335+ running: !(navigation && navigation.loaded)
336 }
337 clip: true
338
339@@ -54,6 +54,7 @@
340
341 anchors.fill: parent
342
343+ flickableDirection: Flickable.VerticalFlick
344 contentHeight: column.height
345 contentWidth: width
346
347@@ -68,7 +69,7 @@
348 id: backButton
349 objectName: "backButton"
350 width: parent.width
351- visible: department && !department.isRoot || false
352+ visible: navigation && !navigation.isRoot || false
353 height: itemHeight
354
355 onClicked: root.goBackToParentClicked();
356@@ -92,7 +93,7 @@
357 left: backImage.right
358 leftMargin: units.gu(0.5)
359 }
360- text: department ? department.parentLabel : ""
361+ text: navigation ? navigation.parentLabel : ""
362 color: root.foregroundColor
363 }
364
365@@ -114,7 +115,7 @@
366 id: allButton
367 objectName: "allButton"
368 width: parent.width
369- visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
370+ visible: navigation && (!navigation.isRoot || (root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
371 height: itemHeight
372
373 Label {
374@@ -123,7 +124,7 @@
375 left: parent.left
376 leftMargin: units.gu(2)
377 }
378- text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
379+ text: navigation ? (navigation.allLabel != "" ? navigation.allLabel : navigation.label) : ""
380 font.bold: true
381 color: root.foregroundColor
382 }
383@@ -141,18 +142,18 @@
384 height: units.dp(1)
385 }
386
387- onClicked: root.allDepartmentClicked();
388+ onClicked: root.allNavigationClicked();
389 }
390
391 Repeater {
392- model: department && department.loaded ? department : null
393+ model: navigation && navigation.loaded ? navigation : null
394 clip: true
395 delegate: AbstractButton {
396 objectName: root.objectName + "child" + index
397 height: root.itemHeight
398 width: root.width
399
400- onClicked: root.enterDepartment(departmentId, hasChildren)
401+ onClicked: root.enterNavigation(navigationId, hasChildren)
402
403 Label {
404 anchors {
405@@ -188,7 +189,7 @@
406 color: root.foregroundColor
407 opacity: 0.1
408 height: units.dp(1)
409- visible: index != department.count - 1
410+ visible: index != navigation.count - 1
411 }
412 }
413 }
414
415=== modified file 'qml/Dash/GenericScopeView.qml'
416--- qml/Dash/GenericScopeView.qml 2014-07-29 11:35:10 +0000
417+++ qml/Dash/GenericScopeView.qml 2014-08-06 10:17:24 +0000
418@@ -25,6 +25,7 @@
419 FocusScope {
420 id: scopeView
421
422+ readonly property alias departmentsShown: dashNavigation.showList
423 property var scope: null
424 property SortFilterProxyModel categories: categoryFilter
425 property bool isCurrent: false
426@@ -39,16 +40,6 @@
427
428 signal backClicked()
429
430- onScopeChanged: {
431- if (scope) {
432- scope.activateApplication.connect(activateApp);
433- }
434- }
435-
436- function activateApp(appId) {
437- Qt.openUrlExternally(appId);
438- }
439-
440 function positionAtBeginning() {
441 categoryView.positionAtBeginning()
442 }
443@@ -119,6 +110,7 @@
444 model: scopeView.categories
445 forceNoClip: previewListView.open
446 pixelAligned: true
447+ interactive: !dashNavigation.showList
448
449 property string expandedCategoryId: ""
450
451@@ -390,7 +382,8 @@
452 searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false
453 scopeStyle: scopeView.scopeStyle
454
455- bottomItem: DashDepartments {
456+ bottomItem: DashNavigation {
457+ id: dashNavigation
458 scope: scopeView.scope
459 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)
460 anchors.right: parent.right
461
462=== modified file 'qml/ScopeTool.qml'
463--- qml/ScopeTool.qml 2014-07-03 09:08:22 +0000
464+++ qml/ScopeTool.qml 2014-08-06 10:17:24 +0000
465@@ -45,16 +45,6 @@
466 signal searchClicked
467 }
468
469- SortFilterProxyModel {
470- id: filteredScopes
471- model: Scopes {
472- id: scopes
473- }
474- dynamicSortFilter: true
475-
476- filterRole: Scopes.RoleVisible
477- filterRegExp: RegExp("^true$")
478- }
479
480 Rectangle {
481 anchors.fill: dashContent
482@@ -72,8 +62,8 @@
483 DashContent {
484 id: dashContent
485
486- model: filteredScopes
487 property var scope: scopes.getScope(currentIndex)
488+ scopes: Scopes { }
489
490 anchors {
491 top: parent.top
492
493=== modified file 'tests/mocks/Unity/CMakeLists.txt'
494--- tests/mocks/Unity/CMakeLists.txt 2014-08-05 12:06:16 +0000
495+++ tests/mocks/Unity/CMakeLists.txt 2014-08-06 10:17:24 +0000
496@@ -7,7 +7,7 @@
497 pkg_search_module(DEE dee-1.0 REQUIRED)
498 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
499 pkg_search_module(DEEQT libdee-qt5 REQUIRED)
500-pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=3)
501+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=4)
502
503 include_directories(
504 ${CMAKE_CURRENT_BINARY_DIR}
505@@ -23,14 +23,14 @@
506 fake_scope.cpp
507 fake_scopes.cpp
508 fake_categories.cpp
509- fake_department.cpp
510+ fake_navigation.cpp
511 fake_resultsmodel.cpp
512 fake_previewmodel.cpp
513 fake_previewstack.cpp
514 fake_previewwidgetmodel.cpp
515 fake_unity_plugin.cpp
516 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h
517- ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/DepartmentInterface.h
518+ ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/NavigationInterface.h
519 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h
520 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h
521 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h
522
523=== modified file 'tests/mocks/Unity/Unity.qmltypes'
524--- tests/mocks/Unity/Unity.qmltypes 2014-07-10 10:59:08 +0000
525+++ tests/mocks/Unity/Unity.qmltypes 2014-08-06 10:17:24 +0000
526@@ -24,6 +24,12 @@
527 Parameter { name: "categoryId"; type: "string" }
528 Parameter { name: "json"; type: "string" }
529 }
530+ Method {
531+ name: "data"
532+ type: "QVariant"
533+ Parameter { name: "row"; type: "int" }
534+ Parameter { name: "role"; type: "int" }
535+ }
536 }
537 Component {
538 name: "PreviewModel"
539@@ -81,13 +87,14 @@
540 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
541 }
542 Method {
543- name: "getDepartment"
544- type: "unity::shell::scopes::DepartmentInterface*"
545- Parameter { name: "id"; type: "string" }
546+ name: "getNavigation"
547+ type: "unity::shell::scopes::NavigationInterface*"
548+ Parameter { name: "navigationId"; type: "string" }
549 }
550 Method {
551- name: "loadDepartment"
552- Parameter { name: "id"; type: "string" }
553+ name: "getAltNavigation"
554+ type: "unity::shell::scopes::NavigationInterface*"
555+ Parameter { name: "altNavigationId"; type: "string" }
556 }
557 Method {
558 name: "performQuery"
559@@ -137,6 +144,7 @@
560 "RoleRawRendererTemplate": 3,
561 "RoleRenderer": 4,
562 "RoleComponents": 5,
563+ "RoleHeaderLink": 6,
564 "RoleResults": 7,
565 "RoleCount": 8
566 }
567@@ -157,27 +165,31 @@
568 }
569 }
570 Component {
571- name: "unity::shell::scopes::DepartmentInterface"
572+ name: "unity::shell::scopes::NavigationInterface"
573 prototype: "QAbstractListModel"
574- exports: ["Unity/Department 0.2"]
575+ exports: ["Unity/Navigation 0.2"]
576 isCreatable: false
577 exportMetaObjectRevisions: [0]
578 Enum {
579 name: "Roles"
580 values: {
581- "RoleDepartmentId": 0,
582- "RoleLabel": 1,
583- "RoleHasChildren": 2,
584- "RoleIsActive": 3
585+ "RoleNavigationId": 0,
586+ "RoleQuery": 1,
587+ "RoleLabel": 2,
588+ "RoleHasChildren": 3,
589+ "RoleIsActive": 4
590 }
591 }
592- Property { name: "departmentId"; type: "string"; isReadonly: true }
593+ Property { name: "navigationId"; type: "string"; isReadonly: true }
594+ Property { name: "query"; type: "string"; isReadonly: true }
595 Property { name: "label"; type: "string"; isReadonly: true }
596 Property { name: "allLabel"; type: "string"; isReadonly: true }
597- Property { name: "parentDepartmentId"; type: "string"; isReadonly: true }
598+ Property { name: "parentNavigationId"; type: "string"; isReadonly: true }
599+ Property { name: "parentQuery"; type: "string"; isReadonly: true }
600 Property { name: "parentLabel"; type: "string"; isReadonly: true }
601 Property { name: "loaded"; type: "bool"; isReadonly: true }
602 Property { name: "isRoot"; type: "bool"; isReadonly: true }
603+ Property { name: "hidden"; type: "bool"; isReadonly: true }
604 Property { name: "count"; type: "int"; isReadonly: true }
605 }
606 Component {
607@@ -247,7 +259,8 @@
608 "RoleEmblem": 8,
609 "RoleSummary": 9,
610 "RoleAttributes": 10,
611- "RoleBackground": 11
612+ "RoleBackground": 11,
613+ "RoleOverlayColor": 12
614 }
615 }
616 Property { name: "categoryId"; type: "string" }
617@@ -259,13 +272,22 @@
618 exports: ["Unity/Scope 0.2"]
619 isCreatable: false
620 exportMetaObjectRevisions: [0]
621+ Enum {
622+ name: "Status"
623+ values: {
624+ "Okay": 0,
625+ "NoInternet": 1,
626+ "NoLocationData": 2,
627+ "Unknown": 3
628+ }
629+ }
630 Property { name: "id"; type: "string"; isReadonly: true }
631 Property { name: "name"; type: "string"; isReadonly: true }
632 Property { name: "iconHint"; type: "string"; isReadonly: true }
633 Property { name: "description"; type: "string"; isReadonly: true }
634 Property { name: "searchHint"; type: "string"; isReadonly: true }
635 Property { name: "searchInProgress"; type: "bool"; isReadonly: true }
636- Property { name: "visible"; type: "bool"; isReadonly: true }
637+ Property { name: "favorite"; type: "bool" }
638 Property { name: "shortcut"; type: "string"; isReadonly: true }
639 Property {
640 name: "categories"
641@@ -273,13 +295,27 @@
642 isReadonly: true
643 isPointer: true
644 }
645+ Property {
646+ name: "settings"
647+ type: "unity::shell::scopes::SettingsModelInterface"
648+ isReadonly: true
649+ isPointer: true
650+ }
651 Property { name: "searchQuery"; type: "string" }
652 Property { name: "noResultsHint"; type: "string" }
653 Property { name: "formFactor"; type: "string" }
654 Property { name: "isActive"; type: "bool" }
655- Property { name: "currentDepartmentId"; type: "string"; isReadonly: true }
656- Property { name: "hasDepartments"; type: "bool"; isReadonly: true }
657+ Property { name: "currentNavigationId"; type: "string"; isReadonly: true }
658+ Property { name: "hasNavigation"; type: "bool"; isReadonly: true }
659+ Property { name: "currentAltNavigationId"; type: "string"; isReadonly: true }
660+ Property { name: "hasAltNavigation"; type: "bool"; isReadonly: true }
661 Property { name: "customizations"; type: "QVariantMap"; isReadonly: true }
662+ Property {
663+ name: "status"
664+ type: "unity::shell::scopes::ScopeInterface::Status"
665+ isReadonly: true
666+ }
667+ Signal { name: "detailsChanged" }
668 Signal { name: "showDash" }
669 Signal { name: "hideDash" }
670 Signal {
671@@ -317,13 +353,18 @@
672 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
673 }
674 Method {
675- name: "getDepartment"
676- type: "unity::shell::scopes::DepartmentInterface*"
677- Parameter { name: "departmentId"; type: "string" }
678- }
679- Method {
680- name: "loadDepartment"
681- Parameter { name: "departmentId"; type: "string" }
682+ name: "getNavigation"
683+ type: "unity::shell::scopes::NavigationInterface*"
684+ Parameter { name: "navigationId"; type: "string" }
685+ }
686+ Method {
687+ name: "getAltNavigation"
688+ type: "unity::shell::scopes::NavigationInterface*"
689+ Parameter { name: "altNavigationId"; type: "string" }
690+ }
691+ Method {
692+ name: "performQuery"
693+ Parameter { name: "cannedQuery"; type: "string" }
694 }
695 }
696 Component {
697@@ -334,11 +375,17 @@
698 values: {
699 "RoleScope": 0,
700 "RoleId": 1,
701- "RoleVisible": 2,
702- "RoleTitle": 3
703+ "RoleTitle": 2
704 }
705 }
706 Property { name: "loaded"; type: "bool"; isReadonly: true }
707+ Property { name: "count"; type: "int"; isReadonly: true }
708+ Property {
709+ name: "overviewScope"
710+ type: "unity::shell::scopes::ScopeInterface"
711+ isReadonly: true
712+ isPointer: true
713+ }
714 Method {
715 name: "getScope"
716 type: "unity::shell::scopes::ScopeInterface*"
717
718=== renamed file 'tests/mocks/Unity/fake_department.cpp' => 'tests/mocks/Unity/fake_navigation.cpp'
719--- tests/mocks/Unity/fake_department.cpp 2014-06-18 13:48:32 +0000
720+++ tests/mocks/Unity/fake_navigation.cpp 2014-08-06 10:17:24 +0000
721@@ -14,14 +14,15 @@
722 * along with this program. If not, see <http://www.gnu.org/licenses/>.
723 */
724
725-#include "fake_department.h"
726+#include "fake_navigation.h"
727
728 #include "fake_scope.h"
729
730+#include <QDebug>
731 #include <QTimer>
732
733-Department::Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
734- : m_departmentId(departmentId)
735+Navigation::Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
736+ : m_navigationId(navigationId)
737 , m_label(label)
738 , m_allLabel(allLabel)
739 , m_parentId(parentId)
740@@ -30,96 +31,87 @@
741 , m_scope(scope)
742 {
743 QTimer::singleShot(1500, this, SLOT(slotLoaded()));
744- connect(scope, SIGNAL(currentDepartmentIdChanged()), this, SLOT(slotCurrentDepartmentChanged()));
745+ connect(scope, SIGNAL(currentNavigationIdChanged()), this, SLOT(slotCurrentNavigationChanged()));
746 }
747
748-QString Department::departmentId() const
749+QString Navigation::navigationId() const
750 {
751- return m_departmentId;
752+ return m_navigationId;
753 }
754
755-QString Department::label() const
756+QString Navigation::label() const
757 {
758 return m_label;
759 }
760
761-QString Department::allLabel() const
762+QString Navigation::allLabel() const
763 {
764 return m_allLabel;
765 }
766
767-QString Department::parentDepartmentId() const
768+QString Navigation::parentNavigationId() const
769 {
770 return m_parentId;
771 }
772
773-QString Department::parentLabel() const
774+QString Navigation::parentLabel() const
775 {
776 return m_parentLabel;
777 }
778
779-void Department::slotLoaded()
780+void Navigation::slotLoaded()
781 {
782 m_loaded = true;
783 Q_EMIT loadedChanged();
784 }
785
786-bool Department::loaded() const
787+bool Navigation::loaded() const
788 {
789 return m_loaded;
790 }
791
792-int Department::count() const
793+int Navigation::count() const
794 {
795 return rowCount();
796 }
797
798-bool Department::isRoot() const
799-{
800- return m_departmentId == "root";
801-}
802-
803-int Department::rowCount(const QModelIndex & /*parent*/) const
804-{
805- if (!m_loaded || m_departmentId.startsWith("child") || m_departmentId == "middle3")
806+bool Navigation::isRoot() const
807+{
808+ return m_navigationId == "root" || m_navigationId == "altroot";
809+}
810+
811+bool Navigation::hidden() const
812+{
813+ return m_navigationId == "altroot";
814+}
815+
816+int Navigation::rowCount(const QModelIndex & /*parent*/) const
817+{
818+ if (!m_loaded || m_navigationId.startsWith("child") || m_navigationId == "middle3")
819 return 0;
820 else
821 return 8;
822 }
823
824-QHash<int, QByteArray> Department::roleNames() const
825-{
826- QHash<int, QByteArray> res;
827- res[RoleDepartmentId] = "departmentId";
828- res[RoleLabel] = "label";
829- res[RoleHasChildren] = "hasChildren";
830- res[RoleIsActive] = "isActive";
831- return res;
832-}
833-
834-QVariant Department::data(const QModelIndex &index, int role) const
835+QVariant Navigation::data(const QModelIndex &index, int role) const
836 {
837 switch (role) {
838- case RoleDepartmentId:
839- if (m_departmentId == "root")
840+ case RoleNavigationId:
841+ if (m_navigationId == "root")
842 return QString("middle%1").arg(index.row());
843- else if (m_departmentId.startsWith("middle"))
844- return QString("child%1%2").arg(m_departmentId).arg(index.row());
845- break;
846+ else if (m_navigationId.startsWith("middle"))
847+ return QString("child%1%2").arg(m_navigationId).arg(index.row());
848 case RoleLabel:
849- return QString("%1Child%2").arg(m_departmentId).arg(index.row());
850- break;
851+ return QString("%1Child%2").arg(m_navigationId).arg(index.row());
852 case RoleHasChildren:
853- return m_departmentId == "root" && index.row() != 3;
854- break;
855+ return m_navigationId == "root" && index.row() != 3;
856 case RoleIsActive:
857- return m_scope->currentDepartmentId() == data(index, RoleDepartmentId);
858- break;
859+ return m_scope->currentNavigationId() == data(index, RoleNavigationId);
860 }
861 return QVariant();
862 }
863
864-void Department::slotCurrentDepartmentChanged()
865+void Navigation::slotCurrentNavigationChanged()
866 {
867 // This is wasteful, should only emit it if really something changed in this
868 // deparment, but this is a mock, so no need to optimize
869
870=== renamed file 'tests/mocks/Unity/fake_department.h' => 'tests/mocks/Unity/fake_navigation.h'
871--- tests/mocks/Unity/fake_department.h 2014-05-29 10:25:21 +0000
872+++ tests/mocks/Unity/fake_navigation.h 2014-08-06 10:17:24 +0000
873@@ -14,48 +14,48 @@
874 * along with this program. If not, see <http://www.gnu.org/licenses/>.
875 */
876
877-#ifndef FAKE_DEPARTMENT_H
878-#define FAKE_DEPARTMENT_H
879+#ifndef FAKE_NAVIGATION_H
880+#define FAKE_NAVIGATION_H
881
882-#include <unity/shell/scopes/DepartmentInterface.h>
883+#include <unity/shell/scopes/NavigationInterface.h>
884
885 class Scope;
886
887-class Department : public unity::shell::scopes::DepartmentInterface
888+class Navigation : public unity::shell::scopes::NavigationInterface
889 {
890 Q_OBJECT
891
892 public:
893- Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
894+ Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
895
896- QString departmentId() const override;
897+ QString navigationId() const override;
898 QString label() const override;
899 QString allLabel() const override;
900- QString parentDepartmentId() const override;
901+ QString parentNavigationId() const override;
902 QString parentLabel() const override;
903 bool loaded() const override;
904+ bool isRoot() const override;
905+ bool hidden() const override;
906 int count() const override;
907- bool isRoot() const override;
908
909 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
910- QHash<int, QByteArray> roleNames() const;
911 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
912
913 public Q_SLOTS:
914- void slotCurrentDepartmentChanged();
915+ void slotCurrentNavigationChanged();
916
917 private Q_SLOTS:
918 void slotLoaded();
919
920 private:
921- QString m_departmentId;
922+ QString m_navigationId;
923 QString m_label;
924 QString m_allLabel;
925 QString m_parentId;
926 QString m_parentLabel;
927 bool m_loaded;
928- QString m_currentDepartment;
929+ QString m_currentNavigation;
930 Scope *m_scope;
931 };
932
933-#endif // FAKE_DEPARTMENT_H
934+#endif // FAKE_NAVIGATION_H
935
936=== modified file 'tests/mocks/Unity/fake_scope.cpp'
937--- tests/mocks/Unity/fake_scope.cpp 2014-07-24 20:40:57 +0000
938+++ tests/mocks/Unity/fake_scope.cpp 2014-08-06 10:17:24 +0000
939@@ -14,24 +14,26 @@
940 * along with this program. If not, see <http://www.gnu.org/licenses/>.
941 */
942
943+#include <QDebug>
944 #include <QUrl>
945
946 #include "fake_scope.h"
947-#include "fake_department.h"
948+#include "fake_navigation.h"
949 #include "fake_resultsmodel.h"
950
951 Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
952 {
953 }
954
955-Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories)
956+Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)
957 : unity::shell::scopes::ScopeInterface(parent)
958 , m_id(id)
959 , m_name(name)
960- , m_visible(visible)
961 , m_searching(false)
962+ , m_favorite(favorite)
963 , m_isActive(false)
964- , m_currentDeparment("root")
965+ , m_currentNavigationId("root")
966+ , m_currentAltNavigationId("altroot")
967 , m_previewRendererName("preview-generic")
968 , m_categories(new Categories(categories, this))
969 {
970@@ -77,6 +79,11 @@
971 return m_searching;
972 }
973
974+bool Scope::favorite() const
975+{
976+ return m_favorite;
977+}
978+
979 unity::shell::scopes::CategoriesInterface* Scope::categories() const
980 {
981 return m_categories;
982@@ -97,11 +104,6 @@
983 return m_formFactor;
984 }
985
986-bool Scope::visible() const
987-{
988- return m_visible;
989-}
990-
991 bool Scope::isActive() const
992 {
993 return m_isActive;
994@@ -131,6 +133,13 @@
995 }
996 }
997
998+void Scope::setFavorite(const bool favorite)
999+{
1000+ if (favorite != m_favorite) {
1001+ m_favorite = favorite;
1002+ Q_EMIT favoriteChanged();
1003+ }
1004+}
1005 void Scope::setSearchInProgress(const bool inProg)
1006 {
1007 if (inProg != m_searching) {
1008@@ -170,14 +179,29 @@
1009 qFatal("Scope::closeScope is not implemented");
1010 }
1011
1012-QString Scope::currentDepartmentId() const
1013-{
1014- return m_currentDeparment;
1015-}
1016-
1017-bool Scope::hasDepartments() const
1018-{
1019- return true;
1020+QString Scope::currentNavigationId() const
1021+{
1022+ return m_currentNavigationId;
1023+}
1024+
1025+bool Scope::hasNavigation() const
1026+{
1027+ return true;
1028+}
1029+
1030+QString Scope::currentAltNavigationId() const
1031+{
1032+ return m_currentAltNavigationId;
1033+}
1034+
1035+bool Scope::hasAltNavigation() const
1036+{
1037+ return true;
1038+}
1039+
1040+Scope::Status Scope::status() const
1041+{
1042+ return Status::Okay;
1043 }
1044
1045 QVariantMap Scope::customizations() const
1046@@ -196,7 +220,12 @@
1047 return m;
1048 }
1049
1050-unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
1051+void Scope::refresh()
1052+{
1053+ qDebug() << "Scope::refresh is currently not implmented in the fake scopes plugin";
1054+}
1055+
1056+unity::shell::scopes::NavigationInterface* Scope::getNavigation(const QString& id)
1057 {
1058 if (id.isEmpty())
1059 return nullptr;
1060@@ -210,11 +239,30 @@
1061 parentId = id.mid(5, 7);
1062 parentLabel = parentId;
1063 }
1064- return new Department(id, id, "all"+id, parentId, parentLabel, this);
1065-}
1066-
1067-void Scope::loadDepartment(const QString& id)
1068-{
1069- m_currentDeparment = id;
1070- Q_EMIT currentDepartmentIdChanged();
1071+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
1072+}
1073+
1074+unity::shell::scopes::NavigationInterface* Scope::getAltNavigation(QString const& id)
1075+{
1076+ if (id.isEmpty())
1077+ return nullptr;
1078+
1079+ QString parentId;
1080+ QString parentLabel;
1081+ if (id.startsWith("altmiddle")) {
1082+ parentId = "altroot";
1083+ parentLabel = "altroot";
1084+ }
1085+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
1086+}
1087+
1088+void Scope::setNavigationState(const QString &navigationId, bool isAltNavigation)
1089+{
1090+ if (isAltNavigation) {
1091+ m_currentAltNavigationId = navigationId;
1092+ Q_EMIT currentAltNavigationIdChanged();
1093+ } else {
1094+ m_currentNavigationId = navigationId;
1095+ Q_EMIT currentNavigationIdChanged();
1096+ }
1097 }
1098
1099=== modified file 'tests/mocks/Unity/fake_scope.h'
1100--- tests/mocks/Unity/fake_scope.h 2014-07-11 16:39:33 +0000
1101+++ tests/mocks/Unity/fake_scope.h 2014-08-06 10:17:24 +0000
1102@@ -30,7 +30,7 @@
1103
1104 public:
1105 Scope(QObject* parent = 0);
1106- Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0, int categories = 20);
1107+ Scope(QString const& id, QString const& name, bool favorite, QObject* parent = 0, int categories = 20);
1108
1109 /* getters */
1110 QString id() const override;
1111@@ -38,9 +38,9 @@
1112 QString iconHint() const override;
1113 QString description() const override;
1114 QString searchHint() const override;
1115- bool visible() const override;
1116 QString shortcut() const override;
1117 bool searchInProgress() const override;
1118+ bool favorite() const override;
1119 unity::shell::scopes::CategoriesInterface* categories() const override;
1120 QString searchQuery() const override;
1121 QString noResultsHint() const override;
1122@@ -53,6 +53,7 @@
1123 void setNoResultsHint(const QString& hint) override;
1124 void setFormFactor(const QString& form_factor) override;
1125 void setActive(const bool) override;
1126+ void setFavorite(const bool) override;
1127 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
1128
1129 Q_INVOKABLE void activate(QVariant const& result) override;
1130@@ -60,14 +61,20 @@
1131 Q_INVOKABLE void cancelActivation() override;
1132 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
1133
1134- QString currentDepartmentId() const override;
1135- bool hasDepartments() const override;
1136- Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
1137- Q_INVOKABLE void loadDepartment(const QString& id) override;
1138+ QString currentNavigationId() const override;
1139+ bool hasNavigation() const override;
1140+ QString currentAltNavigationId() const override;
1141+ bool hasAltNavigation() const override;
1142+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) override;
1143+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) override;
1144+ Q_INVOKABLE void setNavigationState(const QString &navigationId, bool isAltNavigation) override;
1145 Q_SIGNAL void performQuery(const QString& query) override;
1146
1147+ Status status() const override;
1148 QVariantMap customizations() const override;
1149
1150+ Q_INVOKABLE void refresh() override;
1151+
1152 protected:
1153
1154 QString m_id;
1155@@ -77,10 +84,11 @@
1156 QString m_searchQuery;
1157 QString m_noResultsHint;
1158 QString m_formFactor;
1159- bool m_visible;
1160 bool m_searching;
1161+ bool m_favorite;
1162 bool m_isActive;
1163- QString m_currentDeparment;
1164+ QString m_currentNavigationId;
1165+ QString m_currentAltNavigationId;
1166
1167 QString m_previewRendererName;
1168
1169
1170=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
1171--- tests/mocks/Unity/fake_scopes.cpp 2014-07-25 13:25:45 +0000
1172+++ tests/mocks/Unity/fake_scopes.cpp 2014-08-06 10:17:24 +0000
1173@@ -32,6 +32,11 @@
1174 timer.setSingleShot(true);
1175 timer.setInterval(100);
1176 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
1177+
1178+ QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
1179+ QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
1180+ QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
1181+
1182 load();
1183 }
1184
1185@@ -92,8 +97,6 @@
1186 return QVariant::fromValue(scope);
1187 } else if (role == Scopes::RoleId) {
1188 return QVariant::fromValue(scope->id());
1189- } else if (role == Scopes::RoleVisible) {
1190- return QVariant::fromValue(scope->visible());
1191 } else if (role == Scopes::RoleTitle) {
1192 return QVariant::fromValue(scope->name());
1193 } else {
1194@@ -125,6 +128,11 @@
1195 return m_loaded;
1196 }
1197
1198+int Scopes::count() const
1199+{
1200+ return rowCount();
1201+}
1202+
1203 unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
1204 {
1205 return nullptr;
1206
1207=== modified file 'tests/mocks/Unity/fake_scopes.h'
1208--- tests/mocks/Unity/fake_scopes.h 2014-07-25 13:25:45 +0000
1209+++ tests/mocks/Unity/fake_scopes.h 2014-08-06 10:17:24 +0000
1210@@ -50,6 +50,7 @@
1211 QModelIndex parent ( const QModelIndex & index ) const;
1212
1213 bool loaded() const override;
1214+ int count() const override;
1215 unity::shell::scopes::ScopeInterface* overviewScope() const override;
1216
1217 private Q_SLOTS:
1218
1219=== modified file 'tests/mocks/Unity/fake_unity_plugin.cpp'
1220--- tests/mocks/Unity/fake_unity_plugin.cpp 2014-07-08 11:26:44 +0000
1221+++ tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-06 10:17:24 +0000
1222@@ -22,7 +22,7 @@
1223 // local
1224 #include "fake_scopes.h"
1225 #include "fake_categories.h"
1226-#include "fake_department.h"
1227+#include "fake_navigation.h"
1228 #include "fake_previewmodel.h"
1229 #include "fake_previewwidgetmodel.h"
1230 #include "fake_resultsmodel.h"
1231@@ -43,7 +43,7 @@
1232 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");
1233 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");
1234 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");
1235- qmlRegisterUncreatableType<unity::shell::scopes::DepartmentInterface>(uri, 0, 2, "Department", "Can't create Department object in QML.");
1236+ qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
1237 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
1238 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
1239 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
1240
1241=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
1242--- tests/qmltests/Dash/tst_DashContent.qml 2014-07-21 13:28:35 +0000
1243+++ tests/qmltests/Dash/tst_DashContent.qml 2014-08-06 10:17:24 +0000
1244@@ -43,9 +43,6 @@
1245 id: dashContent
1246 anchors.fill: parent
1247
1248- model: SortFilterProxyModel {
1249- model: scopesModel
1250- }
1251 scopes : scopesModel
1252 }
1253
1254@@ -268,117 +265,119 @@
1255 verify(carouselLV.tileWidth / carouselLV.tileHeight == cardTool.components["art"]["aspect-ratio"]);
1256 }
1257
1258- function test_departments() {
1259- var dashDepartments = findChild(dashContent, "dashDepartments");
1260- compare(dashDepartments.visible, true);
1261- compare(dashDepartments.showList, false);
1262- waitForRendering(dashDepartments);
1263- mouseClick(dashDepartments, 0, 0);
1264- compare(dashDepartments.showList, true);
1265-
1266- var departmentListView = findChild(dashDepartments, "departmentListView");
1267- compare(departmentListView.count, 1);
1268- tryCompare(departmentListView.currentItem.department, "loaded", true);
1269-
1270- waitForRendering(departmentListView);
1271- waitForRendering(departmentListView.currentItem);
1272-
1273- var allButton = findChild(dashDepartments, "allButton");
1274- compare(allButton.visible, false);
1275-
1276- var department = findChild(dashDepartments, "department0child3");
1277- mouseClick(department, 0, 0);
1278- compare(dashDepartments.showList, false);
1279- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle3");
1280- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1281-
1282- mouseClick(dashDepartments, 0, 0);
1283- compare(dashDepartments.showList, true);
1284- waitForRendering(departmentListView);
1285- waitForRendering(departmentListView.currentItem);
1286- compare(allButton.visible, true);
1287-
1288- mouseClick(allButton, 0, 0);
1289- compare(dashDepartments.showList, false);
1290- tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
1291- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1292-
1293- mouseClick(dashDepartments, 0, 0);
1294- compare(dashDepartments.showList, true);
1295- waitForRendering(departmentListView);
1296- waitForRendering(departmentListView.currentItem);
1297- compare(allButton.visible, false);
1298-
1299- department = findChild(dashDepartments, "department0child2");
1300- mouseClick(department, 0, 0);
1301- compare(dashDepartments.showList, true);
1302- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1303- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1304-
1305- var departmentList1 = findChild(dashDepartments, "department1");
1306- allButton = findChild(departmentList1, "allButton");
1307- var backButton = findChild(findChild(departmentList1, "department1"), "backButton");
1308- compare(allButton.visible, true);
1309- compare(backButton.visible, true);
1310-
1311- tryCompare(departmentListView, "contentX", departmentList1.x);
1312- waitForRendering(departmentListView);
1313- mouseClick(allButton, 0, 0);
1314- compare(dashDepartments.showList, false);
1315- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1316- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1317-
1318- mouseClick(dashDepartments, 0, 0);
1319- compare(dashDepartments.showList, true);
1320- waitForRendering(departmentListView);
1321- waitForRendering(departmentListView.currentItem);
1322- compare(allButton.visible, true);
1323- compare(backButton.visible, true);
1324-
1325- tryCompare(departmentList1.department, "loaded", true);
1326- department = findChild(dashDepartments, "department1child2");
1327- mouseClick(department, 0, 0);
1328- compare(dashDepartments.showList, false);
1329- tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle22");
1330- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1331-
1332- mouseClick(dashDepartments, 0, 0);
1333- compare(dashDepartments.showList, true);
1334- waitForRendering(departmentListView);
1335- waitForRendering(departmentListView.currentItem);
1336-
1337- tryCompare(departmentList1.department, "loaded", true);
1338- department = findChild(dashDepartments, "department1child3");
1339- mouseClick(department, 0, 0);
1340- compare(dashDepartments.showList, false);
1341- tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle23");
1342- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1343-
1344- mouseClick(dashDepartments, 0, 0);
1345- compare(dashDepartments.showList, true);
1346- waitForRendering(departmentListView);
1347- waitForRendering(departmentListView.currentItem);
1348+ function test_navigations() {
1349+ var dashContentList = findChild(dashContent, "dashContentList");
1350+ tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
1351+ var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
1352+ tryCompare(dashNavigation, "visible", true);
1353+ compare(dashNavigation.showList, false);
1354+ waitForRendering(dashNavigation);
1355+ mouseClick(dashNavigation, 0, 0);
1356+ compare(dashNavigation.showList, true);
1357+
1358+ var navigationListView = findChild(dashNavigation, "navigationListView");
1359+ compare(navigationListView.count, 1);
1360+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
1361+
1362+ waitForRendering(navigationListView);
1363+ waitForRendering(navigationListView.currentItem);
1364+
1365+ var allButton = findChild(dashNavigation, "allButton");
1366+ compare(allButton.visible, false);
1367+
1368+ var navigation = findChild(dashNavigation, "navigation0child3");
1369+ mouseClick(navigation, 0, 0);
1370+ compare(dashNavigation.showList, false);
1371+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle3");
1372+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1373+
1374+ mouseClick(dashNavigation, 0, 0);
1375+ compare(dashNavigation.showList, true);
1376+ waitForRendering(navigationListView);
1377+ waitForRendering(navigationListView.currentItem);
1378+ compare(allButton.visible, true);
1379+
1380+ mouseClick(allButton, 0, 0);
1381+ compare(dashNavigation.showList, false);
1382+ tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
1383+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1384+
1385+ mouseClick(dashNavigation, 0, 0);
1386+ compare(dashNavigation.showList, true);
1387+ waitForRendering(navigationListView);
1388+ waitForRendering(navigationListView.currentItem);
1389+ compare(allButton.visible, false);
1390+
1391+ navigation = findChild(dashNavigation, "navigation0child2");
1392+ mouseClick(navigation, 0, 0);
1393+ compare(dashNavigation.showList, true);
1394+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1395+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1396+
1397+ var navigationList1 = findChild(dashNavigation, "navigation1");
1398+ allButton = findChild(navigationList1, "allButton");
1399+ var backButton = findChild(findChild(navigationList1, "navigation1"), "backButton");
1400+ compare(allButton.visible, true);
1401+ compare(backButton.visible, true);
1402+
1403+ tryCompare(navigationListView, "contentX", navigationList1.x);
1404+ waitForRendering(navigationListView);
1405+ mouseClick(allButton, 0, 0);
1406+ compare(dashNavigation.showList, false);
1407+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1408+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1409+
1410+ mouseClick(dashNavigation, 0, 0);
1411+ compare(dashNavigation.showList, true);
1412+ waitForRendering(navigationListView);
1413+ waitForRendering(navigationListView.currentItem);
1414+ compare(allButton.visible, true);
1415+ compare(backButton.visible, true);
1416+
1417+ tryCompare(navigationList1.navigation, "loaded", true);
1418+ navigation = findChild(dashNavigation, "navigation1child2");
1419+ mouseClick(navigation, 0, 0);
1420+ compare(dashNavigation.showList, false);
1421+ tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle22");
1422+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1423+
1424+ mouseClick(dashNavigation, 0, 0);
1425+ compare(dashNavigation.showList, true);
1426+ waitForRendering(navigationListView);
1427+ waitForRendering(navigationListView.currentItem);
1428+
1429+ tryCompare(navigationList1.navigation, "loaded", true);
1430+ navigation = findChild(dashNavigation, "navigation1child3");
1431+ mouseClick(navigation, 0, 0);
1432+ compare(dashNavigation.showList, false);
1433+ tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle23");
1434+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1435+
1436+ mouseClick(dashNavigation, 0, 0);
1437+ compare(dashNavigation.showList, true);
1438+ waitForRendering(navigationListView);
1439+ waitForRendering(navigationListView.currentItem);
1440 mouseClick(backButton, 0, 0);
1441
1442- tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
1443- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1444- compare(dashDepartments.showList, true);
1445- mouseClick(dashDepartments, 0, 0);
1446- compare(dashDepartments.showList, false);
1447+ tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
1448+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1449+ compare(dashNavigation.showList, true);
1450+ mouseClick(dashNavigation, 0, 0);
1451+ compare(dashNavigation.showList, false);
1452
1453- mouseClick(dashDepartments, 0, 0);
1454- compare(dashDepartments.showList, true);
1455- tryCompare(departmentListView.currentItem.department, "loaded", true);
1456- department = findChild(dashDepartments, "department0child2");
1457- mouseClick(department, 0, 0);
1458- compare(dashDepartments.showList, true);
1459- departmentList1 = findChild(dashDepartments, "department1");
1460- compare(departmentList1.department.loaded, false);
1461- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1462- allButton = findChild(departmentList1, "allButton");
1463- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1464+ mouseClick(dashNavigation, 0, 0);
1465+ compare(dashNavigation.showList, true);
1466+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
1467+ navigation = findChild(dashNavigation, "navigation0child2");
1468+ mouseClick(navigation, 0, 0);
1469+ compare(dashNavigation.showList, true);
1470+ navigationList1 = findChild(dashNavigation, "navigation1");
1471+ compare(navigationList1.navigation.loaded, false);
1472+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1473+ allButton = findChild(navigationList1, "allButton");
1474+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1475 mouseClick(allButton, 0, 0);
1476- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1477+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1478 }
1479 }
1480 }

Subscribers

People subscribed via source and target branches