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

KCalCore Library

  • kcalcore
recurrencerule.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,2007 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_RECURRENCERULE_H
25#define KCALCORE_RECURRENCERULE_H
26
27#include "kcalcore_export.h"
28#include "sortablelist.h"
29
30#include <KDE/KDateTime>
31
32namespace KCalCore {
33
34// These two are duplicates wrt. incidencebase.h
35typedef SortableList<KDateTime> DateTimeList;
36typedef SortableList<QDate> DateList;
37/* List of times */
38typedef SortableList<QTime> TimeList;
39
43class KCALCORE_EXPORT RecurrenceRule
44{
45public:
46 class RuleObserver
47 {
48 public:
49 virtual ~RuleObserver();
51 virtual void recurrenceChanged(RecurrenceRule *) = 0;
52 };
53 typedef QList<RecurrenceRule*> List;
54
56 enum PeriodType {
57 rNone = 0,
58 rSecondly,
59 rMinutely,
60 rHourly,
61 rDaily,
62 rWeekly,
63 rMonthly,
64 rYearly
65 };
66
68 class KCALCORE_EXPORT WDayPos //krazy:exclude=dpointer
69 {
70 public:
71 explicit WDayPos(int ps = 0, short dy = 0);
72 void setDay(short dy);
73 short day() const;
74 void setPos(int ps);
75 int pos() const;
76
77 bool operator==(const RecurrenceRule::WDayPos &pos2) const;
78 bool operator!=(const RecurrenceRule::WDayPos &pos2) const;
79
80 protected:
81 short mDay; // Weekday, 1=monday, 7=sunday
82 int mPos; // week of the day (-1 for last, 1 for first, 0 for all weeks)
83 // Bounded by -366 and +366, 0 means all weeks in that period
84
85 friend KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, const KCalCore::RecurrenceRule::WDayPos &);
86 friend KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, KCalCore::RecurrenceRule::WDayPos &);
87 };
88
89 // Q_DECLARE_TYPEINFO(RecurrenceRule::WDayPos, Q_MOVABLE_TYPE) TODO_KDE5
90
91 RecurrenceRule();
92 RecurrenceRule(const RecurrenceRule &r);
93 ~RecurrenceRule();
94
95 bool operator==(const RecurrenceRule &r) const;
96 bool operator!=(const RecurrenceRule &r) const {
97 return !operator==(r);
98 }
99 RecurrenceRule &operator=(const RecurrenceRule &r);
100
102 void setReadOnly(bool readOnly);
103
107 bool isReadOnly() const;
108
113 bool recurs() const;
114 void setRecurrenceType(PeriodType period);
115 PeriodType recurrenceType() const;
116
118 void clear();
119
123 uint frequency() const;
124
128 void setFrequency(int freq);
129
135 KDateTime startDt() const;
136
149 void setStartDt(const KDateTime &start);
150
153 bool allDay() const;
154
159 void setAllDay(bool allDay);
160
166 KDateTime endDt(bool *result = 0) const;
167
170 void setEndDt(const KDateTime &endDateTime);
171
176 int duration() const;
177
180 void setDuration(int duration);
181
183 int durationTo(const KDateTime &dt) const;
184
186 int durationTo(const QDate &date) const;
187
202 void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec);
203
210 bool recursOn(const QDate &date, const KDateTime::Spec &timeSpec) const;
211
218 bool recursAt(const KDateTime &dt) const;
219
227 bool dateMatchesRules(const KDateTime &dt) const;
228
235 TimeList recurTimesOn(const QDate &date, const KDateTime::Spec &timeSpec) const;
236
248 DateTimeList timesInInterval(const KDateTime &start, const KDateTime &end) const;
249
255 KDateTime getNextDate(const KDateTime &preDateTime) const;
256
263 KDateTime getPreviousDate(const KDateTime &afterDateTime) const;
264
265 void setBySeconds(const QList<int> &bySeconds);
266 void setByMinutes(const QList<int> &byMinutes);
267 void setByHours(const QList<int> &byHours);
268
269 void setByDays(const QList<WDayPos> &byDays);
270 void setByMonthDays(const QList<int> &byMonthDays);
271 void setByYearDays(const QList<int> &byYearDays);
272 void setByWeekNumbers(const QList<int> &byWeekNumbers);
273 void setByMonths(const QList<int> &byMonths);
274 void setBySetPos(const QList<int> &bySetPos);
275 void setWeekStart(short weekStart);
276
277 const QList<int> &bySeconds() const;
278 const QList<int> &byMinutes() const;
279 const QList<int> &byHours() const;
280
281 const QList<WDayPos> &byDays() const;
282 const QList<int> &byMonthDays() const;
283 const QList<int> &byYearDays() const;
284 const QList<int> &byWeekNumbers() const;
285 const QList<int> &byMonths() const;
286 const QList<int> &bySetPos() const;
287 short weekStart() const;
288
296 void setRRule(const QString &rrule);
297 QString rrule() const;
298
299 void setDirty();
307 void addObserver(RuleObserver *observer);
308
315 void removeObserver(RuleObserver *observer);
316
320 void dump() const;
321
322private:
323 //@cond PRIVATE
324 class Private;
325 Private *const d;
326 //@endcond
327
328 friend KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, const KCalCore::RecurrenceRule *);
329 friend KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, const KCalCore::RecurrenceRule *);
330};
331
336KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, const KCalCore::RecurrenceRule *);
337KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, const KCalCore::RecurrenceRule *);
338
343KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, const KCalCore::RecurrenceRule::WDayPos &);
344KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, KCalCore::RecurrenceRule::WDayPos &);
345
346}
347
348#endif
KCalCore::RecurrenceRule::WDayPos
structure for describing the n-th weekday of the month/year.
Definition: recurrencerule.h:69
KCalCore::RecurrenceRule::WDayPos::operator<<
friend KCALCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalCore::RecurrenceRule::WDayPos &)
RecurrenceRule::WDayPos serializer and deserializer.
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::RecurrenceRule::operator<<
friend KCALCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalCore::RecurrenceRule *)
RecurrenceRule serializer and deserializer.
KCalCore::SortableList
A QList which can be sorted.
Definition: sortablelist.h:87
KCalCore
TODO: KDE5:
Definition: alarm.h:47
KCalCore::DateTimeList
SortableList< KDateTime > DateTimeList
List of times.
Definition: incidencebase.h:79
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
KCalCore::DateList
SortableList< QDate > DateList
List of dates.
Definition: incidencebase.h:76
sortablelist.h
This file is part of the API for handling calendar data and defines the Sortable List class.
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