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 <schumacher@kde.org>
5 SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
7 SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
8 SPDX-FileContributor: Alvaro Manera <alvaro.manera@nokia.com>
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 <schumacher@kde.org>
18 @author Reinhold Kainhofer <reinhold@kainhofer.com>
19 @author Rafal Rzepecki <divide@users.sourceforge.net>
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
57class QUrl;
58class QDate;
59class QTimeZone;
60
61namespace KCalendarCore
62{
63/** List of dates */
65
66/** List of times */
68
69class Event;
70class Todo;
71class Journal;
72class FreeBusy;
73class Visitor;
74class 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*/
98class 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(QList<KCalendarCore::Attendee> attendees READ attendees)
107 Q_PROPERTY(QUrl url READ url WRITE setUrl)
108
109public:
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 IncidenceBase() = delete;
225
226 /**
227 Constructs an empty IncidenceBase.
228 @param p (non-null) a Private data object provided by the instantiated
229 class (Event, Todo, Journal, FreeBusy). It takes ownership of the object.
230 */
231 KCALENDARCORE_NO_EXPORT explicit IncidenceBase(IncidenceBasePrivate *p);
232
233 /**
234 Destroys the IncidenceBase.
235 */
236 ~IncidenceBase() override;
237
238 /**
239 Assignment operator.
240 All data belonging to derived classes are also copied. @see assign().
241 The caller guarantees that both types match.
242
243 @code
244 if ( i1.type() == i2.type() ) {
245 i1 = i2;
246 } else {
247 qCDebug(KCALCORE_LOG) << "Invalid assignment!";
248 }
249 @endcode
250
251 Dirty field FieldUnknown will be set.
252
253 @param other is the IncidenceBase to assign.
254 */
255 IncidenceBase &operator=(const IncidenceBase &other);
256
257 /**
258 Compares this with IncidenceBase @p ib for equality.
259 All data belonging to derived classes are also compared. @see equals().
260 @param ib is the IncidenceBase to compare against.
261 @return true if the incidences are equal; false otherwise.
262 */
263 bool operator==(const IncidenceBase &ib) const;
264
265 /**
266 Compares this with IncidenceBase @p ib for inequality.
267 @param ib is the IncidenceBase to compare against.
268 @return true if the incidences are /not/ equal; false otherwise.
269 */
270 bool operator!=(const IncidenceBase &ib) const;
271
272 /**
273 Accept IncidenceVisitor. A class taking part in the visitor mechanism
274 has to provide this implementation:
275 <pre>
276 bool accept(Visitor &v) { return v.visit(this); }
277 </pre>
278
279 @param v is a reference to a Visitor object.
280 @param incidence is a valid IncidenceBase object for visiting.
281 */
282 virtual bool accept(Visitor &v, const IncidenceBase::Ptr &incidence);
283
284 /**
285 Returns the incidence type.
286 */
287 virtual IncidenceType type() const = 0;
288
289 /**
290 Prints the type of incidence as a string.
291 */
292 virtual QByteArray typeStr() const = 0;
293
294 /**
295 Sets the unique id for the incidence to @p uid.
296 @param uid is the string containing the incidence @ref uid.
297 @see uid()
298 */
299 void setUid(const QString &uid);
300
301 /**
302 Returns the unique id (@ref uid) for the incidence.
303 @see setUid()
304 */
305 Q_REQUIRED_RESULT QString uid() const;
306
307 /**
308 Returns the uri for the incidence, of form urn:x-ical:<uid>
309 */
310 Q_REQUIRED_RESULT QUrl uri() const;
311
312 /**
313 Sets the time the incidence was last modified to @p lm.
314 It is stored as a UTC date/time.
315
316 @param lm is the QDateTime when the incidence was last modified.
317
318 @see lastModified()
319 */
320 virtual void setLastModified(const QDateTime &lm);
321
322 /**
323 Returns the time the incidence was last modified.
324 @see setLastModified()
325 */
326 Q_REQUIRED_RESULT QDateTime lastModified() const;
327
328 /**
329 Sets the organizer for the incidence.
330
331 @param organizer is a non-null Person to use as the incidence @ref organizer.
332 @see organizer(), setOrganizer(const QString &)
333 */
334 void setOrganizer(const Person &organizer);
335
336 /**
337 Sets the incidence organizer to any string @p organizer.
338
339 @param organizer is a string to use as the incidence @ref organizer.
340 @see organizer(), setOrganizer(const Person &)
341 */
342 void setOrganizer(const QString &organizer);
343
344 /**
345 Returns the Person associated with this incidence.
346 If no Person was set through setOrganizer(), a default Person()
347 is returned.
348 @see setOrganizer(const QString &), setOrganizer(const Person &)
349 */
350 Person organizer() const;
351
352 /**
353 Sets readonly status.
354
355 @param readOnly if set, the incidence is read-only; else the incidence
356 can be modified.
357 @see isReadOnly().
358 */
359 virtual void setReadOnly(bool readOnly);
360
361 /**
362 Returns true the object is read-only; false otherwise.
363 @see setReadOnly()
364 */
365 Q_REQUIRED_RESULT bool isReadOnly() const;
366
367 /**
368 Sets the incidence's starting date/time with a QDateTime.
369
370 @param dtStart is the incidence start date/time.
371 @see dtStart().
372 */
373 virtual void setDtStart(const QDateTime &dtStart);
374
375 /**
376 Returns an incidence's starting date/time as a QDateTime.
377 @see setDtStart().
378 */
379 virtual QDateTime dtStart() const;
380
381 /**
382 Sets the incidence duration.
383
384 @param duration the incidence duration
385
386 @see duration()
387 */
388 virtual void setDuration(const Duration &duration);
389
390 /**
391 Returns the length of the incidence duration.
392 @see setDuration()
393 */
394 Q_REQUIRED_RESULT Duration duration() const;
395
396 /**
397 Sets if the incidence has a duration.
398 @param hasDuration true if the incidence has a duration; false otherwise.
399 @see hasDuration()
400 */
401 void setHasDuration(bool hasDuration);
402
403 /**
404 Returns true if the incidence has a duration; false otherwise.
405 @see setHasDuration()
406 */
407 Q_REQUIRED_RESULT bool hasDuration() const;
408
409 /**
410 Returns true or false depending on whether the incidence is all-day.
411 i.e. has a date but no time attached to it.
412 @see setAllDay()
413 */
414 Q_REQUIRED_RESULT bool allDay() const;
415
416 /**
417 Sets whether the incidence is all-day, i.e. has a date but no time
418 attached to it.
419
420 @param allDay sets whether the incidence is all-day.
421
422 @see allDay()
423 */
424 virtual void setAllDay(bool allDay);
425
426 /**
427 Shift the times of the incidence so that they appear at the same clock
428 time as before but in a new time zone. The shift is done from a viewing
429 time zone rather than from the actual incidence time zone.
430
431 For example, shifting an incidence whose start time is 09:00
432 America/New York, using an old viewing time zone (@p oldSpec)
433 of Europe/London, to a new time zone (@p newSpec) of Europe/Paris,
434 will result in the time being shifted from 14:00 (which is the London
435 time of the incidence start) to 14:00 Paris time.
436
437 @param oldZone the time zone which provides the clock times
438 @param newZone the new time zone
439 */
440 virtual void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone);
441
442 /**
443 Adds a comment to the incidence. Does not add a linefeed character; simply
444 appends the text as specified.
445
446 @param comment is the QString containing the comment to add.
447 @see removeComment().
448 */
449 void addComment(const QString &comment);
450
451 /**
452 Removes a comment from the incidence. Removes the first comment whose
453 string is an exact match for the specified string in @p comment.
454
455 @param comment is the QString containing the comment to remove.
456 @return true if match found, false otherwise.
457 @see addComment().
458 */
459 Q_REQUIRED_RESULT bool removeComment(const QString &comment);
460
461 /**
462 Deletes all incidence comments.
463 */
464 void clearComments();
465
466 /**
467 Returns all incidence comments as a list of strings.
468 */
469 Q_REQUIRED_RESULT QStringList comments() const;
470
471 /**
472 Adds a contact to thieincidence. Does not add a linefeed character; simply
473 appends the text as specified.
474
475 @param contact is the QString containing the contact to add.
476 @see removeContact().
477 */
478 void addContact(const QString &contact);
479
480 /**
481 Removes a contact from the incidence. Removes the first contact whose
482 string is an exact match for the specified string in @p contact.
483
484 @param contact is the QString containing the contact to remove.
485 @return true if match found, false otherwise.
486 @see addContact().
487 */
488 Q_REQUIRED_RESULT bool removeContact(const QString &contact);
489
490 /**
491 Deletes all incidence contacts.
492 */
493 void clearContacts();
494
495 /**
496 Returns all incidence contacts as a list of strings.
497 */
498 Q_REQUIRED_RESULT QStringList contacts() const;
499
500 /**
501 Add Attendee to this incidence.
502
503 @param attendee the attendee to add
504 @param doUpdate If true the Observers are notified, if false they are not.
505 */
506 void addAttendee(const Attendee &attendee, bool doUpdate = true);
507
508 /**
509 Removes all attendees from the incidence.
510 */
511 void clearAttendees();
512
513 /**
514 Set the attendees of this incidence.
515 This replaces all previously set attendees, unlike addAttendee.
516
517 @param attendees A list of attendees.
518 @param doUpdate If true the Observers are notified, if false they are not.
519 */
520 void setAttendees(const Attendee::List &attendees, bool doUpdate = true);
521
522 /**
523 Returns a list of incidence attendees.
524 All pointers in the list are valid.
525 */
526 Q_REQUIRED_RESULT Attendee::List attendees() const;
527
528 /**
529 Returns the number of incidence attendees.
530 */
531 Q_REQUIRED_RESULT int attendeeCount() const;
532
533 /**
534 Returns the attendee with the specified email address.
535
536 @param email is a QString containing an email address of the
537 form "FirstName LastName <emailaddress>".
538 @see attendeeByMails(), attendeesByUid().
539 */
540 Attendee attendeeByMail(const QString &email) const;
541
542 /**
543 Returns the first incidence attendee with one of the specified
544 email addresses.
545
546 @param emails is a list of QStrings containing email addresses of the
547 form "FirstName LastName <emailaddress>".
548 @param email is a QString containing a single email address to search
549 in addition to the list specified in @p emails.
550 @see attendeeByMail(), attendeesByUid().
551 */
552 Attendee attendeeByMails(const QStringList &emails, const QString &email = QString()) const;
553
554 /**
555 Returns the incidence attendee with the specified attendee @acronym UID.
556
557 @param uid is a QString containing an attendee @acronym UID.
558 @see attendeeByMail(), attendeeByMails().
559 */
560 Attendee attendeeByUid(const QString &uid) const;
561
562 /**
563 Sets the incidences url.
564
565 This property can be used to point to a more dynamic rendition of the incidence.
566 I.e. a website related to the incidence.
567
568 @param url of the incience.
569 @see url()
570 @since 4.12
571 */
572 void setUrl(const QUrl &url);
573
574 /**
575 Returns the url.
576 @return incidences url value
577 @see setUrl()
578 @since 4.12
579 */
580 Q_REQUIRED_RESULT QUrl url() const;
581
582 /**
583 Register observer. The observer is notified when the observed object
584 changes.
585
586 @param observer is a pointer to an IncidenceObserver object that will be
587 watching this incidence.
588 @see unRegisterObserver()
589 */
590 void registerObserver(IncidenceObserver *observer);
591
592 /**
593 Unregister observer. It isn't notified anymore about changes.
594
595 @param observer is a pointer to an IncidenceObserver object that will be
596 watching this incidence.
597 @see registerObserver().
598 */
599 void unRegisterObserver(IncidenceObserver *observer);
600
601 /**
602 Call this to notify the observers after the IncidenceBase object will be
603 changed.
604 */
605 void update();
606
607 /**
608 Call this to notify the observers after the IncidenceBase object has
609 changed.
610 */
611 void updated();
612
613 /**
614 Call this when a group of updates is going to be made. This suppresses
615 change notifications until endUpdates() is called, at which point
616 updated() will automatically be called.
617 */
618 void startUpdates();
619
620 /**
621 Call this when a group of updates is complete, to notify observers that
622 the instance has changed. This should be called in conjunction with
623 startUpdates().
624 */
625 void endUpdates();
626
627 /**
628 Returns a date/time corresponding to the specified DateTimeRole.
629 @param role is a DateTimeRole.
630 */
631 virtual QDateTime dateTime(DateTimeRole role) const = 0;
632
633 /**
634 Sets the date/time corresponding to the specified DateTimeRole.
635 @param dateTime is QDateTime value to set.
636 @param role is a DateTimeRole.
637 */
638 virtual void setDateTime(const QDateTime &dateTime, DateTimeRole role) = 0;
639
640 /**
641 Returns the Akonadi specific sub MIME type of a KCalendarCore::IncidenceBase item,
642 e.g. getting "application/x-vnd.akonadi.calendar.event" for a KCalendarCore::Event.
643 */
644 virtual QLatin1String mimeType() const = 0;
645
646 /**
647 Returns the incidence recurrenceId.
648 @return incidences recurrenceId value
649 @see setRecurrenceId().
650 */
651 virtual QDateTime recurrenceId() const;
652
653 /**
654 Returns a QSet with all Fields that were changed since the incidence was created
655 or resetDirtyFields() was called.
656
657 @see resetDirtyFields()
658 */
659 QSet<IncidenceBase::Field> dirtyFields() const;
660
661 /**
662 Sets which fields are dirty.
663 @see dirtyFields()
664 @since 4.8
665 */
666 void setDirtyFields(const QSet<IncidenceBase::Field> &);
667
668 /**
669 Resets dirty fields.
670 @see dirtyFields()
671 */
672 void resetDirtyFields();
673
674 /**
675 * Constant that identifies KCalendarCore data in a binary stream.
676 *
677 * @since 4.12
678 */
679 Q_REQUIRED_RESULT static quint32 magicSerializationIdentifier();
680
681protected:
682 /**
683 Marks Field @p field as dirty.
684 @param field is the Field type to mark as dirty.
685 @see dirtyFields()
686 */
687 void setFieldDirty(IncidenceBase::Field field);
688
689 /**
690 @copydoc
691 CustomProperties::customPropertyUpdate()
692 */
693 void customPropertyUpdate() override;
694
695 /**
696 @copydoc
697 CustomProperties::customPropertyUpdated()
698 */
699 void customPropertyUpdated() override;
700
701 IncidenceBase(const IncidenceBase &) = delete;
702
703 /**
704 Constructs an IncidenceBase as a copy of another IncidenceBase object.
705 @param ib is the IncidenceBase to copy.
706 @param p (non-null) a Private data object provided by the instantiated
707 class (Event, Todo, Journal, FreeBusy). It takes ownership of the object.
708 */
709 KCALENDARCORE_NO_EXPORT IncidenceBase(const IncidenceBase &ib, IncidenceBasePrivate *p);
710
711 /**
712 Provides polymorfic comparison for equality.
713 Only called by IncidenceBase::operator==() which guarantees that
714 @p incidenceBase is of the right type.
715 @param incidenceBase is the IncidenceBase to compare against.
716 @return true if the incidences are equal; false otherwise.
717 */
718 virtual bool equals(const IncidenceBase &incidenceBase) const;
719
720 /**
721 Provides polymorfic assignment.
722 @param other is the IncidenceBase to assign.
723 */
724 virtual IncidenceBase &assign(const IncidenceBase &other);
725
726 /**
727 * Sub-type specific serialization.
728 */
729 virtual void serialize(QDataStream &out) const;
730 /**
731 * Sub-type specific deserialization.
732 */
733 virtual void deserialize(QDataStream &in);
734
735 enum VirtualHook {};
736
737 /**
738 Standard trick to add virtuals later.
739
740 @param id is any integer unique to this class which we will use to identify the method
741 to be called.
742 @param data is a pointer to some glob of data, typically a struct.
743 */
744 virtual void virtual_hook(VirtualHook id, void *data) = 0;
745
746 /**
747 Identifies a read-only incidence.
748 */
750
751 Q_DECLARE_PRIVATE(IncidenceBase)
752
753protected:
754 IncidenceBasePrivate *const d_ptr;
755
756private:
757 friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::IncidenceBase::Ptr &);
758
759 friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::IncidenceBase::Ptr &);
760};
761
762/**
763 * Compare two QDateTimes for extended equality.
764 *
765 * QDateTime::operator==() in Qt 5.12 returns true if its operands represent
766 * the same instant in time, regardless of their time zones or TimeSpecs (and
767 * contrary to the documentation). This function returns true if and only if
768 * their times, time zones, and TimeSpecs are equal, or both are invalid().
769 *
770 * @since 5.93
771 */
772KCALENDARCORE_EXPORT bool identical(const QDateTime &dt1, const QDateTime &dt2);
773
774/**
775 * Incidence serializer.
776 *
777 * @since 4.12
778 */
779KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::IncidenceBase::Ptr &);
780
781/**
782 * Incidence deserializer.
783 *
784 * @since 4.12
785 */
787}
788
789Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase *)
790Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase::Ptr)
791
792#endif
This file is part of the API for handling calendar data and defines the Attendee class.
Represents information related to an attendee of an Calendar Incidence, typically a meeting or task (...
Definition attendee.h:45
A class to manage custom calendar properties.
Represents a span of time measured in seconds or days.
Definition duration.h:44
This class provides an Event in the sense of RFC2445.
Definition event.h:33
Provides information about the free/busy time of a calendar.
Definition freebusy.h:43
virtual void incidenceUpdate(const QString &uid, const QDateTime &recurrenceId)=0
The IncidenceObserver interface.
virtual void incidenceUpdated(const QString &uid, const QDateTime &recurrenceId)=0
The IncidenceObserver interface.
An abstract class that provides a common base for all calendar incidence classes.
virtual void setDateTime(const QDateTime &dateTime, DateTimeRole role)=0
Sets the date/time corresponding to the specified DateTimeRole.
bool mReadOnly
Identifies a read-only incidence.
IncidenceType
The different types of incidences, per RFC2445.
@ TypeFreeBusy
Type is a free/busy.
@ TypeJournal
Type is a journal.
virtual void virtual_hook(VirtualHook id, void *data)=0
Standard trick to add virtuals later.
QSharedPointer< IncidenceBase > Ptr
A shared pointer to an IncidenceBase.
virtual IncidenceType type() const =0
Returns the incidence type.
Field
The different types of incidence fields.
@ FieldCompleted
Field representing the COMPLETED component.
@ FieldCreated
Field representing the CREATED component.
@ FieldComment
Field representing the COMMENT component.
@ FieldUnknown
Something changed. Always set when you use the assignment operator.
@ FieldRevision
Field representing the SEQUENCE component.
@ FieldDtStart
Field representing the DTSTART component.
@ FieldRelatedTo
Field representing the RELATED-TO component.
@ FieldGeoLongitude
Field representing the longitude part of the GEO component.
@ FieldDescription
Field representing the DESCRIPTION component.
@ FieldLocation
Field representing the LOCATION component.
@ FieldSummary
Field representing the SUMMARY component.
@ FieldRecurrenceId
Field representing the RECURRENCE-ID component.
@ FieldStatus
Field representing the STATUS component.
@ FieldContact
Field representing the CONTACT component.
@ FieldConferences
Field representing the CONFERENCE component.
@ FieldDtEnd
Field representing the DTEND component.
@ FieldPriority
Field representing the PRIORITY component.
@ FieldColor
Field representing the COLOR component.
@ FieldCategories
Field representing the CATEGORIES component.
@ FieldAlarms
Field representing the VALARM component.
@ FieldOrganizer
Field representing the ORGANIZER component.
@ FieldResources
Field representing the RESOURCES component.
@ FieldDtDue
Field representing the DUE component.
@ FieldDuration
Field representing the DURATION component.
@ FieldRecurrence
Field representing the EXDATE, EXRULE, RDATE, and RRULE components.
@ FieldPercentComplete
Field representing the PERCENT-COMPLETE component.
@ FieldUrl
Field representing the URL component.
@ FieldAttachment
Field representing the ATTACH component.
@ FieldTransparency
Field representing the TRANSPARENCY component.
@ FieldUid
Field representing the UID component.
@ FieldGeoLatitude
Field representing the latitude part of the GEO component.
@ FieldLastModified
Field representing the LAST-MODIFIED component.
@ FieldSecrecy
Field representing the CLASS component.
@ FieldSchedulingId
Field representing the X-KDE-LIBKCAL-ID component.
@ FieldAttendees
Field representing the ATTENDEE component.
virtual QLatin1String mimeType() const =0
Returns the Akonadi specific sub MIME type of a KCalendarCore::IncidenceBase item,...
virtual QByteArray typeStr() const =0
Prints the type of incidence as a string.
DateTimeRole
The different types of incidence date/times roles.
@ RoleEndTimeZone
Role for determining an incidence's ending timezone.
@ RoleCalendarHashing
Role for looking up an incidence in a Calendar.
@ RoleAlarmEndOffset
Role for an incidence alarm's ending offset date/time.
@ RoleSort
Role for an incidence's date/time used when sorting.
@ RoleStartTimeZone
Role for determining an incidence's starting timezone.
@ RoleDnD
Role for determining new start and end dates after a DnD.
friend KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &stream, KCalendarCore::IncidenceBase::Ptr &)
Incidence deserializer.
friend KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &stream, const KCalendarCore::IncidenceBase::Ptr &)
Incidence serializer.
virtual QDateTime dateTime(DateTimeRole role) const =0
Returns a date/time corresponding to the specified DateTimeRole.
Provides a Journal in the sense of RFC2445.
Definition journal.h:33
Represents a person, by name and email address.
Definition person.h:38
Provides a To-do in the sense of RFC2445.
Definition todo.h:34
This class provides the interface for a visitor of calendar components.
Definition visitor.h:31
This file is part of the API for handling calendar data and defines the CustomProperties class.
This file is part of the API for handling calendar data and defines the Duration class.
Namespace for all KCalendarCore types.
Definition alarm.h:37
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition alarm.cpp:833
QList< QDate > DateList
List of dates.
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition alarm.cpp:820
QList< QDateTime > DateTimeList
List of times.
KCALENDARCORE_EXPORT bool identical(const QDateTime &dt1, const QDateTime &dt2)
Compare two QDateTimes for extended equality.
This file is part of the API for handling calendar data and defines the Person class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 19 2024 11:59:07 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.