KCalendarCore::RecurrenceRule

Search for usage in LXR

KCalendarCore::RecurrenceRule Class Reference

#include <recurrencerule.h>

Classes

class  WDayPos
 

Public Types

typedef QList< RecurrenceRule * > List
 
enum  PeriodType {
  rNone = 0 , rSecondly , rMinutely , rHourly ,
  rDaily , rWeekly , rMonthly , rYearly
}
 

Public Member Functions

 RecurrenceRule ()
 
 RecurrenceRule (const RecurrenceRule &r)
 
void addObserver (RuleObserver *observer)
 
bool allDay () const
 
const QList< WDayPos > & byDays () const
 
const QList< int > & byHours () const
 
const QList< int > & byMinutes () const
 
const QList< int > & byMonthDays () const
 
const QList< int > & byMonths () const
 
const QList< int > & bySeconds () const
 
const QList< int > & bySetPos () const
 
const QList< int > & byWeekNumbers () const
 
const QList< int > & byYearDays () const
 
void clear ()
 
bool dateMatchesRules (const QDateTime &dt) const
 
void dump () const
 
int duration () const
 
int durationTo (const QDate &date) const
 
int durationTo (const QDateTime &dt) const
 
QDateTime endDt (bool *result=nullptr) const
 
uint frequency () const
 
QDateTime getNextDate (const QDateTime &preDateTime) const
 
QDateTime getPreviousDate (const QDateTime &afterDateTime) const
 
bool isReadOnly () const
 
bool operator!= (const RecurrenceRule &r) const
 
RecurrenceRuleoperator= (const RecurrenceRule &r)
 
bool operator== (const RecurrenceRule &r) const
 
PeriodType 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 removeObserver (RuleObserver *observer)
 
QString rrule () const
 
void setAllDay (bool allDay)
 
void setByDays (const QList< WDayPos > &byDays)
 
void setByHours (const QList< int > &byHours)
 
void setByMinutes (const QList< int > &byMinutes)
 
void setByMonthDays (const QList< int > &byMonthDays)
 
void setByMonths (const QList< int > &byMonths)
 
void setBySeconds (const QList< int > &bySeconds)
 
void setBySetPos (const QList< int > &bySetPos)
 
void setByWeekNumbers (const QList< int > &byWeekNumbers)
 
void setByYearDays (const QList< int > &byYearDays)
 
void setDirty ()
 
void setDuration (int duration)
 
void setEndDt (const QDateTime &endDateTime)
 
void setFrequency (int freq)
 
void setReadOnly (bool readOnly)
 
void setRecurrenceType (PeriodType period)
 
void setRRule (const QString &rrule)
 
void setStartDt (const QDateTime &start)
 
void setWeekStart (short weekStart)
 
void shiftTimes (const QTimeZone &oldTz, const QTimeZone &newTz)
 
QDateTime startDt () const
 
QList< QDateTimetimesInInterval (const QDateTime &start, const QDateTime &end) const
 
short weekStart () const
 

Detailed Description

This class represents a recurrence rule for a calendar incidence.

Definition at line 31 of file recurrencerule.h.

Member Typedef Documentation

◆ List

Member Enumeration Documentation

◆ PeriodType

enum for describing the frequency how an event recurs, if at all.

Definition at line 44 of file recurrencerule.h.

Constructor & Destructor Documentation

◆ RecurrenceRule() [1/2]

RecurrenceRule::RecurrenceRule ( )

/************************************************************************** RecurrenceRule *

Definition at line 863 of file recurrencerule.cpp.

◆ RecurrenceRule() [2/2]

RecurrenceRule::RecurrenceRule ( const RecurrenceRule & r)

Definition at line 868 of file recurrencerule.cpp.

◆ ~RecurrenceRule()

RecurrenceRule::~RecurrenceRule ( )

Definition at line 873 of file recurrencerule.cpp.

Member Function Documentation

◆ addObserver()

void RecurrenceRule::addObserver ( RuleObserver * 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 895 of file recurrencerule.cpp.

◆ allDay()

bool RecurrenceRule::allDay ( ) const

Returns whether the start date has no time associated.

All-Day means – according to rfc2445 – that the event has no time associate.

Definition at line 2126 of file recurrencerule.cpp.

◆ byDays()

const QList< RecurrenceRule::WDayPos > & RecurrenceRule::byDays ( ) const

Definition at line 2146 of file recurrencerule.cpp.

◆ byHours()

const QList< int > & RecurrenceRule::byHours ( ) const

Definition at line 2141 of file recurrencerule.cpp.

◆ byMinutes()

const QList< int > & RecurrenceRule::byMinutes ( ) const

Definition at line 2136 of file recurrencerule.cpp.

◆ byMonthDays()

const QList< int > & RecurrenceRule::byMonthDays ( ) const

Definition at line 2151 of file recurrencerule.cpp.

◆ byMonths()

const QList< int > & RecurrenceRule::byMonths ( ) const

Definition at line 2166 of file recurrencerule.cpp.

◆ bySeconds()

const QList< int > & RecurrenceRule::bySeconds ( ) const

Definition at line 2131 of file recurrencerule.cpp.

◆ bySetPos()

const QList< int > & RecurrenceRule::bySetPos ( ) const

Definition at line 2171 of file recurrencerule.cpp.

◆ byWeekNumbers()

const QList< int > & RecurrenceRule::byWeekNumbers ( ) const

Definition at line 2161 of file recurrencerule.cpp.

◆ byYearDays()

const QList< int > & RecurrenceRule::byYearDays ( ) const

Definition at line 2156 of file recurrencerule.cpp.

◆ clear()

void RecurrenceRule::clear ( )

Turns off recurrence for the event.

Definition at line 977 of file recurrencerule.cpp.

◆ dateMatchesRules()

bool RecurrenceRule::dateMatchesRules ( const QDateTime & dt) const

Returns true if the date matches the rules.

It does not necessarily mean that this is an actual occurrence. In particular, the method does not check if the date is after the end date, or if the frequency interval matches.

Parameters
dtthe date+time to check for matching the rules

Definition at line 1353 of file recurrencerule.cpp.

◆ dump()

void RecurrenceRule::dump ( ) const

Debug output.

Definition at line 2005 of file recurrencerule.cpp.

◆ duration()

int RecurrenceRule::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 2096 of file recurrencerule.cpp.

◆ durationTo() [1/2]

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

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

Definition at line 1577 of file recurrencerule.cpp.

◆ durationTo() [2/2]

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

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

Definition at line 1555 of file recurrencerule.cpp.

◆ endDt()

QDateTime RecurrenceRule::endDt ( bool * result = nullptr) const

Returns the date and time of the last recurrence.

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

Parameters
resultif non-null, *result is updated to true if successful, or false if there is no recurrence or its end date cannot be determined.

Definition at line 916 of file recurrencerule.cpp.

◆ frequency()

uint RecurrenceRule::frequency ( ) const

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

Definition at line 2091 of file recurrencerule.cpp.

◆ getNextDate()

QDateTime RecurrenceRule::getNextDate ( const QDateTime & preDateTime) const

Returns the date and time of the next recurrence, 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
date/time of next recurrence, or invalid date if none.

Definition at line 1648 of file recurrencerule.cpp.

◆ getPreviousDate()

QDateTime RecurrenceRule::getPreviousDate ( 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, or invalid date if none.

Definition at line 1582 of file recurrencerule.cpp.

◆ isReadOnly()

bool RecurrenceRule::isReadOnly ( ) const

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

Definition at line 2111 of file recurrencerule.cpp.

◆ operator!=()

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

Definition at line 82 of file recurrencerule.h.

◆ operator=()

RecurrenceRule & RecurrenceRule::operator= ( const RecurrenceRule & r)

Definition at line 883 of file recurrencerule.cpp.

◆ operator==()

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

Definition at line 878 of file recurrencerule.cpp.

◆ recurrenceType()

RecurrenceRule::PeriodType RecurrenceRule::recurrenceType ( ) const

Definition at line 2086 of file recurrencerule.cpp.

◆ recurs()

bool RecurrenceRule::recurs ( ) const

Returns the event's recurrence status.

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

Definition at line 2121 of file recurrencerule.cpp.

◆ recursAt()

bool RecurrenceRule::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. The start date/time returns true only if it actually matches the rule.

Parameters
dtthe date+time to check for recurrency

Definition at line 1503 of file recurrencerule.cpp.

◆ recursOn()

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

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

The start date returns true only if it actually matches the rule.

Parameters
datedate to check
timeZonetime specification for date

Definition at line 1364 of file recurrencerule.cpp.

◆ recurTimesOn()

TimeList RecurrenceRule::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 timeZone.

Parameters
datethe date for which to find the recurrence times
timeZonetime specification for date

Definition at line 1539 of file recurrencerule.cpp.

◆ removeObserver()

void RecurrenceRule::removeObserver ( RuleObserver * 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 902 of file recurrencerule.cpp.

◆ rrule()

QString RecurrenceRule::rrule ( ) const

Definition at line 2101 of file recurrencerule.cpp.

◆ setAllDay()

void RecurrenceRule::setAllDay ( bool allDay)

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

has no time attached)

Parameters
allDayWhether start datetime is all-day

Definition at line 968 of file recurrencerule.cpp.

◆ setByDays()

void RecurrenceRule::setByDays ( const QList< WDayPos > & byDays)

Definition at line 1032 of file recurrencerule.cpp.

◆ setByHours()

void RecurrenceRule::setByHours ( const QList< int > & byHours)

Definition at line 1023 of file recurrencerule.cpp.

◆ setByMinutes()

void RecurrenceRule::setByMinutes ( const QList< int > & byMinutes)

Definition at line 1014 of file recurrencerule.cpp.

◆ setByMonthDays()

void RecurrenceRule::setByMonthDays ( const QList< int > & byMonthDays)

Definition at line 1041 of file recurrencerule.cpp.

◆ setByMonths()

void RecurrenceRule::setByMonths ( const QList< int > & byMonths)

Definition at line 1068 of file recurrencerule.cpp.

◆ setBySeconds()

void RecurrenceRule::setBySeconds ( const QList< int > & bySeconds)

Definition at line 1005 of file recurrencerule.cpp.

◆ setBySetPos()

void RecurrenceRule::setBySetPos ( const QList< int > & bySetPos)

Definition at line 1077 of file recurrencerule.cpp.

◆ setByWeekNumbers()

void RecurrenceRule::setByWeekNumbers ( const QList< int > & byWeekNumbers)

Definition at line 1059 of file recurrencerule.cpp.

◆ setByYearDays()

void RecurrenceRule::setByYearDays ( const QList< int > & byYearDays)

Definition at line 1050 of file recurrencerule.cpp.

◆ setDirty()

void RecurrenceRule::setDirty ( )

Definition at line 982 of file recurrencerule.cpp.

◆ setDuration()

void RecurrenceRule::setDuration ( int duration)

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

Definition at line 959 of file recurrencerule.cpp.

◆ setEndDt()

void RecurrenceRule::setEndDt ( 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 947 of file recurrencerule.cpp.

◆ setFrequency()

void RecurrenceRule::setFrequency ( int freq)

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

Definition at line 996 of file recurrencerule.cpp.

◆ setReadOnly()

void RecurrenceRule::setReadOnly ( bool readOnly)

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

Definition at line 2116 of file recurrencerule.cpp.

◆ setRecurrenceType()

void RecurrenceRule::setRecurrenceType ( PeriodType period)

Definition at line 907 of file recurrencerule.cpp.

◆ setRRule()

void RecurrenceRule::setRRule ( const QString & rrule)

Set the RRULE string for the rule.

This is merely stored for future reference. The string is not used in any way by the RecurrenceRule.

Parameters
rrulethe RRULE string

Definition at line 2106 of file recurrencerule.cpp.

◆ setStartDt()

void RecurrenceRule::setStartDt ( const QDateTime & start)

Sets the recurrence start date/time.

Note that setting the start date/time does not make the recurrence occur on that date/time, it simply sets a lower limit to when the recurrences take place (this applies only for the by- rules, not for i.e. an hourly rule where the startDt is the first occurrence).

Note that setting start to a date-only value does not make an all-day recurrence: to do this, call setAllDay(true).

Parameters
startthe recurrence's start date and time

Definition at line 987 of file recurrencerule.cpp.

◆ setWeekStart()

void RecurrenceRule::setWeekStart ( short weekStart)

Definition at line 1086 of file recurrencerule.cpp.

◆ shiftTimes()

void RecurrenceRule::shiftTimes ( const QTimeZone & oldTz,
const QTimeZone & newTz )

Shift the times of the rule 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 rule time zone.

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

Parameters
oldTzthe time specification which provides the clock times
newTzthe new time specification

Definition at line 1095 of file recurrencerule.cpp.

◆ startDt()

QDateTime RecurrenceRule::startDt ( ) const

Returns the recurrence start date/time.

Note that the recurrence does not necessarily occur on the start date/time. For this to happen, it must actually match the rule.

Definition at line 2081 of file recurrencerule.cpp.

◆ timesInInterval()

QList< QDateTime > RecurrenceRule::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 1710 of file recurrencerule.cpp.

◆ weekStart()

short RecurrenceRule::weekStart ( ) const

Definition at line 2176 of file recurrencerule.cpp.


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 Fri May 24 2024 11:59:19 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.