@@ -21,59 +21,35 @@ AbstractButton {
2121 id: root
2222 objectName: "dashNavigation"
2323
24+ // Set by parent
2425 property var scope: null
26+ property var scopeStyle: null
27+ property bool isAltNavigation: false
2528
29+ // Used by parent
30+ readonly property var currentNavigation: scope && scope[hasNavigation] ? getNavigation(scope[currentNavigationId]) : null
31+ readonly property alias listView: navigationListView
2632 property bool showList: false
2733
28− readonly property var currentNavigation: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null
29−
30− property alias windowWidth: blackRect.width
31− property alias windowHeight: blackRect.height
32− property var scopeStyle: null
33−
34+ // Internal
3435 // Are we drilling down the tree or up?
3536 property bool isGoingBack: false
37+ readonly property string hasNavigation: isAltNavigation ? "hasAltNavigation" : "hasNavigation"
38+ readonly property string currentNavigationId: isAltNavigation ? "currentAltNavigationId" : "currentNavigationId"
39+ function getNavigation(navId) {
40+ if (isAltNavigation) {
41+ return scope.getAltNavigation(navId);
42+ } else {
43+ return scope.getNavigation(navId);
44+ }
45+ }
3646
3747 visible: root.currentNavigation != null
3848
39− height: visible ? units.gu(5) : 0
40−
4149 onClicked: {
4250 root.showList = !root.showList;
4351 }
4452
45− Rectangle {
46− id: blackRect
47− color: "black"
48− opacity: navigationListView.currentItem && navigationListView.currentItem.visible ? 0.3 : 0
49− Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
50− anchors.top: navigationListView.top
51− anchors.right: parent.right
52− visible: opacity != 0
53− }
54−
55− Image {
56− anchors {
57− top: parent.top
58− left: parent.left
59− right: parent.right
60− }
61− fillMode: Image.Stretch
62− source: "graphics/dash_divider_top_lightgrad.png"
63− z: -1
64− }
65−
66− Image {
67− anchors {
68− bottom: parent.bottom
69− left: parent.left
70− right: parent.right
71− }
72− fillMode: Image.Stretch
73− source: "graphics/dash_divider_top_darkgrad.png"
74− z: -1
75− }
76−
7753 Label {
7854 anchors.fill: parent
7955 anchors.margins: units.gu(2)
@@ -106,11 +82,7 @@ AbstractButton {
10682 // nullifyNavigation: overrides navigationId to be null
10783 // This is used to "clear" the delegate when going "right" on the tree
10884 }
109− anchors {
110− left: parent.left
111− right: parent.right
112− top: root.bottom
113− }
85+ anchors.top: root.bottom
11486 readonly property int maxHeight: (windowHeight - mapToItem(null, root.x, root.y).y) - units.gu(8)
11587 property int prevHeight: maxHeight
11688 height: currentItem ? currentItem.height : maxHeight
@@ -138,7 +110,7 @@ AbstractButton {
138110 }
139111 }
140112 height: desiredHeight
141− navigation: (nullifyNavigation || !scope) ? null : scope.getNavigation(navigationId)
113+ navigation: (nullifyNavigation || !scope) ? null : getNavigation(navigationId)
142114 currentNavigation: root.currentNavigation
143115 onEnterNavigation: {
144116 scope.performQuery(navigationQuery);
@@ -177,27 +149,39 @@ AbstractButton {
177149 }
178150 }
179151
180− InverseMouseArea {
181− anchors.fill: navigationListView
182− enabled: root.showList
183− onClicked: root.showList = false
184− }
185−
186152 onScopeChanged: {
187153 navigationModel.clear();
188− if (scope && scope.hasNavigation) {
189− navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
154+ if (scope && scope[hasNavigation]) {
155+ navigationModel.append({"navigationId": scope[currentNavigationId], "nullifyNavigation": false});
190156 }
191157 }
192158
193159 Connections {
194160 target: scope
161+ // This is duplicated since we can't have something based on the dynamic hasNavigation string property
195162 onHasNavigationChanged: {
196− if (scope.hasNavigation) {
197− navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
198− } else {
199− navigationModel.clear();
163+ if (!root.isAltNavigation) {
164+ if (scope.hasNavigation) {
165+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
166+ } else {
167+ navigationModel.clear();
168+ }
200169 }
201170 }
171+ onHasAltNavigationChanged: {
172+ if (root.isAltNavigation) {
173+ if (scope.hasAltNavigation) {
174+ navigationModel.append({"navigationId": scope.currentAltNavigationId, "nullifyNavigation": false});
175+ } else {
176+ navigationModel.clear();
177+ }
178+ }
179+ }
180+ }
181+
182+ InverseMouseArea {
183+ anchors.fill: navigationListView
184+ enabled: root.showList
185+ onClicked: root.showList = false
202186 }
203187}