KCalendarCore::Recurrence

Search for usage in LXR

#include <recurrence.h>

Inherits KCalendarCore::RecurrenceRule::RuleObserver.

Public Types

enum  {
  rNone = 0 , rMinutely = 0x001 , rHourly = 0x0002 , rDaily = 0x0003 ,
  rWeekly = 0x0004 , rMonthlyPos = 0x0005 , rMonthlyDay = 0x0006 , rYearlyMonth = 0x0007 ,
  rYearlyDay = 0x0008 , rYearlyPos = 0x0009 , rOther = 0x000A , rMax = 0x00FF
}
 

Public Member Functions

 Recurrence ()
 
 Recurrence (const Recurrence &r)
 
 ~Recurrence () override
 
void addExDate (const QDate &exdate)
 
void addExDateTime (const QDateTime &exdate)
 
void addExRule (RecurrenceRule *exrule)
 
void addMonthlyDate (short day)
 
void addMonthlyPos (short pos, const QBitArray &days)
 
void addMonthlyPos (short pos, ushort day)
 
void addObserver (RecurrenceObserver *observer)
 
void addRDate (const QDate &rdate)
 
void addRDateTime (const QDateTime &rdate)
 
void addRDateTimePeriod (const Period &period)
 
void addRRule (RecurrenceRule *rrule)
 
void addWeeklyDays (const QBitArray &days)
 
void addYearlyDate (int date)
 
void addYearlyDay (int day)
 
void addYearlyMonth (short _rNum)
 
void addYearlyPos (short pos, const QBitArray &days)
 
bool allDay () const
 
void clear ()
 
QBitArray days () const
 
RecurrenceRuledefaultRRule (bool create=false) const
 
RecurrenceRuledefaultRRuleConst () const
 
void deleteExRule (RecurrenceRule *exrule)
 
void deleteRRule (RecurrenceRule *rrule)
 
void dump () const
 
int duration () const
 
int durationTo (const QDate &date) const
 
int durationTo (const QDateTime &dt) const
 
QDate endDate () const
 
QDateTime endDateTime () const
 
DateList exDates () const
 
QList< QDateTimeexDateTimes () const
 
RecurrenceRule::List exRules () const
 
int frequency () const
 
QDateTime getNextDateTime (const QDateTime &preDateTime) const
 
QDateTime getPreviousDateTime (const QDateTime &afterDateTime) const
 
QList< int > monthDays () const
 
QList< RecurrenceRule::WDayPosmonthPositions () const
 
bool operator!= (const Recurrence &r) const
 
Recurrenceoperator= (const Recurrence &r)=delete
 
bool operator== (const Recurrence &r) const
 
DateList rDates () const
 
Period rDateTimePeriod (const QDateTime &rdate) const
 
QList< QDateTimerDateTimes () const
 
bool recurReadOnly () const
 
void recurrenceChanged (RecurrenceRule *) override
 
ushort recurrenceType () const
 
bool recurs () const
 
bool recursAt (const QDateTime &dt) const
 
bool recursOn (const QDate &date, const QTimeZone &timeZone) const
 
TimeList recurTimesOn (const QDate &date, const QTimeZone &timeZone) const
 
void removeExRule (RecurrenceRule *exrule)
 
void removeObserver (RecurrenceObserver *observer)
 
void removeRRule (RecurrenceRule *rrule)
 
RecurrenceRule::List rRules () const
 
void setAllDay (bool allDay)
 
void setDaily (int freq)
 
void setDuration (int duration)
 
void setEndDate (const QDate &endDate)
 
void setEndDateTime (const QDateTime &endDateTime)
 
void setExDates (const DateList &exdates)
 
void setExDateTimes (const QList< QDateTime > &exdates)
 
void setFrequency (int freq)
 
void setHourly (int freq)
 
void setMinutely (int freq)
 
void setMonthly (int freq)
 
void setMonthlyDate (const QList< int > &monthlyDays)
 
void setMonthlyPos (const QList< RecurrenceRule::WDayPos > &monthlyDays)
 
void setRDates (const DateList &rdates)
 
void setRDateTimes (const QList< QDateTime > &rdates)
 
void setRecurReadOnly (bool readOnly)
 
void setStartDateTime (const QDateTime &start, bool isAllDay)
 
void setWeekly (int freq, const QBitArray &days, int weekStart=1)
 
void setWeekly (int freq, int weekStart=1)
 
void setYearly (int freq)
 
void setYearlyDate (const QList< int > &dates)
 
void setYearlyDay (const QList< int > &days)
 
void setYearlyMonth (const QList< int > &months)
 
void setYearlyPos (const QList< RecurrenceRule::WDayPos > &days)
 
void shiftTimes (const QTimeZone &oldZone, const QTimeZone &newZone)
 
QDate startDate () const
 
QDateTime startDateTime () const
 
QList< QDateTimetimesInInterval (const QDateTime &start, const QDateTime &end) const
 
void unsetRecurs ()
 
void updated ()
 
int weekStart () const
 
QList< int > yearDates () const
 
QList< int > yearDays () const
 
QList< int > yearMonths () const
 
QList< RecurrenceRule::WDayPosyearPositions () const
 

Static Public Member Functions

static ushort recurrenceType (const RecurrenceRule *rrule)
 

Static Public Attributes

static const QDate MAX_DATE
 

Protected Member Functions

RecurrenceRulesetNewRecurrenceType (RecurrenceRule::PeriodType type, int freq)
 

Detailed Description

This class represents a recurrence rule for a calendar incidence.

It manages all recurrence rules, recurrence date/times, exception rules and exception date times that can appear inside calendar items. Each recurrence rule and exception rule is represented as an object of type RecurrenceRule.

For the simple case where at most one recurrence rule is present, this class provides shortcut methods to set the type: setMinutely() setHourly() setDaily() setWeekly() setMonthly() setYearly() to set/get general information about the recurrence: setEndDate() setEndDateTime() duration() durationTo() setDuration() frequency() setFrequency() and to set/get specific information about the recurrence within the interval: days() monthDays() monthPositions() yearDays() yearDates() yearMonths() yearPositions() addMonthlyPos() addMonthlyDate() addYearlyDay() addYearlyDate() addYearlyPos() addYearlyMonth() These are all available so that you don't have to work on the RecurrenceRule objects themselves. In other words, in that simple situation the interface stays almost the same compared to the old Recurrence class, which allowed only one recurrence rule.

As soon as your recurrence consists of multiple recurrence rules or exception rules, you cannot use the methods mentioned above any more (since each rule will have a different type and different settings). If you still call any of them, the set*ly methods will remove all rules and add one rule with the specified type. The add* and the other set* methods will change only the first recurrence rule, but leave the others untouched.

Definition at line 76 of file recurrence.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

enumeration for describing how an event recurs, if at all.

Definition at line 88 of file recurrence.h.

Constructor & Destructor Documentation

◆ Recurrence() [1/2]

Recurrence::Recurrence ( )

Constructs an empty recurrence.

Definition at line 104 of file recurrence.cpp.

◆ Recurrence() [2/2]

Recurrence::Recurrence ( const Recurrence & r)

Copy constructor.

Parameters
rinstance to copy from

Definition at line 109 of file recurrence.cpp.

◆ ~Recurrence()

Recurrence::~Recurrence ( )
override

Destructor.

Definition at line 129 of file recurrence.cpp.

Member Function Documentation

◆ addExDate()

void Recurrence::addExDate ( const QDate & exdate)

Definition at line 1436 of file recurrence.cpp.

◆ addExDateTime()

void Recurrence::addExDateTime ( const QDateTime & exdate)

Definition at line 1406 of file recurrence.cpp.

◆ addExRule()

void Recurrence::addExRule ( RecurrenceRule * exrule)

Add an exception rule to the recurrence.

Parameters
exrulethe exception rule to add

Definition at line 1288 of file recurrence.cpp.

◆ addMonthlyDate()

void Recurrence::addMonthlyDate ( short day)

Adds a date (e.g.

the 15th of each month) to the monthly day recurrence list.

Parameters
daythe date in the month to recur.

Definition at line 831 of file recurrence.cpp.

◆ addMonthlyPos() [1/2]

void Recurrence::addMonthlyPos ( short pos,
const QBitArray & days )

Adds a position (e.g.

first monday) to the monthly recurrence rule.

Parameters
posthe position in the month for the recurrence, with valid values being 1-5 (5 weeks max in a month).
daysthe days for the position to recur on (bit 0 = Monday). Example: pos = 2, and bits 0 and 2 are set in days: the rule is to repeat every 2nd Monday and Wednesday in the month.

Definition at line 762 of file recurrence.cpp.

◆ addMonthlyPos() [2/2]

void Recurrence::addMonthlyPos ( short pos,
ushort day )

Definition at line 791 of file recurrence.cpp.

◆ addObserver()

void Recurrence::addObserver ( RecurrenceObserver * observer)

Installs an observer.

Whenever some setting of this recurrence object is changed, the recurrenceUpdated( Recurrence* ) method of each observer will be called to inform it of changes.

Parameters
observerthe Recurrence::Observer-derived object, which will be installed as an observer of this object.

Definition at line 141 of file recurrence.cpp.

◆ addRDate()

void Recurrence::addRDate ( const QDate & rdate)

Definition at line 1381 of file recurrence.cpp.

◆ addRDateTime()

void Recurrence::addRDateTime ( const QDateTime & rdate)

Definition at line 1339 of file recurrence.cpp.

◆ addRDateTimePeriod()

void Recurrence::addRDateTimePeriod ( const Period & period)

Add a RDATE defined as a PERIOD.

The start date-time of the period is added to the recurring date time list, and will be listed by a call to rDateTimes(). Use then rDateTimePeriod() to fetch the associated period defintion.

Parameters
perioda given RDATE in period defintion.
Since
5.87

Definition at line 1349 of file recurrence.cpp.

◆ addRRule()

void Recurrence::addRRule ( RecurrenceRule * rrule)

Add a recurrence rule to the recurrence.

Parameters
rrulethe recurrence rule to add

Definition at line 1249 of file recurrence.cpp.

◆ addWeeklyDays()

void Recurrence::addWeeklyDays ( const QBitArray & days)

Adds days to the weekly day recurrence list.

Parameters
daysa 7 bit array indicating which days on which to recur (bit 0 = Monday).

Definition at line 750 of file recurrence.cpp.

◆ addYearlyDate()

void Recurrence::addYearlyDate ( int date)

Adds date within a yearly recurrence.

The month(s) for the recurrence can be specified with addYearlyMonth(), otherwise the month of the start date is used.

By default infinite recurrence is used. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

Parameters
datethe day of the month for the event

Definition at line 914 of file recurrence.cpp.

◆ addYearlyDay()

void Recurrence::addYearlyDay ( int day)

Adds day number of year within a yearly recurrence.

By default infinite recurrence is used. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

Parameters
daythe day of the year for the event. E.g. if day is 60, this means Feb 29 in leap years and March 1 in non-leap years.

Definition at line 880 of file recurrence.cpp.

◆ addYearlyMonth()

void Recurrence::addYearlyMonth ( short _rNum)

Adds month in yearly recurrence.

You can specify specific day numbers within the months (by calling addYearlyDate()) or specific day positions within the month (by calling addYearlyPos).

Parameters
_rNumthe month in which the event shall recur.

Definition at line 936 of file recurrence.cpp.

◆ addYearlyPos()

void Recurrence::addYearlyPos ( short pos,
const QBitArray & days )

Adds position within month/year within a yearly recurrence.

If months are specified (via addYearlyMonth()), the parameters are understood as position within these months, otherwise within the year.

By default infinite recurrence is used. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

Parameters
posthe position in the month/year for the recurrence, with valid values being 1 to 53 and -1 to -53 (53 weeks max in a year).
daysthe days for the position to recur on (bit 0 = Monday). Example: pos = 2, and bits 0 and 2 are set in days If months are specified (via addYearlyMonth), e.g. March, the rule is to repeat every year on the 2nd Monday and Wednesday of March. If no months are specified, the file is to repeat every year on the 2nd Monday and Wednesday of the year.

Definition at line 925 of file recurrence.cpp.

◆ allDay()

bool Recurrence::allDay ( ) const

Set whether the recurrence has no time, just a date.

All-day means – according to rfc2445 – that the event has no time associated. N.B. This property is derived by default from whether setStartDateTime() is called with a date-only or date/time parameter.

Returns
whether the recurrence has a time (false) or it is just a date (true).

Definition at line 158 of file recurrence.cpp.

◆ clear()

void Recurrence::clear ( )

Removes all recurrence and exception rules and dates.

Definition at line 547 of file recurrence.cpp.

◆ days()

QBitArray Recurrence::days ( ) const

Returns week day mask (bit 0 = Monday).

Definition at line 629 of file recurrence.cpp.

◆ defaultRRule()

RecurrenceRule * Recurrence::defaultRRule ( bool create = false) const

Definition at line 179 of file recurrence.cpp.

◆ defaultRRuleConst()

RecurrenceRule * Recurrence::defaultRRuleConst ( ) const

Definition at line 194 of file recurrence.cpp.

◆ deleteExRule()

void Recurrence::deleteExRule ( RecurrenceRule * exrule)

Remove an exception rule from the recurrence and delete it.

Parameters
exrulethe exception rule to remove

Definition at line 1311 of file recurrence.cpp.

◆ deleteRRule()

void Recurrence::deleteRRule ( RecurrenceRule * rrule)

Remove a recurrence rule from the recurrence and delete it.

Parameters
rrulethe recurrence rule to remove

Definition at line 1272 of file recurrence.cpp.

◆ dump()

void Recurrence::dump ( ) const

Debug output.

Definition at line 1453 of file recurrence.cpp.

◆ duration()

int Recurrence::duration ( ) const

Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the total number of recurrences, including the initial occurrence.

Definition at line 468 of file recurrence.cpp.

◆ durationTo() [1/2]

int Recurrence::durationTo ( const QDate & date) const

Returns the number of recurrences up to and including the date specified.

Warning
This function can be very time consuming - use it sparingly!

Definition at line 481 of file recurrence.cpp.

◆ durationTo() [2/2]

int Recurrence::durationTo ( const QDateTime & dt) const

Returns the number of recurrences up to and including the date/time specified.

Warning
This function can be very time consuming - use it sparingly!

Definition at line 474 of file recurrence.cpp.

◆ endDate()

QDate Recurrence::endDate ( ) const

Returns the date of the last recurrence.

Calculates the cumulative end of the whole recurrence (rdates and rrules).

An invalid date is returned if the recurrence has no end.

If any rrule is infinite, or the recurrence doesn't have any rrules or rdates, an invalid date is returned.

Definition at line 427 of file recurrence.cpp.

◆ endDateTime()

QDateTime Recurrence::endDateTime ( ) const

Returns the date/time of the last recurrence.

Calculates the cumulative end of the whole recurrence (rdates and rrules).

An invalid date is returned if the recurrence has no end.

If any rrule is infinite, or the recurrence doesn't have any rrules or rdates, an invalid date is returned.

Definition at line 402 of file recurrence.cpp.

◆ exDates()

DateList Recurrence::exDates ( ) const

Definition at line 1416 of file recurrence.cpp.

◆ exDateTimes()

QList< QDateTime > Recurrence::exDateTimes ( ) const

Definition at line 1391 of file recurrence.cpp.

◆ exRules()

RecurrenceRule::List Recurrence::exRules ( ) const

Definition at line 1283 of file recurrence.cpp.

◆ frequency()

int Recurrence::frequency ( ) const

Returns frequency of recurrence, in terms of the recurrence time period type.

Definition at line 599 of file recurrence.cpp.

◆ getNextDateTime()

QDateTime Recurrence::getNextDateTime ( const QDateTime & preDateTime) const

Returns the start date/time of the earliest recurrence with a start date/time after the specified date/time.

If the recurrence has no time, the next date after the specified date is returned.

Parameters
preDateTimethe date/time after which to find the recurrence.
Returns
start date/time of next recurrence (strictly later than the given QDateTime), or invalid date if none.

Definition at line 1098 of file recurrence.cpp.

◆ getPreviousDateTime()

QDateTime Recurrence::getPreviousDateTime ( const QDateTime & afterDateTime) const

Returns the date and time of the last previous recurrence, before the specified date/time.

If a time later than 00:00:00 is specified and the recurrence has no time, 00:00:00 on the specified date is returned if that date recurs.

Parameters
afterDateTimethe date/time before which to find the recurrence.
Returns
date/time of previous recurrence (strictly earlier than the given QDateTime), or invalid date if none.

Definition at line 1172 of file recurrence.cpp.

◆ monthDays()

QList< int > Recurrence::monthDays ( ) const

Returns list of day numbers of a month.

Definition at line 648 of file recurrence.cpp.

◆ monthPositions()

QList< RecurrenceRule::WDayPos > Recurrence::monthPositions ( ) const

Returns list of day positions in months.

Definition at line 659 of file recurrence.cpp.

◆ operator!=()

bool KCalendarCore::Recurrence::operator!= ( const Recurrence & r) const
inline

Comparison operator for inequality.

Parameters
rinstance to compare with
Returns
true if recurrences are the different, false if the same

Definition at line 131 of file recurrence.h.

◆ operator==()

bool Recurrence::operator== ( const Recurrence & r) const

Comparison operator for equality.

Parameters
rinstance to compare with
Returns
true if recurrences are the same, false otherwise

Definition at line 136 of file recurrence.cpp.

◆ rDates()

DateList Recurrence::rDates ( ) const

Definition at line 1365 of file recurrence.cpp.

◆ rDateTimePeriod()

Period Recurrence::rDateTimePeriod ( const QDateTime & rdate) const

Inquire if the given RDATE is associated to a PERIOD.

Parameters
rdatea given RDATE in date time format.
Returns
a Period, invalid if there is no period associated to
Parameters
rdate.
Since
5.87

Definition at line 1360 of file recurrence.cpp.

◆ rDateTimes()

QList< QDateTime > Recurrence::rDateTimes ( ) const

Definition at line 1322 of file recurrence.cpp.

◆ recurReadOnly()

bool Recurrence::recurReadOnly ( ) const

Returns true if the recurrence is read-only, or false if it can be changed.

Definition at line 570 of file recurrence.cpp.

◆ recurrenceChanged()

void Recurrence::recurrenceChanged ( RecurrenceRule * )
override

Definition at line 1446 of file recurrence.cpp.

◆ recurrenceType() [1/2]

ushort Recurrence::recurrenceType ( ) const

Returns the event's recurrence status.

See the enumeration at the top of this file for possible values.

Definition at line 215 of file recurrence.cpp.

◆ recurrenceType() [2/2]

ushort Recurrence::recurrenceType ( const RecurrenceRule * rrule)
static

Returns the recurrence status for a recurrence rule.

See the enumeration at the top of this file for possible values.

Parameters
rrulethe recurrence rule to get the type for

Definition at line 223 of file recurrence.cpp.

◆ recurs()

bool Recurrence::recurs ( ) const

Returns whether the event recurs at all.

Definition at line 210 of file recurrence.cpp.

◆ recursAt()

bool Recurrence::recursAt ( const QDateTime & dt) const

Returns true if the date/time specified is one at which the event will recur.

Times are rounded down to the nearest minute to determine the result.

Parameters
dtis the date/time to check.

Definition at line 368 of file recurrence.cpp.

◆ recursOn()

bool Recurrence::recursOn ( const QDate & date,
const QTimeZone & timeZone ) const

Returns true if the date specified is one on which the event will recur.

Parameters
datedate to check.
timeZonetime zone for the date.

Definition at line 303 of file recurrence.cpp.

◆ recurTimesOn()

TimeList Recurrence::recurTimesOn ( const QDate & date,
const QTimeZone & timeZone ) const

Returns a list of the times on the specified date at which the recurrence will occur.

The returned times should be interpreted in the context of timeSpec.

Parameters
datethe date for which to find the recurrence times
timeZonetimezone for date

Definition at line 977 of file recurrence.cpp.

◆ removeExRule()

void Recurrence::removeExRule ( RecurrenceRule * exrule)

Remove an exception rule from the recurrence.

exrule is not deleted; it is the responsibility of the caller to ensure that it is deleted.

Parameters
exrulethe exception rule to remove

Definition at line 1300 of file recurrence.cpp.

◆ removeObserver()

void Recurrence::removeObserver ( RecurrenceObserver * observer)

Removes an observer that was added with addObserver.

If the given object was not an observer, it does nothing.

Parameters
observerthe Recurrence::Observer-derived object to be removed from the list of observers of this object.

Definition at line 148 of file recurrence.cpp.

◆ removeRRule()

void Recurrence::removeRRule ( RecurrenceRule * rrule)

Remove a recurrence rule from the recurrence.

rrule is not deleted; it is the responsibility of the caller to ensure that it is deleted.

Parameters
rrulethe recurrence rule to remove

Definition at line 1261 of file recurrence.cpp.

◆ rRules()

RecurrenceRule::List Recurrence::rRules ( ) const

Definition at line 1244 of file recurrence.cpp.

◆ setAllDay()

void Recurrence::setAllDay ( bool allDay)

Sets whether the dtstart is a all-day (i.e.

has no time attached)

Parameters
allDayIf the recurrence is for all-day item (true) or has a time associated (false).

Definition at line 163 of file recurrence.cpp.

◆ setDaily()

void Recurrence::setDaily ( int freq)

Sets an event to recur daily.

By default infinite recurrence is used. The minute and second of the recurrence is taken from the start date (if you need to change them, you will have to modify the defaultRRule's byMinute list manually. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

This method clears all recurrence rules and adds one rule with a daily recurrence. All other recurrence components (recurrence date/times, exception date/times and exception rules) are not modified.

Parameters
freqthe frequency to recur, e.g. 2 is every other day

Definition at line 727 of file recurrence.cpp.

◆ setDuration()

void Recurrence::setDuration ( int duration)

Sets the total number of times the event is to occur, including both the first and last.

Definition at line 486 of file recurrence.cpp.

◆ setEndDate()

void Recurrence::setEndDate ( const QDate & endDate)

Sets the date of the last recurrence.

The end time is set to the recurrence start time.

Parameters
endDatethe ending date after which to stop recurring. If the recurrence is not all-day, the end time will be 23:59.

Definition at line 433 of file recurrence.cpp.

◆ setEndDateTime()

void Recurrence::setEndDateTime ( const QDateTime & endDateTime)

Sets the date and time of the last recurrence.

Parameters
endDateTimethe ending date/time after which to stop recurring.

Definition at line 442 of file recurrence.cpp.

◆ setExDates()

void Recurrence::setExDates ( const DateList & exdates)

Definition at line 1421 of file recurrence.cpp.

◆ setExDateTimes()

void Recurrence::setExDateTimes ( const QList< QDateTime > & exdates)

Definition at line 1396 of file recurrence.cpp.

◆ setFrequency()

void Recurrence::setFrequency ( int freq)

Sets the frequency of recurrence, in terms of the recurrence time period type.

Definition at line 607 of file recurrence.cpp.

◆ setHourly()

void Recurrence::setHourly ( int freq)

Sets an event to recur hourly.

By default infinite recurrence is used. The minute of the recurrence is taken from the start date (if you need to change it, you will have to modify the defaultRRule's byMinute list manually. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

This method clears all recurrence rules and adds one rule with a hourly recurrence. All other recurrence components (recurrence date/times, exception date/times and exception rules) are not modified.

Parameters
freqthe frequency to recur, e.g. 2 is every other hour

Definition at line 720 of file recurrence.cpp.

◆ setMinutely()

void Recurrence::setMinutely ( int freq)

Sets an event to recur minutely.

By default infinite recurrence is used. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

This method clears all recurrence rules and adds one rule with a minutely recurrence. All other recurrence components (recurrence date/times, exception date/times and exception rules) are not modified.

Parameters
freqthe frequency to recur, e.g. 2 is every other minute

Definition at line 713 of file recurrence.cpp.

◆ setMonthly()

void Recurrence::setMonthly ( int freq)

Sets an event to recur monthly.

By default infinite recurrence is used. The date of the monthly recurrence will be taken from the start date unless you explicitly add one or more recurrence dates with addMonthlyDate or a recurrence position in the month (e.g. first monday) using addMonthlyPos. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

This method clears all recurrence rules and adds one rule with a monthly recurrence. All other recurrence components (recurrence date/times, exception date/times and exception rules) are not modified.

Parameters
freqthe frequency to recur, e.g. 3 for every third month.

Definition at line 755 of file recurrence.cpp.

◆ setMonthlyDate()

void Recurrence::setMonthlyDate ( const QList< int > & monthlyDays)

Definition at line 849 of file recurrence.cpp.

◆ setMonthlyPos()

void Recurrence::setMonthlyPos ( const QList< RecurrenceRule::WDayPos > & monthlyDays)

Definition at line 811 of file recurrence.cpp.

◆ setNewRecurrenceType()

RecurrenceRule * Recurrence::setNewRecurrenceType ( RecurrenceRule::PeriodType type,
int freq )
protected

Definition at line 689 of file recurrence.cpp.

◆ setRDates()

void Recurrence::setRDates ( const DateList & rdates)

Definition at line 1370 of file recurrence.cpp.

◆ setRDateTimes()

void Recurrence::setRDateTimes ( const QList< QDateTime > & rdates)

Definition at line 1327 of file recurrence.cpp.

◆ setRecurReadOnly()

void Recurrence::setRecurReadOnly ( bool readOnly)

Set if recurrence is read-only or can be changed.

Definition at line 565 of file recurrence.cpp.

◆ setStartDateTime()

void Recurrence::setStartDateTime ( const QDateTime & start,
bool isAllDay )

Set start of recurrence.

Parameters
startthe new start date or date/time of the recurrence.
isAllDayif true, the recurrence is set to all-day. Otherwise the recurrence is set to non-all-day.

Definition at line 580 of file recurrence.cpp.

◆ setWeekly() [1/2]

void Recurrence::setWeekly ( int freq,
const QBitArray & days,
int weekStart = 1 )

Sets an event to recur weekly.

By default infinite recurrence is used. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

This method clears all recurrence rules and adds one rule with a weekly recurrence. All other recurrence components (recurrence date/times, exception date/times and exception rules) are not modified.

Parameters
freqthe frequency to recur, e.g. every other week etc.
daysa 7 bit array indicating which days on which to recur (bit 0 = Monday).
weekStartthe first day of the week (Monday=1 .. Sunday=7, default is Monday).

Definition at line 744 of file recurrence.cpp.

◆ setWeekly() [2/2]

void Recurrence::setWeekly ( int freq,
int weekStart = 1 )

Sets an event to recur weekly.

By default infinite recurrence is used. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

This method clears all recurrence rules and adds one rule with a weekly recurrence. All other recurrence components (recurrence date/times, exception date/times and exception rules) are not modified.

Parameters
freqthe frequency to recur, e.g. every other week etc.
weekStartthe first day of the week (Monday=1 .. Sunday=7, default is Monday).

Definition at line 734 of file recurrence.cpp.

◆ setYearly()

void Recurrence::setYearly ( int freq)

Sets an event to recur yearly.

By default, this will recur every year on the same date (e.g. every year on April 15 if the start date was April 15). The day of the year can be specified with addYearlyDay(). The day of the month can be specified with addYearlyByDate If both a month and a day ar specified with addYearlyMonth and addYearlyDay, the day is understood as day number within the month.

A position (e.g. 3rd Sunday of year/month, or last Friday of year/month) can be specified with addYearlyPos. Again, if a month is specified, this position is understood as within that month, otherwise within the year.

By default infinite recurrence is used. To set an end date use the method setEndDate and to set the number of occurrences use setDuration.

This method clears all recurrence rules and adds one rule with a yearly recurrence. All other recurrence components (recurrence date/times, exception date/times and exception rules) are not modified.

Parameters
freqthe frequency to recur, e.g. 3 for every third year.

Definition at line 872 of file recurrence.cpp.

◆ setYearlyDate()

void Recurrence::setYearlyDate ( const QList< int > & dates)

Definition at line 919 of file recurrence.cpp.

◆ setYearlyDay()

void Recurrence::setYearlyDay ( const QList< int > & days)

Definition at line 894 of file recurrence.cpp.

◆ setYearlyMonth()

void Recurrence::setYearlyMonth ( const QList< int > & months)

Definition at line 954 of file recurrence.cpp.

◆ setYearlyPos()

void Recurrence::setYearlyPos ( const QList< RecurrenceRule::WDayPos > & days)

Definition at line 930 of file recurrence.cpp.

◆ shiftTimes()

void Recurrence::shiftTimes ( const QTimeZone & oldZone,
const QTimeZone & newZone )

Shift the times of the recurrence so that they appear at the same clock time as before but in a new time zone.

The shift is done from a viewing time zone rather than from the actual recurrence time zone.

For example, shifting a recurrence whose start time is 09:00 America/New York, using an old viewing time zone (oldSpec) of Europe/London, to a new time zone (newSpec) of Europe/Paris, will result in the time being shifted from 14:00 (which is the London time of the recurrence start) to 14:00 Paris time.

Parameters
oldZonethe time specification which provides the clock times
newZonethe new time specification

Definition at line 503 of file recurrence.cpp.

◆ startDate()

QDate Recurrence::startDate ( ) const

Return the start date/time of the recurrence.

Definition at line 575 of file recurrence.cpp.

◆ startDateTime()

QDateTime Recurrence::startDateTime ( ) const

Return the start date/time of the recurrence (Time for all-day recurrences will be 0:00).

Returns
the current start/time of the recurrence.

Definition at line 153 of file recurrence.cpp.

◆ timesInInterval()

QList< QDateTime > Recurrence::timesInInterval ( const QDateTime & start,
const QDateTime & end ) const

Returns a list of all the times at which the recurrence will occur between two specified times.

There is a (large) maximum limit to the number of times returned. If due to this limit the list is incomplete, this is indicated by the last entry being set to an invalid QDateTime value. If you need further values, call the method again with a start time set to just after the last valid time returned.

Parameters
startinclusive start of interval
endinclusive end of interval
Returns
list of date/time values

Definition at line 1040 of file recurrence.cpp.

◆ unsetRecurs()

void Recurrence::unsetRecurs ( )

Removes all recurrence rules.

Recurrence dates and exceptions are not removed.

Definition at line 537 of file recurrence.cpp.

◆ updated()

void Recurrence::updated ( )

Definition at line 199 of file recurrence.cpp.

◆ weekStart()

int Recurrence::weekStart ( ) const

Returns the first day of the week.

Uses only the first RRULE if present (i.e. a second RRULE as well as all EXRULES are ignored!

Returns
Weekday of the first day of the week (Monday=1 .. Sunday=7)

Definition at line 622 of file recurrence.cpp.

◆ yearDates()

QList< int > Recurrence::yearDates ( ) const

Returns the dates within a yearly recurrence.

Returns
the days of the month for the event. E.g. if the list contains 13, this means the recurrence happens on the 13th of the month. The months for the recurrence can be obtained through yearlyMonths(). If this list is empty, the month of the start date is used.

Definition at line 673 of file recurrence.cpp.

◆ yearDays()

QList< int > Recurrence::yearDays ( ) const

Returns the day numbers within a yearly recurrence.

Returns
the days of the year for the event. E.g. if the list contains 60, this means the recurrence happens on day 60 of the year, i.e. on Feb 29 in leap years and March 1 in non-leap years.

Definition at line 667 of file recurrence.cpp.

◆ yearMonths()

QList< int > Recurrence::yearMonths ( ) const

Returns the months within a yearly recurrence.

Returns
the months for the event. E.g. if the list contains 11, this means the recurrence happens in November. The days for the recurrence can be obtained either through yearDates() if they are given as dates within the month or through yearlyPositions() if they are given as positions within the month. If none is specified, the date of the start date is used.

Definition at line 678 of file recurrence.cpp.

◆ yearPositions()

QList< RecurrenceRule::WDayPos > Recurrence::yearPositions ( ) const

Returns the positions within a yearly recurrence.

Returns
the positions for the event, either within a month (if months are set through addYearlyMonth()) or within the year. E.g. if the list contains {Pos=3, Day=5}, this means the third friday. If a month is set this position is understoodas third Friday in the given months, otherwise as third Friday of the year. Returns list of day positions in months, for a recursYearlyPos recurrence rule.

Definition at line 684 of file recurrence.cpp.

Member Data Documentation

◆ MAX_DATE

const QDate KCalendarCore::Recurrence::MAX_DATE
static

Upper date limit for recurrences.

Definition at line 550 of file recurrence.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:47 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.