Ubuntu Pastebin

Paste from ahayzen at Sun, 15 Feb 2015 15:35:08 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
=== modified file 'app/ui/HomePage.qml'
--- app/ui/HomePage.qml	2015-02-15 15:05:43 +0000
+++ app/ui/HomePage.qml	2015-02-15 15:34:32 +0000
@@ -69,13 +69,32 @@
             // TODO with snapMode, currentIndex is not properly set and setting currentIndex fails
             //snapMode: ListView.SnapOneItem
             orientation: ListView.Horizontal
-            currentIndex: settings.current
             highlightMoveDuration: 150
             highlightRangeMode: ListView.StrictlyEnforceRange
             onCurrentIndexChanged: {
                 print("CI: "+currentIndex)
+
+                if (loaded) {
+                    settings.current = currentIndex
+                }
+            }
+            onModelChanged: {
+                currentIndex = settings.current
+
+                if (model > 0) {
+                    loaded = true
+                }
             }
             delegate: LocationPane {}
+
+            property bool loaded: false
+
+            Connections {
+                target: settings
+                onCurrentChanged: {
+                    locationPages.currentIndex = settings.current
+                }
+            }
         }
     }
 }
Download as text