Allow opening locations in your preferred map

Once someone shares a location with you, typically you want to open it
in your preferred mapping application or website. For example, being
sent a location to a restaurant and needing to route it via Google Maps.

Now in NeoChat you can click on the "Open Externally" button on a
location message. On KDE Plasma, the default application can be set
under System Settings. On Android, this URI is handled by Google Maps
and possibly others.
This commit is contained in:
Joshua Goins
2024-09-01 13:57:28 -04:00
parent 4b7cbf37d5
commit 0242ab72e8

View File

@@ -9,6 +9,7 @@ import QtLocation
import QtPositioning
import org.kde.neochat
import org.kde.kirigami as Kirigami
/**
* @brief A component to show a location from a message.
@@ -101,6 +102,18 @@ ColumnLayout {
Qt.openUrlExternally(link);
}
}
Button {
anchors {
top: parent.top
right: parent.right
margins: Kirigami.Units.smallSpacing
}
text: i18nc("@action:button Open the location in an external program", "Open Externally")
icon.name: "compass"
onClicked: Qt.openUrlExternally("geo:" + root.latitude + "," + root.longitude)
}
}
Component {
id: fullScreenMap