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

KDE's Doxygen guidelines are available online.