KCalendarCore

incidence.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 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
18 #ifndef KCALCORE_INCIDENCE_H
19 #define KCALCORE_INCIDENCE_H
20 
21 #include "kcalendarcore_export.h"
22 #include "alarm.h"
23 #include "attachment.h"
24 #include "incidencebase.h"
25 #include "recurrence.h"
26 
27 #include <QMetaType>
28 
29 //@cond PRIVATE
30 // Value used to signal invalid/unset latitude or longitude.
31 #define INVALID_LATLON 255.0 //krazy:exclude=defines (part of the API)
32 //@endcond
33 
34 namespace KCalendarCore
35 {
36 
56 class KCALENDARCORE_EXPORT Incidence
57  : public IncidenceBase, public Recurrence::RecurrenceObserver
58 {
59  Q_GADGET
60  Q_PROPERTY(QString description READ description WRITE setDescription)
61  Q_PROPERTY(QString summary READ summary WRITE setSummary)
62  Q_PROPERTY(QString location READ location WRITE setLocation)
63  Q_PROPERTY(bool hasGeo READ hasGeo WRITE setHasGeo)
64  Q_PROPERTY(float geoLatitude READ geoLatitude WRITE setGeoLatitude)
65  Q_PROPERTY(float geoLongitude READ geoLongitude WRITE setGeoLongitude)
66  Q_PROPERTY(QStringList categories READ categories WRITE setCategories)
67  Q_PROPERTY(int priority READ priority WRITE setPriority)
68  Q_PROPERTY(QDateTime created READ created WRITE setCreated)
69  Q_PROPERTY(KCalendarCore::Incidence::Secrecy secrecy READ secrecy WRITE setSecrecy)
70  Q_PROPERTY(KCalendarCore::Incidence::Status status READ status WRITE setStatus)
71  Q_PROPERTY(QVariantList attachments READ attachmentsVariant)
72 public:
73 
78  enum Status {
88  StatusX
89  };
90  Q_ENUM(Status)
91 
92 
95  enum Secrecy {
98  SecrecyConfidential
99  };
100  Q_ENUM(Secrecy)
101 
102 
106  enum RelType {
109  RelTypeSibling
110  };
111 
116 
121 
125  Incidence();
126 
130  ~Incidence() override;
131 
138  virtual Incidence *clone() const = 0;
139 
146  Q_REQUIRED_RESULT QString instanceIdentifier() const;
147 
154  void setReadOnly(bool readonly) override;
155 
159  void setLastModified(const QDateTime &lm) override;
160 
169  void setLocalOnly(bool localonly);
170 
177  Q_REQUIRED_RESULT bool localOnly() const;
178 
182  void setAllDay(bool allDay) override;
183 
189  void recreate();
190 
197  void setCreated(const QDateTime &dt);
198 
203  Q_REQUIRED_RESULT QDateTime created() const;
204 
211  void setRevision(int rev);
212 
217  Q_REQUIRED_RESULT int revision() const;
218 
225  void setDtStart(const QDateTime &dt) override;
226 
230  void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) override;
231 
239  void setDescription(const QString &description, bool isRich);
240 
248  void setDescription(const QString &description);
249 
255  Q_REQUIRED_RESULT QString description() const;
256 
262  Q_REQUIRED_RESULT QString richDescription() const;
263 
268  Q_REQUIRED_RESULT bool descriptionIsRich() const;
269 
277  void setSummary(const QString &summary, bool isRich);
278 
285  void setSummary(const QString &summary);
286 
292  Q_REQUIRED_RESULT QString summary() const;
293 
299  Q_REQUIRED_RESULT QString richSummary() const;
300 
305  Q_REQUIRED_RESULT bool summaryIsRich() const;
306 
314  void setLocation(const QString &location, bool isRich);
315 
323  void setLocation(const QString &location);
324 
330  Q_REQUIRED_RESULT QString location() const;
331 
337  Q_REQUIRED_RESULT QString richLocation() const;
338 
343  Q_REQUIRED_RESULT bool locationIsRich() const;
344 
351  void setCategories(const QStringList &categories);
352 
360  void setCategories(const QString &catStr);
361 
366  Q_REQUIRED_RESULT QStringList categories() const;
367 
372  Q_REQUIRED_RESULT QString categoriesStr() const;
373 
385  void setRelatedTo(const QString &uid, RelType relType = RelTypeParent);
386 
398  Q_REQUIRED_RESULT QString relatedTo(RelType relType = RelTypeParent) const;
399 
400 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
401 // %%%%% Convenience wrappers for property handling
402 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
408  Q_REQUIRED_RESULT bool hasAltDescription() const;
416  void setAltDescription(const QString &altdescription);
417 
422  Q_REQUIRED_RESULT QString altDescription() const;
423 
424 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425 // %%%%% Recurrence-related methods
426 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
427 
432  Recurrence *recurrence() const;
433 
437  void clearRecurrence();
438 
442  Q_REQUIRED_RESULT bool recurs() const;
443 
447  Q_REQUIRED_RESULT ushort recurrenceType() const;
448 
452  virtual bool recursOn(const QDate &date, const QTimeZone &timeZone) const;
453 
457  Q_REQUIRED_RESULT bool recursAt(const QDateTime &dt) const;
458 
470  virtual QList<QDateTime> startDateTimesForDate(const QDate &date,
471  const QTimeZone &timeZone) const;
472 
482  Q_REQUIRED_RESULT virtual QList<QDateTime> startDateTimesForDateTime(const QDateTime &datetime) const;
483 
493  Q_REQUIRED_RESULT virtual QDateTime endDateForStart(const QDateTime &startDt) const;
494 
495 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
496 // %%%%% Attachment-related methods
497 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
498 
504  void addAttachment(const Attachment &attachment);
505 
513  void deleteAttachments(const QString &mime);
514 
519  Q_REQUIRED_RESULT Attachment::List attachments() const;
520 
527  Q_REQUIRED_RESULT Attachment::List attachments(const QString &mime) const;
528 
533  void clearAttachments();
534 
535 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
536 // %%%%% Secrecy and Status methods
537 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
538 
545  void setSecrecy(Secrecy secrecy);
546 
551  Q_REQUIRED_RESULT Secrecy secrecy() const;
552 
560  void setStatus(Status status);
561 
569  void setCustomStatus(const QString &status);
570 
575  Q_REQUIRED_RESULT QString customStatus() const;
576 
581  Q_REQUIRED_RESULT Status status() const;
582 
583 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
584 // %%%%% Other methods
585 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586 
594  void setResources(const QStringList &resources);
595 
600  Q_REQUIRED_RESULT QStringList resources() const;
601 
610  void setPriority(int priority);
611 
616  Q_REQUIRED_RESULT int priority() const;
617 
622  Q_REQUIRED_RESULT bool hasGeo() const;
623 
629  void setHasGeo(bool hasGeo);
630 
636  void setGeoLatitude(float geolatitude);
637 
643  Q_REQUIRED_RESULT float geoLatitude() const;
644 
650  void setGeoLongitude(float geolongitude);
651 
657  Q_REQUIRED_RESULT float geoLongitude() const;
658 
663  Q_REQUIRED_RESULT bool hasRecurrenceId() const;
664 
672  void setRecurrenceId(const QDateTime &recurrenceId);
673 
679  Q_REQUIRED_RESULT QDateTime recurrenceId() const override;
680 
688  void setThisAndFuture(bool thisAndFuture);
689 
696  Q_REQUIRED_RESULT bool thisAndFuture() const;
697 
698 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
699 // %%%%% Alarm-related methods
700 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701 
705  Q_REQUIRED_RESULT Alarm::List alarms() const;
706 
710  Alarm::Ptr newAlarm();
711 
718  void addAlarm(const Alarm::Ptr &alarm);
719 
726  void removeAlarm(const Alarm::Ptr &alarm);
727 
732  void clearAlarms();
733 
737  Q_REQUIRED_RESULT bool hasEnabledAlarms() const;
738 
739 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
740 // %%%%% Other methods
741 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
742 
767  void setSchedulingID(const QString &sid,
768  const QString &uid = QString());
769 
775  Q_REQUIRED_RESULT QString schedulingID() const;
776 
784  void recurrenceUpdated(Recurrence *recurrence) override;
785 
793  virtual QLatin1String iconName(const QDateTime &recurrenceId = {}) const = 0;
794 
799  virtual bool supportsGroupwareCommunication() const = 0;
800 
810  Q_REQUIRED_RESULT static QStringList mimeTypes();
811 
812 protected:
813 
818  Incidence(const Incidence &other);
819 
825  bool equals(const IncidenceBase &incidence) const override;
826 
830  IncidenceBase &assign(const IncidenceBase &other) override;
831 
832  void serialize(QDataStream &out) const override;
833  void deserialize(QDataStream &in) override;
834 
835 private:
842  Incidence &operator=(const Incidence &other);
843 
844  Q_DECL_HIDDEN QVariantList attachmentsVariant() const;
845 
846  //@cond PRIVATE
847  class Private;
848  Private *const d;
849  //@endcond
850 };
851 
852 }
853 
854 //@cond PRIVATE
855 inline uint qHash(const QSharedPointer<KCalendarCore::Incidence> &key)
856 {
857  return qHash(key.data());
858 }
859 //@endcond
860 
861 //@cond PRIVATE
862 Q_DECLARE_TYPEINFO(KCalendarCore::Incidence::Ptr, Q_MOVABLE_TYPE);
863 Q_DECLARE_METATYPE(KCalendarCore::Incidence *)
864 //@endcond
865 
866 #endif
Secrecy
The different types of incidence access classifications.
Definition: incidence.h:95
RelType
The different types of RELTYPE values specified by the RFC.
Definition: incidence.h:106
QSharedPointer< Incidence > Ptr
A shared pointer to an Incidence.
Definition: incidence.h:115
T * data() const const
An abstract class that provides a common base for all calendar incidence classes. ...
Definition: incidencebase.h:96
The related incidence is a child.
Definition: incidence.h:108
Represents information related to an attachment for a Calendar Incidence.
Definition: attachment.h:47
The related incidence is a parent.
Definition: incidence.h:107
This file is part of the API for handling calendar data and defines the Attachment class...
This file is part of the API for handling calendar data and defines the Alarm class.
This class represents a recurrence rule for a calendar incidence.
Definition: recurrence.h:76
This file is part of the API for handling calendar data and defines the IncidenceBase class...
event or to-do canceled; journal removed
Definition: incidence.h:84
QVector< Ptr > List
List of incidences.
Definition: incidence.h:120
Status
The different types of overall incidence status or confirmation.
Definition: incidence.h:78
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:56
Namespace for all KCalendarCore types.
Definition: alarm.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 6 2020 22:50:04 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.