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>
This commit is contained in:
Lubomir I. Ivanov 2017-07-21 16:26:33 +03:00 committed by Dirk Hohndel
parent 4d0d0e102b
commit 621dd53a43

View file

@ -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");