Use the new code field to fetch the station schedule
[quandoparte] / application / resources / harmattan / qml / StationListPage.qml
index 4f1244a..21fda92 100644 (file)
@@ -16,7 +16,6 @@ Page {
     Menu {
         id: menu
         content: MenuLayout {
-
             MenuItem {
                 text: qsTr("Update Periodically")
                 Switch {
@@ -26,32 +25,25 @@ Page {
                         right: parent.right
                         rightMargin: UiConstants.DefaultMargin
                     }
-                    checked: settings.autoUpdate
+                    onCheckedChanged: settings.autoUpdate = checked
                 }
-                onClicked: settings.autoUpdate ^= true
             }
             MenuItem {
                 text: qsTr("About Quando Parte")
                 onClicked: Private.showAboutPage()
             }
+            Component.onCompleted: periodicCheckSwitch.checked = settings.autoUpdate
         }
     }
     PageHeader {
         id: header
         anchors.top: parent.top
         selectedIndex: stationListProxyModel.sortingMode
-        options: ListModel {
-            id: dialogOptions
-            ListElement {
-                name: QT_TR_NOOP("Stations by Name")
-            }
-            ListElement {
-                name: QT_TR_NOOP("Stations by Distance")
-            }
-            ListElement {
-                name: QT_TR_NOOP("Stations Recently Seen")
-            }
-        }
+        options: [
+            qsTr("Stations by Name"),
+            qsTr("Stations by Distance"),
+            qsTr("Stations Recently Seen")
+        ]
     }
     SearchBar {
         id: searchField
@@ -111,9 +103,15 @@ Page {
 
                         Label {
                             id: mainText
-                            text: Private.highlightSearch(model.display, UiConstants.AccentColor)
+                            text: Private.highlightSearch(model.name, UiConstants.AccentColor)
                             font.bold: true
                         }
+                        Label {
+                            id: subText
+                            text: (model.code !== undefined) ? model.code : "none"
+                            font.bold: UiConstants.SubtitleFontBoldness
+                            font.pixelSize: UiConstants.SubtitleFontPixelSize
+                        }
                     }
                 }
                 Image {
@@ -127,7 +125,7 @@ Page {
                     id: mouseArea
                     anchors.fill: background
                     onClicked: {
-                        Private.loadStation(model.display)
+                        Private.loadStation(model.name, model.code)
                     }
                 }
             }