Commit ec06bbf4 authored by Laurent Montel's avatar Laurent Montel 😁

Allow to show address on map for EventReservation too

parent 8eeac315
......@@ -36,6 +36,7 @@
#include <KItinerary/SortUtil>
#include <KItinerary/TrainTrip>
#include <KItinerary/Taxi>
#include <KItinerary/Event>
#include <KMime/Content>
......@@ -209,6 +210,15 @@ bool SemanticUrlHandler::handleContextMenuRequest(MimeTreeParser::Interface::Bod
const auto res = d.reservations.at(0); // for multi-traveler reservations all subsequent ones are equal regarding what we are interested here
if (JsonLd::isA<LodgingReservation>(res)) {
addGoToMapAction(&menu, res.value<LodgingReservation>().reservationFor().value<LodgingBusiness>());
} else if (JsonLd::isA<EventReservation>(res)) {
const auto event = res.value<EventReservation>().reservationFor().value<Event>();
Place location;
if (JsonLd::canConvert<Place>(event.location())) {
location = JsonLd::convert<Place>(event.location());
addGoToMapAction(&menu, location);
}
} else if (JsonLd::isA<FlightReservation>(res)) {
const auto flight = res.value<FlightReservation>().reservationFor().value<Flight>();
......@@ -387,7 +397,7 @@ void SemanticUrlHandler::addToCalendar(SemanticMemento *memento) const
for (const auto &d : memento->data()) {
auto event = d.event;
if (!event) {
event.reset(new Event);
event.reset(new KCalCore::Event);
CalendarHandler::fillEvent(d.reservations, event);
if (!event->dtStart().isValid() || !event->dtEnd().isValid() || event->summary().isEmpty()) {
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment