@@ -44,15 +44,51 @@ Item {
44 : Theme.palette.normal.baseText
44 : Theme.palette.normal.baseText
48− id: label
48+ id: headersColumn
49 anchors.top: parent.top
49 anchors.top: parent.top
50− anchors.left: parent.left
50+ width: parent.width
51− anchors.margins: units.gu(2)
51+ Repeater {
52− text: root.currentNavigation ? root.currentNavigation.label : ""
52+ model: ListModel {
55+ // headerText: the text to show
56+ // navigationId: the navigation Id that represents
57+ // parentNavigationId: the parent navigation Id
59+ delegate: DashNavigationHeader {
53− color: d.foregroundColor
64+ foregroundColor: d.foregroundColor
54− elide: Text.ElideRight
65+
55− maximumLineCount: 1
66+ function pop(popsNeeded) {
67+ navigationListView.currentIndex = navigationListView.currentIndex - popsNeeded;
68+ navigationModel.setProperty(navigationListView.currentIndex, "nullifyNavigation", false);
69+ navigationModel.remove(navigationModel.count - popsNeeded, popsNeeded);
71+ popsNeeded = Math.min(headersModel.count, popsNeeded);
72+ // This is effectively deleting ourselves, so needs to be the last thing of the function
73+ headersModel.remove(headersModel.count - popsNeeded, popsNeeded);
77+ scope.setNavigationState(parentNavigationId);
79+ var popsNeeded = headersModel.count - index + 1;
85+ scope.setNavigationState(navigationId);
87+ var popsNeeded = headersModel.count - index;
58 ListView {
94 ListView {
@@ -67,7 +103,7 @@ Item {
67 // nullifyNavigation: overrides navigationId to be null
103 // nullifyNavigation: overrides navigationId to be null
68 // This is used to "clear" the delegate when going "right" on the tree
104 // This is used to "clear" the delegate when going "right" on the tree
70− anchors.top: label.bottom
106+ anchors.top: headersColumn.bottom
71 property int maxHeight: -1
107 property int maxHeight: -1
72 Component.onCompleted: updateMaxHeight();
108 Component.onCompleted: updateMaxHeight();
73 function updateMaxHeight()
109 function updateMaxHeight()
@@ -109,6 +145,12 @@ Item {
109 if (hasChildren) {
145 if (hasChildren) {
110 isGoingBack = false;
146 isGoingBack = false;
111 navigationModel.append({"navigationId": newNavigationId, "nullifyNavigation": false});
147 navigationModel.append({"navigationId": newNavigationId, "nullifyNavigation": false});
148+ if (navigationModel.count > 2) {
149+ headersModel.append({"headerText": navigation.allLabel != "" ? navigation.allLabel : navigation.label,
150+ "navigationId": navigationId,
151+ "parentNavigationId": navigation.parentNavigationId
112 navigationListView.currentIndex++;
154 navigationListView.currentIndex++;
114 root.leafClicked();
156 root.leafClicked();
@@ -130,6 +172,10 @@ Item {
130 isGoingBack = true;
172 isGoingBack = true;
131 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
173 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
132 navigationListView.currentIndex--;
174 navigationListView.currentIndex--;
176+ if (headersModel.count > 0) {
177+ headersModel.remove(headersModel.count - 1);
134 onAllNavigationClicked: {
180 onAllNavigationClicked: {
135 root.leafClicked();
181 root.leafClicked();