Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit c004b8ee authored by Volker Krause's avatar Volker Krause

Store geo position in created ical events

parent a18064e9
......@@ -10,6 +10,7 @@ LAST-MODIFIED:20171227T111649Z
DESCRIPTION:Booking reference: XXX007
SUMMARY:Flight AB 8075 from HEL to TXL
LOCATION:Helsinki
GEO:60.317200;24.963301
DTSTART;TZID=Europe/Helsinki:20170920T150500
DTEND;TZID=Europe/Berlin:20170920T160000
TRANSP:OPAQUE
......
......@@ -10,6 +10,7 @@ LAST-MODIFIED:20171227T111649Z
DESCRIPTION:Coach: 17\nSeat: 62\nBooking reference: XXX007
SUMMARY:Train 5186 from Nîmes Gare to Lyon Part-Dieu
LOCATION:Nîmes Gare
GEO:43.832291;4.365845
DTSTART;TZID="UTC+02:00":20170929T182600
DTEND;TZID="UTC+02:00":20170929T195200
TRANSP:OPAQUE
......
......@@ -56,6 +56,7 @@ void CalendarHandler::fillFlightReservation(const QVariant &reservation, const K
JsonLdDocument::readProperty(arrPort, "iataCode").toString()
));
event->setLocation(JsonLdDocument::readProperty(depPort, "name").toString());
fillGeoPosition(depPort, event);
event->setDtStart(JsonLdDocument::readProperty(flight, "departureTime").toDateTime());
event->setDtEnd(JsonLdDocument::readProperty(flight, "arrivalTime").toDateTime());
event->setAllDay(false);
......@@ -79,6 +80,7 @@ void CalendarHandler::fillTrainReservation(const QVariant &reservation, const KC
JsonLdDocument::readProperty(arrStation, "name").toString()
));
event->setLocation(JsonLdDocument::readProperty(depStation, "name").toString());
fillGeoPosition(depStation, event);
event->setDtStart(JsonLdDocument::readProperty(trip, "departureTime").toDateTime());
event->setDtEnd(JsonLdDocument::readProperty(trip, "arrivalTime").toDateTime());
event->setAllDay(false);
......@@ -126,6 +128,7 @@ void CalendarHandler::fillLodgingReservation(const QVariant &reservation, const
JsonLdDocument::readProperty(address, "addressLocality").toString(),
JsonLdDocument::readProperty(address, "addressCountry").toString()
));
fillGeoPosition(lodgingBusiness, event);
event->setDtStart(QDateTime(JsonLdDocument::readProperty(reservation, "checkinDate").toDate(), QTime()));
event->setDtEnd(QDateTime(JsonLdDocument::readProperty(reservation, "checkoutDate").toDate(), QTime()));
event->setAllDay(true);
......@@ -134,3 +137,15 @@ void CalendarHandler::fillLodgingReservation(const QVariant &reservation, const
));
event->setTransparency(Event::Transparent);
}
void CalendarHandler::fillGeoPosition(const QVariant &place, const KCalCore::Event::Ptr &event)
{
const auto geo = JsonLdDocument::readProperty(place, "geo");
if (geo.isNull()) {
return;
}
event->setHasGeo(true);
event->setGeoLatitude(JsonLdDocument::readProperty(geo, "latitude").toFloat());
event->setGeoLongitude(JsonLdDocument::readProperty(geo, "longitude").toFloat());
}
......@@ -34,6 +34,7 @@ private:
static void fillFlightReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillTrainReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillLodgingReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillGeoPosition(const QVariant &place, const KCalCore::Event::Ptr &event);
};
#endif // CALENDARHANDLER_H
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