KCalendarCore

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

KDE's Doxygen guidelines are available online.