24 #include "recurrence.h"
28 #include <QtCore/QBitArray>
29 #include <QtCore/QTime>
31 using namespace KCalCore;
34 class KCalCore::Recurrence::Private
38 : mCachedType( rMax ),
40 mRecurReadOnly( false )
44 Private(
const Private &p )
45 : mRDateTimes( p.mRDateTimes ),
47 mExDateTimes( p.mExDateTimes ),
48 mExDates( p.mExDates ),
49 mStartDateTime( p.mStartDateTime ),
50 mCachedType( p.mCachedType ),
52 mRecurReadOnly( p.mRecurReadOnly )
56 bool operator==(
const Private &p )
const;
58 RecurrenceRule::List mExRules;
59 RecurrenceRule::List mRRules;
64 KDateTime mStartDateTime;
65 QList<RecurrenceObserver*> mObservers;
68 mutable ushort mCachedType;
74 bool Recurrence::Private::operator==(
const Recurrence::Private &p )
const
76 kDebug() << mStartDateTime << p.mStartDateTime;
78 if ( ( mStartDateTime != p.mStartDateTime &&
79 ( mStartDateTime.isValid() || p.mStartDateTime.isValid() ) ) ||
80 mAllDay != p.mAllDay ||
81 mRecurReadOnly != p.mRecurReadOnly ||
82 mExDates != p.mExDates ||
83 mExDateTimes != p.mExDateTimes ||
84 mRDates != p.mRDates ||
85 mRDateTimes != p.mRDateTimes ) {
92 int end = mRRules.count();
93 if ( end != p.mRRules.count() ) {
96 for ( i = 0; i < end; ++i ) {
97 if ( *mRRules[i] != *p.mRRules[i] ) {
101 end = mExRules.count();
102 if ( end != p.mExRules.count() ) {
105 for ( i = 0; i < end; ++i ) {
106 if ( *mExRules[i] != *p.mExRules[i] ) {
121 d( new KCalCore::
Recurrence::Private( *r.d ) )
124 for ( i = 0, end = r.d->mRRules.count(); i < end; ++i ) {
126 d->mRRules.append( rule );
129 for ( i = 0, end = r.d->mExRules.count(); i < end; ++i ) {
131 d->mExRules.append( rule );
138 qDeleteAll( d->mExRules );
139 qDeleteAll( d->mRRules );
145 return *d == *recurrence.d;
151 if ( &recurrence ==
this ) {
161 if ( !d->mObservers.contains( observer ) ) {
162 d->mObservers.append( observer );
168 if ( d->mObservers.contains( observer ) ) {
169 d->mObservers.removeAll( observer );
175 return d->mStartDateTime;
185 if ( d->mRecurReadOnly || allDay == d->mAllDay ) {
190 for (
int i = 0, end = d->mRRules.count(); i < end; ++i ) {
191 d->mRRules[i]->setAllDay( allDay );
193 for (
int i = 0, end = d->mExRules.count(); i < end; ++i ) {
194 d->mExRules[i]->setAllDay( allDay );
201 if ( d->mRRules.isEmpty() ) {
202 if ( !create || d->mRecurReadOnly ) {
210 return d->mRRules[0];
216 return d->mRRules.isEmpty() ? 0 : d->mRRules[0];
219 void Recurrence::updated()
222 d->mCachedType = rMax;
223 for (
int i = 0, end = d->mObservers.count(); i < end; ++i ) {
224 if ( d->mObservers[i] ) {
225 d->mObservers[i]->recurrenceUpdated(
this );
232 return !d->mRRules.isEmpty() || !d->mRDates.isEmpty() || !d->mRDateTimes.isEmpty();
237 if ( d->mCachedType == rMax ) {
240 return d->mCachedType;
251 if ( !rrule->bySetPos().isEmpty() ||
252 !rrule->bySeconds().isEmpty() ||
253 !rrule->byWeekNumbers().isEmpty() ) {
259 if ( !rrule->byMinutes().isEmpty() || !rrule->byHours().isEmpty() ) {
268 if ( ( !rrule->byYearDays().isEmpty() && type != RecurrenceRule::rYearly ) ||
269 ( !rrule->byMonths().isEmpty() && type != RecurrenceRule::rYearly ) ) {
272 if ( !rrule->byDays().isEmpty() ) {
273 if ( type != RecurrenceRule::rYearly &&
274 type != RecurrenceRule::rMonthly &&
275 type != RecurrenceRule::rWeekly ) {
281 case RecurrenceRule::rNone:
283 case RecurrenceRule::rMinutely:
285 case RecurrenceRule::rHourly:
287 case RecurrenceRule::rDaily:
289 case RecurrenceRule::rWeekly:
291 case RecurrenceRule::rMonthly:
293 if ( rrule->byDays().isEmpty() ) {
295 }
else if ( rrule->byMonthDays().isEmpty() ) {
301 case RecurrenceRule::rYearly:
307 if ( !rrule->byDays().isEmpty() ) {
309 if ( rrule->byMonthDays().isEmpty() && rrule->byYearDays().isEmpty() ) {
314 }
else if ( !rrule->byYearDays().isEmpty() ) {
316 if ( rrule->byMonths().isEmpty() && rrule->byMonthDays().isEmpty() ) {
326 default:
return rOther;
334 if ( KDateTime( qd, QTime( 23, 59, 59 ), timeSpec ) < d->mStartDateTime ) {
339 if ( d->mExDates.containsSorted( qd ) ) {
348 for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
349 if ( d->mExRules[i]->recursOn( qd, timeSpec ) ) {
355 if ( d->mRDates.containsSorted( qd ) ) {
361 for ( i = 0, end = d->mRDateTimes.count(); i < end && !
recurs; ++i ) {
362 recurs = ( d->mRDateTimes[i].toTimeSpec( timeSpec ).date() == qd );
364 for ( i = 0, end = d->mRRules.count(); i < end && !
recurs; ++i ) {
365 recurs = d->mRRules[i]->recursOn( qd, timeSpec );
374 for ( i = 0, end = d->mExDateTimes.count(); i < end && !exon; ++i ) {
375 exon = ( d->mExDateTimes[i].toTimeSpec( timeSpec ).date() == qd );
378 for ( i = 0, end = d->mExRules.count(); i < end && !exon; ++i ) {
379 exon = d->mExRules[i]->recursOn( qd, timeSpec );
392 return !timesForDay.isEmpty();
399 KDateTime dtrecur = dt.toTimeSpec( d->mStartDateTime.timeSpec() );
402 if ( d->mExDateTimes.containsSorted( dtrecur ) ||
403 d->mExDates.containsSorted( dtrecur.date() ) ) {
407 for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
408 if ( d->mExRules[i]->recursAt( dtrecur ) ) {
414 if (
startDateTime() == dtrecur || d->mRDateTimes.containsSorted( dtrecur ) ) {
417 for ( i = 0, end = d->mRRules.count(); i < end; ++i ) {
418 if ( d->mRRules[i]->recursAt( dtrecur ) ) {
433 if ( !d->mRDates.isEmpty() ) {
434 dts << KDateTime( d->mRDates.last(), QTime( 0, 0, 0 ), d->mStartDateTime.timeSpec() );
436 if ( !d->mRDateTimes.isEmpty() ) {
437 dts << d->mRDateTimes.last();
439 for (
int i = 0, end = d->mRRules.count(); i < end; ++i ) {
440 KDateTime rl( d->mRRules[i]->endDt() );
442 if ( !rl.isValid() ) {
448 return dts.isEmpty() ? KDateTime() : dts.last();
457 return end.isValid() ? end.date() : QDate();
462 KDateTime dt( date, d->mStartDateTime.time(), d->mStartDateTime.timeSpec() );
464 dt.setTime( QTime( 23, 59, 59 ) );
471 if ( d->mRecurReadOnly ) {
485 return rrule ? rrule->
duration() : 0;
492 return rrule ? rrule->
durationTo( datetime ) : 0;
497 return durationTo( KDateTime( date, QTime( 23, 59, 59 ), d->mStartDateTime.timeSpec() ) );
502 if ( d->mRecurReadOnly ) {
516 if ( d->mRecurReadOnly ) {
520 d->mStartDateTime = d->mStartDateTime.toTimeSpec( oldSpec );
521 d->mStartDateTime.setTimeSpec( newSpec );
524 for ( i = 0, end = d->mRDateTimes.count(); i < end; ++i ) {
525 d->mRDateTimes[i] = d->mRDateTimes[i].toTimeSpec( oldSpec );
526 d->mRDateTimes[i].setTimeSpec( newSpec );
528 for ( i = 0, end = d->mExDateTimes.count(); i < end; ++i ) {
529 d->mExDateTimes[i] = d->mExDateTimes[i].toTimeSpec( oldSpec );
530 d->mExDateTimes[i].setTimeSpec( newSpec );
532 for ( i = 0, end = d->mRRules.count(); i < end; ++i ) {
533 d->mRRules[i]->shiftTimes( oldSpec, newSpec );
535 for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
536 d->mExRules[i]->shiftTimes( oldSpec, newSpec );
542 if ( d->mRecurReadOnly ) {
545 qDeleteAll( d->mRRules );
552 if ( d->mRecurReadOnly ) {
555 qDeleteAll( d->mRRules );
557 qDeleteAll( d->mExRules );
560 d->mRDateTimes.clear();
562 d->mExDateTimes.clear();
563 d->mCachedType = rMax;
569 d->mRecurReadOnly = readOnly;
574 return d->mRecurReadOnly;
579 return d->mStartDateTime.date();
584 if ( d->mRecurReadOnly ) {
587 d->mStartDateTime = start;
591 for ( i = 0, end = d->mRRules.count(); i < end; ++i ) {
592 d->mRRules[i]->setStartDt( start );
594 for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
595 d->mExRules[i]->setStartDt( start );
610 if ( d->mRecurReadOnly || freq <= 0 ) {
626 return rrule ? rrule->weekStart() : 1;
636 QList<RecurrenceRule::WDayPos> bydays = rrule->byDays();
637 for (
int i = 0; i < bydays.size(); ++i ) {
638 if ( bydays.at( i ).pos() == 0 ) {
639 days.setBit( bydays.at( i ).day() - 1 );
653 return rrule->byMonthDays();
663 return rrule ? rrule->byDays() : QList<RecurrenceRule::WDayPos>();
671 return rrule ? rrule->byYearDays() : QList<int>();
682 return rrule ? rrule->byMonths() : QList<int>();
692 if ( d->mRecurReadOnly || freq <= 0 ) {
696 qDeleteAll( d->mRRules );
703 rrule->setRecurrenceType( type );
711 if ( setNewRecurrenceType( RecurrenceRule::rMinutely, _rFreq ) ) {
718 if ( setNewRecurrenceType( RecurrenceRule::rHourly, _rFreq ) ) {
725 if ( setNewRecurrenceType( RecurrenceRule::rDaily, _rFreq ) ) {
732 RecurrenceRule *rrule = setNewRecurrenceType( RecurrenceRule::rWeekly, freq );
736 rrule->setWeekStart( weekStart );
753 if ( setNewRecurrenceType( RecurrenceRule::rMonthly, freq ) ) {
761 if ( d->mRecurReadOnly || pos > 53 || pos < -53 ) {
769 bool changed =
false;
770 QList<RecurrenceRule::WDayPos> positions = rrule->byDays();
772 for (
int i = 0; i < 7; ++i ) {
773 if ( days.testBit( i ) ) {
775 if ( !positions.contains( p ) ) {
777 positions.append( p );
782 rrule->setByDays( positions );
790 if ( d->mRecurReadOnly || pos > 53 || pos < -53 ) {
798 QList<RecurrenceRule::WDayPos> positions = rrule->byDays();
801 if ( !positions.contains( p ) ) {
802 positions.append( p );
803 rrule->setByDays( positions );
810 if ( d->mRecurReadOnly || day > 31 || day < -31 ) {
819 QList<int>
monthDays = rrule->byMonthDays();
820 if ( !monthDays.contains( day ) ) {
821 monthDays.append( day );
822 rrule->setByMonthDays( monthDays );
829 if ( setNewRecurrenceType( RecurrenceRule::rYearly, freq ) ) {
842 QList<int>
days = rrule->byYearDays();
843 if ( !days.contains( day ) ) {
845 rrule->setByYearDays( days );
865 if ( d->mRecurReadOnly || month < 1 || month > 12 ) {
874 QList<int> months = rrule->byMonths();
875 if ( !months.contains( month ) ) {
877 rrule->setByMonths( months );
889 if ( d->mExDates.containsSorted( date ) ) {
896 for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
897 if ( d->mExRules[i]->recursOn( date, timeSpec ) ) {
904 if ( dt.date() == date ) {
908 bool foundDate =
false;
909 for ( i = 0, end = d->mRDateTimes.count(); i < end; ++i ) {
910 dt = d->mRDateTimes[i].toTimeSpec( timeSpec );
911 if ( dt.date() == date ) {
914 }
else if ( foundDate ) {
918 for ( i = 0, end = d->mRRules.count(); i < end; ++i ) {
919 times += d->mRRules[i]->recurTimesOn( date, timeSpec );
925 for ( i = 0, end = d->mExDateTimes.count(); i < end; ++i ) {
926 dt = d->mExDateTimes[i].toTimeSpec( timeSpec );
927 if ( dt.date() == date ) {
928 extimes << dt.time();
930 }
else if ( foundDate ) {
935 for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
936 extimes += d->mExRules[i]->recurTimesOn( date, timeSpec );
942 for ( i = 0, end = extimes.count(); i < end; ++i ) {
955 for ( i = 0, count = d->mRRules.count(); i < count; ++i ) {
956 times += d->mRRules[i]->timesInInterval( start, end );
960 for ( i = 0, count = d->mRDateTimes.count(); i < count; ++i ) {
961 if ( d->mRDateTimes[i] >= start && d->mRDateTimes[i] <= end ) {
962 times += d->mRDateTimes[i];
967 KDateTime kdt( d->mStartDateTime );
968 for ( i = 0, count = d->mRDates.count(); i < count; ++i ) {
969 kdt.setDate( d->mRDates[i] );
970 if ( kdt >= start && kdt <= end ) {
980 if ( ( !d->mRDates.isEmpty() || !d->mRDateTimes.isEmpty() ) &&
981 d->mRRules.isEmpty() &&
982 start <= d->mStartDateTime &&
983 end >= d->mStartDateTime ) {
984 times += d->mStartDateTime;
991 int enddt = times.count();
992 for ( i = 0, count = d->mExDates.count(); i < count && idt < enddt; ++i ) {
993 while ( idt < enddt && times[idt].date() < d->mExDates[i] ) {
996 while ( idt < enddt && times[idt].date() == d->mExDates[i] ) {
997 times.removeAt( idt );
1002 for ( i = 0, count = d->mExRules.count(); i < count; ++i ) {
1003 extimes += d->mExRules[i]->timesInInterval( start, end );
1005 extimes += d->mExDateTimes;
1009 for ( i = 0, count = extimes.count(); i < count; ++i ) {
1021 KDateTime nextDT = preDateTime;
1028 while ( loop < 1000 ) {
1048 int i = d->mRDateTimes.findGT( nextDT );
1050 dates << d->mRDateTimes[i];
1054 for ( i = 0, end = d->mRDates.count(); i < end; ++i ) {
1055 kdt.setDate( d->mRDates[i] );
1056 if ( kdt > nextDT ) {
1063 for ( i = 0, end = d->mRRules.count(); i < end; ++i ) {
1064 KDateTime dt = d->mRRules[i]->getNextDate( nextDT );
1065 if ( dt.isValid() ) {
1072 if ( dates.isEmpty() ) {
1075 nextDT = dates.first();
1078 if ( !d->mExDates.containsSorted( nextDT.date() ) &&
1079 !d->mExDateTimes.containsSorted( nextDT ) ) {
1080 bool allowed =
true;
1081 for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
1082 allowed = allowed && !( d->mExRules[i]->recursAt( nextDT ) );
1096 KDateTime prevDT = afterDateTime;
1101 while ( loop < 1000 ) {
1118 int i = d->mRDateTimes.findLT( prevDT );
1120 dates << d->mRDateTimes[i];
1124 for ( i = d->mRDates.count(); --i >= 0; ) {
1125 kdt.setDate( d->mRDates[i] );
1126 if ( kdt < prevDT ) {
1134 for ( i = 0, end = d->mRRules.count(); i < end; ++i ) {
1135 KDateTime dt = d->mRRules[i]->getPreviousDate( prevDT );
1136 if ( dt.isValid() ) {
1143 if ( dates.isEmpty() ) {
1146 prevDT = dates.last();
1149 if ( !d->mExDates.containsSorted( prevDT.date() ) &&
1150 !d->mExDateTimes.containsSorted( prevDT ) ) {
1151 bool allowed =
true;
1152 for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
1153 allowed = allowed && !( d->mExRules[i]->recursAt( prevDT ) );
1167 RecurrenceRule::List Recurrence::rRules()
const
1174 if ( d->mRecurReadOnly || !rrule ) {
1179 d->mRRules.append( rrule );
1186 if (d->mRecurReadOnly) {
1190 d->mRRules.removeAll( rrule );
1197 if (d->mRecurReadOnly) {
1201 d->mRRules.removeAll( rrule );
1206 RecurrenceRule::List Recurrence::exRules()
const
1213 if ( d->mRecurReadOnly || !exrule ) {
1218 d->mExRules.append( exrule );
1225 if ( d->mRecurReadOnly ) {
1229 d->mExRules.removeAll( exrule );
1236 if ( d->mRecurReadOnly ) {
1240 d->mExRules.removeAll( exrule );
1247 return d->mRDateTimes;
1250 void Recurrence::setRDateTimes(
const DateTimeList &rdates )
1252 if ( d->mRecurReadOnly ) {
1256 d->mRDateTimes = rdates;
1261 void Recurrence::addRDateTime(
const KDateTime &rdate )
1263 if ( d->mRecurReadOnly ) {
1267 d->mRDateTimes.insertSorted( rdate );
1271 DateList Recurrence::rDates()
const
1276 void Recurrence::setRDates(
const DateList &rdates )
1278 if ( d->mRecurReadOnly ) {
1282 d->mRDates = rdates;
1287 void Recurrence::addRDate(
const QDate &rdate )
1289 if ( d->mRecurReadOnly ) {
1293 d->mRDates.insertSorted( rdate );
1299 return d->mExDateTimes;
1302 void Recurrence::setExDateTimes(
const DateTimeList &exdates )
1304 if ( d->mRecurReadOnly ) {
1308 d->mExDateTimes = exdates;
1312 void Recurrence::addExDateTime(
const KDateTime &exdate )
1314 if ( d->mRecurReadOnly ) {
1318 d->mExDateTimes.insertSorted( exdate );
1322 DateList Recurrence::exDates()
const
1327 void Recurrence::setExDates(
const DateList &exdates )
1329 if ( d->mRecurReadOnly ) {
1333 d->mExDates = exdates;
1338 void Recurrence::addExDate(
const QDate &exdate )
1340 if ( d->mRecurReadOnly ) {
1344 d->mExDates.insertSorted( exdate );
1360 int count = d->mRRules.count();
1361 kDebug() <<
" -)" << count <<
"RRULEs:";
1362 for ( i = 0; i < count; ++i ) {
1363 kDebug() <<
" -) RecurrenceRule: ";
1364 d->mRRules[i]->dump();
1366 count = d->mExRules.count();
1367 kDebug() <<
" -)" << count <<
"EXRULEs:";
1368 for ( i = 0; i < count; ++i ) {
1369 kDebug() <<
" -) ExceptionRule :";
1370 d->mExRules[i]->dump();
1373 count = d->mRDates.count();
1374 kDebug() << endl <<
" -)" << count <<
"Recurrence Dates:";
1375 for ( i = 0; i < count; ++i ) {
1376 kDebug() <<
" " << d->mRDates[i];
1378 count = d->mRDateTimes.count();
1379 kDebug() << endl <<
" -)" << count <<
"Recurrence Date/Times:";
1380 for ( i = 0; i < count; ++i ) {
1381 kDebug() <<
" " << d->mRDateTimes[i].dateTime();
1383 count = d->mExDates.count();
1384 kDebug() << endl <<
" -)" << count <<
"Exceptions Dates:";
1385 for ( i = 0; i < count; ++i ) {
1386 kDebug() <<
" " << d->mExDates[i];
1388 count = d->mExDateTimes.count();
1389 kDebug() << endl <<
" -)" << count <<
"Exception Date/Times:";
1390 for ( i = 0; i < count; ++i ) {
1391 kDebug() <<
" " << d->mExDateTimes[i].dateTime();
1395 Recurrence::RecurrenceObserver::~RecurrenceObserver()
void addWeeklyDays(const QBitArray &days)
Adds days to the weekly day recurrence list.
void setFrequency(int freq)
Sets the recurrence frequency, in terms of the recurrence time period type.
structure for describing the n-th weekday of the month/year.
void addYearlyDay(int day)
Adds day number of year within a yearly recurrence.
Recurrence()
Constructs an empty recurrence.
bool operator==(const Recurrence &r) const
Comparison operator for equality.
void setDuration(int duration)
Sets the total number of times the event is to occur, including both the first and last...
void setStartDateTime(const KDateTime &start)
Set start of recurrence.
QDate startDate() const
Return the start date/time of the recurrence.
void removeObserver(RecurrenceObserver *observer)
Removes an observer that was added with addObserver.
void setDuration(int duration)
Sets the total number of times the event is to occur, including both the first and last...
void sortUnique()
Sort the list.
QList< int > yearDays() const
Returns the day numbers within a yearly recurrence.
bool recurReadOnly() const
Returns true if the recurrence is read-only, or false if it can be changed.
void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec)
Shift the times of the recurrence so that they appear at the same clock time as before but in a new t...
QList< int > yearDates() const
Returns the dates within a yearly recurrence.
void setEndDateTime(const KDateTime &endDateTime)
Sets the date and time of the last recurrence.
int durationTo(const KDateTime &dt) const
Returns the number of recurrences up to and including the date/time specified.
int weekStart() const
Returns the first day of the week.
void setYearly(int freq)
Sets an event to recur yearly.
QDate endDate() const
Returns the date of the last recurrence.
int frequency() const
Returns frequency of recurrence, in terms of the recurrence time period type.
void dump() const
Debug output.
void setEndDt(const KDateTime &endDateTime)
Sets the date and time of the last recurrence.
void addObserver(RecurrenceObserver *observer)
Installs an observer.
This class represents a recurrence rule for a calendar incidence.
int removeSorted(const T &value, int start=0)
Remove value value from the list.
bool recursOn(const QDate &date, const KDateTime::Spec &timeSpec) const
Returns true if the date specified is one on which the event will recur.
void setRecurReadOnly(bool readOnly)
Set if recurrence is read-only or can be changed.
void setEndDate(const QDate &endDate)
Sets the date of the last recurrence.
void addMonthlyPos(short pos, const QBitArray &days)
Adds a position (e.g.
A QList which can be sorted.
bool allDay() const
Set whether the recurrence has no time, just a date.
void setFrequency(int freq)
Sets the frequency of recurrence, in terms of the recurrence time period type.
QList< int > monthDays() const
Returns list of day numbers of a month.
void deleteRRule(RecurrenceRule *rrule)
Remove a recurrence rule from the recurrence and delete it.
void setHourly(int freq)
Sets an event to recur hourly.
uint frequency() const
Returns the recurrence frequency, in terms of the recurrence time period type.
void removeExRule(RecurrenceRule *exrule)
Remove an exception rule from the recurrence.
void clear()
Removes all recurrence and exception rules and dates.
bool recursAt(const KDateTime &dt) const
Returns true if the date/time specified is one at which the event will recur.
int duration() const
Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the total number of re...
QList< int > yearMonths() const
Returns the months within a yearly recurrence.
void removeObserver(RuleObserver *observer)
Removes an observer that was added with addObserver.
void addMonthlyDate(short day)
Adds a date (e.g.
PeriodType
enum for describing the frequency how an event recurs, if at all.
void addObserver(RuleObserver *observer)
Installs an observer.
void unsetRecurs()
Removes all recurrence rules.
void addRRule(RecurrenceRule *rrule)
Add a recurrence rule to the recurrence.
void addYearlyDate(int date)
Adds date within a yearly recurrence.
void setMinutely(int freq)
Sets an event to recur minutely.
Recurrence & operator=(const Recurrence &r)
Assignment operator.
int durationTo(const KDateTime &dt) const
Returns the number of recurrences up to and including the date/time specified.
KDateTime getNextDateTime(const KDateTime &preDateTime) const
Returns the date and time of the next recurrence, after the specified date/time.
int duration() const
Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the total number of re...
void setAllDay(bool allDay)
Sets whether the dtstart is a all-day (i.e.
void addYearlyMonth(short _rNum)
Adds month in yearly recurrence.
void setAllDay(bool allDay)
Sets whether the dtstart is all-day (i.e.
KDateTime getPreviousDateTime(const KDateTime &afterDateTime) const
Returns the date and time of the last previous recurrence, before the specified date/time.
DateTimeList timesInInterval(const KDateTime &start, const KDateTime &end) const
Returns a list of all the times at which the recurrence will occur between two specified times...
ushort recurrenceType() const
Returns the event's recurrence status.
void setStartDt(const KDateTime &start)
Sets the recurrence start date/time.
void deleteExRule(RecurrenceRule *exrule)
Remove an exception rule from the recurrence and delete it.
void setMonthly(int freq)
Sets an event to recur monthly.
void addYearlyPos(short pos, const QBitArray &days)
Adds position within month/year within a yearly recurrence.
QBitArray days() const
Returns week day mask (bit 0 = Monday).
void removeRRule(RecurrenceRule *rrule)
Remove a recurrence rule from the recurrence.
KDateTime startDateTime() const
Return the start date/time of the recurrence (Time for all-day recurrences will be 0:00)...
KDateTime endDateTime() const
Returns the date/time of the last recurrence.
bool recurs() const
Returns whether the event recurs at all.
TimeList recurTimesOn(const QDate &date, const KDateTime::Spec &timeSpec) const
Returns a list of the times on the specified date at which the recurrence will occur.
void addExRule(RecurrenceRule *exrule)
Add an exception rule to the recurrence.
QList< RecurrenceRule::WDayPos > monthPositions() const
Returns list of day positions in months.
QList< RecurrenceRule::WDayPos > yearPositions() const
Returns the positions within a yearly recurrence.
void setWeekly(int freq, int weekStart=1)
Sets an event to recur weekly.
void setDaily(int freq)
Sets an event to recur daily.
This class represents a recurrence rule for a calendar incidence.