on xenial help sign in
Merge lp:~unity-team/unity8/scopes-v4
commit737e6c060ac1e939a8fb63745ce5dc83c87a3c5e authorMichał Sawicz <michal.sawicz@canonical.com> dateWed 6 Aug 2014, 16:50 (12 years ago) parentb650121d2cf1f9
18 files changed+403−311
debian/control+2−2 qml/Dash/Dash.qml+9−11 qml/Dash/DashContent.qml+3−4 qml/Dash/DashDepartments.qml → qml/Dash/DashNavigation.qml+50−43 qml/Dash/DashDepartmentsList.qml → qml/Dash/DashNavigationList.qml+14−13 qml/Dash/GenericScopeView.qml+4−11 qml/ScopeTool.qml+1−11 tests/mocks/Unity/CMakeLists.txt+3−3 tests/mocks/Unity/Unity.qmltypes+79−27 tests/mocks/Unity/fake_department.cpp → tests/mocks/Unity/fake_navigation.cpp+32−40 tests/mocks/Unity/fake_department.h → tests/mocks/Unity/fake_navigation.h+13−13 tests/mocks/Unity/fake_scope.cpp+65−17 tests/mocks/Unity/fake_scope.h+16−8 tests/mocks/Unity/fake_scopes.cpp+10−2 tests/mocks/Unity/fake_scopes.h+1 tests/mocks/Unity/fake_unity_plugin.cpp+2−2 tests/qmltests/Dash/tst_Dash.qml+5−9 tests/qmltests/Dash/tst_DashContent.qml+94−95
debian/control+2−2
@@ -24,7 +24,7 @@ Build-Depends: cmake,
2424 libpulse-dev,
2525 libqmenumodel-dev (>= 0.2.8),
2626 libqt5xmlpatterns5-dev,
27− libunity-api-dev (>= 7.87),
27+ libunity-api-dev (>= 7.88),
2828 libusermetricsoutput1-dev,
2929 libxcb1-dev,
3030 pkg-config,
@@ -112,7 +112,7 @@ Depends: qtdeclarative5-ubuntu-thumbnailer0.1 | ubuntu-thumbnailer-impl,
112112 unity-application-impl-2,
113113 unity-notifications-impl-3,
114114 unity-plugin-scopes | unity-scopes-impl,
115− unity-scopes-impl-2,
115+ unity-scopes-impl-4,
116116 unity8-fake-env | unity-application-impl,
117117 ${misc:Depends},
118118Breaks: unity8 (<< 7.86),
qml/Dash/Dash.qml+9−11
@@ -38,7 +38,13 @@ Showable {
3838 }
3939
4040 function setCurrentScope(scopeId, animate, reset) {
41− var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
41+ var scopeIndex = -1;
42+ for (var i = 0; i < scopes.count; ++i) {
43+ if (scopes.getScope(i).id == scopeId) {
44+ scopeIndex = i;
45+ break;
46+ }
47+ }
4248
4349 if (scopeIndex == -1) {
4450 console.warn("No match for scope with id: %1".arg(scopeId))
@@ -63,15 +69,8 @@ Showable {
6369 }
6470 }
6571
66− SortFilterProxyModel {
67− id: filteredScopes
68− model: Scopes {
69− id: scopes
70− }
71− dynamicSortFilter: true
72−
73− filterRole: Scopes.RoleVisible
74− filterRegExp: RegExp("^true$")
72+ Scopes {
73+ id: scopes
7574 }
7675
7776 DashContent {
@@ -79,7 +78,6 @@ Showable {
7978 objectName: "dashContent"
8079 width: parent.width
8180 height: parent.height
82− model: filteredScopes
8381 scopes: scopes
8482 visible: x != -width
8583 onGotoScope: {
qml/Dash/DashContent.qml+3−4
@@ -23,8 +23,7 @@ import "../Components"
2323Item {
2424 id: dashContent
2525
26− property var model: null
27− property var scopes: null
26+ property alias scopes: dashContentList.model
2827 readonly property alias currentIndex: dashContentList.currentIndex
2928 readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item
3029 && dashContentList.currentItem.item.processing || false
@@ -91,10 +90,9 @@ Item {
9190 id: dashContentList
9291 objectName: "dashContentList"
9392
94− interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving
93+ interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown
9594
9695 anchors.fill: parent
97− model: dashContent.model
9896 orientation: ListView.Horizontal
9997 boundsBehavior: Flickable.DragAndOvershootBounds
10098 flickDeceleration: units.gu(625)
@@ -132,6 +130,7 @@ Item {
132130 objectName: scope.id + " loader"
133131
134132 readonly property bool moving: item ? item.moving : false
133+ readonly property bool navigationShown: item ? item.navigationShown : false
135134 readonly property var categoryView: item ? item.categoryView : null
136135 readonly property var theScope: scope
137136
qml/Dash/DashDepartments.qml → qml/Dash/DashNavigation.qmlrenamed+50−43
@@ -15,17 +15,17 @@
1515 */
1616
1717import QtQuick 2.2
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
1919
2020AbstractButton {
2121 id: root
22− objectName: "dashDepartments"
22+ objectName: "dashNavigation"
2323
2424 property var scope: null
2525
2626 property bool showList: false
2727
28− readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartmentId) : null
28+ readonly property var currentNavigation: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null
2929
3030 property alias windowWidth: blackRect.width
3131 property alias windowHeight: blackRect.height
@@ -34,20 +34,21 @@ AbstractButton {
3434 // Are we drilling down the tree or up?
3535 property bool isGoingBack: false
3636
37− visible: root.currentDepartment != null
37+ visible: root.currentNavigation != null
3838
3939 height: visible ? units.gu(5) : 0
4040
4141 onClicked: {
42+ navigationListView.updateMaxHeight();
4243 root.showList = !root.showList;
4344 }
4445
4546 Rectangle {
4647 id: blackRect
4748 color: "black"
48− opacity: departmentListView.currentItem && departmentListView.currentItem.visible ? 0.3 : 0
49+ opacity: navigationListView.currentItem && navigationListView.currentItem.visible ? 0.3 : 0
4950 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
50− anchors.top: departmentListView.top
51+ anchors.top: navigationListView.top
5152 anchors.right: parent.right
5253 visible: opacity != 0
5354 }
@@ -78,7 +79,7 @@ AbstractButton {
7879 anchors.fill: parent
7980 anchors.margins: units.gu(2)
8081 verticalAlignment: Text.AlignVCenter
81− text: root.currentDepartment ? root.currentDepartment.label : ""
82+ text: root.currentNavigation ? root.currentNavigation.label : ""
8283 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
8384 }
8485
@@ -92,18 +93,18 @@ AbstractButton {
9293 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
9394 }
9495
95− // departmentListView is outside root
96+ // navigationListView is outside root
9697 ListView {
97− id: departmentListView
98− objectName: "departmentListView"
98+ id: navigationListView
99+ objectName: "navigationListView"
99100 orientation: ListView.Horizontal
100101 interactive: false
101102 clip: root.width != windowWidth
102103 model: ListModel {
103− id: departmentModel
104+ id: navigationModel
104105 // We have two roles
105− // departmentId: the department id of the department the list represents
106− // nullifyDepartment: overrides departmentId to be null
106+ // navigationId: the navigation id of the navigation the list represents
107+ // nullifyNavigation: overrides navigationId to be null
107108 // This is used to "clear" the delegate when going "right" on the tree
108109 }
109110 anchors {
@@ -111,7 +112,12 @@ AbstractButton {
111112 right: parent.right
112113 top: root.bottom
113114 }
114− readonly property int maxHeight: (windowHeight - mapToItem(null, root.x, root.y).y) - units.gu(8)
115+ property int maxHeight: -1
116+ Component.onCompleted: updateMaxHeight();
117+ function updateMaxHeight()
118+ {
119+ maxHeight = (windowHeight - mapToItem(null, 0, 0).y) - units.gu(8);
120+ }
115121 property int prevHeight: maxHeight
116122 height: currentItem ? currentItem.height : maxHeight
117123 onHeightChanged: {
@@ -120,83 +126,84 @@ AbstractButton {
120126 }
121127 }
122128 highlightMoveDuration: UbuntuAnimation.FastDuration
123− delegate: DashDepartmentsList {
124− objectName: "department" + index
129+ delegate: DashNavigationList {
130+ objectName: "navigation" + index
125131 visible: height != 0
126− width: departmentListView.width
132+ width: navigationListView.width
127133 scopeStyle: root.scopeStyle
128134 property real desiredHeight: {
129135 if (root.showList) {
130− if (department && department.loaded && x == departmentListView.contentX)
136+ if (navigation && navigation.loaded && x == navigationListView.contentX)
131137 {
132− return Math.min(implicitHeight, departmentListView.maxHeight);
138+ navigationListView.updateMaxHeight();
139+ return Math.min(implicitHeight, navigationListView.maxHeight);
133140 } else {
134− return departmentListView.prevHeight;
141+ return navigationListView.prevHeight;
135142 }
136143 } else {
137144 return 0;
138145 }
139146 }
140147 height: desiredHeight
141− department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
142− currentDepartment: root.currentDepartment
143− onEnterDepartment: {
144− scope.loadDepartment(newDepartmentId);
148+ navigation: (nullifyNavigation || !scope) ? null : scope.getNavigation(navigationId)
149+ currentNavigation: root.currentNavigation
150+ onEnterNavigation: {
151+ scope.setNavigationState(newNavigationId, false);
145152 // We only need to add a new item to the model
146153 // if we have children, otherwise just load it
147154 if (hasChildren) {
148155 isGoingBack = false;
149− departmentModel.append({"departmentId": newDepartmentId, "nullifyDepartment": false});
150− departmentListView.currentIndex++;
156+ navigationModel.append({"navigationId": newNavigationId, "nullifyNavigation": false});
157+ navigationListView.currentIndex++;
151158 } else {
152159 showList = false;
153160 }
154161 }
155162 onGoBackToParentClicked: {
156− scope.loadDepartment(department.parentDepartmentId);
163+ scope.setNavigationState(navigation.parentNavigationId, false);
157164 isGoingBack = true;
158− departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
159− departmentListView.currentIndex--;
165+ navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
166+ navigationListView.currentIndex--;
160167 }
161− onAllDepartmentClicked: {
168+ onAllNavigationClicked: {
162169 showList = false;
163− if (root.currentDepartment.parentDepartmentId == department.departmentId) {
170+ if (root.currentNavigation.parentNavigationId == navigation.navigationId) {
164171 // For leaves we have to go to the parent too
165− scope.loadDepartment(root.currentDepartment.parentDepartmentId);
172+ scope.setNavigationState(root.currentNavigation.parentNavigationId, false);
166173 }
167174 }
168175 }
169176 onContentXChanged: {
170− if (contentX == width * departmentListView.currentIndex) {
177+ if (contentX == width * navigationListView.currentIndex) {
171178 if (isGoingBack) {
172− departmentModel.remove(departmentListView.currentIndex + 1);
179+ navigationModel.remove(navigationListView.currentIndex + 1);
173180 } else {
174− departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", true);
181+ navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", true);
175182 }
176183 }
177184 }
178185 }
179186
180187 InverseMouseArea {
181− anchors.fill: departmentListView
188+ anchors.fill: navigationListView
182189 enabled: root.showList
183190 onClicked: root.showList = false
184191 }
185192
186193 onScopeChanged: {
187− departmentModel.clear();
188− if (scope && scope.hasDepartments) {
189− departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
194+ navigationModel.clear();
195+ if (scope && scope.hasNavigation) {
196+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
190197 }
191198 }
192199
193200 Connections {
194201 target: scope
195− onHasDepartmentsChanged: {
196− if (scope.hasDepartments) {
197− departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
202+ onHasNavigationChanged: {
203+ if (scope.hasNavigation) {
204+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
198205 } else {
199− departmentModel.clear();
206+ navigationModel.clear();
200207 }
201208 }
202209 }
qml/Dash/DashDepartmentsList.qml → qml/Dash/DashNavigationList.qmlrenamed+14−13
@@ -15,16 +15,16 @@
1515 */
1616
1717import QtQuick 2.2
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
1919
2020Item {
2121 id: root
22− property var department: null
23− property var currentDepartment: null
22+ property var navigation: null
23+ property var currentNavigation: null
2424 property var scopeStyle: null
25− signal enterDepartment(var newDepartmentId, bool hasChildren)
25+ signal enterNavigation(var newNavigationId, bool hasChildren)
2626 signal goBackToParentClicked()
27− signal allDepartmentClicked()
27+ signal allNavigationClicked()
2828
2929 readonly property int itemHeight: units.gu(5)
3030 readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
@@ -49,6 +49,7 @@ Item {
4949
5050 anchors.fill: parent
5151
52+ flickableDirection: Flickable.VerticalFlick
5253 contentHeight: column.height
5354 contentWidth: width
5455
@@ -63,7 +64,7 @@ Item {
6364 id: backButton
6465 objectName: "backButton"
6566 width: parent.width
66− visible: department && !department.isRoot || false
67+ visible: navigation && !navigation.isRoot || false
6768 height: itemHeight
6869
6970 onClicked: root.goBackToParentClicked();
@@ -87,7 +88,7 @@ Item {
8788 left: backImage.right
8889 leftMargin: units.gu(0.5)
8990 }
90− text: department ? department.parentLabel : ""
91+ text: navigation ? navigation.parentLabel : ""
9192 color: root.foregroundColor
9293 }
9394
@@ -109,7 +110,7 @@ Item {
109110 id: allButton
110111 objectName: "allButton"
111112 width: parent.width
112− visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
113+ visible: navigation && (!navigation.isRoot || (root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
113114 height: itemHeight
114115
115116 Label {
@@ -118,7 +119,7 @@ Item {
118119 left: parent.left
119120 leftMargin: units.gu(2)
120121 }
121− text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
122+ text: navigation ? (navigation.allLabel != "" ? navigation.allLabel : navigation.label) : ""
122123 font.bold: true
123124 color: root.foregroundColor
124125 }
@@ -136,18 +137,18 @@ Item {
136137 height: units.dp(1)
137138 }
138139
139− onClicked: root.allDepartmentClicked();
140+ onClicked: root.allNavigationClicked();
140141 }
141142
142143 Repeater {
143− model: department && department.loaded ? department : null
144+ model: navigation && navigation.loaded ? navigation : null
144145 clip: true
145146 delegate: AbstractButton {
146147 objectName: root.objectName + "child" + index
147148 height: root.itemHeight
148149 width: root.width
149150
150− onClicked: root.enterDepartment(departmentId, hasChildren)
151+ onClicked: root.enterNavigation(navigationId, hasChildren)
151152
152153 Label {
153154 anchors {
@@ -183,7 +184,7 @@ Item {
183184 color: root.foregroundColor
184185 opacity: 0.1
185186 height: units.dp(1)
186− visible: index != department.count - 1
187+ visible: index != navigation.count - 1
187188 }
188189 }
189190 }
qml/Dash/GenericScopeView.qml+4−11
@@ -25,6 +25,7 @@ import "../Components/ListItems" as ListItems
2525FocusScope {
2626 id: scopeView
2727
28+ readonly property alias navigationShown: dashNavigation.showList
2829 property var scope: null
2930 property SortFilterProxyModel categories: categoryFilter
3031 property bool isCurrent: false
@@ -41,16 +42,6 @@ FocusScope {
4142
4243 signal backClicked()
4344
44− onScopeChanged: {
45− if (scope) {
46− scope.activateApplication.connect(activateApp);
47− }
48− }
49−
50− function activateApp(appId) {
51− Qt.openUrlExternally(appId);
52− }
53−
5445 function positionAtBeginning() {
5546 categoryView.positionAtBeginning()
5647 }
@@ -121,6 +112,7 @@ FocusScope {
121112 model: scopeView.categories
122113 forceNoClip: previewListView.open
123114 pixelAligned: true
115+ interactive: !dashNavigation.showList
124116
125117 property string expandedCategoryId: ""
126118
@@ -391,7 +383,8 @@ FocusScope {
391383 searchEntryEnabled: true
392384 scopeStyle: scopeView.scopeStyle
393385
394− bottomItem: DashDepartments {
386+ bottomItem: DashNavigation {
387+ id: dashNavigation
395388 scope: scopeView.scope
396389 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)
397390 anchors.right: parent.right
qml/ScopeTool.qml+1−11
@@ -45,16 +45,6 @@ Rectangle {
4545 signal searchClicked
4646 }
4747
48− SortFilterProxyModel {
49− id: filteredScopes
50− model: Scopes {
51− id: scopes
52− }
53− dynamicSortFilter: true
54−
55− filterRole: Scopes.RoleVisible
56− filterRegExp: RegExp("^true$")
57− }
5848
5949 Rectangle {
6050 anchors.fill: dashContent
@@ -72,8 +62,8 @@ Rectangle {
7262 DashContent {
7363 id: dashContent
7464
75− model: filteredScopes
7665 property var scope: scopes.getScope(currentIndex)
66+ scopes: Scopes { }
7767
7868 anchors {
7969 top: parent.top
tests/mocks/Unity/CMakeLists.txt+3−3
@@ -7,7 +7,7 @@ add_subdirectory(DashCommunicator)
77pkg_search_module(DEE dee-1.0 REQUIRED)
88pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
99pkg_search_module(DEEQT libdee-qt5 REQUIRED)
10−pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=3)
10+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=4)
1111
1212include_directories(
1313 ${CMAKE_CURRENT_BINARY_DIR}
@@ -23,14 +23,14 @@ set(UnityQML_SOURCES
2323 fake_scope.cpp
2424 fake_scopes.cpp
2525 fake_categories.cpp
26− fake_department.cpp
26+ fake_navigation.cpp
2727 fake_resultsmodel.cpp
2828 fake_previewmodel.cpp
2929 fake_previewstack.cpp
3030 fake_previewwidgetmodel.cpp
3131 fake_unity_plugin.cpp
3232 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h
33− ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/DepartmentInterface.h
33+ ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/NavigationInterface.h
3434 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h
3535 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h
3636 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h
tests/mocks/Unity/Unity.qmltypes+79−27
@@ -24,6 +24,12 @@ Module {
2424 Parameter { name: "categoryId"; type: "string" }
2525 Parameter { name: "json"; type: "string" }
2626 }
27+ Method {
28+ name: "data"
29+ type: "QVariant"
30+ Parameter { name: "row"; type: "int" }
31+ Parameter { name: "role"; type: "int" }
32+ }
2733 }
2834 Component {
2935 name: "PreviewModel"
@@ -62,6 +68,10 @@ Module {
6268 prototype: "unity::shell::scopes::ScopeInterface"
6369 exports: ["Unity/MockScope 0.2"]
6470 exportMetaObjectRevisions: [0]
71+ Signal {
72+ name: "performQuery"
73+ Parameter { name: "query"; type: "string" }
74+ }
6575 Method {
6676 name: "setSearchInProgress"
6777 Parameter { name: "inProg"; type: "bool" }
@@ -81,18 +91,21 @@ Module {
8191 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
8292 }
8393 Method {
84− name: "getDepartment"
85− type: "unity::shell::scopes::DepartmentInterface*"
86− Parameter { name: "id"; type: "string" }
94+ name: "getNavigation"
95+ type: "unity::shell::scopes::NavigationInterface*"
96+ Parameter { name: "navigationId"; type: "string" }
8797 }
8898 Method {
89− name: "loadDepartment"
90− Parameter { name: "id"; type: "string" }
99+ name: "getAltNavigation"
100+ type: "unity::shell::scopes::NavigationInterface*"
101+ Parameter { name: "altNavigationId"; type: "string" }
91102 }
92103 Method {
93− name: "performQuery"
94− Parameter { name: "query"; type: "string" }
104+ name: "setNavigationState"
105+ Parameter { name: "navigationId"; type: "string" }
106+ Parameter { name: "isAltNavigation"; type: "bool" }
95107 }
108+ Method { name: "refresh" }
96109 }
97110 Component {
98111 name: "Scopes"
@@ -137,6 +150,7 @@ Module {
137150 "RoleRawRendererTemplate": 3,
138151 "RoleRenderer": 4,
139152 "RoleComponents": 5,
153+ "RoleHeaderLink": 6,
140154 "RoleResults": 7,
141155 "RoleCount": 8
142156 }
@@ -157,27 +171,28 @@ Module {
157171 }
158172 }
159173 Component {
160− name: "unity::shell::scopes::DepartmentInterface"
174+ name: "unity::shell::scopes::NavigationInterface"
161175 prototype: "QAbstractListModel"
162− exports: ["Unity/Department 0.2"]
176+ exports: ["Unity/Navigation 0.2"]
163177 isCreatable: false
164178 exportMetaObjectRevisions: [0]
165179 Enum {
166180 name: "Roles"
167181 values: {
168− "RoleDepartmentId": 0,
182+ "RoleNavigationId": 0,
169183 "RoleLabel": 1,
170184 "RoleHasChildren": 2,
171185 "RoleIsActive": 3
172186 }
173187 }
174− Property { name: "departmentId"; type: "string"; isReadonly: true }
188+ Property { name: "navigationId"; type: "string"; isReadonly: true }
175189 Property { name: "label"; type: "string"; isReadonly: true }
176190 Property { name: "allLabel"; type: "string"; isReadonly: true }
177− Property { name: "parentDepartmentId"; type: "string"; isReadonly: true }
191+ Property { name: "parentNavigationId"; type: "string"; isReadonly: true }
178192 Property { name: "parentLabel"; type: "string"; isReadonly: true }
179193 Property { name: "loaded"; type: "bool"; isReadonly: true }
180194 Property { name: "isRoot"; type: "bool"; isReadonly: true }
195+ Property { name: "hidden"; type: "bool"; isReadonly: true }
181196 Property { name: "count"; type: "int"; isReadonly: true }
182197 }
183198 Component {
@@ -247,7 +262,8 @@ Module {
247262 "RoleEmblem": 8,
248263 "RoleSummary": 9,
249264 "RoleAttributes": 10,
250− "RoleBackground": 11
265+ "RoleBackground": 11,
266+ "RoleOverlayColor": 12
251267 }
252268 }
253269 Property { name: "categoryId"; type: "string" }
@@ -259,13 +275,22 @@ Module {
259275 exports: ["Unity/Scope 0.2"]
260276 isCreatable: false
261277 exportMetaObjectRevisions: [0]
278+ Enum {
279+ name: "Status"
280+ values: {
281+ "Okay": 0,
282+ "NoInternet": 1,
283+ "NoLocationData": 2,
284+ "Unknown": 3
285+ }
286+ }
262287 Property { name: "id"; type: "string"; isReadonly: true }
263288 Property { name: "name"; type: "string"; isReadonly: true }
264289 Property { name: "iconHint"; type: "string"; isReadonly: true }
265290 Property { name: "description"; type: "string"; isReadonly: true }
266291 Property { name: "searchHint"; type: "string"; isReadonly: true }
267292 Property { name: "searchInProgress"; type: "bool"; isReadonly: true }
268− Property { name: "visible"; type: "bool"; isReadonly: true }
293+ Property { name: "favorite"; type: "bool" }
269294 Property { name: "shortcut"; type: "string"; isReadonly: true }
270295 Property {
271296 name: "categories"
@@ -273,13 +298,27 @@ Module {
273298 isReadonly: true
274299 isPointer: true
275300 }
301+ Property {
302+ name: "settings"
303+ type: "unity::shell::scopes::SettingsModelInterface"
304+ isReadonly: true
305+ isPointer: true
306+ }
276307 Property { name: "searchQuery"; type: "string" }
277308 Property { name: "noResultsHint"; type: "string" }
278309 Property { name: "formFactor"; type: "string" }
279310 Property { name: "isActive"; type: "bool" }
280− Property { name: "currentDepartmentId"; type: "string"; isReadonly: true }
281− Property { name: "hasDepartments"; type: "bool"; isReadonly: true }
311+ Property { name: "currentNavigationId"; type: "string"; isReadonly: true }
312+ Property { name: "hasNavigation"; type: "bool"; isReadonly: true }
313+ Property { name: "currentAltNavigationId"; type: "string"; isReadonly: true }
314+ Property { name: "hasAltNavigation"; type: "bool"; isReadonly: true }
282315 Property { name: "customizations"; type: "QVariantMap"; isReadonly: true }
316+ Property {
317+ name: "status"
318+ type: "unity::shell::scopes::ScopeInterface::Status"
319+ isReadonly: true
320+ }
321+ Signal { name: "detailsChanged" }
283322 Signal { name: "showDash" }
284323 Signal { name: "hideDash" }
285324 Signal {
@@ -298,10 +337,6 @@ Module {
298337 name: "openScope"
299338 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
300339 }
301− Signal {
302− name: "activateApplication"
303− Parameter { name: "desktop"; type: "string" }
304− }
305340 Method {
306341 name: "activate"
307342 Parameter { name: "result"; type: "QVariant" }
@@ -317,14 +352,25 @@ Module {
317352 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
318353 }
319354 Method {
320− name: "getDepartment"
321− type: "unity::shell::scopes::DepartmentInterface*"
322− Parameter { name: "departmentId"; type: "string" }
355+ name: "getNavigation"
356+ type: "unity::shell::scopes::NavigationInterface*"
357+ Parameter { name: "navigationId"; type: "string" }
358+ }
359+ Method {
360+ name: "getAltNavigation"
361+ type: "unity::shell::scopes::NavigationInterface*"
362+ Parameter { name: "altNavigationId"; type: "string" }
323363 }
324364 Method {
325− name: "loadDepartment"
326− Parameter { name: "departmentId"; type: "string" }
365+ name: "setNavigationState"
366+ Parameter { name: "navId"; type: "string" }
367+ Parameter { name: "altNavigation"; type: "bool" }
327368 }
369+ Method {
370+ name: "performQuery"
371+ Parameter { name: "cannedQuery"; type: "string" }
372+ }
373+ Method { name: "refresh" }
328374 }
329375 Component {
330376 name: "unity::shell::scopes::ScopesInterface"
@@ -334,11 +380,17 @@ Module {
334380 values: {
335381 "RoleScope": 0,
336382 "RoleId": 1,
337− "RoleVisible": 2,
338− "RoleTitle": 3
383+ "RoleTitle": 2
339384 }
340385 }
341386 Property { name: "loaded"; type: "bool"; isReadonly: true }
387+ Property { name: "count"; type: "int"; isReadonly: true }
388+ Property {
389+ name: "overviewScope"
390+ type: "unity::shell::scopes::ScopeInterface"
391+ isReadonly: true
392+ isPointer: true
393+ }
342394 Method {
343395 name: "getScope"
344396 type: "unity::shell::scopes::ScopeInterface*"
tests/mocks/Unity/fake_department.cpp → tests/mocks/Unity/fake_navigation.cpprenamed+32−40
@@ -14,14 +14,15 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#include "fake_department.h"
17+#include "fake_navigation.h"
1818
1919#include "fake_scope.h"
2020
21+#include <QDebug>
2122#include <QTimer>
2223
23−Department::Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
24− : m_departmentId(departmentId)
24+Navigation::Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
25+ : m_navigationId(navigationId)
2526 , m_label(label)
2627 , m_allLabel(allLabel)
2728 , m_parentId(parentId)
@@ -30,96 +31,87 @@ Department::Department(const QString& departmentId, const QString& label, const
3031 , m_scope(scope)
3132{
3233 QTimer::singleShot(1500, this, SLOT(slotLoaded()));
33− connect(scope, SIGNAL(currentDepartmentIdChanged()), this, SLOT(slotCurrentDepartmentChanged()));
34+ connect(scope, SIGNAL(currentNavigationIdChanged()), this, SLOT(slotCurrentNavigationChanged()));
3435}
3536
36−QString Department::departmentId() const
37+QString Navigation::navigationId() const
3738{
38− return m_departmentId;
39+ return m_navigationId;
3940}
4041
41−QString Department::label() const
42+QString Navigation::label() const
4243{
4344 return m_label;
4445}
4546
46−QString Department::allLabel() const
47+QString Navigation::allLabel() const
4748{
4849 return m_allLabel;
4950}
5051
51−QString Department::parentDepartmentId() const
52+QString Navigation::parentNavigationId() const
5253{
5354 return m_parentId;
5455}
5556
56−QString Department::parentLabel() const
57+QString Navigation::parentLabel() const
5758{
5859 return m_parentLabel;
5960}
6061
61−void Department::slotLoaded()
62+void Navigation::slotLoaded()
6263{
6364 m_loaded = true;
6465 Q_EMIT loadedChanged();
6566}
6667
67−bool Department::loaded() const
68+bool Navigation::loaded() const
6869{
6970 return m_loaded;
7071}
7172
72−int Department::count() const
73+int Navigation::count() const
7374{
7475 return rowCount();
7576}
7677
77−bool Department::isRoot() const
78+bool Navigation::isRoot() const
7879{
79− return m_departmentId == "root";
80+ return m_navigationId == "root" || m_navigationId == "altroot";
8081}
8182
82−int Department::rowCount(const QModelIndex & /*parent*/) const
83+bool Navigation::hidden() const
8384{
84− if (!m_loaded || m_departmentId.startsWith("child") || m_departmentId == "middle3")
85− return 0;
86− else
87− return 8;
85+ return m_navigationId == "altroot";
8886}
8987
90−QHash<int, QByteArray> Department::roleNames() const
88+int Navigation::rowCount(const QModelIndex & /*parent*/) const
9189{
92− QHash<int, QByteArray> res;
93− res[RoleDepartmentId] = "departmentId";
94− res[RoleLabel] = "label";
95− res[RoleHasChildren] = "hasChildren";
96− res[RoleIsActive] = "isActive";
97− return res;
90+ if (!m_loaded || m_navigationId.startsWith("child") || m_navigationId == "middle3")
91+ return 0;
92+ else
93+ return 8;
9894}
9995
100−QVariant Department::data(const QModelIndex &index, int role) const
96+QVariant Navigation::data(const QModelIndex &index, int role) const
10197{
10298 switch (role) {
103− case RoleDepartmentId:
104− if (m_departmentId == "root")
99+ case RoleNavigationId:
100+ if (m_navigationId == "root")
105101 return QString("middle%1").arg(index.row());
106− else if (m_departmentId.startsWith("middle"))
107− return QString("child%1%2").arg(m_departmentId).arg(index.row());
108− break;
102+ else if (m_navigationId.startsWith("middle"))
103+ return QString("child%1%2").arg(m_navigationId).arg(index.row());
109104 case RoleLabel:
110− return QString("%1Child%2").arg(m_departmentId).arg(index.row());
111− break;
105+ return QString("%1Child%2").arg(m_navigationId).arg(index.row());
112106 case RoleHasChildren:
113− return m_departmentId == "root" && index.row() != 3;
114− break;
107+ return m_navigationId == "root" && index.row() != 3;
115108 case RoleIsActive:
116− return m_scope->currentDepartmentId() == data(index, RoleDepartmentId);
117− break;
109+ return m_scope->currentNavigationId() == data(index, RoleNavigationId);
118110 }
119111 return QVariant();
120112}
121113
122−void Department::slotCurrentDepartmentChanged()
114+void Navigation::slotCurrentNavigationChanged()
123115{
124116 // This is wasteful, should only emit it if really something changed in this
125117 // deparment, but this is a mock, so no need to optimize
tests/mocks/Unity/fake_department.h → tests/mocks/Unity/fake_navigation.hrenamed+13−13
@@ -14,48 +14,48 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef FAKE_DEPARTMENT_H
18−#define FAKE_DEPARTMENT_H
17+#ifndef FAKE_NAVIGATION_H
18+#define FAKE_NAVIGATION_H
1919
20−#include <unity/shell/scopes/DepartmentInterface.h>
20+#include <unity/shell/scopes/NavigationInterface.h>
2121
2222class Scope;
2323
24−class Department : public unity::shell::scopes::DepartmentInterface
24+class Navigation : public unity::shell::scopes::NavigationInterface
2525{
2626 Q_OBJECT
2727
2828public:
29− Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
29+ Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
3030
31− QString departmentId() const override;
31+ QString navigationId() const override;
3232 QString label() const override;
3333 QString allLabel() const override;
34− QString parentDepartmentId() const override;
34+ QString parentNavigationId() const override;
3535 QString parentLabel() const override;
3636 bool loaded() const override;
37− int count() const override;
3837 bool isRoot() const override;
38+ bool hidden() const override;
39+ int count() const override;
3940
4041 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
41− QHash<int, QByteArray> roleNames() const;
4242 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
4343
4444public Q_SLOTS:
45− void slotCurrentDepartmentChanged();
45+ void slotCurrentNavigationChanged();
4646
4747private Q_SLOTS:
4848 void slotLoaded();
4949
5050private:
51− QString m_departmentId;
51+ QString m_navigationId;
5252 QString m_label;
5353 QString m_allLabel;
5454 QString m_parentId;
5555 QString m_parentLabel;
5656 bool m_loaded;
57− QString m_currentDepartment;
57+ QString m_currentNavigation;
5858 Scope *m_scope;
5959};
6060
61−#endif // FAKE_DEPARTMENT_H
61+#endif // FAKE_NAVIGATION_H
tests/mocks/Unity/fake_scope.cpp+65−17
@@ -14,24 +14,26 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17+#include <QDebug>
1718#include <QUrl>
1819
1920#include "fake_scope.h"
20−#include "fake_department.h"
21+#include "fake_navigation.h"
2122#include "fake_resultsmodel.h"
2223
2324Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
2425{
2526}
2627
27−Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories)
28+Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)
2829 : unity::shell::scopes::ScopeInterface(parent)
2930 , m_id(id)
3031 , m_name(name)
31− , m_visible(visible)
3232 , m_searching(false)
33+ , m_favorite(favorite)
3334 , m_isActive(false)
34− , m_currentDeparment("root")
35+ , m_currentNavigationId("root")
36+ , m_currentAltNavigationId("altroot")
3537 , m_previewRendererName("preview-generic")
3638 , m_categories(new Categories(categories, this))
3739{
@@ -77,6 +79,11 @@ bool Scope::searchInProgress() const
7779 return m_searching;
7880}
7981
82+bool Scope::favorite() const
83+{
84+ return m_favorite;
85+}
86+
8087unity::shell::scopes::CategoriesInterface* Scope::categories() const
8188{
8289 return m_categories;
@@ -97,11 +104,6 @@ QString Scope::formFactor() const
97104 return m_formFactor;
98105}
99106
100−bool Scope::visible() const
101−{
102− return m_visible;
103−}
104−
105107bool Scope::isActive() const
106108{
107109 return m_isActive;
@@ -131,6 +133,13 @@ void Scope::setActive(const bool active)
131133 }
132134}
133135
136+void Scope::setFavorite(const bool favorite)
137+{
138+ if (favorite != m_favorite) {
139+ m_favorite = favorite;
140+ Q_EMIT favoriteChanged();
141+ }
142+}
134143void Scope::setSearchInProgress(const bool inProg)
135144{
136145 if (inProg != m_searching) {
@@ -170,16 +179,31 @@ void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
170179 qFatal("Scope::closeScope is not implemented");
171180}
172181
173−QString Scope::currentDepartmentId() const
182+QString Scope::currentNavigationId() const
183+{
184+ return m_currentNavigationId;
185+}
186+
187+bool Scope::hasNavigation() const
188+{
189+ return true;
190+}
191+
192+QString Scope::currentAltNavigationId() const
174193{
175− return m_currentDeparment;
194+ return m_currentAltNavigationId;
176195}
177196
178−bool Scope::hasDepartments() const
197+bool Scope::hasAltNavigation() const
179198{
180199 return true;
181200}
182201
202+Scope::Status Scope::status() const
203+{
204+ return Status::Okay;
205+}
206+
183207QVariantMap Scope::customizations() const
184208{
185209 QVariantMap m, h;
@@ -196,7 +220,12 @@ QVariantMap Scope::customizations() const
196220 return m;
197221}
198222
199−unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
223+void Scope::refresh()
224+{
225+ qDebug() << "Scope::refresh is currently not implmented in the fake scopes plugin";
226+}
227+
228+unity::shell::scopes::NavigationInterface* Scope::getNavigation(const QString& id)
200229{
201230 if (id.isEmpty())
202231 return nullptr;
@@ -210,11 +239,30 @@ unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& i
210239 parentId = id.mid(5, 7);
211240 parentLabel = parentId;
212241 }
213− return new Department(id, id, "all"+id, parentId, parentLabel, this);
242+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
243+}
244+
245+unity::shell::scopes::NavigationInterface* Scope::getAltNavigation(QString const& id)
246+{
247+ if (id.isEmpty())
248+ return nullptr;
249+
250+ QString parentId;
251+ QString parentLabel;
252+ if (id.startsWith("altmiddle")) {
253+ parentId = "altroot";
254+ parentLabel = "altroot";
255+ }
256+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
214257}
215258
216−void Scope::loadDepartment(const QString& id)
259+void Scope::setNavigationState(const QString &navigationId, bool isAltNavigation)
217260{
218− m_currentDeparment = id;
219− Q_EMIT currentDepartmentIdChanged();
261+ if (isAltNavigation) {
262+ m_currentAltNavigationId = navigationId;
263+ Q_EMIT currentAltNavigationIdChanged();
264+ } else {
265+ m_currentNavigationId = navigationId;
266+ Q_EMIT currentNavigationIdChanged();
267+ }
220268}
tests/mocks/Unity/fake_scope.h+16−8
@@ -30,7 +30,7 @@ class Scope : public unity::shell::scopes::ScopeInterface
3030
3131public:
3232 Scope(QObject* parent = 0);
33− Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0, int categories = 20);
33+ Scope(QString const& id, QString const& name, bool favorite, QObject* parent = 0, int categories = 20);
3434
3535 /* getters */
3636 QString id() const override;
@@ -38,9 +38,9 @@ public:
3838 QString iconHint() const override;
3939 QString description() const override;
4040 QString searchHint() const override;
41− bool visible() const override;
4241 QString shortcut() const override;
4342 bool searchInProgress() const override;
43+ bool favorite() const override;
4444 unity::shell::scopes::CategoriesInterface* categories() const override;
4545 QString searchQuery() const override;
4646 QString noResultsHint() const override;
@@ -53,6 +53,7 @@ public:
5353 void setNoResultsHint(const QString& hint) override;
5454 void setFormFactor(const QString& form_factor) override;
5555 void setActive(const bool) override;
56+ void setFavorite(const bool) override;
5657 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
5758
5859 Q_INVOKABLE void activate(QVariant const& result) override;
@@ -60,14 +61,20 @@ public:
6061 Q_INVOKABLE void cancelActivation() override;
6162 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
6263
63− QString currentDepartmentId() const override;
64− bool hasDepartments() const override;
65− Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
66− Q_INVOKABLE void loadDepartment(const QString& id) override;
64+ QString currentNavigationId() const override;
65+ bool hasNavigation() const override;
66+ QString currentAltNavigationId() const override;
67+ bool hasAltNavigation() const override;
68+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) override;
69+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) override;
70+ Q_INVOKABLE void setNavigationState(const QString &navigationId, bool isAltNavigation) override;
6771 Q_SIGNAL void performQuery(const QString& query) override;
6872
73+ Status status() const override;
6974 QVariantMap customizations() const override;
7075
76+ Q_INVOKABLE void refresh() override;
77+
7178protected:
7279
7380 QString m_id;
@@ -77,10 +84,11 @@ protected:
7784 QString m_searchQuery;
7885 QString m_noResultsHint;
7986 QString m_formFactor;
80− bool m_visible;
8187 bool m_searching;
88+ bool m_favorite;
8289 bool m_isActive;
83− QString m_currentDeparment;
90+ QString m_currentNavigationId;
91+ QString m_currentAltNavigationId;
8492
8593 QString m_previewRendererName;
8694
tests/mocks/Unity/fake_scopes.cpp+10−2
@@ -32,6 +32,11 @@ Scopes::Scopes(QObject *parent)
3232 timer.setSingleShot(true);
3333 timer.setInterval(100);
3434 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
35+
36+ QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
37+ QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
38+ QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
39+
3540 load();
3641}
3742
@@ -92,8 +97,6 @@ QVariant Scopes::data(const QModelIndex& index, int role) const
9297 return QVariant::fromValue(scope);
9398 } else if (role == Scopes::RoleId) {
9499 return QVariant::fromValue(scope->id());
95− } else if (role == Scopes::RoleVisible) {
96− return QVariant::fromValue(scope->visible());
97100 } else if (role == Scopes::RoleTitle) {
98101 return QVariant::fromValue(scope->name());
99102 } else {
@@ -125,6 +128,11 @@ bool Scopes::loaded() const
125128 return m_loaded;
126129}
127130
131+int Scopes::count() const
132+{
133+ return rowCount();
134+}
135+
128136unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
129137{
130138 return nullptr;
tests/mocks/Unity/fake_scopes.h+1
@@ -50,6 +50,7 @@ public:
5050 QModelIndex parent ( const QModelIndex & index ) const;
5151
5252 bool loaded() const override;
53+ int count() const override;
5354 unity::shell::scopes::ScopeInterface* overviewScope() const override;
5455
5556private Q_SLOTS:
tests/mocks/Unity/fake_unity_plugin.cpp+2−2
@@ -22,7 +22,7 @@
2222// local
2323#include "fake_scopes.h"
2424#include "fake_categories.h"
25−#include "fake_department.h"
25+#include "fake_navigation.h"
2626#include "fake_previewmodel.h"
2727#include "fake_previewwidgetmodel.h"
2828#include "fake_resultsmodel.h"
@@ -43,7 +43,7 @@ void FakeUnityPlugin::registerTypes(const char *uri)
4343 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");
4444 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");
4545 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");
46− qmlRegisterUncreatableType<unity::shell::scopes::DepartmentInterface>(uri, 0, 2, "Department", "Can't create Department object in QML.");
46+ qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
4747 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
4848 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
4949 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
tests/qmltests/Dash/tst_Dash.qml+5−9
@@ -60,10 +60,10 @@ Item {
6060
6161 function get_scope_data() {
6262 return [
63− { tag: "MockScope1", visualIndex: 0, shouldBeVisible: true },
64− { tag: "MockScope2", visualIndex: -1, shouldBeVisible: false },
65− { tag: "clickscope", visualIndex: 1, shouldBeVisible: true },
66− { tag: "MockScope5", visualIndex: 2, shouldBeVisible: true },
63+ { tag: "MockScope1", visualIndex: 0 },
64+ { tag: "MockScope2", visualIndex: 1 },
65+ { tag: "clickscope", visualIndex: 2 },
66+ { tag: "MockScope5", visualIndex: 3 },
6767 ]
6868 }
6969
@@ -72,10 +72,6 @@ Item {
7272 }
7373
7474 function test_show_scope_on_load(data) {
75− if (data.shouldBeVisible == false) {
76− console.log("Not testing " + data.tag + ": not visible");
77− return;
78− }
7975 var dashContentList = findChild(dash, "dashContentList");
8076
8177 dash.showScopeOnLoaded = data.tag
@@ -83,7 +79,7 @@ Item {
8379 tryCompare(dashContentList, "count", 0);
8480 scopes.load();
8581 tryCompare(scopes, "loaded", true);
86− tryCompare(dashContentList, "count", 4);
82+ tryCompare(dashContentList, "count", 5);
8783
8884 verify(dashContentList != undefined);
8985 tryCompare(dashContentList, "currentIndex", data.visualIndex);
tests/qmltests/Dash/tst_DashContent.qml+94−95
@@ -43,9 +43,6 @@ Item {
4343 id: dashContent
4444 anchors.fill: parent
4545
46− model: SortFilterProxyModel {
47− model: scopesModel
48− }
4946 scopes : scopesModel
5047 }
5148
@@ -268,117 +265,119 @@ Item {
268265 verify(carouselLV.tileWidth / carouselLV.tileHeight == cardTool.components["art"]["aspect-ratio"]);
269266 }
270267
271− function test_departments() {
272− var dashDepartments = findChild(dashContent, "dashDepartments");
273− compare(dashDepartments.visible, true);
274− compare(dashDepartments.showList, false);
275− waitForRendering(dashDepartments);
276− mouseClick(dashDepartments, 0, 0);
277− compare(dashDepartments.showList, true);
278−
279− var departmentListView = findChild(dashDepartments, "departmentListView");
280− compare(departmentListView.count, 1);
281− tryCompare(departmentListView.currentItem.department, "loaded", true);
282−
283− waitForRendering(departmentListView);
284− waitForRendering(departmentListView.currentItem);
285−
286− var allButton = findChild(dashDepartments, "allButton");
268+ function test_navigations() {
269+ var dashContentList = findChild(dashContent, "dashContentList");
270+ tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
271+ var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
272+ tryCompare(dashNavigation, "visible", true);
273+ compare(dashNavigation.showList, false);
274+ waitForRendering(dashNavigation);
275+ mouseClick(dashNavigation, 0, 0);
276+ compare(dashNavigation.showList, true);
277+
278+ var navigationListView = findChild(dashNavigation, "navigationListView");
279+ compare(navigationListView.count, 1);
280+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
281+
282+ waitForRendering(navigationListView);
283+ waitForRendering(navigationListView.currentItem);
284+
285+ var allButton = findChild(dashNavigation, "allButton");
287286 compare(allButton.visible, false);
288287
289− var department = findChild(dashDepartments, "department0child3");
290− mouseClick(department, 0, 0);
291− compare(dashDepartments.showList, false);
292− tryCompare(dashDepartments.currentDepartment, "departmentId", "middle3");
293− tryCompare(departmentListView.currentItem.department, "departmentId", "root");
288+ var navigation = findChild(dashNavigation, "navigation0child3");
289+ mouseClick(navigation, 0, 0);
290+ compare(dashNavigation.showList, false);
291+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle3");
292+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
294293
295− mouseClick(dashDepartments, 0, 0);
296− compare(dashDepartments.showList, true);
297− waitForRendering(departmentListView);
298− waitForRendering(departmentListView.currentItem);
294+ mouseClick(dashNavigation, 0, 0);
295+ compare(dashNavigation.showList, true);
296+ waitForRendering(navigationListView);
297+ waitForRendering(navigationListView.currentItem);
299298 compare(allButton.visible, true);
300299
301300 mouseClick(allButton, 0, 0);
302− compare(dashDepartments.showList, false);
303− tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
304− tryCompare(departmentListView.currentItem.department, "departmentId", "root");
305−
306− mouseClick(dashDepartments, 0, 0);
307− compare(dashDepartments.showList, true);
308− waitForRendering(departmentListView);
309− waitForRendering(departmentListView.currentItem);
301+ compare(dashNavigation.showList, false);
302+ tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
303+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
304+
305+ mouseClick(dashNavigation, 0, 0);
306+ compare(dashNavigation.showList, true);
307+ waitForRendering(navigationListView);
308+ waitForRendering(navigationListView.currentItem);
310309 compare(allButton.visible, false);
311310
312− department = findChild(dashDepartments, "department0child2");
313− mouseClick(department, 0, 0);
314− compare(dashDepartments.showList, true);
315− tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
316− tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
311+ navigation = findChild(dashNavigation, "navigation0child2");
312+ mouseClick(navigation, 0, 0);
313+ compare(dashNavigation.showList, true);
314+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
315+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
317316
318− var departmentList1 = findChild(dashDepartments, "department1");
319− allButton = findChild(departmentList1, "allButton");
320− var backButton = findChild(findChild(departmentList1, "department1"), "backButton");
317+ var navigationList1 = findChild(dashNavigation, "navigation1");
318+ allButton = findChild(navigationList1, "allButton");
319+ var backButton = findChild(findChild(navigationList1, "navigation1"), "backButton");
321320 compare(allButton.visible, true);
322321 compare(backButton.visible, true);
323322
324− tryCompare(departmentListView, "contentX", departmentList1.x);
325− waitForRendering(departmentListView);
323+ tryCompare(navigationListView, "contentX", navigationList1.x);
324+ waitForRendering(navigationListView);
326325 mouseClick(allButton, 0, 0);
327− compare(dashDepartments.showList, false);
328− tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
329− tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
330−
331− mouseClick(dashDepartments, 0, 0);
332− compare(dashDepartments.showList, true);
333− waitForRendering(departmentListView);
334− waitForRendering(departmentListView.currentItem);
326+ compare(dashNavigation.showList, false);
327+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
328+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
329+
330+ mouseClick(dashNavigation, 0, 0);
331+ compare(dashNavigation.showList, true);
332+ waitForRendering(navigationListView);
333+ waitForRendering(navigationListView.currentItem);
335334 compare(allButton.visible, true);
336335 compare(backButton.visible, true);
337336
338− tryCompare(departmentList1.department, "loaded", true);
339− department = findChild(dashDepartments, "department1child2");
340− mouseClick(department, 0, 0);
341− compare(dashDepartments.showList, false);
342− tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle22");
343− tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
344−
345− mouseClick(dashDepartments, 0, 0);
346− compare(dashDepartments.showList, true);
347− waitForRendering(departmentListView);
348− waitForRendering(departmentListView.currentItem);
349−
350− tryCompare(departmentList1.department, "loaded", true);
351− department = findChild(dashDepartments, "department1child3");
352− mouseClick(department, 0, 0);
353− compare(dashDepartments.showList, false);
354− tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle23");
355− tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
356−
357− mouseClick(dashDepartments, 0, 0);
358− compare(dashDepartments.showList, true);
359− waitForRendering(departmentListView);
360− waitForRendering(departmentListView.currentItem);
337+ tryCompare(navigationList1.navigation, "loaded", true);
338+ navigation = findChild(dashNavigation, "navigation1child2");
339+ mouseClick(navigation, 0, 0);
340+ compare(dashNavigation.showList, false);
341+ tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle22");
342+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
343+
344+ mouseClick(dashNavigation, 0, 0);
345+ compare(dashNavigation.showList, true);
346+ waitForRendering(navigationListView);
347+ waitForRendering(navigationListView.currentItem);
348+
349+ tryCompare(navigationList1.navigation, "loaded", true);
350+ navigation = findChild(dashNavigation, "navigation1child3");
351+ mouseClick(navigation, 0, 0);
352+ compare(dashNavigation.showList, false);
353+ tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle23");
354+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
355+
356+ mouseClick(dashNavigation, 0, 0);
357+ compare(dashNavigation.showList, true);
358+ waitForRendering(navigationListView);
359+ waitForRendering(navigationListView.currentItem);
361360 mouseClick(backButton, 0, 0);
362361
363− tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
364− tryCompare(departmentListView.currentItem.department, "departmentId", "root");
365− compare(dashDepartments.showList, true);
366− mouseClick(dashDepartments, 0, 0);
367− compare(dashDepartments.showList, false);
368−
369− mouseClick(dashDepartments, 0, 0);
370− compare(dashDepartments.showList, true);
371− tryCompare(departmentListView.currentItem.department, "loaded", true);
372− department = findChild(dashDepartments, "department0child2");
373− mouseClick(department, 0, 0);
374− compare(dashDepartments.showList, true);
375− departmentList1 = findChild(dashDepartments, "department1");
376− compare(departmentList1.department.loaded, false);
377− tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
378− allButton = findChild(departmentList1, "allButton");
379− tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
362+ tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
363+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
364+ compare(dashNavigation.showList, true);
365+ mouseClick(dashNavigation, 0, 0);
366+ compare(dashNavigation.showList, false);
367+
368+ mouseClick(dashNavigation, 0, 0);
369+ compare(dashNavigation.showList, true);
370+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
371+ navigation = findChild(dashNavigation, "navigation0child2");
372+ mouseClick(navigation, 0, 0);
373+ compare(dashNavigation.showList, true);
374+ navigationList1 = findChild(dashNavigation, "navigation1");
375+ compare(navigationList1.navigation.loaded, false);
376+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
377+ allButton = findChild(navigationList1, "allButton");
378+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
380379 mouseClick(allButton, 0, 0);
381− tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
380+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
382381 }
383382 }
384383}