KCalendarCore

recurrence.h
1 /*
2  This file is part of the kcalcore library.
3 
4  SPDX-FileCopyrightText: 1998 Preston Brown <[email protected]>
5  SPDX-FileCopyrightText: 2001, 2003 Cornelius Schumacher <[email protected]>
6  SPDX-FileCopyrightText: 2002, 2006 David Jarvie <[email protected]>
7  SPDX-FileCopyrightText: 2005 Reinhold Kainhofer <[email protected]>
8 
9  SPDX-License-Identifier: LGPL-2.0-or-later
10 */
11 #ifndef KCALCORE_RECURRENCE_H
12 #define KCALCORE_RECURRENCE_H
13 
14 #include "kcalendarcore_export.h"
15 #include "recurrencerule.h"
16 
17 class QBitArray;
18 class QTimeZone;
19 
20 namespace KCalendarCore
21 {
22 class RecurrenceRule;
23 
24 /**
25  This class represents a recurrence rule for a calendar incidence.
26 
27  It manages all recurrence rules, recurrence date/times, exception rules
28  and exception date times that can appear inside calendar items.
29  Each recurrence rule and exception rule is represented as an object
30  of type RecurrenceRule.
31 
32  For the simple case where at most one recurrence
33  rule is present, this class provides shortcut methods to set the type:
34  setMinutely()
35  setHourly()
36  setDaily()
37  setWeekly()
38  setMonthly()
39  setYearly()
40  to set/get general information about the recurrence:
41  setEndDate()
42  setEndDateTime()
43  duration()
44  durationTo()
45  setDuration()
46  frequency()
47  setFrequency()
48  and to set/get specific information about the recurrence within the interval:
49  days()
50  monthDays()
51  monthPositions()
52  yearDays()
53  yearDates()
54  yearMonths()
55  yearPositions()
56  addMonthlyPos()
57  addMonthlyDate()
58  addYearlyDay()
59  addYearlyDate()
60  addYearlyPos()
61  addYearlyMonth()
62  These are all available so that you don't have to work on the RecurrenceRule
63  objects themselves.
64  In other words, in that simple situation the interface stays almost the
65  same compared to the old Recurrence class, which allowed only one
66  recurrence rule.
67 
68  As soon as your recurrence consists of multiple recurrence rules or exception
69  rules, you cannot use the methods mentioned above any more (since each rule
70  will have a different type and different settings). If you still call
71  any of them, the set*ly methods will remove all rules and add one rule with
72  the specified type. The add* and the other set* methods will change only
73  the first recurrence rule, but leave the others untouched.
74 */
75 class KCALENDARCORE_EXPORT Recurrence : public RecurrenceRule::RuleObserver
76 {
77 public:
78  class RecurrenceObserver
79  {
80  public:
81  virtual ~RecurrenceObserver();
82  /** This method will be called on each change of the recurrence object */
83  virtual void recurrenceUpdated(Recurrence *r) = 0;
84  };
85 
86  /** enumeration for describing how an event recurs, if at all. */
87  enum {
88  rNone = 0,
89  rMinutely = 0x001,
90  rHourly = 0x0002,
91  rDaily = 0x0003,
92  rWeekly = 0x0004,
93  rMonthlyPos = 0x0005,
94  rMonthlyDay = 0x0006,
95  rYearlyMonth = 0x0007,
96  rYearlyDay = 0x0008,
97  rYearlyPos = 0x0009,
98  rOther = 0x000A,
99  rMax = 0x00FF,
100  };
101 
102  /**
103  Constructs an empty recurrence.
104  */
105  Recurrence();
106 
107  /**
108  Copy constructor.
109  @param r instance to copy from
110  */
111  Recurrence(const Recurrence &r);
112 
113  /**
114  Destructor.
115  */
116  ~Recurrence() override;
117 
118  /**
119  Comparison operator for equality.
120  @param r instance to compare with
121  @return true if recurrences are the same, false otherwise
122  */
123  bool operator==(const Recurrence &r) const;
124 
125  /**
126  Comparison operator for inequality.
127  @param r instance to compare with
128  @return true if recurrences are the different, false if the same
129  */
130  bool operator!=(const Recurrence &r) const
131  {
132  return !operator==(r);
133  }
134 
135 #if KCALENDARCORE_BUILD_DEPRECATED_SINCE(5, 64)
136  /**
137  Assignment operator.
138  @param r the recurrence which will be assigned to this.
139  @deprecated Do not use, will be removed in KF6
140  @warning Broken implementation, do not use!
141  */
142  KCALENDARCORE_DEPRECATED_VERSION(5, 64, "Do not use")
143  Recurrence &operator=(const Recurrence &r);
144 #else
145  Recurrence &operator=(const Recurrence &r) = delete;
146 #endif
147 
148  /** Return the start date/time of the recurrence (Time for all-day recurrences will be 0:00).
149  @return the current start/time of the recurrence. */
150  Q_REQUIRED_RESULT QDateTime startDateTime() const;
151  /** Return the start date/time of the recurrence */
152  Q_REQUIRED_RESULT QDate startDate() const;
153  /** Set start of recurrence.
154  @param start the new start date or date/time of the recurrence.
155  @param isAllDay if true, the recurrence is set to all-day. Otherwise the recurrence is set
156  to non-all-day.
157  */
158  void setStartDateTime(const QDateTime &start, bool isAllDay);
159 
160  /** Set whether the recurrence has no time, just a date.
161  * All-day means -- according to rfc2445 -- that the event has no time
162  * associated.
163  * N.B. This property is derived by default from whether setStartDateTime() is
164  * called with a date-only or date/time parameter.
165  * @return whether the recurrence has a time (false) or it is just a date (true). */
166  Q_REQUIRED_RESULT bool allDay() const;
167  /** Sets whether the dtstart is a all-day (i.e. has no time attached)
168  @param allDay If the recurrence is for all-day item (true) or has a time associated (false).
169  */
170  void setAllDay(bool allDay);
171 
172  /** Set if recurrence is read-only or can be changed. */
173  void setRecurReadOnly(bool readOnly);
174 
175  /** Returns true if the recurrence is read-only, or false if it can be changed. */
176  Q_REQUIRED_RESULT bool recurReadOnly() const;
177 
178  /** Returns whether the event recurs at all. */
179  Q_REQUIRED_RESULT bool recurs() const;
180 
181  /** Returns the event's recurrence status. See the enumeration at the top
182  * of this file for possible values. */
183  Q_REQUIRED_RESULT ushort recurrenceType() const;
184 
185  /** Returns the recurrence status for a recurrence rule.
186  * See the enumeration at the top of this file for possible values.
187  *
188  * @param rrule the recurrence rule to get the type for
189  */
190  static ushort recurrenceType(const RecurrenceRule *rrule);
191 
192  /**
193  Returns true if the date specified is one on which the event will recur.
194 
195  @param date date to check.
196  @param timeZone time zone for the @p date.
197  */
198  bool recursOn(const QDate &date, const QTimeZone &timeZone) const;
199 
200  /**
201  Returns true if the date/time specified is one at which the event will
202  recur. Times are rounded down to the nearest minute to determine the
203  result.
204 
205  @param dt is the date/time to check.
206  */
207  bool recursAt(const QDateTime &dt) const;
208 
209  /**
210  Removes all recurrence rules. Recurrence dates and exceptions are
211  not removed.
212  */
213  void unsetRecurs();
214 
215  /**
216  Removes all recurrence and exception rules and dates.
217  */
218  void clear();
219 
220  /** Returns a list of the times on the specified date at which the
221  * recurrence will occur. The returned times should be interpreted in the
222  * context of @p timeSpec.
223  * @param date the date for which to find the recurrence times
224  * @param timeZone timezone for @p date
225  */
226  Q_REQUIRED_RESULT TimeList recurTimesOn(const QDate &date, const QTimeZone &timeZone) const;
227 
228  /** Returns a list of all the times at which the recurrence will occur
229  * between two specified times.
230  *
231  * There is a (large) maximum limit to the number of times returned. If due to
232  * this limit the list is incomplete, this is indicated by the last entry being
233  * set to an invalid QDateTime value. If you need further values, call the
234  * method again with a start time set to just after the last valid time returned.
235  *
236  * @param start inclusive start of interval
237  * @param end inclusive end of interval
238  * @return list of date/time values
239  */
240  Q_REQUIRED_RESULT QList<QDateTime> timesInInterval(const QDateTime &start, const QDateTime &end) const;
241 
242  /** Returns the start date/time of the earliest recurrence with a start date/time after
243  * the specified date/time.
244  * If the recurrence has no time, the next date after the specified date is returned.
245  * @param preDateTime the date/time after which to find the recurrence.
246  * @return start date/time of next recurrence (strictly later than the given
247  * QDateTime), or invalid date if none.
248  */
249  Q_REQUIRED_RESULT QDateTime getNextDateTime(const QDateTime &preDateTime) const;
250 
251  /** Returns the date and time of the last previous recurrence, before the specified date/time.
252  * If a time later than 00:00:00 is specified and the recurrence has no time, 00:00:00 on
253  * the specified date is returned if that date recurs.
254  *
255  * @param afterDateTime the date/time before which to find the recurrence.
256  * @return date/time of previous recurrence (strictly earlier than the given
257  * QDateTime), or invalid date if none.
258  */
259  Q_REQUIRED_RESULT QDateTime getPreviousDateTime(const QDateTime &afterDateTime) const;
260 
261  /** Returns frequency of recurrence, in terms of the recurrence time period type. */
262  Q_REQUIRED_RESULT int frequency() const;
263 
264  /** Sets the frequency of recurrence, in terms of the recurrence time period type. */
265  void setFrequency(int freq);
266 
267  /**
268  * Returns -1 if the event recurs infinitely, 0 if the end date is set,
269  * otherwise the total number of recurrences, including the initial occurrence.
270  */
271  Q_REQUIRED_RESULT int duration() const;
272 
273  /** Sets the total number of times the event is to occur, including both the
274  * first and last. */
275  void setDuration(int duration);
276 
277  /** Returns the number of recurrences up to and including the date/time specified.
278  * @warning This function can be very time consuming - use it sparingly!
279  */
280  Q_REQUIRED_RESULT int durationTo(const QDateTime &dt) const;
281 
282  /** Returns the number of recurrences up to and including the date specified.
283  * @warning This function can be very time consuming - use it sparingly!
284  */
285  Q_REQUIRED_RESULT int durationTo(const QDate &date) const;
286 
287  /** Returns the date/time of the last recurrence.
288  * An invalid date is returned if the recurrence has no end.
289  */
290  Q_REQUIRED_RESULT QDateTime endDateTime() const;
291 
292  /** Returns the date of the last recurrence.
293  * An invalid date is returned if the recurrence has no end.
294  */
295  Q_REQUIRED_RESULT QDate endDate() const;
296 
297  /** Sets the date of the last recurrence. The end time is set to the recurrence start time.
298  * @param endDate the ending date after which to stop recurring. If the
299  * recurrence is not all-day, the end time will be 23:59.*/
300  void setEndDate(const QDate &endDate);
301 
302  /** Sets the date and time of the last recurrence.
303  * @param endDateTime the ending date/time after which to stop recurring. */
304  void setEndDateTime(const QDateTime &endDateTime);
305 
306  /**
307  Shift the times of the recurrence so that they appear at the same clock
308  time as before but in a new time zone. The shift is done from a viewing
309  time zone rather than from the actual recurrence time zone.
310 
311  For example, shifting a recurrence whose start time is 09:00 America/New York,
312  using an old viewing time zone (@p oldSpec) of Europe/London, to a new time
313  zone (@p newSpec) of Europe/Paris, will result in the time being shifted
314  from 14:00 (which is the London time of the recurrence start) to 14:00 Paris
315  time.
316 
317  @param oldZone the time specification which provides the clock times
318  @param newZone the new time specification
319  */
320  void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone);
321 
322  /** Sets an event to recur minutely. By default infinite recurrence is used.
323  To set an end date use the method setEndDate and to set the number
324  of occurrences use setDuration.
325 
326  This method clears all recurrence rules and adds one rule with a
327  minutely recurrence. All other recurrence components (recurrence
328  date/times, exception date/times and exception rules) are not
329  modified.
330  * @param freq the frequency to recur, e.g. 2 is every other minute
331  */
332  void setMinutely(int freq);
333 
334  /** Sets an event to recur hourly. By default infinite recurrence is used.
335  The minute of the recurrence is taken from the start date (if you
336  need to change it, you will have to modify the defaultRRule's
337  byMinute list manually.
338  To set an end date use the method setEndDate and to set the number
339  of occurrences use setDuration.
340 
341  This method clears all recurrence rules and adds one rule with a
342  hourly recurrence. All other recurrence components (recurrence
343  date/times, exception date/times and exception rules) are not
344  modified.
345  * @param freq the frequency to recur, e.g. 2 is every other hour
346  */
347  void setHourly(int freq);
348 
349  /** Sets an event to recur daily. By default infinite recurrence is used.
350  The minute and second of the recurrence is taken from the start date
351  (if you need to change them, you will have to modify the defaultRRule's
352  byMinute list manually.
353  To set an end date use the method setEndDate and to set the number
354  of occurrences use setDuration.
355 
356  This method clears all recurrence rules and adds one rule with a
357  daily recurrence. All other recurrence components (recurrence
358  date/times, exception date/times and exception rules) are not
359  modified.
360  * @param freq the frequency to recur, e.g. 2 is every other day
361  */
362  void setDaily(int freq);
363 
364  /** Sets an event to recur weekly. By default infinite recurrence is used.
365  To set an end date use the method setEndDate and to set the number
366  of occurrences use setDuration.
367 
368  This method clears all recurrence rules and adds one rule with a
369  weekly recurrence. All other recurrence components (recurrence
370  date/times, exception date/times and exception rules) are not
371  modified.
372  * @param freq the frequency to recur, e.g. every other week etc.
373  * @param weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday).
374  */
375  void setWeekly(int freq, int weekStart = 1);
376  /** Sets an event to recur weekly. By default infinite recurrence is used.
377  To set an end date use the method setEndDate and to set the number
378  of occurrences use setDuration.
379 
380  This method clears all recurrence rules and adds one rule with a
381  weekly recurrence. All other recurrence components (recurrence
382  date/times, exception date/times and exception rules) are not
383  modified.
384  * @param freq the frequency to recur, e.g. every other week etc.
385  * @param days a 7 bit array indicating which days on which to recur (bit 0 = Monday).
386  * @param weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday).
387  */
388  void setWeekly(int freq, const QBitArray &days, int weekStart = 1);
389 
390  /** Adds days to the weekly day recurrence list.
391  * @param days a 7 bit array indicating which days on which to recur (bit 0 = Monday).
392  */
393  void addWeeklyDays(const QBitArray &days);
394  /** Returns the first day of the week. Uses only the
395  * first RRULE if present (i.e. a second RRULE as well as all EXRULES are
396  * ignored!
397  * @return Weekday of the first day of the week (Monday=1 .. Sunday=7)
398  */
399  int weekStart() const;
400 
401  /** Returns week day mask (bit 0 = Monday). */
402  Q_REQUIRED_RESULT QBitArray days() const; // Emulate the old behavior
403 
404  /** Sets an event to recur monthly. By default infinite recurrence is used.
405  The date of the monthly recurrence will be taken from the start date
406  unless you explicitly add one or more recurrence dates with
407  addMonthlyDate or a recurrence position in the month (e.g. first
408  monday) using addMonthlyPos.
409  To set an end date use the method setEndDate and to set the number
410  of occurrences use setDuration.
411 
412  This method clears all recurrence rules and adds one rule with a
413  monthly recurrence. All other recurrence components (recurrence
414  date/times, exception date/times and exception rules) are not
415  modified.
416  * @param freq the frequency to recur, e.g. 3 for every third month.
417  */
418  void setMonthly(int freq);
419 
420  /** Adds a position (e.g. first monday) to the monthly recurrence rule.
421  * @param pos the position in the month for the recurrence, with valid
422  * values being 1-5 (5 weeks max in a month).
423  * @param days the days for the position to recur on (bit 0 = Monday).
424  * Example: pos = 2, and bits 0 and 2 are set in days:
425  * the rule is to repeat every 2nd Monday and Wednesday in the month.
426  */
427  void addMonthlyPos(short pos, const QBitArray &days);
428  void addMonthlyPos(short pos, ushort day);
429 
430  void setMonthlyPos(const QList<RecurrenceRule::WDayPos> &monthlyDays);
431 
432  /** Adds a date (e.g. the 15th of each month) to the monthly day
433  * recurrence list.
434  * @param day the date in the month to recur.
435  */
436  void addMonthlyDate(short day);
437 
438  void setMonthlyDate(const QList<int> &monthlyDays);
439 
440  /** Returns list of day positions in months. */
441  Q_REQUIRED_RESULT QList<RecurrenceRule::WDayPos> monthPositions() const;
442 
443  /** Returns list of day numbers of a month. */
444  // Emulate old behavior
445  Q_REQUIRED_RESULT QList<int> monthDays() const;
446 
447  /** Sets an event to recur yearly. By default, this will recur every year
448  * on the same date (e.g. every year on April 15 if the start date was
449  * April 15).
450  * The day of the year can be specified with addYearlyDay().
451  * The day of the month can be specified with addYearlyByDate
452  * If both a month and a day ar specified with addYearlyMonth and
453  * addYearlyDay, the day is understood as day number within the month.
454  *
455  * A position (e.g. 3rd Sunday of year/month, or last Friday of year/month)
456  * can be specified with addYearlyPos. Again, if a month is specified,
457  * this position is understood as within that month, otherwise within
458  * the year.
459  *
460  * By default infinite recurrence is used. To set an end date use the
461  * method setEndDate and to set the number of occurrences use setDuration.
462 
463  This method clears all recurrence rules and adds one rule with a
464  yearly recurrence. All other recurrence components (recurrence
465  date/times, exception date/times and exception rules) are not
466  modified.
467  * @param freq the frequency to recur, e.g. 3 for every third year.
468  */
469  void setYearly(int freq);
470 
471  /** Adds day number of year within a yearly recurrence.
472  * By default infinite recurrence is used. To set an end date use the
473  * method setEndDate and to set the number of occurrences use setDuration.
474  * @param day the day of the year for the event. E.g. if day is 60, this
475  * means Feb 29 in leap years and March 1 in non-leap years.
476  */
477  void addYearlyDay(int day);
478 
479  void setYearlyDay(const QList<int> &days);
480 
481  /** Adds date within a yearly recurrence. The month(s) for the recurrence
482  * can be specified with addYearlyMonth(), otherwise the month of the
483  * start date is used.
484  *
485  * By default infinite recurrence is used. To set an end date use the
486  * method setEndDate and to set the number of occurrences use setDuration.
487  * @param date the day of the month for the event
488  */
489  void addYearlyDate(int date);
490 
491  void setYearlyDate(const QList<int> &dates);
492 
493  /** Adds month in yearly recurrence. You can specify specific day numbers
494  * within the months (by calling addYearlyDate()) or specific day positions
495  * within the month (by calling addYearlyPos).
496  * @param _rNum the month in which the event shall recur.
497  */
498  void addYearlyMonth(short _rNum);
499 
500  void setYearlyMonth(const QList<int> &months);
501 
502  /** Adds position within month/year within a yearly recurrence. If months
503  * are specified (via addYearlyMonth()), the parameters are understood as
504  * position within these months, otherwise within the year.
505  *
506  * By default infinite recurrence is used.
507  * To set an end date use the method setEndDate and to set the number
508  * of occurrences use setDuration.
509  * @param pos the position in the month/year for the recurrence, with valid
510  * values being 1 to 53 and -1 to -53 (53 weeks max in a year).
511  * @param days the days for the position to recur on (bit 0 = Monday).
512  * Example: pos = 2, and bits 0 and 2 are set in days
513  * If months are specified (via addYearlyMonth), e.g. March, the rule is
514  * to repeat every year on the 2nd Monday and Wednesday of March.
515  * If no months are specified, the fule is to repeat every year on the
516  * 2nd Monday and Wednesday of the year.
517  */
518  void addYearlyPos(short pos, const QBitArray &days);
519 
520  void setYearlyPos(const QList<RecurrenceRule::WDayPos> &days);
521 
522  /** Returns the day numbers within a yearly recurrence.
523  * @return the days of the year for the event. E.g. if the list contains
524  * 60, this means the recurrence happens on day 60 of the year, i.e.
525  * on Feb 29 in leap years and March 1 in non-leap years.
526  */
527  Q_REQUIRED_RESULT QList<int> yearDays() const;
528 
529  /** Returns the dates within a yearly recurrence.
530  * @return the days of the month for the event. E.g. if the list contains
531  * 13, this means the recurrence happens on the 13th of the month.
532  * The months for the recurrence can be obtained through
533  * yearlyMonths(). If this list is empty, the month of the start
534  * date is used.
535  */
536  Q_REQUIRED_RESULT QList<int> yearDates() const;
537 
538  /** Returns the months within a yearly recurrence.
539  * @return the months for the event. E.g. if the list contains
540  * 11, this means the recurrence happens in November.
541  * The days for the recurrence can be obtained either through
542  * yearDates() if they are given as dates within the month or
543  * through yearlyPositions() if they are given as positions within the
544  * month. If none is specified, the date of the start date is used.
545  */
546  Q_REQUIRED_RESULT QList<int> yearMonths() const;
547 
548  /** Returns the positions within a yearly recurrence.
549  * @return the positions for the event, either within a month (if months
550  * are set through addYearlyMonth()) or within the year.
551  * E.g. if the list contains {Pos=3, Day=5}, this means the third
552  * friday. If a month is set this position is understoodas third
553  * Friday in the given months, otherwise as third Friday of the
554  * year.
555  */
556  /** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */
557  Q_REQUIRED_RESULT QList<RecurrenceRule::WDayPos> yearPositions() const;
558 
559  /** Upper date limit for recurrences */
560  static const QDate MAX_DATE;
561 
562  /**
563  Debug output.
564  */
565  void dump() const;
566 
567  // RRULE
568  Q_REQUIRED_RESULT RecurrenceRule::List rRules() const;
569  /**
570  Add a recurrence rule to the recurrence.
571  @param rrule the recurrence rule to add
572  */
573  void addRRule(RecurrenceRule *rrule);
574 
575  /**
576  Remove a recurrence rule from the recurrence.
577  @p rrule is not deleted; it is the responsibility of the caller
578  to ensure that it is deleted.
579  @param rrule the recurrence rule to remove
580  */
581  void removeRRule(RecurrenceRule *rrule);
582 
583  /**
584  Remove a recurrence rule from the recurrence and delete it.
585  @param rrule the recurrence rule to remove
586  */
587  void deleteRRule(RecurrenceRule *rrule);
588 
589  // EXRULE
590  Q_REQUIRED_RESULT RecurrenceRule::List exRules() const;
591 
592  /**
593  Add an exception rule to the recurrence.
594  @param exrule the exception rule to add
595  */
596  void addExRule(RecurrenceRule *exrule);
597 
598  /**
599  Remove an exception rule from the recurrence.
600  @p exrule is not deleted; it is the responsibility of the caller
601  to ensure that it is deleted.
602  @param exrule the exception rule to remove
603  */
604  void removeExRule(RecurrenceRule *exrule);
605 
606  /**
607  Remove an exception rule from the recurrence and delete it.
608  @param exrule the exception rule to remove
609  */
610  void deleteExRule(RecurrenceRule *exrule);
611 
612  // RDATE
613  Q_REQUIRED_RESULT QList<QDateTime> rDateTimes() const;
614  Q_REQUIRED_RESULT DateList rDates() const;
615  void setRDateTimes(const QList<QDateTime> &rdates);
616  void setRDates(const DateList &rdates);
617  void addRDateTime(const QDateTime &rdate);
618  void addRDate(const QDate &rdate);
619 
620  // ExDATE
621  Q_REQUIRED_RESULT QList<QDateTime> exDateTimes() const;
622  Q_REQUIRED_RESULT DateList exDates() const;
623  void setExDateTimes(const QList<QDateTime> &exdates);
624  void setExDates(const DateList &exdates);
625  void addExDateTime(const QDateTime &exdate);
626  void addExDate(const QDate &exdate);
627 
628  RecurrenceRule *defaultRRule(bool create = false) const;
629  RecurrenceRule *defaultRRuleConst() const;
630  void updated();
631 
632  /**
633  Installs an observer. Whenever some setting of this recurrence
634  object is changed, the recurrenceUpdated( Recurrence* ) method
635  of each observer will be called to inform it of changes.
636  @param observer the Recurrence::Observer-derived object, which
637  will be installed as an observer of this object.
638  */
639  void addObserver(RecurrenceObserver *observer);
640  /**
641  Removes an observer that was added with addObserver. If the
642  given object was not an observer, it does nothing.
643  @param observer the Recurrence::Observer-derived object to
644  be removed from the list of observers of this object.
645  */
646  void removeObserver(RecurrenceObserver *observer);
647 
648  void recurrenceChanged(RecurrenceRule *) override;
649 
650 protected:
651  RecurrenceRule *setNewRecurrenceType(RecurrenceRule::PeriodType type, int freq);
652 
653 private:
654  //@cond PRIVATE
655  class Private;
656  Private *const d;
657  //@endcond
658 
659  friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, KCalendarCore::Recurrence *);
660  friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::Recurrence *);
661 };
662 
663 /**
664  * Recurrence serializer and deserializer.
665  * @since 4.12
666  */
667 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, KCalendarCore::Recurrence *);
668 KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::Recurrence *);
669 
670 }
671 
672 #endif
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:821
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:834
PeriodType
enum for describing the frequency how an event recurs, if at all.
bool operator!=(const Recurrence &r) const
Comparison operator for inequality.
Definition: recurrence.h:130
This class represents a recurrence rule for a calendar incidence.
Definition: recurrence.h:75
static const QDate MAX_DATE
Upper date limit for recurrences.
Definition: recurrence.h:560
This class represents a recurrence rule for a calendar incidence.
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 Wed Apr 14 2021 22:50:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.