Implement Station map lookup
authorLuciano Montanaro <mikelima@cirulla.net>
Sat, 16 Nov 2013 09:53:01 +0000 (10:53 +0100)
committerLuciano Montanaro <mikelima@cirulla.net>
Sat, 16 Nov 2013 09:53:01 +0000 (10:53 +0100)
application/resources/harmattan/qml/StationListPage.qml
application/resources/sailfish/qml/pages/StationListPage.qml

index 7429c04..ee0d51a 100644 (file)
@@ -186,6 +186,16 @@ Page {
                     onClicked: {
                         Private.loadStation(model.name, model.code)
                     }
+                    onPressAndHold: contextMenu.open()
+                }
+                ContextMenu {
+                    id: contextMenu
+                    MenuLayout {
+                        MenuItem {
+                            text: qsTr("Show on the map")
+                            onClicked: Qt.openUrlExternally("geo:" + model.longitude + "," + model.latitude)
+                        }
+                    }
                 }
             }
         }
index 382c7ca..739742d 100644 (file)
@@ -1,4 +1,5 @@
 import QtQuick 2.0
+import QtLocation 5.0
 import Sailfish.Silica 1.0
 import net.cirulla.quandoparte 1.0
 import "StationListPage.js" as Private
@@ -59,15 +60,12 @@ Page {
                 text: model.name ? Private.highlightSearch(model.name, Theme.highlightColor) : ""
             }
             onClicked: Private.loadStation(model.name, model.code)
-        }
-        section {
-            criteria: ViewSection.FirstCharacter
-            delegate: BackgroundItem {
-                height: Theme.itemSizeSmall
-                width: parent.width
-                Label {
-                    id: sectionLabel
-                    text: section
+            onPressAndHold: contextMenu.show(listItem)
+            ContextMenu {
+                id: contextMenu
+                MenuItem {
+                    text: qsTr("Show on the map")
+                    onClicked: Qt.openUrlExternally("geo:" + model.longitude + "," + model.latitude)
                 }
             }
         }