@@ -44,15 +44,51 @@ Item {
4444 : Theme.palette.normal.baseText
4545 }
4646
47− Label {
48− id: label
47+ Column {
48+ id: headersColumn
4949 anchors.top: parent.top
50− anchors.left: parent.left
51− anchors.margins: units.gu(2)
52− text: root.currentNavigation ? root.currentNavigation.label : ""
53− color: d.foregroundColor
54− elide: Text.ElideRight
55− maximumLineCount: 1
50+ width: parent.width
51+ Repeater {
52+ model: ListModel {
53+ id: headersModel
54+ // Roles
55+ // headerText: the text to show
56+ // navigationId: the navigation Id that represents
57+ // parentNavigationId: the parent navigation Id
58+ }
59+ delegate: DashNavigationHeader {
60+ height: units.gu(5)
61+ width: parent.width
62+
63+ text: headerText
64+ foregroundColor: d.foregroundColor
65+
66+ function pop(popsNeeded) {
67+ navigationListView.currentIndex = navigationListView.currentIndex - popsNeeded;
68+ navigationModel.setProperty(navigationListView.currentIndex, "nullifyNavigation", false);
69+ navigationModel.remove(navigationModel.count - popsNeeded, popsNeeded);
70+
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);
74+ }
75+
76+ onBackClicked: {
77+ scope.setNavigationState(parentNavigationId);
78+
79+ var popsNeeded = headersModel.count - index + 1;
80+ pop(popsNeeded);
81+ }
82+
83+ onTextClicked: {
84+ root.leafClicked();
85+ scope.setNavigationState(navigationId);
86+
87+ var popsNeeded = headersModel.count - index;
88+ pop(popsNeeded);
89+ }
90+ }
91+ }
5692 }
5793
5894 ListView {
@@ -67,7 +103,7 @@ Item {
67103 // nullifyNavigation: overrides navigationId to be null
68104 // This is used to "clear" the delegate when going "right" on the tree
69105 }
70− anchors.top: label.bottom
106+ anchors.top: headersColumn.bottom
71107 property int maxHeight: -1
72108 Component.onCompleted: updateMaxHeight();
73109 function updateMaxHeight()
@@ -109,6 +145,12 @@ Item {
109145 if (hasChildren) {
110146 isGoingBack = false;
111147 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
152+ });
153+ }
112154 navigationListView.currentIndex++;
113155 } else {
114156 root.leafClicked();
@@ -130,6 +172,10 @@ Item {
130172 isGoingBack = true;
131173 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
132174 navigationListView.currentIndex--;
175+
176+ if (headersModel.count > 0) {
177+ headersModel.remove(headersModel.count - 1);
178+ }
133179 }
134180 onAllNavigationClicked: {
135181 root.leafClicked();