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

0001 /*
0002   This file is part of the kcalcore library.
0003 
0004   SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <schumacher@kde.org>
0005   SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
0006   SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
0007   SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
0008   SPDX-FileContributor: Alvaro Manera <alvaro.manera@nokia.com>
0009 
0010   SPDX-License-Identifier: LGPL-2.0-or-later
0011 */
0012 /**
0013   @file
0014   This file is part of the API for handling calendar data and
0015   defines the IncidenceBase class.
0016 
0017   @author Cornelius Schumacher \<schumacher@kde.org\>
0018   @author Reinhold Kainhofer \<reinhold@kainhofer.com\>
0019   @author Rafal Rzepecki \<divide@users.sourceforge.net\>
0020 
0021   @glossary @anchor incidence @b incidence:
0022   General term for a calendar component.
0023   Examples are events, to-dos, and journals.
0024 
0025   @glossary @anchor event @b event:
0026   An @ref incidence that has a start and end time, typically representing some
0027   occurrence of social or personal importance. May be recurring.
0028   Examples are appointments, meetings, or holidays.
0029 
0030   @glossary @anchor to-do @b to-do:
0031   An @ref incidence that has an optional start time and an optional due time
0032   typically representing some undertaking to be performed. May be recurring.
0033   Examples are "fix the bug" or "pay the bills".
0034 
0035   @glossary @anchor todo @b todo:
0036   See @ref to-do.
0037 
0038   @glossary @anchor journal @b journal:
0039   An @ref incidence with a start date that represents a diary or daily record
0040   of one's activities. May @b not be recurring.
0041 */
0042 
0043 #ifndef KCALCORE_INCIDENCEBASE_H
0044 #define KCALCORE_INCIDENCEBASE_H
0045 
0046 #include "attendee.h"
0047 #include "customproperties.h"
0048 #include "duration.h"
0049 #include "person.h"
0050 
0051 #include <QDataStream>
0052 #include <QDateTime>
0053 #include <QSet>
0054 #include <QSharedPointer>
0055 #include <QUrl>
0056 
0057 class QUrl;
0058 class QDate;
0059 class QTimeZone;
0060 
0061 namespace KCalendarCore
0062 {
0063 /** List of dates */
0064 typedef QList<QDate> DateList;
0065 
0066 /** List of times */
0067 typedef QList<QDateTime> DateTimeList;
0068 
0069 class Event;
0070 class Todo;
0071 class Journal;
0072 class FreeBusy;
0073 class Visitor;
0074 class IncidenceBasePrivate;
0075 
0076 /**
0077   @brief
0078   An abstract class that provides a common base for all calendar incidence
0079   classes.
0080 
0081   define: organizer (person)
0082   define: uid (same as the attendee uid?)
0083 
0084   Several properties are not allowed for VFREEBUSY objects (see rfc:2445),
0085   so they are not in IncidenceBase. The hierarchy is:
0086 
0087   IncidenceBase
0088   + FreeBusy
0089   + Incidence
0090     + Event
0091     + Todo
0092     + Journal
0093 
0094   So IncidenceBase contains all properties that are common to all classes,
0095   and Incidence contains all additional properties that are common to
0096   Events, Todos and Journals, but are not allowed for FreeBusy entries.
0097 */
0098 class KCALENDARCORE_EXPORT IncidenceBase : public CustomProperties
0099 {
0100     Q_GADGET
0101     Q_PROPERTY(QString uid READ uid WRITE setUid)
0102     Q_PROPERTY(QDateTime lastModified READ lastModified WRITE setLastModified)
0103     Q_PROPERTY(QDateTime dtStart READ dtStart WRITE setDtStart)
0104     Q_PROPERTY(bool allDay READ allDay WRITE setAllDay)
0105     Q_PROPERTY(KCalendarCore::Person organizer READ organizer WRITE setOrganizer)
0106     Q_PROPERTY(QVariantList attendees READ attendeesVariant)
0107     Q_PROPERTY(QUrl url READ url WRITE setUrl)
0108 
0109 public:
0110     /**
0111       A shared pointer to an IncidenceBase.
0112     */
0113     typedef QSharedPointer<IncidenceBase> Ptr;
0114 
0115     /**
0116       The different types of incidences, per RFC2445.
0117       @see type(), typeStr()
0118     */
0119     enum IncidenceType {
0120         TypeEvent = 0, /**< Type is an event */
0121         TypeTodo, /**< Type is a to-do */
0122         TypeJournal, /**< Type is a journal */
0123         TypeFreeBusy, /**< Type is a free/busy */
0124         TypeUnknown, /**< Type unknown */
0125     };
0126 
0127     /**
0128       The different types of incidence date/times roles.
0129       @see dateTime()
0130     */
0131     enum DateTimeRole {
0132         RoleAlarmStartOffset = 0, /**< Role for an incidence alarm's starting offset date/time */
0133         RoleAlarmEndOffset, /**< Role for an incidence alarm's ending offset date/time */
0134         RoleSort, /**< Role for an incidence's date/time used when sorting */
0135         RoleCalendarHashing, /**< Role for looking up an incidence in a Calendar */
0136         RoleStartTimeZone, /**< Role for determining an incidence's starting timezone */
0137         RoleEndTimeZone, /**< Role for determining an incidence's ending timezone */
0138         RoleEndRecurrenceBase,
0139         RoleEnd, /**< Role for determining an incidence's dtEnd, will return
0140                     an invalid QDateTime if the incidence does not support dtEnd */
0141         RoleDisplayEnd, /**< Role used for display purposes, represents the end boundary
0142                            if an incidence supports dtEnd */
0143         RoleAlarm, /**< Role for determining the date/time of the first alarm.
0144                       Returns invalid time if the incidence doesn't have any alarm */
0145         RoleRecurrenceStart, /**< Role for determining the start of the recurrence.
0146                                 Currently that's DTSTART for an event and DTDUE for a to-do.
0147                                 (NOTE: If the incidence is a to-do, recurrence should be
0148                                 calculated having DTSTART for a reference, not DT-DUE.
0149                                 This is one place KCalendarCore isn't compliant with RFC2445) */
0150         RoleDisplayStart, /**< Role for display purposes, represents the start boundary of an
0151                              incidence. To-dos return dtDue here, for historical reasons */
0152         RoleDnD, /**< Role for determining new start and end dates after a DnD */
0153     };
0154 
0155     /**
0156       The different types of incidence fields.
0157     */
0158     enum Field {
0159         FieldDtStart, ///< Field representing the DTSTART component.
0160         FieldDtEnd, ///< Field representing the DTEND component.
0161         FieldLastModified, ///< Field representing the LAST-MODIFIED component.
0162         FieldDescription, ///< Field representing the DESCRIPTION component.
0163         FieldSummary, ///< Field representing the SUMMARY component.
0164         FieldLocation, ///< Field representing the LOCATION component.
0165         FieldCompleted, ///< Field representing the COMPLETED component.
0166         FieldPercentComplete, ///< Field representing the PERCENT-COMPLETE component.
0167         FieldDtDue, ///< Field representing the DUE component.
0168         FieldCategories, ///< Field representing the CATEGORIES component.
0169         FieldRelatedTo, ///< Field representing the RELATED-TO component.
0170         FieldRecurrence, ///< Field representing the EXDATE, EXRULE, RDATE, and RRULE components.
0171         FieldAttachment, ///< Field representing the ATTACH component.
0172         FieldSecrecy, ///< Field representing the CLASS component.
0173         FieldStatus, ///< Field representing the STATUS component.
0174         FieldTransparency, ///< Field representing the TRANSPARENCY component.
0175         FieldResources, ///< Field representing the RESOURCES component.
0176         FieldPriority, ///< Field representing the PRIORITY component.
0177         FieldGeoLatitude, ///< Field representing the latitude part of the GEO component.
0178         FieldGeoLongitude, ///< Field representing the longitude part of the GEO component.
0179         FieldRecurrenceId, ///< Field representing the RECURRENCE-ID component.
0180         FieldAlarms, ///< Field representing the VALARM component.
0181         FieldSchedulingId, ///< Field representing the X-KDE-LIBKCAL-ID component.
0182         FieldAttendees, ///< Field representing the ATTENDEE component.
0183         FieldOrganizer, ///< Field representing the ORGANIZER component.
0184         FieldCreated, ///< Field representing the CREATED component.
0185         FieldRevision, ///< Field representing the SEQUENCE component.
0186         FieldDuration, ///< Field representing the DURATION component.
0187         FieldContact, ///< Field representing the CONTACT component.
0188         FieldComment, ///< Field representing the COMMENT component.
0189         FieldUid, ///< Field representing the UID component.
0190         FieldUnknown, ///< Something changed. Always set when you use the assignment operator.
0191         FieldUrl, ///< Field representing the URL component.
0192         FieldConferences, ///< Field representing the CONFERENCE component.
0193         FieldColor, ///< Field representing the COLOR component.
0194     };
0195 
0196     /**
0197       The IncidenceObserver class.
0198     */
0199     class KCALENDARCORE_EXPORT IncidenceObserver
0200     {
0201     public:
0202         /**
0203           Destroys the IncidenceObserver.
0204         */
0205         virtual ~IncidenceObserver();
0206 
0207         /**
0208           The IncidenceObserver interface.
0209           This function is called before any changes are made.
0210           @param uid is the string containing the incidence @ref uid.
0211           @param recurrenceId is possible recurrenceid of incidence.
0212         */
0213         virtual void incidenceUpdate(const QString &uid, const QDateTime &recurrenceId) = 0;
0214 
0215         /**
0216           The IncidenceObserver interface.
0217           This function is called after changes are completed.
0218           @param uid is the string containing the incidence @ref uid.
0219           @param recurrenceId is possible recurrenceid of incidence.
0220         */
0221         virtual void incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) = 0;
0222     };
0223 
0224 #if KCALENDARCORE_BUILD_DEPRECATED_SINCE(5, 91)
0225     /**
0226       Constructs an empty IncidenceBase.
0227       @deprecated Use IncidenceBase(IncidenceBasePrivate *p).
0228     */
0229     KCALENDARCORE_DEPRECATED_VERSION(5, 91, "Do not use")
0230     IncidenceBase();
0231 #else
0232     IncidenceBase() = delete;
0233 #endif
0234 
0235     /**
0236       Constructs an empty IncidenceBase.
0237       @param p (non-null) a Private data object provided by the instantiated
0238       class (Event, Todo, Journal, FreeBusy).  It takes ownership of the object.
0239     */
0240     KCALENDARCORE_NO_EXPORT explicit IncidenceBase(IncidenceBasePrivate *p);
0241 
0242     /**
0243       Destroys the IncidenceBase.
0244     */
0245     ~IncidenceBase() override;
0246 
0247     /**
0248       Assignment operator.
0249       All data belonging to derived classes are also copied. @see assign().
0250       The caller guarantees that both types match.
0251 
0252       @code
0253       if ( i1.type() == i2.type() ) {
0254         i1 = i2;
0255       } else {
0256         qCDebug(KCALCORE_LOG) << "Invalid assignment!";
0257       }
0258       @endcode
0259 
0260       Dirty field FieldUnknown will be set.
0261 
0262       @param other is the IncidenceBase to assign.
0263      */
0264     IncidenceBase &operator=(const IncidenceBase &other);
0265 
0266     /**
0267       Compares this with IncidenceBase @p ib for equality.
0268       All data belonging to derived classes are also compared. @see equals().
0269       @param ib is the IncidenceBase to compare against.
0270       @return true if the incidences are equal; false otherwise.
0271     */
0272     bool operator==(const IncidenceBase &ib) const;
0273 
0274     /**
0275       Compares this with IncidenceBase @p ib for inequality.
0276       @param ib is the IncidenceBase to compare against.
0277       @return true if the incidences are /not/ equal; false otherwise.
0278     */
0279     bool operator!=(const IncidenceBase &ib) const;
0280 
0281     /**
0282      Accept IncidenceVisitor. A class taking part in the visitor mechanism
0283      has to provide this implementation:
0284      <pre>
0285        bool accept(Visitor &v) { return v.visit(this); }
0286      </pre>
0287 
0288      @param v is a reference to a Visitor object.
0289      @param incidence is a valid IncidenceBase object for visiting.
0290     */
0291     virtual bool accept(Visitor &v, const IncidenceBase::Ptr &incidence);
0292 
0293     /**
0294       Returns the incidence type.
0295     */
0296     virtual IncidenceType type() const = 0;
0297 
0298     /**
0299       Prints the type of incidence as a string.
0300     */
0301     virtual QByteArray typeStr() const = 0;
0302 
0303     /**
0304       Sets the unique id for the incidence to @p uid.
0305       @param uid is the string containing the incidence @ref uid.
0306       @see uid()
0307     */
0308     void setUid(const QString &uid);
0309 
0310     /**
0311       Returns the unique id (@ref uid) for the incidence.
0312       @see setUid()
0313     */
0314     Q_REQUIRED_RESULT QString uid() const;
0315 
0316     /**
0317       Returns the uri for the incidence, of form urn:x-ical:\<uid\>
0318     */
0319     Q_REQUIRED_RESULT QUrl uri() const;
0320 
0321     /**
0322       Sets the time the incidence was last modified to @p lm.
0323       It is stored as a UTC date/time.
0324 
0325       @param lm is the QDateTime when the incidence was last modified.
0326 
0327       @see lastModified()
0328     */
0329     virtual void setLastModified(const QDateTime &lm);
0330 
0331     /**
0332       Returns the time the incidence was last modified.
0333       @see setLastModified()
0334     */
0335     Q_REQUIRED_RESULT QDateTime lastModified() const;
0336 
0337     /**
0338       Sets the organizer for the incidence.
0339 
0340       @param organizer is a non-null Person to use as the incidence @ref organizer.
0341       @see organizer(), setOrganizer(const QString &)
0342     */
0343     void setOrganizer(const Person &organizer);
0344 
0345     /**
0346       Sets the incidence organizer to any string @p organizer.
0347 
0348       @param organizer is a string to use as the incidence @ref organizer.
0349       @see organizer(), setOrganizer(const Person &)
0350     */
0351     void setOrganizer(const QString &organizer);
0352 
0353     /**
0354       Returns the Person associated with this incidence.
0355       If no Person was set through setOrganizer(), a default Person()
0356       is returned.
0357       @see setOrganizer(const QString &), setOrganizer(const Person &)
0358     */
0359     Person organizer() const;
0360 
0361     /**
0362       Sets readonly status.
0363 
0364       @param readOnly if set, the incidence is read-only; else the incidence
0365       can be modified.
0366       @see isReadOnly().
0367     */
0368     virtual void setReadOnly(bool readOnly);
0369 
0370     /**
0371       Returns true the object is read-only; false otherwise.
0372       @see setReadOnly()
0373     */
0374     Q_REQUIRED_RESULT bool isReadOnly() const;
0375 
0376     /**
0377       Sets the incidence's starting date/time with a QDateTime.
0378 
0379       @param dtStart is the incidence start date/time.
0380       @see dtStart().
0381     */
0382     virtual void setDtStart(const QDateTime &dtStart);
0383 
0384     /**
0385       Returns an incidence's starting date/time as a QDateTime.
0386       @see setDtStart().
0387     */
0388     virtual QDateTime dtStart() const;
0389 
0390     /**
0391       Sets the incidence duration.
0392 
0393       @param duration the incidence duration
0394 
0395       @see duration()
0396     */
0397     virtual void setDuration(const Duration &duration);
0398 
0399     /**
0400       Returns the length of the incidence duration.
0401       @see setDuration()
0402     */
0403     Q_REQUIRED_RESULT Duration duration() const;
0404 
0405     /**
0406       Sets if the incidence has a duration.
0407       @param hasDuration true if the incidence has a duration; false otherwise.
0408       @see hasDuration()
0409     */
0410     void setHasDuration(bool hasDuration);
0411 
0412     /**
0413       Returns true if the incidence has a duration; false otherwise.
0414       @see setHasDuration()
0415     */
0416     Q_REQUIRED_RESULT bool hasDuration() const;
0417 
0418     /**
0419       Returns true or false depending on whether the incidence is all-day.
0420       i.e. has a date but no time attached to it.
0421       @see setAllDay()
0422     */
0423     Q_REQUIRED_RESULT bool allDay() const;
0424 
0425     /**
0426       Sets whether the incidence is all-day, i.e. has a date but no time
0427       attached to it.
0428 
0429       @param allDay sets whether the incidence is all-day.
0430 
0431       @see allDay()
0432     */
0433     virtual void setAllDay(bool allDay);
0434 
0435     /**
0436       Shift the times of the incidence so that they appear at the same clock
0437       time as before but in a new time zone. The shift is done from a viewing
0438       time zone rather than from the actual incidence time zone.
0439 
0440       For example, shifting an incidence whose start time is 09:00
0441       America/New York, using an old viewing time zone (@p oldSpec)
0442       of Europe/London, to a new time zone (@p newSpec) of Europe/Paris,
0443       will result in the time being shifted from 14:00 (which is the London
0444       time of the incidence start) to 14:00 Paris time.
0445 
0446       @param oldZone the time zone which provides the clock times
0447       @param newZone the new time zone
0448     */
0449     virtual void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone);
0450 
0451     /**
0452       Adds a comment to the incidence. Does not add a linefeed character; simply
0453       appends the text as specified.
0454 
0455       @param comment is the QString containing the comment to add.
0456       @see removeComment().
0457     */
0458     void addComment(const QString &comment);
0459 
0460     /**
0461       Removes a comment from the incidence. Removes the first comment whose
0462       string is an exact match for the specified string in @p comment.
0463 
0464       @param comment is the QString containing the comment to remove.
0465       @return true if match found, false otherwise.
0466       @see addComment().
0467      */
0468     Q_REQUIRED_RESULT bool removeComment(const QString &comment);
0469 
0470     /**
0471       Deletes all incidence comments.
0472     */
0473     void clearComments();
0474 
0475     /**
0476       Returns all incidence comments as a list of strings.
0477     */
0478     Q_REQUIRED_RESULT QStringList comments() const;
0479 
0480     /**
0481       Adds a contact to thieincidence. Does not add a linefeed character; simply
0482       appends the text as specified.
0483 
0484       @param contact is the QString containing the contact to add.
0485       @see removeContact().
0486     */
0487     void addContact(const QString &contact);
0488 
0489     /**
0490       Removes a contact from the incidence. Removes the first contact whose
0491       string is an exact match for the specified string in @p contact.
0492 
0493       @param contact is the QString containing the contact to remove.
0494       @return true if match found, false otherwise.
0495       @see addContact().
0496      */
0497     Q_REQUIRED_RESULT bool removeContact(const QString &contact);
0498 
0499     /**
0500       Deletes all incidence contacts.
0501     */
0502     void clearContacts();
0503 
0504     /**
0505       Returns all incidence contacts as a list of strings.
0506     */
0507     Q_REQUIRED_RESULT QStringList contacts() const;
0508 
0509     /**
0510       Add Attendee to this incidence.
0511 
0512       @param attendee the attendee to add
0513       @param doUpdate If true the Observers are notified, if false they are not.
0514     */
0515     void addAttendee(const Attendee &attendee, bool doUpdate = true);
0516 
0517     /**
0518       Removes all attendees from the incidence.
0519     */
0520     void clearAttendees();
0521 
0522     /**
0523        Set the attendees of this incidence.
0524        This replaces all previously set attendees, unlike addAttendee.
0525 
0526        @param attendees A list of attendees.
0527        @param doUpdate If true the Observers are notified, if false they are not.
0528     */
0529     void setAttendees(const Attendee::List &attendees, bool doUpdate = true);
0530 
0531     /**
0532       Returns a list of incidence attendees.
0533       All pointers in the list are valid.
0534     */
0535     Q_REQUIRED_RESULT Attendee::List attendees() const;
0536 
0537     /**
0538       Returns the number of incidence attendees.
0539     */
0540     Q_REQUIRED_RESULT int attendeeCount() const;
0541 
0542     /**
0543       Returns the attendee with the specified email address.
0544 
0545       @param email is a QString containing an email address of the
0546       form "FirstName LastName <emailaddress>".
0547       @see attendeeByMails(), attendeesByUid().
0548     */
0549     Attendee attendeeByMail(const QString &email) const;
0550 
0551     /**
0552       Returns the first incidence attendee with one of the specified
0553       email addresses.
0554 
0555       @param emails is a list of QStrings containing email addresses of the
0556       form "FirstName LastName <emailaddress>".
0557       @param email is a QString containing a single email address to search
0558       in addition to the list specified in @p emails.
0559       @see attendeeByMail(), attendeesByUid().
0560     */
0561     Attendee attendeeByMails(const QStringList &emails, const QString &email = QString()) const;
0562 
0563     /**
0564       Returns the incidence attendee with the specified attendee @acronym UID.
0565 
0566       @param uid is a QString containing an attendee @acronym UID.
0567       @see attendeeByMail(), attendeeByMails().
0568     */
0569     Attendee attendeeByUid(const QString &uid) const;
0570 
0571     /**
0572       Sets the incidences url.
0573 
0574       This property can be used to point to a more dynamic rendition of the incidence.
0575       I.e. a website related to the incidence.
0576 
0577       @param url of the incience.
0578       @see url()
0579       @since 4.12
0580     */
0581     void setUrl(const QUrl &url);
0582 
0583     /**
0584       Returns the url.
0585       @return incidences url value
0586       @see setUrl()
0587       @since 4.12
0588     */
0589     Q_REQUIRED_RESULT QUrl url() const;
0590 
0591     /**
0592       Register observer. The observer is notified when the observed object
0593       changes.
0594 
0595       @param observer is a pointer to an IncidenceObserver object that will be
0596       watching this incidence.
0597       @see unRegisterObserver()
0598     */
0599     void registerObserver(IncidenceObserver *observer);
0600 
0601     /**
0602       Unregister observer. It isn't notified anymore about changes.
0603 
0604       @param observer is a pointer to an IncidenceObserver object that will be
0605       watching this incidence.
0606       @see registerObserver().
0607     */
0608     void unRegisterObserver(IncidenceObserver *observer);
0609 
0610     /**
0611       Call this to notify the observers after the IncidenceBase object will be
0612       changed.
0613     */
0614     void update();
0615 
0616     /**
0617       Call this to notify the observers after the IncidenceBase object has
0618       changed.
0619     */
0620     void updated();
0621 
0622     /**
0623       Call this when a group of updates is going to be made. This suppresses
0624       change notifications until endUpdates() is called, at which point
0625       updated() will automatically be called.
0626     */
0627     void startUpdates();
0628 
0629     /**
0630       Call this when a group of updates is complete, to notify observers that
0631       the instance has changed. This should be called in conjunction with
0632       startUpdates().
0633     */
0634     void endUpdates();
0635 
0636     /**
0637       Returns a date/time corresponding to the specified DateTimeRole.
0638       @param role is a DateTimeRole.
0639     */
0640     virtual QDateTime dateTime(DateTimeRole role) const = 0;
0641 
0642     /**
0643       Sets the date/time corresponding to the specified DateTimeRole.
0644       @param dateTime is QDateTime value to set.
0645       @param role is a DateTimeRole.
0646     */
0647     virtual void setDateTime(const QDateTime &dateTime, DateTimeRole role) = 0;
0648 
0649     /**
0650       Returns the Akonadi specific sub MIME type of a KCalendarCore::IncidenceBase item,
0651       e.g. getting "application/x-vnd.akonadi.calendar.event" for a KCalendarCore::Event.
0652     */
0653     virtual QLatin1String mimeType() const = 0;
0654 
0655     /**
0656       Returns the incidence recurrenceId.
0657       @return incidences recurrenceId value
0658       @see setRecurrenceId().
0659     */
0660     virtual QDateTime recurrenceId() const;
0661 
0662     /**
0663        Returns a QSet with all Fields that were changed since the incidence was created
0664        or resetDirtyFields() was called.
0665 
0666        @see resetDirtyFields()
0667     */
0668     QSet<IncidenceBase::Field> dirtyFields() const;
0669 
0670     /**
0671        Sets which fields are dirty.
0672        @see dirtyFields()
0673        @since 4.8
0674      */
0675     void setDirtyFields(const QSet<IncidenceBase::Field> &);
0676 
0677     /**
0678        Resets dirty fields.
0679        @see dirtyFields()
0680     */
0681     void resetDirtyFields();
0682 
0683     /**
0684      * Constant that identifies KCalendarCore data in a binary stream.
0685      *
0686      * @since 4.12
0687      */
0688     Q_REQUIRED_RESULT static quint32 magicSerializationIdentifier();
0689 
0690 protected:
0691     /**
0692        Marks Field @p field as dirty.
0693        @param field is the Field type to mark as dirty.
0694        @see dirtyFields()
0695     */
0696     void setFieldDirty(IncidenceBase::Field field);
0697 
0698     /**
0699       @copydoc
0700       CustomProperties::customPropertyUpdate()
0701     */
0702     void customPropertyUpdate() override;
0703 
0704     /**
0705       @copydoc
0706       CustomProperties::customPropertyUpdated()
0707     */
0708     void customPropertyUpdated() override;
0709 
0710 #if KCALENDARCORE_BUILD_DEPRECATED_SINCE(5, 91)
0711     /**
0712       Constructs an IncidenceBase as a copy of another IncidenceBase object.
0713       @param ib is the IncidenceBase to copy.
0714       @deprecated Use IncidenceBase(const IncidenceBase &ib, IncidenceBasePrivate  *p).
0715     */
0716     IncidenceBase(const IncidenceBase &ib);
0717 #else
0718     IncidenceBase(const IncidenceBase &) = delete;
0719 #endif
0720 
0721     /**
0722       Constructs an IncidenceBase as a copy of another IncidenceBase object.
0723       @param ib is the IncidenceBase to copy.
0724       @param p (non-null) a Private data object provided by the instantiated
0725       class (Event, Todo, Journal, FreeBusy).  It takes ownership of the object.
0726     */
0727     KCALENDARCORE_NO_EXPORT IncidenceBase(const IncidenceBase &ib, IncidenceBasePrivate *p);
0728 
0729     /**
0730       Provides polymorfic comparison for equality.
0731       Only called by IncidenceBase::operator==() which guarantees that
0732       @p incidenceBase is of the right type.
0733       @param incidenceBase is the IncidenceBase to compare against.
0734       @return true if the incidences are equal; false otherwise.
0735     */
0736     virtual bool equals(const IncidenceBase &incidenceBase) const;
0737 
0738     /**
0739       Provides polymorfic assignment.
0740       @param other is the IncidenceBase to assign.
0741     */
0742     virtual IncidenceBase &assign(const IncidenceBase &other);
0743 
0744     /**
0745      * Sub-type specific serialization.
0746      */
0747     virtual void serialize(QDataStream &out) const;
0748     /**
0749      * Sub-type specific deserialization.
0750      */
0751     virtual void deserialize(QDataStream &in);
0752 
0753     enum VirtualHook {};
0754 
0755     /**
0756       Standard trick to add virtuals later.
0757 
0758       @param id is any integer unique to this class which we will use to identify the method
0759              to be called.
0760       @param data is a pointer to some glob of data, typically a struct.
0761     */
0762     virtual void virtual_hook(VirtualHook id, void *data) = 0;
0763 
0764     /**
0765       Identifies a read-only incidence.
0766     */
0767     bool mReadOnly;
0768 
0769     Q_DECLARE_PRIVATE(IncidenceBase)
0770 
0771 protected:
0772     IncidenceBasePrivate *const d_ptr;
0773 
0774 private:
0775     Q_DECL_HIDDEN QVariantList attendeesVariant() const;
0776 
0777     friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::IncidenceBase::Ptr &);
0778 
0779     friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::IncidenceBase::Ptr &);
0780 };
0781 
0782 /**
0783  * Compare two QDateTimes for extended equality.
0784  *
0785  * QDateTime::operator==() in Qt 5.12 returns true if its operands represent
0786  * the same instant in time, regardless of their time zones or TimeSpecs (and
0787  * contrary to the documentation).  This function returns true if and only if
0788  * their times, time zones, and TimeSpecs are equal, or both are invalid().
0789  *
0790  * @since 5.93
0791  */
0792 KCALENDARCORE_EXPORT bool identical(QDateTime, QDateTime);
0793 
0794 /**
0795  * Incidence serializer.
0796  *
0797  * @since 4.12
0798  */
0799 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::IncidenceBase::Ptr &);
0800 
0801 /**
0802  * Incidence deserializer.
0803  *
0804  * @since 4.12
0805  */
0806 KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::IncidenceBase::Ptr &);
0807 }
0808 
0809 Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase *)
0810 Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase::Ptr)
0811 
0812 #endif