on xenial help sign in
Accomodate for the fact that we can go back when going at index 0
b129810Albert Astals
qml/Dash/DashNavigationButton.qml+14
@@ -139,6 +139,17 @@ AbstractButton {
139 }
139 }
140 }
140 }
141 onGoBackToParentClicked: {
141 onGoBackToParentClicked: {
142+ if (navigationListView.currentIndex == 0) {
143+ // This can happen if we jumped to a leaf and deep tree and the user
144+ // is now going back, create space in the list for the list to move "left"
145+ var aux = navigationListView.highlightMoveDuration;
146+ navigationListView.highlightMoveDuration = 0;
147+ navigationModel.insert(0, {"navigationId": navigation.parentNavigationId, "nullifyNavigation": false});
148+ navigationListView.currentIndex = navigationListView.currentIndex + 1;
149+ navigationListView.contentX = width * navigationListView.currentIndex;
150+ navigationListView.highlightMoveDuration = aux;
151+ }
152+
142 scope.setNavigationState(navigation.parentNavigationId, isAltNavigation);
153 scope.setNavigationState(navigation.parentNavigationId, isAltNavigation);
143 isGoingBack = true;
154 isGoingBack = true;
144 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
155 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
@@ -153,6 +164,9 @@ AbstractButton {
153 }
164 }
154 }
165 }
155 onContentXChanged: {
166 onContentXChanged: {
167+ if (navigationListView.highlightMoveDuration == 0)
168+ return;
169+
156 if (contentX == width * navigationListView.currentIndex) {
170 if (contentX == width * navigationListView.currentIndex) {
157 if (isGoingBack) {
171 if (isGoingBack) {
158 navigationModel.remove(navigationListView.currentIndex + 1);
172 navigationModel.remove(navigationListView.currentIndex + 1);