summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-21 16:26:33 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commit621dd53a4333a29a3e07293f75e4346a27705bbe (patch)
treefcbfc41215ec2d53721a9e67f03c1e6cc412e7c8 /mobile-widgets
parent4d0d0e102b12d70e3944c7fdeae3b3a0270f6870 (diff)
downloadsubsurface-621dd53a4333a29a3e07293f75e4346a27705bbe.tar.gz
mapwidget.qml: open current location in Google Maps
openLocationInGoogleMaps() now can be used to open a URL in an external browser, triggered by the context menu. Use the same Google Maps URL formating as in main.qml showMap(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/MapWidget.qml8
1 files changed, 7 insertions, 1 deletions
diff --git a/mobile-widgets/qml/MapWidget.qml b/mobile-widgets/qml/MapWidget.qml
index 13c095a5f..aa5edc5e6 100644
--- a/mobile-widgets/qml/MapWidget.qml
+++ b/mobile-widgets/qml/MapWidget.qml
@@ -138,6 +138,12 @@ Item {
}
}
+ function openLocationInGoogleMaps(latitude, longitude) {
+ var loc = latitude + " " + longitude
+ var url = "https://www.google.com/maps/place/" + loc + "/@" + loc + ",5000m/data=!3m1!1e3!4m2!3m1!1s0x0:0x0"
+ Qt.openUrlExternally(url)
+ }
+
MapWidgetContextMenu {
id: contextMenu
y: 10; x: map.width - y
@@ -145,7 +151,7 @@ Item {
// TODO: perform action actions
switch (action) {
case contextMenu.actions.OPEN_LOCATION_IN_GOOGLE_MAPS:
- console.log("OPEN_LOCATION_IN_GOOGLE_MAPS");
+ openLocationInGoogleMaps(map.center.latitude, map.center.longitude)
break;
case contextMenu.actions.COPY_LOCATION_DECIMAL:
console.log("COPY_LOCATION_DECIMAL");