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 */
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 <QDateTime>
52 #include <QSharedPointer>
53 #include <QSet>
54 #include <QUrl>
55 #include <QDataStream>
56 
57 class QUrl;
58 class QDate;
59 class QTimeZone;
60 
61 namespace KCalendarCore {
64 
67 
68 class Event;
69 class Todo;
70 class Journal;
71 class FreeBusy;
72 class Visitor;
73 
96 class KCALENDARCORE_EXPORT IncidenceBase : public CustomProperties
97 {
98  Q_GADGET
99  Q_PROPERTY(QString uid READ uid WRITE setUid)
100  Q_PROPERTY(QDateTime lastModified READ lastModified WRITE setLastModified)
101  Q_PROPERTY(QDateTime dtStart READ dtStart WRITE setDtStart)
102  Q_PROPERTY(bool allDay READ allDay WRITE setAllDay)
103  Q_PROPERTY(KCalendarCore::Person organizer READ organizer WRITE setOrganizer)
104  Q_PROPERTY(QVariantList attendees READ attendeesVariant)
105 
106 public:
111 
117  TypeEvent = 0,
121  TypeUnknown
122  };
123 
129  RoleAlarmStartOffset = 0,
135  RoleEndRecurrenceBase,
136  RoleEnd,
138  RoleDisplayEnd,
140  RoleAlarm,
142  RoleRecurrenceStart,
147  RoleDisplayStart,
149  RoleDnD
150  };
151 
155  enum Field {
156  FieldDtStart,
190  FieldColor
191  };
192 
196  class KCALENDARCORE_EXPORT IncidenceObserver
197  {
198  public:
199 
203  virtual ~IncidenceObserver();
204 
211  virtual void incidenceUpdate(const QString &uid, const QDateTime &recurrenceId) = 0;
212 
219  virtual void incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) = 0;
220  };
221 
225  IncidenceBase();
226 
230  ~IncidenceBase() override;
231 
249  IncidenceBase &operator=(const IncidenceBase &other);
250 
257  bool operator==(const IncidenceBase &ib) const;
258 
264  bool operator!=(const IncidenceBase &ib) const;
265 
276  virtual bool accept(Visitor &v, const IncidenceBase::Ptr &incidence);
277 
281  virtual IncidenceType type() const = 0;
282 
286  virtual QByteArray typeStr() const = 0;
287 
293  void setUid(const QString &uid);
294 
299  Q_REQUIRED_RESULT QString uid() const;
300 
304  Q_REQUIRED_RESULT QUrl uri() const;
305 
314  virtual void setLastModified(const QDateTime &lm);
315 
320  Q_REQUIRED_RESULT QDateTime lastModified() const;
321 
328  void setOrganizer(const Person &organizer);
329 
336  void setOrganizer(const QString &organizer);
337 
344  Person organizer() const;
345 
353  virtual void setReadOnly(bool readOnly);
354 
359  Q_REQUIRED_RESULT bool isReadOnly() const;
360 
369  virtual void setDtStart(const QDateTime &dtStart);
370 
375  virtual QDateTime dtStart() const;
376 
384  virtual void setDuration(const Duration &duration);
385 
390  Q_REQUIRED_RESULT Duration duration() const;
391 
397  void setHasDuration(bool hasDuration);
398 
403  Q_REQUIRED_RESULT bool hasDuration() const;
404 
410  Q_REQUIRED_RESULT bool allDay() const;
411 
420  virtual void setAllDay(bool allDay);
421 
436  virtual void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone);
437 
445  void addComment(const QString &comment);
446 
455  Q_REQUIRED_RESULT bool removeComment(const QString &comment);
456 
460  void clearComments();
461 
465  Q_REQUIRED_RESULT QStringList comments() const;
466 
474  void addContact(const QString &contact);
475 
484  Q_REQUIRED_RESULT bool removeContact(const QString &contact);
485 
489  void clearContacts();
490 
494  Q_REQUIRED_RESULT QStringList contacts() const;
495 
502  void addAttendee(const Attendee &attendee, bool doUpdate = true);
503 
507  void clearAttendees();
508 
516  void setAttendees(const Attendee::List &attendees, bool doUpdate = true);
517 
522  Q_REQUIRED_RESULT Attendee::List attendees() const;
523 
527  Q_REQUIRED_RESULT int attendeeCount() const;
528 
536  Attendee attendeeByMail(const QString &email) const;
537 
548  Attendee attendeeByMails(const QStringList &emails, const QString &email = QString()) const;
549 
556  Attendee attendeeByUid(const QString &uid) const;
557 
568  void setUrl(const QUrl &url);
569 
576  Q_REQUIRED_RESULT QUrl url() const;
577 
586  void registerObserver(IncidenceObserver *observer);
587 
595  void unRegisterObserver(IncidenceObserver *observer);
596 
601  void update();
602 
607  void updated();
608 
614  void startUpdates();
615 
621  void endUpdates();
622 
627  virtual QDateTime dateTime(DateTimeRole role) const = 0;
628 
634  virtual void setDateTime(const QDateTime &dateTime, DateTimeRole role) = 0;
635 
640  virtual QLatin1String mimeType() const = 0;
641 
647  virtual QDateTime recurrenceId() const;
648 
655  QSet<IncidenceBase::Field> dirtyFields() const;
656 
662  void setDirtyFields(const QSet<IncidenceBase::Field> &);
663 
668  void resetDirtyFields();
669 
675  Q_REQUIRED_RESULT static quint32 magicSerializationIdentifier();
676 
677 protected:
678 
684  void setFieldDirty(IncidenceBase::Field field);
685 
690  void customPropertyUpdate() override;
691 
696  void customPropertyUpdated() override;
697 
702  IncidenceBase(const IncidenceBase &ib);
703 
711  virtual bool equals(const IncidenceBase &incidenceBase) const;
712 
717  virtual IncidenceBase &assign(const IncidenceBase &other);
718 
722  virtual void serialize(QDataStream &out) const;
726  virtual void deserialize(QDataStream &in);
727 
728  enum VirtualHook {};
729 
737  virtual void virtual_hook(VirtualHook id, void *data) = 0;
738 
742  bool mReadOnly;
743 
744 private:
745  //@cond PRIVATE
746  class Private;
747  Private *const d;
748 
749  Q_DECL_HIDDEN QVariantList attendeesVariant() const;
750  //@endcond
751 
752  friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::IncidenceBase::Ptr &);
753 
754  friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::IncidenceBase::Ptr &);
755 };
756 
762 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::IncidenceBase::Ptr &);
763 
770 }
771 
772 Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase *)
773 Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase::Ptr)
774 
775 #endif
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:825
This file is part of the API for handling calendar data and defines the Attendee class.
Field representing the ORGANIZER component.
A class to manage custom calendar properties.
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...
Represents a person, by name and email address.
Definition: person.h:38
Field representing the LOCATION component.
Represents information related to an attendee of an Calendar Incidence, typically a meeting or task (...
Definition: attendee.h:45
Provides a Journal in the sense of RFC2445.
Definition: journal.h:30
Something changed. Always set when you use the assignment operator.
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:849
Provides information about the free/busy time of a calendar.
Definition: freebusy.h:40
Field representing the RELATED-TO component.
Field
The different types of incidence fields.
Field representing the RESOURCES component.
Field representing the CLASS component.
Field representing the longitude part of the GEO component.
DateTimeRole
The different types of incidence date/times roles.
Field representing the STATUS component.
An abstract class that provides a common base for all calendar incidence classes. ...
Definition: incidencebase.h:96
Role for an incidence&#39;s date/time used when sorting.
This file is part of the API for handling calendar data and defines the Person class.
Field representing the VALARM component.
Represents a span of time measured in seconds or days.
Definition: duration.h:44
Role for determining an incidence&#39;s starting timezone.
Field representing the DUE component.
Role for determining an incidence&#39;s ending timezone.
This class provides an Event in the sense of RFC2445.
Definition: event.h:30
Field representing the COMPLETED component.
Role for looking up an incidence in a Calendar.
Field representing the UID component.
Provides a To-do in the sense of RFC2445.
Definition: todo.h:31
IncidenceType
The different types of incidences, per RFC2445.
Field representing the PERCENT-COMPLETE component.
Field representing the TRANSPARENCY component.
Field representing the DURATION component.
Field representing the latitude part of the GEO component.
Field representing the ATTENDEE component.
Field representing the DTSTART component.
Field representing the X-KDE-LIBKCAL-ID component.
Field representing the CONTACT component.
QSharedPointer< IncidenceBase > Ptr
A shared pointer to an IncidenceBase.
Field representing the COMMENT component.
This file is part of the API for handling calendar data and defines the Duration class.
Field representing the SUMMARY component.
Field representing the EXDATE, EXRULE, RDATE, and RRULE components.
Field representing the CATEGORIES component.
Field representing the LAST-MODIFIED component.
Field representing the PRIORITY component.
Field representing the RECURRENCE-ID component.
Field representing the ATTACH component.
QList< QDate > DateList
List of dates.
Definition: incidencebase.h:63
Field representing the CREATED component.
Field representing the SEQUENCE component.
Field representing the URL component.
Field representing the DTEND component.
Field representing the DESCRIPTION component.
Namespace for all KCalendarCore types.
Definition: alarm.h:36
Role for an incidence alarm&#39;s ending offset date/time.
QList< QDateTime > DateTimeList
List of times.
Definition: incidencebase.h:66
bool mReadOnly
Identifies a read-only incidence.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Dec 3 2020 22:51:44 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.