Enable autoUpdate timer for SailfishOS
authorLuciano Montanaro <mikelima@cirulla.net>
Sat, 4 Jan 2014 14:04:52 +0000 (15:04 +0100)
committerLuciano Montanaro <mikelima@cirulla.net>
Sat, 4 Jan 2014 14:04:52 +0000 (15:04 +0100)
Prepare the application for use of the autoUpdate setting.

application/resources/sailfish/qml/main.qml

index baa9b19..aad9970 100644 (file)
@@ -5,13 +5,20 @@ import "pages"
 
 ApplicationWindow {
     id: window
-    initialPage: StationListPage { }
+    initialPage: Qt.resolvedUrl("pages/StationListPage.qml")
     cover: Qt.resolvedUrl("cover/CoverPage.qml")
     Timer { /* XXX This is an AlignedTimer in Harmattan, which should be better for battery */
         id: updateTimer
-        interval: 120
+        interval: 120000
+        repeat: true
+        running: Qt.application.active && settings.autoUpdate
     }
     StationScheduleModel {
         id: schedule
     }
+    Component.onCompleted: {
+        if (Qt.application.active && settings.autoUpdate) {
+            updateTimer.start()
+        }
+    }
 }