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 */
9 /**
10  @file
11  This file is part of the API for handling calendar data and
12  defines the Incidence class.
13 
14  @author Cornelius Schumacher <[email protected]>
15  @author Reinhold Kainhofer <[email protected]>
16 */
17 
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 #include "conference.h"
27 
28 #include <QMetaType>
29 
30 //@cond PRIVATE
31 // Value used to signal invalid/unset latitude or longitude.
32 #define INVALID_LATLON 255.0 //krazy:exclude=defines (part of the API)
33 //@endcond
34 
35 namespace KCalendarCore
36 {
37 
38 /**
39  @brief
40  Provides the abstract base class common to non-FreeBusy (Events, To-dos,
41  Journals) calendar components known as incidences.
42 
43  Several properties are not allowed for VFREEBUSY objects (see rfc:2445),
44  so they are not in IncidenceBase. The hierarchy is:
45 
46  IncidenceBase
47  + FreeBusy
48  + Incidence
49  + Event
50  + Todo
51  + Journal
52 
53  So IncidenceBase contains all properties that are common to all classes,
54  and Incidence contains all additional properties that are common to
55  Events, Todos and Journals, but are not allowed for FreeBusy entries.
56 */
57 class KCALENDARCORE_EXPORT Incidence
58  : public IncidenceBase, public Recurrence::RecurrenceObserver
59 {
60  Q_GADGET
61  Q_PROPERTY(QString description READ description WRITE setDescription)
62  Q_PROPERTY(QString summary READ summary WRITE setSummary)
63  Q_PROPERTY(QString location READ location WRITE setLocation)
64  Q_PROPERTY(bool hasGeo READ hasGeo WRITE setHasGeo)
65  Q_PROPERTY(float geoLatitude READ geoLatitude WRITE setGeoLatitude)
66  Q_PROPERTY(float geoLongitude READ geoLongitude WRITE setGeoLongitude)
67  Q_PROPERTY(QStringList categories READ categories WRITE setCategories)
68  Q_PROPERTY(int priority READ priority WRITE setPriority)
69  Q_PROPERTY(QDateTime created READ created WRITE setCreated)
70  Q_PROPERTY(KCalendarCore::Incidence::Secrecy secrecy READ secrecy WRITE setSecrecy)
71  Q_PROPERTY(KCalendarCore::Incidence::Status status READ status WRITE setStatus)
72  Q_PROPERTY(QVariantList attachments READ attachmentsVariant)
73  Q_PROPERTY(QVariantList conferences READ conferencesVariant)
74 public:
75 
76  /**
77  The different types of overall incidence status or confirmation.
78  The meaning is specific to the incidence type in context.
79  */
80  enum Status {
81  StatusNone, /**< No status */
82  StatusTentative, /**< event is tentative */
83  StatusConfirmed, /**< event is definite */
84  StatusCompleted, /**< to-do completed */
85  StatusNeedsAction, /**< to-do needs action */
86  StatusCanceled, /**< event or to-do canceled; journal removed */
87  StatusInProcess, /**< to-do in process */
88  StatusDraft, /**< journal is draft */
89  StatusFinal, /**< journal is final */
90  StatusX /**< a non-standard status string */
91  };
92  Q_ENUM(Status)
93 
94  /**
95  The different types of incidence access classifications.
96  */
97  enum Secrecy {
98  SecrecyPublic, /**< Not secret (default) */
99  SecrecyPrivate, /**< Secret to the owner */
100  SecrecyConfidential /**< Secret to the owner and some others */
101  };
102  Q_ENUM(Secrecy)
103 
104  /**
105  The different types of RELTYPE values specified by the RFC.
106  Only RelTypeParent is supported for now.
107  */
108  enum RelType {
109  RelTypeParent, /**< The related incidence is a parent. */
110  RelTypeChild, /**< The related incidence is a child. */
111  RelTypeSibling /**< The related incidence is a peer. */
112  };
113 
114  /**
115  A shared pointer to an Incidence.
116  */
118 
119  /**
120  List of incidences.
121  */
123 
124  /**
125  Constructs an empty incidence.*
126  */
127  Incidence();
128 
129  /**
130  Destroys an incidence.
131  */
132  ~Incidence() override;
133 
134  /**
135  Returns an exact copy of this incidence. The returned object is owned
136  by the caller.
137 
138  Dirty fields are cleared.
139  */
140  virtual Incidence *clone() const = 0;
141 
142  /**
143  Returns a unique identifier for a specific instance of an incidence.
144 
145  Due to the recurrence-id, the uid is not unique for a KCalendarCore::Incidence.
146  @since 4.11
147  */
148  Q_REQUIRED_RESULT QString instanceIdentifier() const;
149 
150  /**
151  Set readonly state of incidence.
152 
153  @param readonly If true, the incidence is set to readonly, if false the
154  incidence is set to readwrite.
155  */
156  void setReadOnly(bool readonly) override;
157 
158  /**
159  @copydoc IncidenceBase::setLastModified().
160  */
161  void setLastModified(const QDateTime &lm) override;
162 
163  /**
164  Set localOnly state of incidence.
165  A local only incidence can be updated but it will not increase the revision
166  number neither the modified date.
167 
168  @param localonly If true, the incidence is set to localonly, if false the
169  incidence is set to normal stat.
170  */
171  void setLocalOnly(bool localonly);
172 
173  /**
174  Get the localOnly status.
175  @return true if Local only, false otherwise.
176 
177  @see setLocalOnly()
178  */
179  Q_REQUIRED_RESULT bool localOnly() const;
180 
181  /**
182  @copydoc IncidenceBase::setAllDay().
183  */
184  void setAllDay(bool allDay) override;
185 
186  /**
187  Recreate incidence. The incidence is made a new unique incidence, but already stored
188  information is preserved. Sets unique id, creation date, last
189  modification date and revision number.
190  */
191  void recreate();
192 
193  /**
194  Sets the incidence creation date/time. It is stored as a UTC date/time.
195 
196  @param dt is the creation date/time.
197  @see created().
198  */
199  void setCreated(const QDateTime &dt);
200 
201  /**
202  Returns the incidence creation date/time.
203  @see setCreated().
204  */
205  Q_REQUIRED_RESULT QDateTime created() const;
206 
207  /**
208  Sets the number of revisions this incidence has seen.
209 
210  @param rev is the incidence revision number.
211  @see revision().
212  */
213  void setRevision(int rev);
214 
215  /**
216  Returns the number of revisions this incidence has seen.
217  @see setRevision().
218  */
219  Q_REQUIRED_RESULT int revision() const;
220 
221  /**
222  Sets the incidence starting date/time.
223 
224  @param dt is the starting date/time.
225  @see IncidenceBase::dtStart().
226  */
227  void setDtStart(const QDateTime &dt) override;
228 
229  /**
230  @copydoc IncidenceBase::shiftTimes()
231  */
232  void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) override;
233 
234  /**
235  Sets the incidence description.
236 
237  @param description is the incidence description string.
238  @param isRich if true indicates the description string contains richtext.
239  @see description().
240  */
241  void setDescription(const QString &description, bool isRich);
242 
243  /**
244  Sets the incidence description and tries to guess if the description
245  is rich text.
246 
247  @param description is the incidence description string.
248  @see description().
249  */
250  void setDescription(const QString &description);
251 
252  /**
253  Returns the incidence description.
254  @see setDescription().
255  @see richDescription().
256  */
257  Q_REQUIRED_RESULT QString description() const;
258 
259  /**
260  Returns the incidence description in rich text format.
261  @see setDescription().
262  @see description().
263  */
264  Q_REQUIRED_RESULT QString richDescription() const;
265 
266  /**
267  Returns true if incidence description contains RichText; false otherwise.
268  @see setDescription(), description().
269  */
270  Q_REQUIRED_RESULT bool descriptionIsRich() const;
271 
272  /**
273  Sets the incidence summary.
274 
275  @param summary is the incidence summary string.
276  @param isRich if true indicates the summary string contains richtext.
277  @see summary().
278  */
279  void setSummary(const QString &summary, bool isRich);
280 
281  /**
282  Sets the incidence summary and tries to guess if the summary is richtext.
283 
284  @param summary is the incidence summary string.
285  @see summary().
286  */
287  void setSummary(const QString &summary);
288 
289  /**
290  Returns the incidence summary.
291  @see setSummary().
292  @see richSummary().
293  */
294  Q_REQUIRED_RESULT QString summary() const;
295 
296  /**
297  Returns the incidence summary in rich text format.
298  @see setSummary().
299  @see summary().
300  */
301  Q_REQUIRED_RESULT QString richSummary() const;
302 
303  /**
304  Returns true if incidence summary contains RichText; false otherwise.
305  @see setSummary(), summary().
306  */
307  Q_REQUIRED_RESULT bool summaryIsRich() const;
308 
309  /**
310  Sets the incidence location. Do _not_ use with journals.
311 
312  @param location is the incidence location string.
313  @param isRich if true indicates the location string contains richtext.
314  @see location().
315  */
316  void setLocation(const QString &location, bool isRich);
317 
318  /**
319  Sets the incidence location and tries to guess if the location is
320  richtext. Do _not_ use with journals.
321 
322  @param location is the incidence location string.
323  @see location().
324  */
325  void setLocation(const QString &location);
326 
327  /**
328  Returns the incidence location. Do _not_ use with journals.
329  @see setLocation().
330  @see richLocation().
331  */
332  Q_REQUIRED_RESULT QString location() const;
333 
334  /**
335  Returns the incidence location in rich text format.
336  @see setLocation().
337  @see location().
338  */
339  Q_REQUIRED_RESULT QString richLocation() const;
340 
341  /**
342  Returns true if incidence location contains RichText; false otherwise.
343  @see setLocation(), location().
344  */
345  Q_REQUIRED_RESULT bool locationIsRich() const;
346 
347  /**
348  Sets the incidence category list.
349 
350  @param categories is a list of category strings.
351  @see setCategories( const QString &), categories().
352  */
353  void setCategories(const QStringList &categories);
354 
355  /**
356  Sets the incidence category list based on a comma delimited string.
357 
358  @param catStr is a QString containing a list of categories which
359  are delimited by a comma character.
360  @see setCategories( const QStringList &), categories().
361  */
362  void setCategories(const QString &catStr);
363 
364  /**
365  Returns the incidence categories as a list of strings.
366  @see setCategories( const QStringList &), setCategories( const QString &).
367  */
368  Q_REQUIRED_RESULT QStringList categories() const;
369 
370  /**
371  Returns the incidence categories as a comma separated string.
372  @see categories().
373  */
374  Q_REQUIRED_RESULT QString categoriesStr() const;
375 
376  /**
377  Relates another incidence to this one, by UID. This function should only
378  be used when constructing a calendar before the related incidence exists.
379 
380  @param uid is a QString containing a UID for another incidence.
381  @param relType specifies the relation type.
382 
383  @warning KCalendarCore only supports one related-to field per reltype for now.
384 
385  @see relatedTo().
386  */
387  void setRelatedTo(const QString &uid, RelType relType = RelTypeParent);
388 
389  /**
390  Returns a UID string for the incidence that is related to this one.
391  This function should only be used when constructing a calendar before
392  the related incidence exists.
393 
394  @warning KCalendarCore only supports one related-to field per reltype for now.
395 
396  @param relType specifies the relation type.
397 
398  @see setRelatedTo().
399  */
400  Q_REQUIRED_RESULT QString relatedTo(RelType relType = RelTypeParent) const;
401 
402  /**
403  Set the incidence color, as added in RFC7986.
404 
405  @param colorName a named color as defined in CSS3 color name, see
406  https://www.w3.org/TR/css-color-3/#svg-color.
407  @since: 5.76
408  */
409  void setColor(const QString &colorName);
410 
411  /**
412  Returns the color, if any is defined, for this incidence.
413 
414  @since: 5.76
415  */
416  Q_REQUIRED_RESULT QString color() const;
417 
418 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
419 // %%%%% Convenience wrappers for property handling
420 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
421  /**
422  Returns true if the alternative (=text/html) description is
423  available.
424  @see setAltDescription(), altDescription()
425  */
426  Q_REQUIRED_RESULT bool hasAltDescription() const;
427  /**
428  Sets the incidence's alternative (=text/html) description. If
429  the text is empty, the property is removed.
430 
431  @param altdescription is the incidence altdescription string.
432  @see altAltdescription().
433  */
434  void setAltDescription(const QString &altdescription);
435 
436  /**
437  Returns the incidence alternative (=text/html) description.
438  @see setAltDescription().
439  */
440  Q_REQUIRED_RESULT QString altDescription() const;
441 
442 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
443 // %%%%% Recurrence-related methods
444 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
445 
446  /**
447  Returns the recurrence rule associated with this incidence. If there is
448  none, returns an appropriate (non-0) object.
449  */
450  Recurrence *recurrence() const;
451 
452  /**
453  Removes all recurrence and exception rules and dates.
454  */
455  void clearRecurrence();
456 
457  /**
458  @copydoc Recurrence::recurs()
459  */
460  Q_REQUIRED_RESULT bool recurs() const;
461 
462  /**
463  @copydoc Recurrence::recurrenceType()
464  */
465  Q_REQUIRED_RESULT ushort recurrenceType() const;
466 
467  /**
468  @copydoc Recurrence::recursOn()
469  */
470  virtual bool recursOn(const QDate &date, const QTimeZone &timeZone) const;
471 
472  /**
473  @copydoc Recurrence::recursAt()
474  */
475  Q_REQUIRED_RESULT bool recursAt(const QDateTime &dt) const;
476 
477  /**
478  Calculates the start date/time for all recurrences that happen at some
479  time on the given date (might start before that date, but end on or
480  after the given date).
481 
482  @param date the date when the incidence should occur
483  @param timeSpec time specification for @p date.
484  @return the start date/time of all occurrences that overlap with the
485  given date; an empty list if the incidence does not overlap with the
486  date at all.
487  */
488  virtual QList<QDateTime> startDateTimesForDate(const QDate &date,
489  const QTimeZone &timeZone) const;
490 
491  /**
492  Calculates the start date/time for all recurrences that happen at the
493  given time.
494 
495  @param datetime the date/time when the incidence should occur.
496  @return the start date/time of all occurrences that overlap with the
497  given date/time; an empty list if the incidence does not happen at the
498  given time at all.
499  */
500  Q_REQUIRED_RESULT virtual QList<QDateTime> startDateTimesForDateTime(const QDateTime &datetime) const;
501 
502  /**
503  Returns the end date/time of the incidence occurrence if it starts at
504  specified date/time.
505 
506  @param startDt is the specified starting date/time.
507  @return the corresponding end date/time for the occurrence; or the start
508  date/time if the end date/time is invalid; or the end date/time if
509  the start date/time is invalid.
510  */
511  Q_REQUIRED_RESULT virtual QDateTime endDateForStart(const QDateTime &startDt) const;
512 
513 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514 // %%%%% Attachment-related methods
515 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
516 
517  /**
518  Adds an attachment to the incidence.
519 
520  @param attachment a valid Attachment object.
521  */
522  void addAttachment(const Attachment &attachment);
523 
524  /**
525  Removes all attachments of the specified MIME type from the incidence.
526  The memory used by all the removed attachments is freed.
527 
528  @param mime is a QString containing the MIME type.
529  @see deleteAttachment().
530  */
531  void deleteAttachments(const QString &mime);
532 
533  /**
534  Returns a list of all incidence attachments.
535  @see attachments( const QString &).
536  */
537  Q_REQUIRED_RESULT Attachment::List attachments() const;
538 
539  /**
540  Returns a list of all incidence attachments with the specified MIME type.
541 
542  @param mime is a QString containing the MIME type.
543  @see attachments().
544  */
545  Q_REQUIRED_RESULT Attachment::List attachments(const QString &mime) const;
546 
547  /**
548  Removes all attachments and frees the memory used by them.
549  @see deleteAttachments( const QString &).
550  */
551  void clearAttachments();
552 
553 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
554 // %%%%% Secrecy and Status methods
555 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
556 
557  /**
558  Sets the incidence #Secrecy.
559 
560  @param secrecy is the incidence #Secrecy to set.
561  @see secrecy(), secrecyStr().
562  */
563  void setSecrecy(Secrecy secrecy);
564 
565  /**
566  Returns the incidence #Secrecy.
567  @see setSecrecy(), secrecyStr().
568  */
569  Q_REQUIRED_RESULT Secrecy secrecy() const;
570 
571  /**
572  Sets the incidence status to a standard #Status value.
573  Note that StatusX cannot be specified.
574 
575  @param status is the incidence #Status to set.
576  @see status(), setCustomStatus().
577  */
578  void setStatus(Status status);
579 
580  /**
581  Sets the incidence #Status to a non-standard status value.
582 
583  @param status is a non-standard status string. If empty,
584  the incidence #Status will be set to StatusNone.
585  @see setStatus(), status() customStatus().
586  */
587  void setCustomStatus(const QString &status);
588 
589  /**
590  Returns the non-standard status value.
591  @see setCustomStatus().
592  */
593  Q_REQUIRED_RESULT QString customStatus() const;
594 
595  /**
596  Returns the incidence #Status.
597  @see setStatus(), setCustomStatus(), statusStr().
598  */
599  Q_REQUIRED_RESULT Status status() const;
600 
601 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
602 // %%%%% Other methods
603 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
604 
605  /**
606  Sets a list of incidence resources. (Note: resources in this context
607  means items used by the incidence such as money, fuel, hours, etc).
608 
609  @param resources is a list of resource strings.
610  @see resources().
611  */
612  void setResources(const QStringList &resources);
613 
614  /**
615  Returns the incidence resources as a list of strings.
616  @see setResources().
617  */
618  Q_REQUIRED_RESULT QStringList resources() const;
619 
620  /**
621  Sets the incidences priority. The priority must be an integer value
622  between 0 and 9, where 0 is undefined, 1 is the highest, and 9 is the
623  lowest priority (decreasing order).
624 
625  @param priority is the incidence priority to set.
626  @see priority().
627  */
628  void setPriority(int priority);
629 
630  /**
631  Returns the incidence priority.
632  @see setPriority().
633  */
634  Q_REQUIRED_RESULT int priority() const;
635 
636  /**
637  Returns true if the incidence has geo data, otherwise return false.
638  @see setHasGeo(), setGeoLatitude(float), setGeoLongitude(float).
639  */
640  Q_REQUIRED_RESULT bool hasGeo() const;
641 
642  /**
643  Sets if the incidence has geo data.
644  @param hasGeo true if incidence has geo data, otherwise false
645  @see hasGeo(), geoLatitude(), geoLongitude().
646  */
647  void setHasGeo(bool hasGeo);
648 
649  /**
650  Set the incidences geoLatitude.
651  @param geolatitude is the incidence geolatitude to set
652  @see geoLatitude().
653  */
654  void setGeoLatitude(float geolatitude);
655 
656  /**
657  Returns the incidence geoLatidude.
658  @return incidences geolatitude value
659  @see setGeoLatitude().
660  */
661  Q_REQUIRED_RESULT float geoLatitude() const;
662 
663  /**
664  Set the incidencesgeoLongitude.
665  @param geolongitude is the incidence geolongitude to set
666  @see geoLongitude().
667  */
668  void setGeoLongitude(float geolongitude);
669 
670  /**
671  Returns the incidence geoLongitude.
672  @return incidences geolongitude value
673  @see setGeoLongitude().
674  */
675  Q_REQUIRED_RESULT float geoLongitude() const;
676 
677  /**
678  Returns true if the incidence has recurrenceId, otherwise return false.
679  @see setRecurrenceId(QDateTime)
680  */
681  Q_REQUIRED_RESULT bool hasRecurrenceId() const;
682 
683  /**
684  Set the incidences recurrenceId.
685  This field indicates that this is an exception to a recurring incidence.
686  The uid of this incidence MUST be the same as the one of the recurring main incidence.
687  @param recurrenceId is the incidence recurrenceId to set
688  @see recurrenceId().
689  */
690  void setRecurrenceId(const QDateTime &recurrenceId);
691 
692  /**
693  Returns the incidence recurrenceId.
694  @return incidences recurrenceId value
695  @see setRecurrenceId().
696  */
697  Q_REQUIRED_RESULT QDateTime recurrenceId() const override;
698 
699  /**
700  Set to true if the exception also applies to all future occurrences.
701  This option is only relevant if the incidence has a recurrenceId set.
702  @param thisAndFuture value
703  @see thisAndFuture(), setRecurrenceId()
704  @since 4.11
705  */
706  void setThisAndFuture(bool thisAndFuture);
707 
708  /**
709  Returns true if the exception also applies to all future occurrences.
710  @return incidences thisAndFuture value
711  @see setThisAndFuture()
712  @since 4.11
713  */
714  Q_REQUIRED_RESULT bool thisAndFuture() const;
715 
716 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
717 // %%%%% Alarm-related methods
718 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719 
720  /**
721  Returns a list of all incidence alarms.
722  */
723  Q_REQUIRED_RESULT Alarm::List alarms() const;
724 
725  /**
726  Create a new incidence alarm.
727  */
728  Alarm::Ptr newAlarm();
729 
730  /**
731  Adds an alarm to the incidence.
732 
733  @param alarm is a pointer to a valid Alarm object.
734  @see removeAlarm().
735  */
736  void addAlarm(const Alarm::Ptr &alarm);
737 
738  /**
739  Removes the specified alarm from the incidence.
740 
741  @param alarm is a pointer to a valid Alarm object.
742  @see addAlarm().
743  */
744  void removeAlarm(const Alarm::Ptr &alarm);
745 
746  /**
747  Removes all alarms.
748  @see removeAlarm().
749  */
750  void clearAlarms();
751 
752  /**
753  Returns true if any of the incidence alarms are enabled; false otherwise.
754  */
755  Q_REQUIRED_RESULT bool hasEnabledAlarms() const;
756 
757 
758 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
759 // %%%%% Conferences-related method
760 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
761 
762  /**
763  * Returns list of all incidence conferencing methods.
764  * @since 5.77
765  */
766  Q_REQUIRED_RESULT Conference::List conferences() const;
767 
768  /**
769  * Replaces all conferences in the incidence with given @p conferences
770  *
771  * @param conferences New conferences to store in the incidence.
772  * @since 5.77
773  */
774  void setConferences(const Conference::List &conferences);
775 
776  /**
777  * Adds a conference to the incidence.
778  *
779  * @param conferene A conference to add.
780  * @since 5.77
781  */
782  void addConference(const Conference &conference);
783 
784  /**
785  * Removes all conferences from the incidence.
786  * @since 5.77
787  */
788  void clearConferences();
789 
790 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
791 // %%%%% Other methods
792 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
793 
794  /**
795  Set the incidence scheduling ID. Do _not_ use with journals.
796  This is used for accepted invitations as the place to store the UID
797  of the invitation. It is later used again if updates to the
798  invitation comes in.
799  If we did not set a new UID on incidences from invitations, we can
800  end up with more than one resource having events with the same UID,
801  if you have access to other peoples resources.
802 
803  While constructing an incidence, when setting the scheduling ID,
804  you will always want to set the incidence UID too. Instead of calling
805  setUID() separately, you can pass the UID through @p uid so both
806  members are changed in one atomic operation ( don't forget that
807  setUID() emits incidenceUpdated() and whoever catches that signal
808  will have an half-initialized incidence, therefore, always set
809  the schedulingID and UID at the same time, and never with two separate
810  calls).
811 
812  @param sid is a QString containing the scheduling ID.
813  @param uid is a QString containing the incidence UID to set, if not
814  specified, the current UID isn't changed, and this parameter
815  is ignored.
816  @see schedulingID().
817  */
818  void setSchedulingID(const QString &sid,
819  const QString &uid = QString());
820 
821  /**
822  Returns the incidence scheduling ID. Do _not_ use with journals.
823  If a scheduling ID is not set, then return the incidence UID.
824  @see setSchedulingID().
825  */
826  Q_REQUIRED_RESULT QString schedulingID() const;
827 
828  /**
829  Observer interface for the recurrence class. If the recurrence is
830  changed, this method will be called for the incidence the recurrence
831  object belongs to.
832 
833  @param recurrence is a pointer to a valid Recurrence object.
834  */
835  void recurrenceUpdated(Recurrence *recurrence) override;
836 
837  /**
838  Returns the name of the icon that best represents this incidence.
839 
840  @param recurrenceId Some recurring incidences might use a different icon,
841  for example, completed to-do occurrences. Use this parameter to identify
842  the specific occurrence in a recurring serie.
843  */
844  virtual QLatin1String iconName(const QDateTime &recurrenceId = {}) const = 0;
845 
846  /**
847  * Returns true if the incidence type supports groupware communication.
848  * @since 4.10
849  */
850  virtual bool supportsGroupwareCommunication() const = 0;
851 
852  /**
853  Returns the list of possible mime types in an Incidence object:
854  "text/calendar"
855  "application/x-vnd.akonadi.calendar.event"
856  "application/x-vnd.akonadi.calendar.todo"
857  "application/x-vnd.akonadi.calendar.journal"
858 
859  @since 4.12
860  */
861  Q_REQUIRED_RESULT static QStringList mimeTypes();
862 
863 protected:
864 
865  /**
866  Copy constructor.
867  @param other is the incidence to copy.
868  */
869  Incidence(const Incidence &other);
870 
871  /**
872  Compares this with Incidence @p incidence for equality.
873  @param incidence is the Incidence to compare against.
874  @return true if the incidences are equal; false otherwise.
875  */
876  bool equals(const IncidenceBase &incidence) const override;
877 
878  /**
879  @copydoc IncidenceBase::assign()
880  */
881  IncidenceBase &assign(const IncidenceBase &other) override;
882 
883  void serialize(QDataStream &out) const override;
884  void deserialize(QDataStream &in) override;
885 
886 private:
887  /**
888  Disabled, not polymorphic.
889  Use IncidenceBase::operator= which is safe because it calls
890  virtual function assign.
891  @param other is another Incidence object to assign to this one.
892  */
893  Incidence &operator=(const Incidence &other);
894 
895  Q_DECL_HIDDEN QVariantList attachmentsVariant() const;
896  Q_DECL_HIDDEN QVariantList conferencesVariant() const;
897 
898  //@cond PRIVATE
899  class Private;
900  Private *const d;
901  //@endcond
902 };
903 
904 }
905 
906 //@cond PRIVATE
907 inline uint qHash(const QSharedPointer<KCalendarCore::Incidence> &key)
908 {
909  return qHash(key.data());
910 }
911 //@endcond
912 
913 //@cond PRIVATE
914 Q_DECLARE_TYPEINFO(KCalendarCore::Incidence::Ptr, Q_MOVABLE_TYPE);
915 Q_DECLARE_METATYPE(KCalendarCore::Incidence *)
916 //@endcond
917 
918 #endif
Secrecy
The different types of incidence access classifications.
Definition: incidence.h:97
RelType
The different types of RELTYPE values specified by the RFC.
Definition: incidence.h:108
QSharedPointer< Incidence > Ptr
A shared pointer to an Incidence.
Definition: incidence.h:117
T * data() const const
Represents information related to a conference information of an Calendar Incidence, typically a meeting or task (to-do).
Definition: conference.h:32
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:110
Represents information related to an attachment for a Calendar Incidence.
Definition: attachment.h:47
The related incidence is a parent.
Definition: incidence.h:109
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:86
QVector< Ptr > List
List of incidences.
Definition: incidence.h:122
Status
The different types of overall incidence status or confirmation.
Definition: incidence.h:80
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:57
Namespace for all KCalendarCore types.
Definition: alarm.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Mar 8 2021 22:50:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.