summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2017-12-21 20:18:03 +0100
committerVolker Krause <[email protected]>2017-12-21 20:18:03 +0100
commit97efca8766b49e7f021106763f280612d2aabfab (patch)
treed60062d78d0309a4f0873c803168f2014d9a5f55
parente545a74812e995ad7eb0227d44f067f0c20a2742 (diff)
Add show on map actions for train stations too
-rw-r--r--plugins/messageviewer/bodypartformatter/semantic/semanticurlhandler.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/messageviewer/bodypartformatter/semantic/semanticurlhandler.cpp b/plugins/messageviewer/bodypartformatter/semantic/semanticurlhandler.cpp
index 485c72e..cdda7ec 100644
--- a/plugins/messageviewer/bodypartformatter/semantic/semanticurlhandler.cpp
+++ b/plugins/messageviewer/bodypartformatter/semantic/semanticurlhandler.cpp
@@ -138,6 +138,22 @@ bool SemanticUrlHandler::handleContextMenuRequest(MimeTreeParser::Interface::Bod
addGoToMapAction(&menu, airport);
places.insert(iataCode);
}
+ } else if (r.userType() == qMetaTypeId<TrainReservation>()) {
+ const auto trip = JsonLdDocument::readProperty(r, "reservationFor");
+
+ auto station = JsonLdDocument::readProperty(trip, "departureStation");
+ auto name = JsonLdDocument::readProperty(station, "name").toString();
+ if (!places.contains(name)) {
+ addGoToMapAction(&menu, station);
+ places.insert(name);
+ }
+
+ station = JsonLdDocument::readProperty(trip, "arrivalStation");
+ name = JsonLdDocument::readProperty(station, "name").toString();
+ if (!places.contains(name)) {
+ addGoToMapAction(&menu, station);
+ places.insert(name);
+ }
}
}