Merge lp:~neokore/ubuntu-weather-app/MoveToAddedLocation into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Raúl Yeguas
Status: Merged
Approved by: Martin Borho
Approved revision: 19
Merged at revision: 17
Proposed branch: lp:~neokore/ubuntu-weather-app/MoveToAddedLocation
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 39 lines (+8/-3)
1 file modified
ubuntu-weather-app.qml (+8/-3)
To merge this branch: bzr merge lp:~neokore/ubuntu-weather-app/MoveToAddedLocation
Reviewer Review Type Date Requested Status
Martin Borho Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+161890@code.launchpad.net

Commit message

Tabs move to new added location's tab when you add one. Made it with Martin's help.

Description of the change

Tabs move to new added location's tab when you add one. Made it with Martin's help.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Martin Borho (martin-borho) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu-weather-app.qml'
2--- ubuntu-weather-app.qml 2013-05-01 16:37:10 +0000
3+++ ubuntu-weather-app.qml 2013-05-01 17:14:24 +0000
4@@ -37,12 +37,15 @@
5
6 // see https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1124071, temporary workaround
7 function buildTabs(locations) {
8+ // check if there was a location added
9+ var locLength = locations.length,
10+ locBeforeLen = locationsList.length,
11+ focusToLast = (locBeforeLen > 0 && locLength > locBeforeLen) ? true : false;
12 locationsList = locations;
13 if(tabsObject !== null) {
14 tabsObject.destroy()
15 }
16- var locLength = locations.length,
17- tabsString = "import QtQuick 2.0; import Ubuntu.Components 0.1; import Ubuntu.Components.Popups 0.1; import \"components\" as Components; "
18+ var tabsString = "import QtQuick 2.0; import Ubuntu.Components 0.1; import Ubuntu.Components.Popups 0.1; import \"components\" as Components; "
19 + "Tabs {id: tabs; anchors.fill: parent;"
20 if(locLength > 0) {
21 for(var x=0;x<locLength;x++) {
22@@ -55,6 +58,8 @@
23 if(loading != null)
24 loading.destroy();
25 tabsObject = Qt.createQmlObject(tabsString, tabPage, "tabs")
26+ if(focusToLast)
27+ tabsObject.selectedTabIndex = locLength -1;
28 }
29
30 function removeLocation(dbId) {
31@@ -104,7 +109,7 @@
32 id: tabs
33 objectName: "Tabs"
34 anchors.fill: parent
35- Tab {Components.LoadingComponent{id:loading; anchors.fill: parent}}
36+ Tab {Components.LoadingComponent{id:loading; anchors.fill: tabs}}
37 }
38 }
39 }

Subscribers

People subscribed via source and target branches