Warning, file /pim/kitinerary/src/lib/calendarhandler.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002    SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kitinerary_export.h"
0010 
0011 #include <QSharedPointer>
0012 template<typename T> class QList;
0013 class QVariant;
0014 
0015 namespace KCalendarCore {
0016 class Calendar;
0017 class Event;
0018 }
0019 
0020 namespace KItinerary {
0021 
0022 /** Methods for converting between ical events and JSON-LD booking data. */
0023 namespace CalendarHandler
0024 {
0025     /** Attempts to find calendar events in @p calendar for @p reservation.
0026      *  For a complete reservation this should not return more than one element,
0027      *  for a minimal cancellation element however this can return multiple events
0028      *  (e.g. all trip segments covered by the same reservation number).
0029      *  @since 20.08
0030      */
0031 KITINERARY_EXPORT QList<QSharedPointer<KCalendarCore::Event>>
0032 findEvents(KCalendarCore::Calendar *calendar, const QVariant &reservation);
0033 KITINERARY_EXPORT QList<QSharedPointer<KCalendarCore::Event>>
0034 findEvents(const QSharedPointer<KCalendarCore::Calendar> &calendar,
0035            const QVariant &reservation);
0036 
0037 /** Returns the reservations for this event.
0038  *  In case of a mult-travler trip, the result contains more than one
0039  * reservation.
0040  */
0041 KITINERARY_EXPORT QList<QVariant>
0042 reservationsForEvent(const QSharedPointer<KCalendarCore::Event> &event);
0043 
0044 /** Checks if the given @p reservation contains enough information to create an
0045  * iCal event from it. */
0046 KITINERARY_EXPORT bool canCreateEvent(const QVariant &reservation);
0047 
0048 /** Fills @p event with details of @p reservations.
0049  *  Can be used on new events or to update existing ones.
0050  *  @param reservations When passing more than one reservation here, those must
0051  * be for the same multi-traveler trip. That is, MergeUtil::isSame() returns
0052  * true for Reservation::reservationFor for each pair of values.
0053  *  @param event The event.
0054  */
0055 KITINERARY_EXPORT void
0056 fillEvent(const QList<QVariant> &reservations,
0057           const QSharedPointer<KCalendarCore::Event> &event);
0058 }
0059 
0060 }
0061