Use Item instead of Row in sheet to fix warning
[quandoparte] / application / resources / harmattan / qml / StationListPage.qml
index ee62845..7955711 100644 (file)
@@ -1,10 +1,15 @@
 import QtQuick 1.0
 import QtMobility.location 1.1
 import com.nokia.meego 1.0
+import net.cirulla.quandoparte 1.0
+import "uiconstants.js" as UiConstants
 
 Page {
     property variant stationView
     id: stationListPage
+    Component.onCompleted: {
+        stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
+    }
     tools: ToolBarLayout {
         id: toolBar
         ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
@@ -39,20 +44,54 @@ Page {
         }
     }
 
-    Column {
+    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")
+            }
+        }
+    }
+    SearchBar {
+        id: searchField
+        anchors.top: header.bottom
+    }
+    Binding {
+        target: stationListProxyModel
+        property: "searchPattern"
+        value: searchField.text
+    }
+    Binding {
+        target: stationListProxyModel
+        property: "sortingMode"
+        value: header.selectedIndex
+    }
+    Rectangle {
+        id: shadow
+        width: parent.width
+        anchors.top: mainView.top
+        height: 5
+        gradient: Gradient {
+            GradientStop {color: "#aa000000"; position: 0.0}
+            GradientStop {color: "#00000000"; position: 1.0}
+        }
+    }
+    Item {
+        id: mainView
         x: 16
         y: 16
+        anchors.top: searchField.bottom
         width: parent.width - 32
         height: parent.height
-        spacing: 16
-        SearchBar {
-            id: searchField
-        }
-        Binding {
-            target: stationListProxyModel
-            property: "searchPattern"
-            value: searchField.text
-        }
         ListView {
             id: stationListView
             clip: true
@@ -96,8 +135,8 @@ Page {
 
     Sheet {
         id: settingsSheet
-        acceptButtonText: "Save"
-        rejectButtonText: "Cancel"
+        acceptButtonText: qsTr("Save")
+        rejectButtonText: qsTr("Cancel")
         content: Item {
             x: 16
             y: 16
@@ -106,15 +145,16 @@ Page {
             Column {
                 spacing: 16
                 anchors.fill: parent
-                Row {
+                Item {
                     height: 40
-                    spacing: 16
+                    anchors.leftMargin: UiConstants.DefaultMargins
                     anchors.left: parent.left
                     anchors.right: parent.right
                     Label {
                         font.bold: true
                         text: "Show Last Station on Startup"
                         anchors.verticalCenter: parent.verticalCenter
+                        anchors.left: parent.left
                     }
                     Switch {
                         anchors.verticalCenter: parent.verticalCenter
@@ -122,9 +162,9 @@ Page {
                         anchors.right: parent.right
                     }
                 }
-                Row {
+                Item {
                     height: 40
-                    spacing: 16
+                    anchors.leftMargin: UiConstants.DefaultMargins
                     anchors.left: parent.left
                     anchors.right: parent.right
                     Label {