Merge lp:~aacid/unity8/deparment_jumping into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michael Zanetti
Approved revision: 1477
Merged at revision: 1501
Proposed branch: lp:~aacid/unity8/deparment_jumping
Merge into: lp:unity8
Diff against target: 74 lines (+26/-11)
1 file modified
qml/Dash/DashNavigationButton.qml (+26/-11)
To merge this branch: bzr merge lp:~aacid/unity8/deparment_jumping
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Review via email: mp+243639@code.launchpad.net

Commit message

Make Navigation work when "jumping" to the non root

There's two fixes:
 * If the Navigation we jumped to is a leaf, list the model of the parent
 * If we're going back/left but we're already on index 0 of the list prepend the parent so we can continue going back

Description of the change

* Are there any related MPs required for this MP to build/function as expected?
No hard depend, but it needs to land with a
  https://code.launchpad.net/~stolowski/unity-scope-click/fix-1343242/+merge/243681
  https://code.launchpad.net/~stolowski/unity-scopes-shell/fix-current-nav-id/+merge/243679
to actually fix the bug.

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Michael Zanetti (mzanetti) wrote :

hmm... for some reason, after applying this I can only see the Music category in the store any more.

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Combined with the other branches it seems to work fine.

 * Did you perform an exploratory manual test run of the code change and any related functionality?

yes

 * Did CI run pass? If not, please explain why.

it's gone

 * Did you make sure that the branch does not contain spurious tags?

yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/DashNavigationButton.qml'
2--- qml/Dash/DashNavigationButton.qml 2014-10-23 11:59:22 +0000
3+++ qml/Dash/DashNavigationButton.qml 2014-12-04 11:18:24 +0000
4@@ -139,6 +139,17 @@
5 }
6 }
7 onGoBackToParentClicked: {
8+ if (navigationListView.currentIndex == 0) {
9+ // This can happen if we jumped to the non root of a deep tree and the user
10+ // is now going back, create space in the list for the list to move "left"
11+ var aux = navigationListView.highlightMoveDuration;
12+ navigationListView.highlightMoveDuration = 0;
13+ navigationModel.insert(0, {"navigationId": navigation.parentNavigationId, "nullifyNavigation": false});
14+ navigationListView.currentIndex = navigationListView.currentIndex + 1;
15+ navigationListView.contentX = width * navigationListView.currentIndex;
16+ navigationListView.highlightMoveDuration = aux;
17+ }
18+
19 scope.setNavigationState(navigation.parentNavigationId, isAltNavigation);
20 isGoingBack = true;
21 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
22@@ -153,6 +164,9 @@
23 }
24 }
25 onContentXChanged: {
26+ if (navigationListView.highlightMoveDuration == 0)
27+ return;
28+
29 if (contentX == width * navigationListView.currentIndex) {
30 if (isGoingBack) {
31 navigationModel.remove(navigationListView.currentIndex + 1);
32@@ -175,9 +189,18 @@
33 }
34
35 onScopeChanged: {
36+ setNewNavigation();
37+ }
38+
39+ function setNewNavigation() {
40 navigationModel.clear();
41 if (scope && scope[hasNavigation]) {
42- navigationModel.append({"navigationId": scope[currentNavigationId], "nullifyNavigation": false});
43+ var navigation = getNavigation(scope[currentNavigationId]);
44+ if (navigation.count > 0) {
45+ navigationModel.append({"navigationId": scope[currentNavigationId], "nullifyNavigation": false});
46+ } else {
47+ navigationModel.append({"navigationId": navigation.parentNavigationId, "nullifyNavigation": false});
48+ }
49 }
50 }
51
52@@ -186,20 +209,12 @@
53 // This is duplicated since we can't have something based on the dynamic hasNavigation string property
54 onHasNavigationChanged: {
55 if (!root.isAltNavigation) {
56- if (scope.hasNavigation) {
57- navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
58- } else {
59- navigationModel.clear();
60- }
61+ setNewNavigation();
62 }
63 }
64 onHasAltNavigationChanged: {
65 if (root.isAltNavigation) {
66- if (scope.hasAltNavigation) {
67- navigationModel.append({"navigationId": scope.currentAltNavigationId, "nullifyNavigation": false});
68- } else {
69- navigationModel.clear();
70- }
71+ setNewNavigation();
72 }
73 }
74 }

Subscribers

People subscribed via source and target branches