KCalendarCore

incidencebase.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <[email protected]>
5  SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <[email protected]>
6  SPDX-FileCopyrightText: 2005 Rafal Rzepecki <[email protected]>
7  SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
8  SPDX-FileContributor: Alvaro Manera <[email protected]>
9 
10  SPDX-License-Identifier: LGPL-2.0-or-later
11 */
12 /**
13  @file
14  This file is part of the API for handling calendar data and
15  defines the IncidenceBase class.
16 
17  @author Cornelius Schumacher <[email protected]>
18  @author Reinhold Kainhofer <[email protected]>
19  @author Rafal Rzepecki <[email protected]>
20 
21  @glossary @anchor incidence @b incidence:
22  General term for a calendar component.
23  Examples are events, to-dos, and journals.
24 
25  @glossary @anchor event @b event:
26  An @ref incidence that has a start and end time, typically representing some
27  occurrence of social or personal importance. May be recurring.
28  Examples are appointments, meetings, or holidays.
29 
30  @glossary @anchor to-do @b to-do:
31  An @ref incidence that has an optional start time and an optional due time
32  typically representing some undertaking to be performed. May be recurring.
33  Examples are "fix the bug" or "pay the bills".
34 
35  @glossary @anchor todo @b todo:
36  See @ref to-do.
37 
38  @glossary @anchor journal @b journal:
39  An @ref incidence with a start date that represents a diary or daily record
40  of one's activities. May @b not be recurring.
41 */
42 
43 #ifndef KCALCORE_INCIDENCEBASE_H
44 #define KCALCORE_INCIDENCEBASE_H
45 
46 #include "attendee.h"
47 #include "customproperties.h"
48 #include "duration.h"
49 #include "person.h"
50 
51 #include <QDataStream>
52 #include <QDateTime>
53 #include <QSet>
54 #include <QSharedPointer>
55 #include <QUrl>
56 
57 class QUrl;
58 class QDate;
59 class QTimeZone;
60 
61 namespace KCalendarCore
62 {
63 /** List of dates */
65 
66 /** List of times */
68 
69 class Event;
70 class Todo;
71 class Journal;
72 class FreeBusy;
73 class Visitor;
74 class IncidenceBasePrivate;
75 
76 /**
77  @brief
78  An abstract class that provides a common base for all calendar incidence
79  classes.
80 
81  define: organizer (person)
82  define: uid (same as the attendee uid?)
83 
84  Several properties are not allowed for VFREEBUSY objects (see rfc:2445),
85  so they are not in IncidenceBase. The hierarchy is:
86 
87  IncidenceBase
88  + FreeBusy
89  + Incidence
90  + Event
91  + Todo
92  + Journal
93 
94  So IncidenceBase contains all properties that are common to all classes,
95  and Incidence contains all additional properties that are common to
96  Events, Todos and Journals, but are not allowed for FreeBusy entries.
97 */
98 class KCALENDARCORE_EXPORT IncidenceBase : public CustomProperties
99 {
100  Q_GADGET
101  Q_PROPERTY(QString uid READ uid WRITE setUid)
102  Q_PROPERTY(QDateTime lastModified READ lastModified WRITE setLastModified)
103  Q_PROPERTY(QDateTime dtStart READ dtStart WRITE setDtStart)
104  Q_PROPERTY(bool allDay READ allDay WRITE setAllDay)
105  Q_PROPERTY(KCalendarCore::Person organizer READ organizer WRITE setOrganizer)
106  Q_PROPERTY(QVariantList attendees READ attendeesVariant)
107  Q_PROPERTY(QUrl url READ url WRITE setUrl)
108 
109 public:
110  /**
111  A shared pointer to an IncidenceBase.
112  */
114 
115  /**
116  The different types of incidences, per RFC2445.
117  @see type(), typeStr()
118  */
120  TypeEvent = 0, /**< Type is an event */
121  TypeTodo, /**< Type is a to-do */
122  TypeJournal, /**< Type is a journal */
123  TypeFreeBusy, /**< Type is a free/busy */
124  TypeUnknown, /**< Type unknown */
125  };
126 
127  /**
128  The different types of incidence date/times roles.
129  @see dateTime()
130  */
132  RoleAlarmStartOffset = 0, /**< Role for an incidence alarm's starting offset date/time */
133  RoleAlarmEndOffset, /**< Role for an incidence alarm's ending offset date/time */
134  RoleSort, /**< Role for an incidence's date/time used when sorting */
135  RoleCalendarHashing, /**< Role for looking up an incidence in a Calendar */
136  RoleStartTimeZone, /**< Role for determining an incidence's starting timezone */
137  RoleEndTimeZone, /**< Role for determining an incidence's ending timezone */
138  RoleEndRecurrenceBase,
139  RoleEnd, /**< Role for determining an incidence's dtEnd, will return
140  an invalid QDateTime if the incidence does not support dtEnd */
141  RoleDisplayEnd, /**< Role used for display purposes, represents the end boundary
142  if an incidence supports dtEnd */
143  RoleAlarm, /**< Role for determining the date/time of the first alarm.
144  Returns invalid time if the incidence doesn't have any alarm */
145  RoleRecurrenceStart, /**< Role for determining the start of the recurrence.
146  Currently that's DTSTART for an event and DTDUE for a to-do.
147  (NOTE: If the incidence is a to-do, recurrence should be
148  calculated having DTSTART for a reference, not DT-DUE.
149  This is one place KCalendarCore isn't compliant with RFC2445) */
150  RoleDisplayStart, /**< Role for display purposes, represents the start boundary of an
151  incidence. To-dos return dtDue here, for historical reasons */
152  RoleDnD, /**< Role for determining new start and end dates after a DnD */
153  };
154 
155  /**
156  The different types of incidence fields.
157  */
158  enum Field {
159  FieldDtStart, ///< Field representing the DTSTART component.
160  FieldDtEnd, ///< Field representing the DTEND component.
161  FieldLastModified, ///< Field representing the LAST-MODIFIED component.
162  FieldDescription, ///< Field representing the DESCRIPTION component.
163  FieldSummary, ///< Field representing the SUMMARY component.
164  FieldLocation, ///< Field representing the LOCATION component.
165  FieldCompleted, ///< Field representing the COMPLETED component.
166  FieldPercentComplete, ///< Field representing the PERCENT-COMPLETE component.
167  FieldDtDue, ///< Field representing the DUE component.
168  FieldCategories, ///< Field representing the CATEGORIES component.
169  FieldRelatedTo, ///< Field representing the RELATED-TO component.
170  FieldRecurrence, ///< Field representing the EXDATE, EXRULE, RDATE, and RRULE components.
171  FieldAttachment, ///< Field representing the ATTACH component.
172  FieldSecrecy, ///< Field representing the CLASS component.
173  FieldStatus, ///< Field representing the STATUS component.
174  FieldTransparency, ///< Field representing the TRANSPARENCY component.
175  FieldResources, ///< Field representing the RESOURCES component.
176  FieldPriority, ///< Field representing the PRIORITY component.
177  FieldGeoLatitude, ///< Field representing the latitude part of the GEO component.
178  FieldGeoLongitude, ///< Field representing the longitude part of the GEO component.
179  FieldRecurrenceId, ///< Field representing the RECURRENCE-ID component.
180  FieldAlarms, ///< Field representing the VALARM component.
181  FieldSchedulingId, ///< Field representing the X-KDE-LIBKCAL-ID component.
182  FieldAttendees, ///< Field representing the ATTENDEE component.
183  FieldOrganizer, ///< Field representing the ORGANIZER component.
184  FieldCreated, ///< Field representing the CREATED component.
185  FieldRevision, ///< Field representing the SEQUENCE component.
186  FieldDuration, ///< Field representing the DURATION component.
187  FieldContact, ///< Field representing the CONTACT component.
188  FieldComment, ///< Field representing the COMMENT component.
189  FieldUid, ///< Field representing the UID component.
190  FieldUnknown, ///< Something changed. Always set when you use the assignment operator.
191  FieldUrl, ///< Field representing the URL component.
192  FieldConferences, ///< Field representing the CONFERENCE component.
193  FieldColor, ///< Field representing the COLOR component.
194  };
195 
196  /**
197  The IncidenceObserver class.
198  */
199  class KCALENDARCORE_EXPORT IncidenceObserver
200  {
201  public:
202  /**
203  Destroys the IncidenceObserver.
204  */
205  virtual ~IncidenceObserver();
206 
207  /**
208  The IncidenceObserver interface.
209  This function is called before any changes are made.
210  @param uid is the string containing the incidence @ref uid.
211  @param recurrenceId is possible recurrenceid of incidence.
212  */
213  virtual void incidenceUpdate(const QString &uid, const QDateTime &recurrenceId) = 0;
214 
215  /**
216  The IncidenceObserver interface.
217  This function is called after changes are completed.
218  @param uid is the string containing the incidence @ref uid.
219  @param recurrenceId is possible recurrenceid of incidence.
220  */
221  virtual void incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) = 0;
222  };
223 
224 #if KCALENDARCORE_BUILD_DEPRECATED_SINCE(5, 91)
225  /**
226  Constructs an empty IncidenceBase.
227  @deprecated Use IncidenceBase(IncidenceBasePrivate *p).
228  */
229  KCALENDARCORE_DEPRECATED_VERSION(5, 91, "Do not use")
230  IncidenceBase();
231 #else
232  IncidenceBase() = delete;
233 #endif
234 
235  /**
236  Constructs an empty IncidenceBase.
237  @param p (non-null) a Private data object provided by the instantiated
238  class (Event, Todo, Journal, FreeBusy). It takes ownership of the object.
239  */
240  KCALENDARCORE_NO_EXPORT explicit IncidenceBase(IncidenceBasePrivate *p);
241 
242  /**
243  Destroys the IncidenceBase.
244  */
245  ~IncidenceBase() override;
246 
247  /**
248  Assignment operator.
249  All data belonging to derived classes are also copied. @see assign().
250  The caller guarantees that both types match.
251 
252  @code
253  if ( i1.type() == i2.type() ) {
254  i1 = i2;
255  } else {
256  qCDebug(KCALCORE_LOG) << "Invalid assignment!";
257  }
258  @endcode
259 
260  Dirty field FieldUnknown will be set.
261 
262  @param other is the IncidenceBase to assign.
263  */
264  IncidenceBase &operator=(const IncidenceBase &other);
265 
266  /**
267  Compares this with IncidenceBase @p ib for equality.
268  All data belonging to derived classes are also compared. @see equals().
269  @param ib is the IncidenceBase to compare against.
270  @return true if the incidences are equal; false otherwise.
271  */
272  bool operator==(const IncidenceBase &ib) const;
273 
274  /**
275  Compares this with IncidenceBase @p ib for inequality.
276  @param ib is the IncidenceBase to compare against.
277  @return true if the incidences are /not/ equal; false otherwise.
278  */
279  bool operator!=(const IncidenceBase &ib) const;
280 
281  /**
282  Accept IncidenceVisitor. A class taking part in the visitor mechanism
283  has to provide this implementation:
284  <pre>
285  bool accept(Visitor &v) { return v.visit(this); }
286  </pre>
287 
288  @param v is a reference to a Visitor object.
289  @param incidence is a valid IncidenceBase object for visiting.
290  */
291  virtual bool accept(Visitor &v, const IncidenceBase::Ptr &incidence);
292 
293  /**
294  Returns the incidence type.
295  */
296  virtual IncidenceType type() const = 0;
297 
298  /**
299  Prints the type of incidence as a string.
300  */
301  virtual QByteArray typeStr() const = 0;
302 
303  /**
304  Sets the unique id for the incidence to @p uid.
305  @param uid is the string containing the incidence @ref uid.
306  @see uid()
307  */
308  void setUid(const QString &uid);
309 
310  /**
311  Returns the unique id (@ref uid) for the incidence.
312  @see setUid()
313  */
314  Q_REQUIRED_RESULT QString uid() const;
315 
316  /**
317  Returns the uri for the incidence, of form urn:x-ical:<uid>
318  */
319  Q_REQUIRED_RESULT QUrl uri() const;
320 
321  /**
322  Sets the time the incidence was last modified to @p lm.
323  It is stored as a UTC date/time.
324 
325  @param lm is the QDateTime when the incidence was last modified.
326 
327  @see lastModified()
328  */
329  virtual void setLastModified(const QDateTime &lm);
330 
331  /**
332  Returns the time the incidence was last modified.
333  @see setLastModified()
334  */
335  Q_REQUIRED_RESULT QDateTime lastModified() const;
336 
337  /**
338  Sets the organizer for the incidence.
339 
340  @param organizer is a non-null Person to use as the incidence @ref organizer.
341  @see organizer(), setOrganizer(const QString &)
342  */
343  void setOrganizer(const Person &organizer);
344 
345  /**
346  Sets the incidence organizer to any string @p organizer.
347 
348  @param organizer is a string to use as the incidence @ref organizer.
349  @see organizer(), setOrganizer(const Person &)
350  */
351  void setOrganizer(const QString &organizer);
352 
353  /**
354  Returns the Person associated with this incidence.
355  If no Person was set through setOrganizer(), a default Person()
356  is returned.
357  @see setOrganizer(const QString &), setOrganizer(const Person &)
358  */
359  Person organizer() const;
360 
361  /**
362  Sets readonly status.
363 
364  @param readOnly if set, the incidence is read-only; else the incidence
365  can be modified.
366  @see isReadOnly().
367  */
368  virtual void setReadOnly(bool readOnly);
369 
370  /**
371  Returns true the object is read-only; false otherwise.
372  @see setReadOnly()
373  */
374  Q_REQUIRED_RESULT bool isReadOnly() const;
375 
376  /**
377  Sets the incidence's starting date/time with a QDateTime.
378 
379  @param dtStart is the incidence start date/time.
380  @see dtStart().
381  */
382  virtual void setDtStart(const QDateTime &dtStart);
383 
384  /**
385  Returns an incidence's starting date/time as a QDateTime.
386  @see setDtStart().
387  */
388  virtual QDateTime dtStart() const;
389 
390  /**
391  Sets the incidence duration.
392 
393  @param duration the incidence duration
394 
395  @see duration()
396  */
397  virtual void setDuration(const Duration &duration);
398 
399  /**
400  Returns the length of the incidence duration.
401  @see setDuration()
402  */
403  Q_REQUIRED_RESULT Duration duration() const;
404 
405  /**
406  Sets if the incidence has a duration.
407  @param hasDuration true if the incidence has a duration; false otherwise.
408  @see hasDuration()
409  */
410  void setHasDuration(bool hasDuration);
411 
412  /**
413  Returns true if the incidence has a duration; false otherwise.
414  @see setHasDuration()
415  */
416  Q_REQUIRED_RESULT bool hasDuration() const;
417 
418  /**
419  Returns true or false depending on whether the incidence is all-day.
420  i.e. has a date but no time attached to it.
421  @see setAllDay()
422  */
423  Q_REQUIRED_RESULT bool allDay() const;
424 
425  /**
426  Sets whether the incidence is all-day, i.e. has a date but no time
427  attached to it.
428 
429  @param allDay sets whether the incidence is all-day.
430 
431  @see allDay()
432  */
433  virtual void setAllDay(bool allDay);
434 
435  /**
436  Shift the times of the incidence so that they appear at the same clock
437  time as before but in a new time zone. The shift is done from a viewing
438  time zone rather than from the actual incidence time zone.
439 
440  For example, shifting an incidence whose start time is 09:00
441  America/New York, using an old viewing time zone (@p oldSpec)
442  of Europe/London, to a new time zone (@p newSpec) of Europe/Paris,
443  will result in the time being shifted from 14:00 (which is the London
444  time of the incidence start) to 14:00 Paris time.
445 
446  @param oldZone the time zone which provides the clock times
447  @param newZone the new time zone
448  */
449  virtual void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone);
450 
451  /**
452  Adds a comment to the incidence. Does not add a linefeed character; simply
453  appends the text as specified.
454 
455  @param comment is the QString containing the comment to add.
456  @see removeComment().
457  */
458  void addComment(const QString &comment);
459 
460  /**
461  Removes a comment from the incidence. Removes the first comment whose
462  string is an exact match for the specified string in @p comment.
463 
464  @param comment is the QString containing the comment to remove.
465  @return true if match found, false otherwise.
466  @see addComment().
467  */
468  Q_REQUIRED_RESULT bool removeComment(const QString &comment);
469 
470  /**
471  Deletes all incidence comments.
472  */
473  void clearComments();
474 
475  /**
476  Returns all incidence comments as a list of strings.
477  */
478  Q_REQUIRED_RESULT QStringList comments() const;
479 
480  /**
481  Adds a contact to thieincidence. Does not add a linefeed character; simply
482  appends the text as specified.
483 
484  @param contact is the QString containing the contact to add.
485  @see removeContact().
486  */
487  void addContact(const QString &contact);
488 
489  /**
490  Removes a contact from the incidence. Removes the first contact whose
491  string is an exact match for the specified string in @p contact.
492 
493  @param contact is the QString containing the contact to remove.
494  @return true if match found, false otherwise.
495  @see addContact().
496  */
497  Q_REQUIRED_RESULT bool removeContact(const QString &contact);
498 
499  /**
500  Deletes all incidence contacts.
501  */
502  void clearContacts();
503 
504  /**
505  Returns all incidence contacts as a list of strings.
506  */
507  Q_REQUIRED_RESULT QStringList contacts() const;
508 
509  /**
510  Add Attendee to this incidence.
511 
512  @param attendee the attendee to add
513  @param doUpdate If true the Observers are notified, if false they are not.
514  */
515  void addAttendee(const Attendee &attendee, bool doUpdate = true);
516 
517  /**
518  Removes all attendees from the incidence.
519  */
520  void clearAttendees();
521 
522  /**
523  Set the attendees of this incidence.
524  This replaces all previously set attendees, unlike addAttendee.
525 
526  @param attendees A list of attendees.
527  @param doUpdate If true the Observers are notified, if false they are not.
528  */
529  void setAttendees(const Attendee::List &attendees, bool doUpdate = true);
530 
531  /**
532  Returns a list of incidence attendees.
533  All pointers in the list are valid.
534  */
535  Q_REQUIRED_RESULT Attendee::List attendees() const;
536 
537  /**
538  Returns the number of incidence attendees.
539  */
540  Q_REQUIRED_RESULT int attendeeCount() const;
541 
542  /**
543  Returns the attendee with the specified email address.
544 
545  @param email is a QString containing an email address of the
546  form "FirstName LastName <emailaddress>".
547  @see attendeeByMails(), attendeesByUid().
548  */
549  Attendee attendeeByMail(const QString &email) const;
550 
551  /**
552  Returns the first incidence attendee with one of the specified
553  email addresses.
554 
555  @param emails is a list of QStrings containing email addresses of the
556  form "FirstName LastName <emailaddress>".
557  @param email is a QString containing a single email address to search
558  in addition to the list specified in @p emails.
559  @see attendeeByMail(), attendeesByUid().
560  */
561  Attendee attendeeByMails(const QStringList &emails, const QString &email = QString()) const;
562 
563  /**
564  Returns the incidence attendee with the specified attendee @acronym UID.
565 
566  @param uid is a QString containing an attendee @acronym UID.
567  @see attendeeByMail(), attendeeByMails().
568  */
569  Attendee attendeeByUid(const QString &uid) const;
570 
571  /**
572  Sets the incidences url.
573 
574  This property can be used to point to a more dynamic rendition of the incidence.
575  I.e. a website related to the incidence.
576 
577  @param url of the incience.
578  @see url()
579  @since 4.12
580  */
581  void setUrl(const QUrl &url);
582 
583  /**
584  Returns the url.
585  @return incidences url value
586  @see setUrl()
587  @since 4.12
588  */
589  Q_REQUIRED_RESULT QUrl url() const;
590 
591  /**
592  Register observer. The observer is notified when the observed object
593  changes.
594 
595  @param observer is a pointer to an IncidenceObserver object that will be
596  watching this incidence.
597  @see unRegisterObserver()
598  */
599  void registerObserver(IncidenceObserver *observer);
600 
601  /**
602  Unregister observer. It isn't notified anymore about changes.
603 
604  @param observer is a pointer to an IncidenceObserver object that will be
605  watching this incidence.
606  @see registerObserver().
607  */
608  void unRegisterObserver(IncidenceObserver *observer);
609 
610  /**
611  Call this to notify the observers after the IncidenceBase object will be
612  changed.
613  */
614  void update();
615 
616  /**
617  Call this to notify the observers after the IncidenceBase object has
618  changed.
619  */
620  void updated();
621 
622  /**
623  Call this when a group of updates is going to be made. This suppresses
624  change notifications until endUpdates() is called, at which point
625  updated() will automatically be called.
626  */
627  void startUpdates();
628 
629  /**
630  Call this when a group of updates is complete, to notify observers that
631  the instance has changed. This should be called in conjunction with
632  startUpdates().
633  */
634  void endUpdates();
635 
636  /**
637  Returns a date/time corresponding to the specified DateTimeRole.
638  @param role is a DateTimeRole.
639  */
640  virtual QDateTime dateTime(DateTimeRole role) const = 0;
641 
642  /**
643  Sets the date/time corresponding to the specified DateTimeRole.
644  @param dateTime is QDateTime value to set.
645  @param role is a DateTimeRole.
646  */
647  virtual void setDateTime(const QDateTime &dateTime, DateTimeRole role) = 0;
648 
649  /**
650  Returns the Akonadi specific sub MIME type of a KCalendarCore::IncidenceBase item,
651  e.g. getting "application/x-vnd.akonadi.calendar.event" for a KCalendarCore::Event.
652  */
653  virtual QLatin1String mimeType() const = 0;
654 
655  /**
656  Returns the incidence recurrenceId.
657  @return incidences recurrenceId value
658  @see setRecurrenceId().
659  */
660  virtual QDateTime recurrenceId() const;
661 
662  /**
663  Returns a QSet with all Fields that were changed since the incidence was created
664  or resetDirtyFields() was called.
665 
666  @see resetDirtyFields()
667  */
668  QSet<IncidenceBase::Field> dirtyFields() const;
669 
670  /**
671  Sets which fields are dirty.
672  @see dirtyFields()
673  @since 4.8
674  */
675  void setDirtyFields(const QSet<IncidenceBase::Field> &);
676 
677  /**
678  Resets dirty fields.
679  @see dirtyFields()
680  */
681  void resetDirtyFields();
682 
683  /**
684  * Constant that identifies KCalendarCore data in a binary stream.
685  *
686  * @since 4.12
687  */
688  Q_REQUIRED_RESULT static quint32 magicSerializationIdentifier();
689 
690 protected:
691  /**
692  Marks Field @p field as dirty.
693  @param field is the Field type to mark as dirty.
694  @see dirtyFields()
695  */
696  void setFieldDirty(IncidenceBase::Field field);
697 
698  /**
699  @copydoc
700  CustomProperties::customPropertyUpdate()
701  */
702  void customPropertyUpdate() override;
703 
704  /**
705  @copydoc
706  CustomProperties::customPropertyUpdated()
707  */
708  void customPropertyUpdated() override;
709 
710 #if KCALENDARCORE_BUILD_DEPRECATED_SINCE(5, 91)
711  /**
712  Constructs an IncidenceBase as a copy of another IncidenceBase object.
713  @param ib is the IncidenceBase to copy.
714  @deprecated Use IncidenceBase(const IncidenceBase &ib, IncidenceBasePrivate *p).
715  */
716  IncidenceBase(const IncidenceBase &ib);
717 #else
718  IncidenceBase(const IncidenceBase &) = delete;
719 #endif
720 
721  /**
722  Constructs an IncidenceBase as a copy of another IncidenceBase object.
723  @param ib is the IncidenceBase to copy.
724  @param p (non-null) a Private data object provided by the instantiated
725  class (Event, Todo, Journal, FreeBusy). It takes ownership of the object.
726  */
727  KCALENDARCORE_NO_EXPORT IncidenceBase(const IncidenceBase &ib, IncidenceBasePrivate *p);
728 
729  /**
730  Provides polymorfic comparison for equality.
731  Only called by IncidenceBase::operator==() which guarantees that
732  @p incidenceBase is of the right type.
733  @param incidenceBase is the IncidenceBase to compare against.
734  @return true if the incidences are equal; false otherwise.
735  */
736  virtual bool equals(const IncidenceBase &incidenceBase) const;
737 
738  /**
739  Provides polymorfic assignment.
740  @param other is the IncidenceBase to assign.
741  */
742  virtual IncidenceBase &assign(const IncidenceBase &other);
743 
744  /**
745  * Sub-type specific serialization.
746  */
747  virtual void serialize(QDataStream &out) const;
748  /**
749  * Sub-type specific deserialization.
750  */
751  virtual void deserialize(QDataStream &in);
752 
753  enum VirtualHook {};
754 
755  /**
756  Standard trick to add virtuals later.
757 
758  @param id is any integer unique to this class which we will use to identify the method
759  to be called.
760  @param data is a pointer to some glob of data, typically a struct.
761  */
762  virtual void virtual_hook(VirtualHook id, void *data) = 0;
763 
764  /**
765  Identifies a read-only incidence.
766  */
767  bool mReadOnly;
768 
769  Q_DECLARE_PRIVATE(IncidenceBase)
770 
771 protected:
772  IncidenceBasePrivate *const d_ptr;
773 
774 private:
775  Q_DECL_HIDDEN QVariantList attendeesVariant() const;
776 
777  friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::IncidenceBase::Ptr &);
778 
779  friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::IncidenceBase::Ptr &);
780 };
781 
782 /**
783  * Compare two QDateTimes for extended equality.
784  *
785  * QDateTime::operator==() in Qt 5.12 returns true if its operands represent
786  * the same instant in time, regardless of their time zones or TimeSpecs (and
787  * contrary to the documentation). This function returns true if and only if
788  * their times, time zones, and TimeSpecs are equal, or both are invalid().
789  *
790  * @since 5.93
791  */
792 KCALENDARCORE_EXPORT bool identical(QDateTime, QDateTime);
793 
794 /**
795  * Incidence serializer.
796  *
797  * @since 4.12
798  */
799 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::IncidenceBase::Ptr &);
800 
801 /**
802  * Incidence deserializer.
803  *
804  * @since 4.12
805  */
807 }
808 
809 Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase *)
810 Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase::Ptr)
811 
812 #endif
@ FieldDtDue
Field representing the DUE component.
@ FieldGeoLongitude
Field representing the longitude part of the GEO component.
@ FieldTransparency
Field representing the TRANSPARENCY component.
@ FieldGeoLatitude
Field representing the latitude part of the GEO component.
@ FieldUrl
Field representing the URL component.
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:820
@ FieldSecrecy
Field representing the CLASS component.
Represents a span of time measured in seconds or days.
Definition: duration.h:43
Represents information related to an attendee of an Calendar Incidence, typically a meeting or task (...
Definition: attendee.h:44
DateTimeRole
The different types of incidence date/times roles.
@ FieldCategories
Field representing the CATEGORIES component.
@ RoleStartTimeZone
Role for determining an incidence's starting timezone.
@ FieldStatus
Field representing the STATUS component.
@ FieldPercentComplete
Field representing the PERCENT-COMPLETE component.
Namespace for all KCalendarCore types.
Definition: alarm.h:36
@ FieldComment
Field representing the COMMENT component.
@ FieldAttachment
Field representing the ATTACH component.
KCALENDARCORE_EXPORT bool identical(QDateTime, QDateTime)
Compare two QDateTimes for extended equality.
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:833
@ FieldConferences
Field representing the CONFERENCE component.
@ RoleSort
Role for an incidence's date/time used when sorting.
@ FieldSchedulingId
Field representing the X-KDE-LIBKCAL-ID component.
@ TypeTodo
Type is a to-do.
@ FieldColor
Field representing the COLOR component.
Provides a Journal in the sense of RFC2445.
Definition: journal.h:32
@ FieldCreated
Field representing the CREATED component.
@ FieldDescription
Field representing the DESCRIPTION component.
@ FieldPriority
Field representing the PRIORITY component.
An abstract class that provides a common base for all calendar incidence classes.
Definition: incidencebase.h:98
Provides a To-do in the sense of RFC2445.
Definition: todo.h:33
@ FieldCompleted
Field representing the COMPLETED component.
@ FieldRevision
Field representing the SEQUENCE component.
Field
The different types of incidence fields.
@ FieldRelatedTo
Field representing the RELATED-TO component.
@ FieldDuration
Field representing the DURATION component.
Provides information about the free/busy time of a calendar.
Definition: freebusy.h:42
@ FieldRecurrence
Field representing the EXDATE, EXRULE, RDATE, and RRULE components.
QSharedPointer< IncidenceBase > Ptr
A shared pointer to an IncidenceBase.
@ FieldUid
Field representing the UID component.
@ RoleCalendarHashing
Role for looking up an incidence in a Calendar.
This class provides the interface for a visitor of calendar components.
Definition: visitor.h:30
@ FieldLastModified
Field representing the LAST-MODIFIED component.
@ FieldAlarms
Field representing the VALARM component.
@ FieldSummary
Field representing the SUMMARY component.
IncidenceType
The different types of incidences, per RFC2445.
@ FieldRecurrenceId
Field representing the RECURRENCE-ID component.
@ FieldAttendees
Field representing the ATTENDEE component.
@ RoleEndTimeZone
Role for determining an incidence's ending timezone.
@ TypeFreeBusy
Type is a free/busy.
@ FieldUnknown
Something changed. Always set when you use the assignment operator.
QList< QDate > DateList
List of dates.
Definition: incidencebase.h:64
@ TypeJournal
Type is a journal.
@ FieldResources
Field representing the RESOURCES component.
@ RoleDnD
Role for determining new start and end dates after a DnD.
@ FieldOrganizer
Field representing the ORGANIZER component.
Represents a person, by name and email address.
Definition: person.h:37
@ RoleAlarmEndOffset
Role for an incidence alarm's ending offset date/time.
@ FieldContact
Field representing the CONTACT component.
bool mReadOnly
Identifies a read-only incidence.
QList< QDateTime > DateTimeList
List of times.
Definition: incidencebase.h:67
A class to manage custom calendar properties.
@ FieldDtEnd
Field representing the DTEND component.
@ FieldDtStart
Field representing the DTSTART component.
This class provides an Event in the sense of RFC2445.
Definition: event.h:32
@ FieldLocation
Field representing the LOCATION component.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Sep 27 2023 03:57:32 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.