Commit fb83a27a authored by Volker Krause's avatar Volker Krause
Browse files

Hide implementation details

parent e248ee31
......@@ -31,6 +31,13 @@
using namespace KCalCore;
using namespace KItinerary;
static void fillFlightReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillTripReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillTrainReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillBusReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillLodgingReservation(const LodgingReservation &reservation, const KCalCore::Event::Ptr &event);
static void fillGeoPosition(const QVariant &place, const KCalCore::Event::Ptr &event);
QDateTime CalendarHandler::startDateTime(const QVariant &reservation)
{
if (reservation.userType() == qMetaTypeId<FlightReservation>()
......@@ -84,7 +91,7 @@ void CalendarHandler::fillEvent(const QVariant &reservation, const KCalCore::Eve
}
}
void CalendarHandler::fillFlightReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event)
static void fillFlightReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event)
{
const auto flight = JsonLdDocument::readProperty(reservation, "reservationFor");
const auto airline = JsonLdDocument::readProperty(flight, "airline");
......@@ -145,7 +152,7 @@ void CalendarHandler::fillFlightReservation(const QVariant &reservation, const K
event->setDescription(desc.join(QLatin1Char('\n')));
}
void CalendarHandler::fillTripReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event)
static void fillTripReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event)
{
const auto trip = JsonLdDocument::readProperty(reservation, "reservationFor");
const auto depStation = JsonLdDocument::readProperty(trip, "departureStation");
......@@ -183,7 +190,7 @@ void CalendarHandler::fillTripReservation(const QVariant &reservation, const KCa
event->setDescription(desc.join(QLatin1Char('\n')));
}
void CalendarHandler::fillTrainReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event)
static void fillTrainReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event)
{
const auto trip = JsonLdDocument::readProperty(reservation, "reservationFor");
const auto depStation = JsonLdDocument::readProperty(trip, "departureStation");
......@@ -200,7 +207,7 @@ void CalendarHandler::fillTrainReservation(const QVariant &reservation, const KC
fillTripReservation(reservation, event);
}
void CalendarHandler::fillBusReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event)
static void fillBusReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event)
{
const auto trip = JsonLdDocument::readProperty(reservation, "reservationFor");
const auto depStation = JsonLdDocument::readProperty(trip, "departureStation");
......@@ -217,7 +224,7 @@ void CalendarHandler::fillBusReservation(const QVariant &reservation, const KCal
fillTripReservation(reservation, event);
}
void CalendarHandler::fillLodgingReservation(const LodgingReservation &reservation, const KCalCore::Event::Ptr &event)
static void fillLodgingReservation(const LodgingReservation &reservation, const KCalCore::Event::Ptr &event)
{
if (reservation.reservationFor().isNull()) {
return;
......@@ -241,7 +248,7 @@ void CalendarHandler::fillLodgingReservation(const LodgingReservation &reservati
event->setTransparency(Event::Transparent);
}
void CalendarHandler::fillGeoPosition(const QVariant &place, const KCalCore::Event::Ptr &event)
static void fillGeoPosition(const QVariant &place, const KCalCore::Event::Ptr &event)
{
const auto geo = JsonLdDocument::readProperty(place, "geo").value<GeoCoordinates>();
if (!geo.isValid()) {
......
......@@ -29,31 +29,20 @@ class QVariant;
namespace KItinerary {
class LodgingReservation;
/** Methods for converting between ical events and JSON-LD booking data. */
class KITINERARY_EXPORT CalendarHandler
namespace KITINERARY_EXPORT CalendarHandler
{
public:
/** Returns the start time associated with the given reservation. */
static QDateTime startDateTime(const QVariant &reservation);
QDateTime startDateTime(const QVariant &reservation);
/** Attempts to find an event in @p calendar for @p reservation. */
static KCalCore::Event::Ptr findEvent(const KCalCore::Calendar::Ptr &calendar, const QVariant &reservation);
KCalCore::Event::Ptr findEvent(const KCalCore::Calendar::Ptr &calendar, const QVariant &reservation);
/** Fills @p event with details of @p reservation.
* Can be used on new events or to update existing ones.
*/
static void fillEvent(const QVariant &reservation, const KCalCore::Event::Ptr &event);
private:
static void fillFlightReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillTripReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillTrainReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillBusReservation(const QVariant &reservation, const KCalCore::Event::Ptr &event);
static void fillLodgingReservation(const LodgingReservation &reservation, const KCalCore::Event::Ptr &event);
static void fillGeoPosition(const QVariant &place, const KCalCore::Event::Ptr &event);
};
void fillEvent(const QVariant &reservation, const KCalCore::Event::Ptr &event);
}
}
......
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