24 #ifndef KCAL_RECURRENCERULE_H
25 #define KCAL_RECURRENCERULE_H
27 #include "kcal_export.h"
31 #include <kdatetime.h>
33 #include <QtCore/QList>
38 typedef SortableList<KDateTime> DateTimeList;
39 typedef SortableList<QDate> DateList;
41 typedef SortableList<QTime> TimeList;
52 virtual ~RuleObserver() {}
74 explicit WDayPos(
int ps = 0,
short dy = 0 ) : mDay( dy ), mPos( ps ) {}
75 short day()
const {
return mDay; }
76 int pos()
const {
return mPos; }
77 void setDay(
short dy ) { mDay = dy; }
78 void setPos(
int ps ) { mPos = ps; }
81 return mDay == pos2.mDay && mPos == pos2.mPos;
95 bool operator!=(
const RecurrenceRule &r )
const {
return !operator==(r); }
99 void setReadOnly(
bool readOnly );
104 bool isReadOnly()
const;
111 void setRecurrenceType( PeriodType period );
112 PeriodType recurrenceType()
const;
120 uint frequency()
const;
125 void setFrequency(
int freq );
132 KDateTime startDt()
const;
145 void setStartDt(
const KDateTime &start );
155 void setAllDay(
bool allDay );
162 KDateTime endDt(
bool *result = 0 )
const;
166 void setEndDt(
const KDateTime &endDateTime );
172 int duration()
const;
176 void setDuration(
int duration );
179 int durationTo(
const KDateTime &dt )
const;
182 int durationTo(
const QDate &date )
const;
198 void shiftTimes(
const KDateTime::Spec &oldSpec,
const KDateTime::Spec &newSpec );
206 bool recursOn(
const QDate &date,
const KDateTime::Spec &timeSpec )
const;
214 bool recursAt(
const KDateTime &dt )
const;
223 bool dateMatchesRules(
const KDateTime &dt )
const;
231 TimeList recurTimesOn(
const QDate &date,
const KDateTime::Spec &timeSpec )
const;
244 DateTimeList timesInInterval(
const KDateTime &start,
const KDateTime &end )
const;
251 KDateTime getNextDate(
const KDateTime &preDateTime )
const;
259 KDateTime getPreviousDate(
const KDateTime &afterDateTime )
const;
261 void setBySeconds(
const QList<int> bySeconds );
262 void setByMinutes(
const QList<int> byMinutes );
263 void setByHours(
const QList<int> byHours );
265 void setByDays(
const QList<WDayPos> byDays );
266 void setByMonthDays(
const QList<int> byMonthDays );
267 void setByYearDays(
const QList<int> byYearDays );
268 void setByWeekNumbers(
const QList<int> byWeekNumbers );
269 void setByMonths(
const QList<int> byMonths );
270 void setBySetPos(
const QList<int> bySetPos );
271 void setWeekStart(
short weekStart );
273 const QList<int> &bySeconds()
const;
274 const QList<int> &byMinutes()
const;
275 const QList<int> &byHours()
const;
277 const QList<WDayPos> &byDays()
const;
278 const QList<int> &byMonthDays()
const;
279 const QList<int> &byYearDays()
const;
280 const QList<int> &byWeekNumbers()
const;
281 const QList<int> &byMonths()
const;
282 const QList<int> &bySetPos()
const;
283 short weekStart()
const;
292 void setRRule(
const QString &rrule );
293 QString rrule()
const;
303 void addObserver( RuleObserver *observer );
311 void removeObserver( RuleObserver *observer );
This file is part of the API for handling calendar data and defines the Sortable List class...
structure for describing the n-th weekday of the month/year.
This file is part of the API for handling calendar data and defines the ListBase class.
This class provides a template for lists of pointers.
A QList which can be sorted.
PeriodType
enum for describing the frequency how an event recurs, if at all.
This class represents a recurrence rule for a calendar incidence.