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,
188  FieldUrl
189  };
190 
194  class KCALENDARCORE_EXPORT IncidenceObserver
195  {
196  public:
197 
201  virtual ~IncidenceObserver();
202 
209  virtual void incidenceUpdate(const QString &uid, const QDateTime &recurrenceId) = 0;
210 
217  virtual void incidenceUpdated(const QString &uid, const QDateTime &recurrenceId) = 0;
218  };
219 
223  IncidenceBase();
224 
228  ~IncidenceBase() override;
229 
247  IncidenceBase &operator=(const IncidenceBase &other);
248 
255  bool operator==(const IncidenceBase &ib) const;
256 
262  bool operator!=(const IncidenceBase &ib) const;
263 
274  virtual bool accept(Visitor &v, const IncidenceBase::Ptr &incidence);
275 
279  virtual IncidenceType type() const = 0;
280 
284  virtual QByteArray typeStr() const = 0;
285 
291  void setUid(const QString &uid);
292 
297  Q_REQUIRED_RESULT QString uid() const;
298 
302  Q_REQUIRED_RESULT QUrl uri() const;
303 
312  virtual void setLastModified(const QDateTime &lm);
313 
318  Q_REQUIRED_RESULT QDateTime lastModified() const;
319 
326  void setOrganizer(const Person &organizer);
327 
334  void setOrganizer(const QString &organizer);
335 
342  Person organizer() const;
343 
351  virtual void setReadOnly(bool readOnly);
352 
357  Q_REQUIRED_RESULT bool isReadOnly() const;
358 
367  virtual void setDtStart(const QDateTime &dtStart);
368 
373  virtual QDateTime dtStart() const;
374 
382  virtual void setDuration(const Duration &duration);
383 
388  Q_REQUIRED_RESULT Duration duration() const;
389 
395  void setHasDuration(bool hasDuration);
396 
401  Q_REQUIRED_RESULT bool hasDuration() const;
402 
408  Q_REQUIRED_RESULT bool allDay() const;
409 
418  virtual void setAllDay(bool allDay);
419 
434  virtual void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone);
435 
443  void addComment(const QString &comment);
444 
453  Q_REQUIRED_RESULT bool removeComment(const QString &comment);
454 
458  void clearComments();
459 
463  Q_REQUIRED_RESULT QStringList comments() const;
464 
472  void addContact(const QString &contact);
473 
482  Q_REQUIRED_RESULT bool removeContact(const QString &contact);
483 
487  void clearContacts();
488 
492  Q_REQUIRED_RESULT QStringList contacts() const;
493 
500  void addAttendee(const Attendee &attendee, bool doUpdate = true);
501 
505  void clearAttendees();
506 
514  void setAttendees(const Attendee::List &attendees, bool doUpdate = true);
515 
520  Q_REQUIRED_RESULT Attendee::List attendees() const;
521 
525  Q_REQUIRED_RESULT int attendeeCount() const;
526 
534  Attendee attendeeByMail(const QString &email) const;
535 
546  Attendee attendeeByMails(const QStringList &emails, const QString &email = QString()) const;
547 
554  Attendee attendeeByUid(const QString &uid) const;
555 
566  void setUrl(const QUrl &url);
567 
574  Q_REQUIRED_RESULT QUrl url() const;
575 
584  void registerObserver(IncidenceObserver *observer);
585 
593  void unRegisterObserver(IncidenceObserver *observer);
594 
599  void update();
600 
605  void updated();
606 
612  void startUpdates();
613 
619  void endUpdates();
620 
625  virtual QDateTime dateTime(DateTimeRole role) const = 0;
626 
632  virtual void setDateTime(const QDateTime &dateTime, DateTimeRole role) = 0;
633 
638  virtual QLatin1String mimeType() const = 0;
639 
645  virtual QDateTime recurrenceId() const;
646 
653  QSet<IncidenceBase::Field> dirtyFields() const;
654 
660  void setDirtyFields(const QSet<IncidenceBase::Field> &);
661 
666  void resetDirtyFields();
667 
673  Q_REQUIRED_RESULT static quint32 magicSerializationIdentifier();
674 
675 protected:
676 
682  void setFieldDirty(IncidenceBase::Field field);
683 
688  void customPropertyUpdate() override;
689 
694  void customPropertyUpdated() override;
695 
700  IncidenceBase(const IncidenceBase &ib);
701 
709  virtual bool equals(const IncidenceBase &incidenceBase) const;
710 
715  virtual IncidenceBase &assign(const IncidenceBase &other);
716 
720  virtual void serialize(QDataStream &out) const;
724  virtual void deserialize(QDataStream &in);
725 
726  enum VirtualHook {};
727 
735  virtual void virtual_hook(VirtualHook id, void *data) = 0;
736 
740  bool mReadOnly;
741 
742 private:
743  //@cond PRIVATE
744  class Private;
745  Private *const d;
746 
747  Q_DECL_HIDDEN QVariantList attendeesVariant() const;
748  //@endcond
749 
750  friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::IncidenceBase::Ptr &);
751 
752  friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::IncidenceBase::Ptr &);
753 };
754 
760 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, const KCalendarCore::IncidenceBase::Ptr &);
761 
768 }
769 
770 Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase *)
771 Q_DECLARE_METATYPE(KCalendarCore::IncidenceBase::Ptr)
772 
773 #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
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 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 Wed Jul 8 2020 22:49:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.