summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2017-12-28 16:25:05 +0100
committerVolker Krause <[email protected]>2017-12-28 16:25:05 +0100
commit1c54711c69ed481b2a11665a08b1a31a38729303 (patch)
treef0ee702d51970fc9bedbcecc75857865867765d1
parent41b65bc9f5ae8b185603da96af927af81df43a7f (diff)
Include checkin and checkout times in description for hotel bookings
-rw-r--r--plugins/messageviewer/bodypartformatter/autotests/calendarhandlerdata/hotel.ics2
-rw-r--r--plugins/messageviewer/bodypartformatter/semantic/calendarhandler.cpp11
2 files changed, 9 insertions, 4 deletions
diff --git a/plugins/messageviewer/bodypartformatter/autotests/calendarhandlerdata/hotel.ics b/plugins/messageviewer/bodypartformatter/autotests/calendarhandlerdata/hotel.ics
index 25bfe9b..dd55765 100644
--- a/plugins/messageviewer/bodypartformatter/autotests/calendarhandlerdata/hotel.ics
+++ b/plugins/messageviewer/bodypartformatter/autotests/calendarhandlerdata/hotel.ics
@@ -7,7 +7,7 @@ DTSTAMP:20171227T111649Z
CREATED:20171227T111649Z
UID:1b22236a-21ff-4885-8c99-b3b2bbca062c
LAST-MODIFIED:20171227T111649Z
-DESCRIPTION:Booking reference: 1234567890
+DESCRIPTION:Check-in: 3:00 PM\nCheck-out: 12:00 PM\nBooking reference: 1234567890
SUMMARY:Hotel reservation: Glo Hotel Sello
LOCATION:Leppävaarankatu 1\, 02600 Espoo\, Finland
DTSTART;VALUE=DATE:20170919
diff --git a/plugins/messageviewer/bodypartformatter/semantic/calendarhandler.cpp b/plugins/messageviewer/bodypartformatter/semantic/calendarhandler.cpp
index a4e7440..27f0f43 100644
--- a/plugins/messageviewer/bodypartformatter/semantic/calendarhandler.cpp
+++ b/plugins/messageviewer/bodypartformatter/semantic/calendarhandler.cpp
@@ -165,10 +165,15 @@ void CalendarHandler::fillLodgingReservation(const QVariant &reservation, const
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()));
+
+ const auto checkinDt = JsonLdDocument::readProperty(reservation, "checkinDate").toDateTime();
+ const auto checkoutDt = JsonLdDocument::readProperty(reservation, "checkoutDate").toDateTime();
+ event->setDtStart(QDateTime(checkinDt.date(), QTime()));
+ event->setDtEnd(QDateTime(checkoutDt.date(), QTime()));
event->setAllDay(true);
- event->setDescription(i18n("Booking reference: %1",
+ event->setDescription(i18n("Check-in: %1\nCheck-out: %2\nBooking reference: %3",
+ QLocale().toString(checkinDt.time(), QLocale::ShortFormat),
+ QLocale().toString(checkoutDt.time(), QLocale::ShortFormat),
JsonLdDocument::readProperty(reservation, "reservationNumber").toString()
));
event->setTransparency(Event::Transparent);