ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #02881
[Merge] lp:~vthompson/ubuntu-weather-app/reboot-migrate-locations into lp:ubuntu-weather-app/reboot
Victor Thompson has proposed merging lp:~vthompson/ubuntu-weather-app/reboot-migrate-locations into lp:ubuntu-weather-app/reboot.
Commit message:
Properly migrate Locations.
Requested reviews:
Ubuntu Weather Developers (ubuntu-weather-dev)
For more details, see:
https://code.launchpad.net/~vthompson/ubuntu-weather-app/reboot-migrate-locations/+merge/262292
Properly migrate Locations.
--
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~vthompson/ubuntu-weather-app/reboot-migrate-locations into lp:ubuntu-weather-app/reboot.
=== modified file 'app/data/Storage.qml'
--- app/data/Storage.qml 2015-05-09 00:47:22 +0000
+++ app/data/Storage.qml 2015-06-18 03:58:46 +0000
@@ -121,6 +121,12 @@
return res;
}
+ function insertLocationAtStart(data) {
+ var res = insertLocation(data);
+ reorder(res, 0);
+ return 0;
+ }
+
function updateLocation(dbId, data) {
openDB();
db.transaction( function(tx){
=== modified file 'app/ubuntu-weather-app.qml'
--- app/ubuntu-weather-app.qml 2015-06-10 01:47:37 +0000
+++ app/ubuntu-weather-app.qml 2015-06-18 03:58:46 +0000
@@ -148,6 +148,7 @@
property string units
property string windUnits
+ property bool addedCurrentLocation: false
property bool migrated: false
Component.onCompleted: {
@@ -170,8 +171,9 @@
// Add or replace the current locaiton to the storage and refresh the
// locationList
function updateCurrentLocation(location) {
- if (locationsList == null || locationsList.length == 0) {
- storage.insertLocation({location: location});
+ if (!settings.addedCurrentLocation || locationsList == null || locationsList.length == 0) {
+ storage.insertLocationAtStart({location: location});
+ settings.addedCurrentLocation = true;
} else {
storage.updateLocation(locationsList[0].db.id, {location: location});
}
=== modified file 'app/ui/LocationsPage.qml'
--- app/ui/LocationsPage.qml 2015-06-14 21:17:22 +0000
+++ app/ui/LocationsPage.qml 2015-06-18 03:58:46 +0000
@@ -72,7 +72,7 @@
left: parent.left
right: parent.right
}
- height: units.gu(8)
+ height: settings.addedCurrentLocation ? units.gu(8) : units.gu(0)
interactive: false
model: currentLocationModel
delegate: WeatherListItem {
@@ -262,7 +262,7 @@
"icon": iconMap[data.data[0].current.icon]
}
- if (i > 0) {
+ if (!settings.addedCurrentLocation || i > 0) {
locationsModel.append(loc)
} else {
currentLocationModel.append(loc)
Follow ups