QtMobility Reference Documentation

QOrganizerRecurrenceRule Class Reference

The QOrganizerRecurrenceRule class describes the a rule by which a QOrganizerItem repeats. More...

 #include <QOrganizerRecurrenceRule>

This class was introduced in Qt Mobility 1.1.

Public Types

enum Frequency { Invalid, Daily, Weekly, Monthly, Yearly }
enum LimitType { NoLimit, CountLimit, DateLimit }
enum Month { January, February, March, April, ..., December }

Public Functions

QOrganizerRecurrenceRule ()
QOrganizerRecurrenceRule ( const QOrganizerRecurrenceRule & other )
~QOrganizerRecurrenceRule ()
void clearLimit ()
QSet<int> daysOfMonth () const
QSet<Qt::DayOfWeek> daysOfWeek () const
QSet<int> daysOfYear () const
Qt::DayOfWeek firstDayOfWeek () const
Frequency frequency () const
int interval () const
int limitCount () const
QDate limitDate () const
LimitType limitType () const
QSet<Month> monthsOfYear () const
QSet<int> positions () const
void setDaysOfMonth ( const QSet<int> & days )
void setDaysOfWeek ( const QSet<Qt::DayOfWeek> & days )
void setDaysOfYear ( const QSet<int> & days )
void setFirstDayOfWeek ( Qt::DayOfWeek day )
void setFrequency ( Frequency freq )
void setInterval ( int interval )
void setLimit ( int count )
void setLimit ( const QDate & date )
void setMonthsOfYear ( const QSet<Month> & months )
void setPositions ( const QSet<int> & pos )
void setWeeksOfYear ( const QSet<int> & weeks )
QSet<int> weeksOfYear () const
QOrganizerRecurrenceRule & operator= ( const QOrganizerRecurrenceRule & other )
bool operator== ( const QOrganizerRecurrenceRule & other ) const

Detailed Description

The QOrganizerRecurrenceRule class describes the a rule by which a QOrganizerItem repeats.

This class is a mapping of a subset of the iCalendar RRULE property value, and each field in this class corresponds to a fragment of iCalendar's RRULE. This class supports the same fragments as those supported by RRULE, except for describing recurrences on a higher frequency than Daily. That is, this class doesn't support hourly, minutely or secondly recurrences, nor does it support specifying which hour, minute or second of a day to recur on. These types of rules are unsupported because most calendaring backends don't support them, and it simplifies recurrences by enforcing that there can be at most one occurrence of an item per day.

The general rules for interaction between the fields when generating the occurence dates is as follows:

  • When a criterion takes a list, the items in the list are unioned together.
    • eg. with [dayOfWeek == Tuesday,Thursday], the event occurs if it is Tuesday or Thursday
  • Frequency and specific criteria interact in a more complicated fashion. For each criterion on a larger timespan than the frequency, the dates matching the criterion are intersected with the dates resulting from the frequency.
    • eg. [frequency = Daily, month = January] means every day in January For each criterion on a shorter timespan than the frequency, the criterion is unioned.
    • eg. [frequency = Weekly, dayOfWeek = Wednesday,Friday] means every Wednesday and Friday of every week.

    This makes the frequency field superfluous in many cases when other criteria are present. eg. all of the below mean the same thing:

    • [frequency = Daily, dayOfWeek = Monday,Tuesday]
    • [frequency = Weekly, dayOfWeek = Monday,Tuesday]
    • [frequency = Monthly, dayOfWeek = Monday,Tuesday]
    • [frequency = Yearly, dayOfWeek = Monday,Tuesday]

    However, the frequency field may start affecting the result differently when other fields are added like interval and positions.

  • For the purpose of calculating occurrence dates, information not contained in the rule is in some cases derived from the startDateTime field of the event that the detail is associated with. There are three cases where such derivation is necessary.
    • Case 1: frequency == Weekly. If dayOfWeek is not specified, derive it from the week day that the startDateTime occurs on.
    • Case 2: frequency == Monthly. If neither dayOfWeek or dayOfMonth is specified, dayOfMonth should be derived from the startDateTime
    • Case 3: frequency == Yearly. If none of monthOfYear, weekOfYear, dayOfYear, dayOfMonth or dayOfWeek are specified, derive monthOfYear and dayOfMonth. If monthOfYear is specified but not weekOfYear, dayOfYear, dayOfMonth or dayOfWeek, then derive dayOfMonth. If weekOfYear is specified but not dayOfYear, dayOfWeek or dayOfMonth, derive dayOfWeek from the startDateTime. For any cases not covered here, do not derive any of the fields.

A recurrence rule may be limited by either count or date, or it may be unlimited. If limited by count, the series generated by the rule will have at most count occurrences. If limited by date, the series generated by the rule may have occurrences up to (and including) the limit date. See setLimit() for more information on this topic.

Member Type Documentation

enum QOrganizerRecurrenceRule::Frequency

ConstantValueDescription
QOrganizerRecurrenceRule::Invalid0Signifies that the entire rrule is invalid.
QOrganizerRecurrenceRule::Daily1 
QOrganizerRecurrenceRule::Weekly2 
QOrganizerRecurrenceRule::Monthly3 
QOrganizerRecurrenceRule::Yearly4 

enum QOrganizerRecurrenceRule::LimitType

ConstantValueDescription
QOrganizerRecurrenceRule::NoLimit0The recurrence rule has no limit specified
QOrganizerRecurrenceRule::CountLimit1The recurrence rule specifies a certain count of repetitions in the series
QOrganizerRecurrenceRule::DateLimit2The recurrence rule specifies that the series ends after a particular date

enum QOrganizerRecurrenceRule::Month

ConstantValue
QOrganizerRecurrenceRule::January1
QOrganizerRecurrenceRule::February2
QOrganizerRecurrenceRule::March3
QOrganizerRecurrenceRule::April4
QOrganizerRecurrenceRule::May5
QOrganizerRecurrenceRule::June6
QOrganizerRecurrenceRule::July7
QOrganizerRecurrenceRule::August8
QOrganizerRecurrenceRule::September9
QOrganizerRecurrenceRule::October10
QOrganizerRecurrenceRule::November11
QOrganizerRecurrenceRule::December12

Member Function Documentation

QOrganizerRecurrenceRule::QOrganizerRecurrenceRule ()

Constructs a QOrganizerRecurrenceRule object describing a weekly recurrence.

QOrganizerRecurrenceRule::QOrganizerRecurrenceRule ( const QOrganizerRecurrenceRule & other )

* Constructs a QOrganizerRecurrenceRule object as a copy of other.

This function was introduced in Qt Mobility 1.1.

QOrganizerRecurrenceRule::~QOrganizerRecurrenceRule ()

Destroys the QOrganizerRecurrenceRule object.

void QOrganizerRecurrenceRule::clearLimit ()

Clear any recurrence rule limitation conditions.

This function was introduced in Qt Mobility 1.1.

QSet<int> QOrganizerRecurrenceRule::daysOfMonth () const

* Returns a list of the days of the month that the item should recur on. If not set, this is the * empty list, which signifies that it should be implied, if necessary, by the day-of-month of the * item.

This function was introduced in Qt Mobility 1.1.

See also setDaysOfMonth().

QSet<Qt::DayOfWeek> QOrganizerRecurrenceRule::daysOfWeek () const

* Returns a list of the days of week that the item should recur on. If not set, this is the empty * list, which signifies that it should be implied, if necessary, by the day-of-week of the item.

This function was introduced in Qt Mobility 1.1.

See also setDaysOfWeek().

QSet<int> QOrganizerRecurrenceRule::daysOfYear () const

* Returns a list of the days of the year that the item should recur on. If not set, this is the * empty list, which signifies that it should be implied, if necessary, by the day-of-year of the * item.

This function was introduced in Qt Mobility 1.1.

See also setDaysOfYear().

Qt::DayOfWeek QOrganizerRecurrenceRule::firstDayOfWeek () const

* Returns the day that the week starts on. If not set, this is Monday.

This function was introduced in Qt Mobility 1.1.

See also setFirstDayOfWeek().

Frequency QOrganizerRecurrenceRule::frequency () const

* Returns the frequency with which the item recurs. The default frequency is Invalid.

This function was introduced in Qt Mobility 1.1.

See also setFrequency().

int QOrganizerRecurrenceRule::interval () const

* Returns the interval of recurrence. The default interval is 1.

This function was introduced in Qt Mobility 1.1.

See also setInterval().

int QOrganizerRecurrenceRule::limitCount () const

Returns the "count" condition specified by the recurrence rule. The default count is -1 (ie. * unlimited)

This function was introduced in Qt Mobility 1.1.

QDate QOrganizerRecurrenceRule::limitDate () const

Returns the end-date condition specified by the recurrence rule. The default end date is the * null date (ie. no end date).

This function was introduced in Qt Mobility 1.1.

LimitType QOrganizerRecurrenceRule::limitType () const

Returns the type of limitation specified by the recurrence rule. The default limit type is NoLimit (ie. * unlimited)

This function was introduced in Qt Mobility 1.1.

QSet<Month> QOrganizerRecurrenceRule::monthsOfYear () const

* Returns a list of the months that the item should recur on. If not set, this is the * empty list, which signifies that it should be implied, if necessary, by the month of the * item.

This function was introduced in Qt Mobility 1.1.

See also setMonthsOfYear().

QSet<int> QOrganizerRecurrenceRule::positions () const

* Returns the position-list of the recurrence rule. If not set, this is the empty list, which * signifies that the recurrence dates should not be restricted by position.

This function was introduced in Qt Mobility 1.1.

See also setPositions().

void QOrganizerRecurrenceRule::setDaysOfMonth ( const QSet<int> & days )

* Sets the days of the month on which the item should recur to days. Negative values in the list * represent the number of days from the end of the month. eg. 1 represents the first day of the * month and -1 represents the last day of the month. * * This corresponds to the BYMONTHDAY fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also daysOfMonth().

void QOrganizerRecurrenceRule::setDaysOfWeek ( const QSet<Qt::DayOfWeek> & days )

* Sets the days of week on which the item should recur to days. * * This corresponds to the BYDAY fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also daysOfWeek().

void QOrganizerRecurrenceRule::setDaysOfYear ( const QSet<int> & days )

* Sets the days of the year on which the item should recur to days. Negative values in the list * represent the number of days from the end of the year. eg. 1 represents the first day of the * year and -1 represents the last day of the year. * * This corresponds to the BYYEARDAY fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also daysOfYear().

void QOrganizerRecurrenceRule::setFirstDayOfWeek ( Qt::DayOfWeek day )

Sets the day that the week starts on to day, for the purposes of calculating recurrences. * This is significant when the frequency is Weekly and the interval is greater than 1, or when * weekOfYear is set. See the iCalendar spec for examples of its significance. * * This corresponds to the BYWKST fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also firstDayOfWeek().

void QOrganizerRecurrenceRule::setFrequency ( Frequency freq )

* Sets the frequency with which the item recurs to freq. * * This corresponds to the FREQ fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also frequency().

void QOrganizerRecurrenceRule::setInterval ( int interval )

* Sets the interval, between cycles of length given by frequency(), in which the item should recur * to interval. * * For example, if the frequency() is QOrganizerRecurrenceRule::Daily and the interval is set to * 2, the item should recur every second day. * * This corresponds to the INTERVAL fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also interval().

void QOrganizerRecurrenceRule::setLimit ( int count )

Sets the "count" condition of the recurrence rule to count. If an end-date was previously * set, it is removed as count and endDate are mutually exclusive. * * The "count" condition is the maximum number of times the item should recur. Calling clearLimit() or setting this * to a negative value removes the count condition. * * This corresponds to the COUNT fragment in iCalendar's RRULE. *

This function was introduced in Qt Mobility 1.1.

See also clearLimit().

void QOrganizerRecurrenceRule::setLimit ( const QDate & date )

Sets the end-date condition of the recurrence rule to date. If a "count" condition was * previously set, it is removed as count and endDate are mutually exclusive. * * The end-date condition is the date after which the item should not recur. Calling clearLimit() or setting this to * the null date removes the end-date condition. * * This corresponds to the UNTIL fragment in iCalendar's RRULE. *

This function was introduced in Qt Mobility 1.1.

See also clearLimit().

void QOrganizerRecurrenceRule::setMonthsOfYear ( const QSet<Month> & months )

* Sets the months on which the item should recur to months. * * This corresponds to the BYMONTHDAY fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also monthsOfYear().

void QOrganizerRecurrenceRule::setPositions ( const QSet<int> & pos )

* Sets the list of positions that the item should recur on to pos. This specifies that the item * should only recur on the nth occurrence within the set of events otherwise specified by the rule, * for the values of n in pos. * * Negative values in the list represnet a position counting from the end of the set. * * For example, if frequency() == Monthly and months() is the list Monday, Tuesday, Wednesday, * Thursday, Friday, and positions() == -1, this specifies that the item should recur on the last * weekday of each month. * * This corresponds to the BYSETPOS fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also positions().

void QOrganizerRecurrenceRule::setWeeksOfYear ( const QSet<int> & weeks )

* Sets the weeks of the year on which the item should recur to weeks. Negative values in the list * represent the number of weeks from the end of the year. eg. 1 represents the first week of the * year and -1 represents the last week of the year. * * This corresponds to the BYWEEK fragment in iCalendar's RRULE.

This function was introduced in Qt Mobility 1.1.

See also weeksOfYear().

QSet<int> QOrganizerRecurrenceRule::weeksOfYear () const

* Returns a list of the weeks of the year that the item should recur on. If not set, this is the * empty list, which signifies that it should be implied, if necessary, by the week number of the * item.

This function was introduced in Qt Mobility 1.1.

See also setWeeksOfYear().

QOrganizerRecurrenceRule & QOrganizerRecurrenceRule::operator= ( const QOrganizerRecurrenceRule & other )

* Assigns this detail to be equal to other.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerRecurrenceRule::operator== ( const QOrganizerRecurrenceRule & other ) const

Returns true if this recurrence rule is equal to the other; otherwise returns false.

This function was introduced in Qt Mobility 1.1.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.