~nik90/ubuntu-clock-app/prep-new-design-part1

« back to all changes in this revision

Viewing changes to clock/WorldClock.qml

Transitions the storage of world clocks and current location of user from LocalStorage to U1db.

Approved by Ubuntu Phone Apps Jenkins Bot, Riccardo Padovani.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import QtQuick 2.0
20
20
import Ubuntu.Components 0.1
 
21
import QtQuick.XmlListModel 2.0
21
22
import Ubuntu.Components.ListItems 0.1 as ListItem
22
 
import QtQuick.XmlListModel 2.0
 
23
import "../common/ClockUtils.js" as Utils
23
24
 
24
25
// Page to to search a world city and add it to the world clocks
25
26
Page {
32
33
    property alias setFocus: searchBox.setFocus
33
34
 
34
35
    visible: false;
35
 
    title: isWorldCity ? i18n.tr("Add City") : i18n.tr("Edit Current Location")
 
36
    title: isWorldCity ? i18n.tr("Add City") : i18n.tr("Edit Current Location")    
36
37
 
37
38
    Column {
38
39
        id: worldClocks
65
66
            onStatusChanged: {
66
67
                if(status == XmlListModel.Ready && worldClocks.city != "null") {
67
68
                    if (isWorldCity)
68
 
                        worldModel.appendPreset(worldClocks.city, getTimeDifference(cityDetailsModel.get(0).time), worldClocks.lng, worldClocks.lat);
 
69
                        clockPage.addWorldLocation(worldClocks.city, getTimeDifference(cityDetailsModel.get(0).time), worldClocks.lng, worldClocks.lat)
69
70
                    else
70
 
                        worldModel.appendCurrentLocation(worldClocks.city, worldClocks.lng, worldClocks.lat);
 
71
                        clockPage.updateCurrentLocation(worldClocks.city, worldClocks.lng, worldClocks.lat)
71
72
                    worldClocks.clearUserSearch();
72
73
                    pageStack.pop()
73
74
                }