• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KCalCore Library

  • kcalcore
recurrence.h
1/*
2 This file is part of the kcalcore library.
3
4 Copyright (c) 1998 Preston Brown <pbrown@kde.org>
5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
6 Copyright (c) 2002,2006 David Jarvie <software@astrojar.org.uk>
7 Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
23*/
24#ifndef KCALCORE_RECURRENCE_H
25#define KCALCORE_RECURRENCE_H
26
27#include "kcalcore_export.h"
28#include "recurrencerule.h"
29
30class QBitArray;
31
32namespace KCalCore {
33
34class RecurrenceRule;
35
87class KCALCORE_EXPORT Recurrence : public RecurrenceRule::RuleObserver
88{
89public:
90 class RecurrenceObserver
91 {
92 public:
93 virtual ~RecurrenceObserver();
95 virtual void recurrenceUpdated(Recurrence *r) = 0;
96 };
97
99 enum {
100 rNone = 0,
101 rMinutely = 0x001,
102 rHourly = 0x0002,
103 rDaily = 0x0003,
104 rWeekly = 0x0004,
105 rMonthlyPos = 0x0005,
106 rMonthlyDay = 0x0006,
107 rYearlyMonth = 0x0007,
108 rYearlyDay = 0x0008,
109 rYearlyPos = 0x0009,
110 rOther = 0x000A,
111 rMax=0x00FF
112 };
113
117 Recurrence();
118
123 Recurrence(const Recurrence &r);
124
128 ~Recurrence();
129
135 bool operator==(const Recurrence &r) const;
136
142 bool operator!=(const Recurrence &r) const {
143 return !operator==(r);
144 }
145
150 Recurrence &operator=(const Recurrence &r);
151
154 KDateTime startDateTime() const;
156 QDate startDate() const;
162 void setStartDateTime(const KDateTime &start);
163
170 bool allDay() const;
174 void setAllDay(bool allDay);
175
177 void setRecurReadOnly(bool readOnly);
178
180 bool recurReadOnly() const;
181
183 bool recurs() const;
184
187 ushort recurrenceType() const;
188
194 static ushort recurrenceType(const RecurrenceRule *rrule);
195
202 bool recursOn(const QDate &date, const KDateTime::Spec &timeSpec) const;
203
211 bool recursAt(const KDateTime &dt) const;
212
217 void unsetRecurs();
218
222 void clear();
223
230 TimeList recurTimesOn(const QDate &date, const KDateTime::Spec &timeSpec) const;
231
244 DateTimeList timesInInterval(const KDateTime &start, const KDateTime &end) const;
245
252 KDateTime getNextDateTime(const KDateTime &preDateTime) const;
253
262 KDateTime getPreviousDateTime(const KDateTime &afterDateTime) const;
263
265 int frequency() const;
266
268 void setFrequency(int freq);
269
274 int duration() const;
275
278 void setDuration(int duration);
279
283 int durationTo(const KDateTime &dt) const;
284
288 int durationTo(const QDate &date) const;
289
293 KDateTime endDateTime() const;
294
298 QDate endDate() const;
299
303 void setEndDate(const QDate &endDate);
304
307 void setEndDateTime(const KDateTime &endDateTime);
308
323 void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec);
324
335 void setMinutely(int freq);
336
350 void setHourly(int freq);
351
365 void setDaily(int freq);
366
378 void setWeekly(int freq, int weekStart = 1);
391 void setWeekly(int freq, const QBitArray &days, int weekStart = 1);
392
396 void addWeeklyDays(const QBitArray &days);
402 int weekStart() const;
403
405 QBitArray days() const; // Emulate the old behavior
406
421 void setMonthly(int freq);
422
430 void addMonthlyPos(short pos, const QBitArray &days);
431 void addMonthlyPos(short pos, ushort day);
432
437 void addMonthlyDate(short day);
438
440 QList<RecurrenceRule::WDayPos> monthPositions() const;
441
443 // Emulate old behavior
444 QList<int> monthDays() const;
445
468 void setYearly(int freq);
469
476 void addYearlyDay(int day);
477
486 void addYearlyDate(int date);
487
493 void addYearlyMonth(short _rNum);
494
511 void addYearlyPos(short pos, const QBitArray &days);
512
518 QList<int> yearDays() const;
519
527 QList<int> yearDates() const;
528
537 QList<int> yearMonths() const;
538
548 QList<RecurrenceRule::WDayPos> yearPositions() const;
549
551 static const QDate MAX_DATE;
552
556 void dump() const;
557
558 // RRULE
559 RecurrenceRule::List rRules() const;
564 void addRRule(RecurrenceRule *rrule);
565
572 void removeRRule(RecurrenceRule *rrule);
573
578 void deleteRRule(RecurrenceRule *rrule);
579
580 // EXRULE
581 RecurrenceRule::List exRules() const;
582
587 void addExRule(RecurrenceRule *exrule);
588
595 void removeExRule(RecurrenceRule *exrule);
596
601 void deleteExRule(RecurrenceRule *exrule);
602
603 // RDATE
604 DateTimeList rDateTimes() const;
605 DateList rDates() const;
606 void setRDateTimes(const DateTimeList &rdates);
607 void setRDates(const DateList &rdates);
608 void addRDateTime(const KDateTime &rdate);
609 void addRDate(const QDate &rdate);
610
611 // ExDATE
612 DateTimeList exDateTimes() const;
613 DateList exDates() const;
614 void setExDateTimes(const DateTimeList &exdates);
615 void setExDates(const DateList &exdates);
616 void addExDateTime(const KDateTime &exdate);
617 void addExDate(const QDate &exdate);
618
619 RecurrenceRule *defaultRRule(bool create = false) const;
620 RecurrenceRule *defaultRRuleConst() const;
621 void updated();
622
630 void addObserver(RecurrenceObserver *observer);
637 void removeObserver(RecurrenceObserver *observer);
638
639 void recurrenceChanged(RecurrenceRule *);
640
641protected:
642 RecurrenceRule *setNewRecurrenceType(RecurrenceRule::PeriodType type, int freq);
643
644private:
645 //@cond PRIVATE
646 class Private;
647 Private *const d;
648 //@endcond
649
650 friend KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, KCalCore::Recurrence *);
651 friend KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, KCalCore::Recurrence *);
652};
653
658KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, KCalCore::Recurrence *);
659KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, KCalCore::Recurrence *);
660
661}
662
663#endif
KCalCore::RecurrenceRule
This class represents a recurrence rule for a calendar incidence.
Definition: recurrencerule.h:44
KCalCore::RecurrenceRule::PeriodType
PeriodType
enum for describing the frequency how an event recurs, if at all.
Definition: recurrencerule.h:56
KCalCore::Recurrence
This class represents a recurrence rule for a calendar incidence.
Definition: recurrence.h:88
KCalCore::Recurrence::MAX_DATE
static const QDate MAX_DATE
Upper date limit for recurrences.
Definition: recurrence.h:551
KCalCore::Recurrence::operator<<
friend KCALCORE_EXPORT QDataStream & operator<<(QDataStream &out, KCalCore::Recurrence *)
Recurrence serializer and deserializer.
KCalCore::Recurrence::operator!=
bool operator!=(const Recurrence &r) const
Comparison operator for inequality.
Definition: recurrence.h:142
KCalCore::SortableList
A QList which can be sorted.
Definition: sortablelist.h:87
KCalCore
TODO: KDE5:
Definition: alarm.h:47
KCalCore::operator>>
KCALCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:863
KCalCore::operator<<
KCALCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:853
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal