24 #ifndef KCAL_RECURRENCE_H
25 #define KCAL_RECURRENCE_H
28 #include <tqbitarray.h>
29 #include <tqptrlist.h>
31 #include "libkcal_export.h"
32 #include "recurrencerule.h"
89 class LIBKCAL_EXPORT
Recurrence :
public RecurrenceRule::Observer
94 virtual ~Observer() {}
96 virtual void recurrenceUpdated(
Recurrence * ) = 0;
100 enum { rNone = 0, rMinutely = 0x001, rHourly = 0x0002, rDaily = 0x0003,
101 rWeekly = 0x0004, rMonthlyPos = 0x0005, rMonthlyDay = 0x0006,
102 rYearlyMonth = 0x0007, rYearlyDay = 0x0008, rYearlyPos = 0x0009,
103 rOther = 0x000A, rMax=0x00FF };
110 bool operator!=(
const Recurrence& r )
const {
return !operator==(r); }
114 TQDateTime startDateTime()
const;
116 TQDate
startDate()
const {
return mStartDateTime.date(); }
120 void setStartDateTime(
const TQDateTime &start );
124 void setStartDate(
const TQDate &start );
136 void setFloats(
bool floats );
144 bool doesRecur()
const;
147 ushort recurrenceType()
const;
153 bool recursOn(
const TQDate &qd )
const;
156 bool recursAt(
const TQDateTime & )
const;
167 TQValueList<TQTime> recurTimesOn(
const TQDate &date)
const;
181 DateTimeList timesInInterval(
const TQDateTime &start,
const TQDateTime &end )
const;
189 TQDateTime getNextDateTime(
const TQDateTime& preDateTime )
const;
196 TQDateTime getPreviousDateTime(
const TQDateTime& afterDateTime )
const;
199 int frequency()
const;
201 void setFrequency(
int freq);
207 int duration()
const;
210 void setDuration(
int duration);
212 int durationTo(
const TQDateTime &)
const;
219 TQDateTime endDateTime()
const;
223 TQDate endDate()
const;
227 void setEndDate(
const TQDate &endDate );
230 void setEndDateTime(
const TQDateTime &endDateTime );
244 void setMinutely(
int freq );
259 void setHourly(
int freq );
274 void setDaily(
int freq );
287 void setWeekly(
int freq,
int weekStart = 1 );
300 void setWeekly(
int freq,
const TQBitArray &days,
int weekStart = 1 );
304 void addWeeklyDays(
const TQBitArray &days );
310 int weekStart()
const;
312 TQBitArray days()
const;
328 void setMonthly(
int freq );
336 void addMonthlyPos(
short pos,
const TQBitArray &days );
337 void addMonthlyPos(
short pos, ushort day );
342 void addMonthlyDate(
short day );
344 TQValueList<RecurrenceRule::WDayPos> monthPositions()
const;
347 TQValueList<int> monthDays()
const;
371 void setYearly(
int freq );
378 void addYearlyDay(
int day );
387 void addYearlyDate(
int date );
393 void addYearlyMonth(
short _rNum );
410 void addYearlyPos(
short pos,
const TQBitArray &days );
417 TQValueList<int> yearDays()
const;
425 TQValueList<int> yearDates()
const;
434 TQValueList<int> yearMonths()
const;
444 TQValueList<RecurrenceRule::WDayPos> yearPositions()
const;
465 DateTimeList rDateTimes()
const;
466 DateList rDates()
const;
467 void setRDateTimes(
const DateTimeList &rdates);
468 void setRDates(
const DateList &rdates);
469 void addRDateTime(
const TQDateTime &rdate );
470 void addRDate(
const TQDate &rdate );
473 DateTimeList exDateTimes()
const;
474 DateList exDates()
const;
475 void setExDateTimes(
const DateTimeList &exdates);
476 void setExDates(
const DateList &exdates);
477 void addExDateTime(
const TQDateTime &exdate );
478 void addExDate(
const TQDate &exdate );
491 void addObserver( Observer *observer );
498 void removeObserver( Observer *observer );
508 TQValueList<TQDateTime>mRDateTimes;
509 TQValueList<TQDate> mRDates;
510 TQValueList<TQDateTime> mExDateTimes;
511 TQValueList<TQDate> mExDates;
513 TQDateTime mStartDateTime;
518 mutable ushort mCachedType;
520 TQValueList<Observer*> mObservers;
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.
static const TQDate MAX_DATE
Upper date limit for recurrences.
TQDate startDate() const
Return the start date/time of the recurrence.
void setRecurReadOnly(bool readOnly)
Set if recurrence is read-only or can be changed.
bool recurReadOnly() const
Returns true if the recurrence is read-only, or false if it can be changed.
int durationTo(const TQDate &date) const
Returns the number of recurrences up to and including the date specified.
bool doesFloat() const
Set whether the recurrence has no time, just a date.
Namespace KCal is for global classes, objects and/or functions in libkcal.