libkcal Library API Documentation

KCal::Recurrence Class Reference

This class represents a recurrence rule for a calendar incidence. More...

#include <recurrence.h>

List of all members.

Public Types

enum  {
  rNone = 0, rMinutely = 0x001, rHourly = 0x0002, rDaily = 0x0003,
  rWeekly = 0x0004, rMonthlyPos = 0x0005, rMonthlyDay = 0x0006, rYearlyMonth = 0x0007,
  rYearlyDay = 0x0008, rYearlyPos = 0x0009
}
 enumeration for describing how an event recurs, if at all. More...


Public Member Functions

 Recurrence (Incidence *parent, int compatVersion=0)
 Recurrence (const Recurrence &, Incidence *parent)
QDateTime recurStart () const
 Return the start of the recurrence.

int recurExDatesCount () const
 Returns the number of exception dates for the recurrence.

void setRecurStart (const QDateTime &start)
 Set start of recurrence, as a date and time.

void setRecurStart (const QDate &start)
 Set start of recurrence, as a date with no time.

void setFloats (bool f)
 Set whether the recurrence has no time, just a date.

void setRecurReadOnly (bool readOnly)
 Set if recurrence is read-only or can be changed.

void setRecurExDatesCount (int count)
 Set number of exception dates.

void setCompatVersion (int version=0)
ushort doesRecur () const
 Returns the event's recurrence status.

bool recursOnPure (const QDate &qd) const
 Returns true if the date specified is one on which the event will recur.

bool recursAtPure (const QDateTime &) const
 Returns true if the date/time specified is one at which the event will recur.

void unsetRecurs ()
 Turns off recurrence for the event.

QDate getNextDate (const QDate &preDate, bool *last=0) const
QDateTime getNextDateTime (const QDateTime &preDateTime, bool *last=0) const
QDate getPreviousDate (const QDate &afterDate, bool *last=0) const
QDateTime getPreviousDateTime (const QDateTime &afterDateTime, bool *last=0) const
int frequency () const
 Returns frequency of recurrence, in terms of the recurrence time period type.

int duration () const
 Returns the total number of recurrences, including the initial occurrence.

void setDuration (int duration)
 Sets the total number of times the event is to occur, including both the first and last.

int durationTo (const QDate &) const
 Returns the number of recurrences up to and including the date specified.

int durationTo (const QDateTime &) const
 Returns the number of recurrences up to and including the date/time specified.

QDate endDate () const
 Returns the date of the last recurrence.

QDateTime endDateTime () const
 Returns the date and time of the last recurrence.

QString endDateStr (bool shortfmt=true) const
 Returns a string representing the recurrence end date in the format according to the user's locale settings.

void setMinutely (int _rFreq, int duration)
void setMinutely (int _rFreq, const QDateTime &endDateTime)
void setHourly (int _rFreq, int duration)
void setHourly (int _rFreq, const QDateTime &endDateTime)
void setDaily (int _rFreq, int duration)
void setDaily (int _rFreq, const QDate &endDate)
void setWeekly (int _rFreq, const QBitArray &_rDays, int duration, int weekStart=1)
void setWeekly (int _rFreq, const QBitArray &_rDays, const QDate &endDate, int weekStart=1)
int weekStart () const
 Returns the first day of the week.

const QBitArraydays () const
 Returns week day mask (bit 0 = Monday).

void setMonthly (short type, int _rFreq, int duration)
void setMonthly (short type, int _rFreq, const QDate &endDate)
 same as above, but with ending date not number of recurrences

void addMonthlyPos (short _rPos, const QBitArray &_rDays)
void addMonthlyDay (short _rDay)
const QPtrList< rMonthPos > & monthPositions () const
 Returns list of day positions in months.

const QPtrList< int > & monthDays () const
 Returns list of day numbers of a month.

void setYearly (int type, int freq, int duration)
void setYearly (int type, int freq, const QDate &endDate)
 Sets an event to recur yearly ending at endDate.

void addYearlyNum (short _rNum)
 Adds position of day or month in year.

void addYearlyMonthPos (short _rPos, const QBitArray &_rDays)
 Adds a position to the recursYearlyPos recurrence rule, if it is set.

const QPtrList< int > & yearNums () const
 Returns positions of days or months in year.

const QPtrList< rMonthPos > & yearMonthPositions () const
 Returns list of day positions in months, for a recursYearlyPos recurrence rule.


Protected Types

enum  PeriodFunc { END_DATE_AND_COUNT, COUNT_TO_DATE, NEXT_AFTER_DATE }

Protected Member Functions

bool recursSecondly (const QDate &, int secondFreq) const
bool recursMinutelyAt (const QDateTime &dt, int minuteFreq) const
bool recursDaily (const QDate &) const
bool recursWeekly (const QDate &) const
bool recursMonthly (const QDate &) const
bool recursYearlyByMonth (const QDate &) const
bool recursYearlyByPos (const QDate &) const
bool recursYearlyByDay (const QDate &) const
QDate getNextDateNoTime (const QDate &preDate, bool *last) const
QDate getPreviousDateNoTime (const QDate &afterDate, bool *last) const
void addMonthlyPos_ (short _rPos, const QBitArray &_rDays)
void setDailySub (short type, int freq, int duration)
void setYearly_ (short type, int freq, int duration)
int recurCalc (PeriodFunc, QDate &enddate) const
int recurCalc (PeriodFunc, QDateTime &endtime) const
int secondlyCalc (PeriodFunc, QDateTime &endtime, int freq) const
int dailyCalc (PeriodFunc, QDate &enddate) const
int weeklyCalc (PeriodFunc, QDate &enddate) const
int weeklyCalcEndDate (QDate &enddate, int daysPerWeek) const
int weeklyCalcToDate (const QDate &enddate, int daysPerWeek) const
int weeklyCalcNextAfter (QDate &enddate, int daysPerWeek) const
int monthlyCalc (PeriodFunc, QDate &enddate) const
int monthlyCalcEndDate (QDate &enddate, MonthlyData &) const
int monthlyCalcToDate (const QDate &enddate, MonthlyData &) const
int monthlyCalcNextAfter (QDate &enddate, MonthlyData &) const
int yearlyMonthCalc (PeriodFunc, QDate &enddate) const
int yearlyMonthCalcEndDate (QDate &enddate, YearlyMonthData &) const
int yearlyMonthCalcToDate (const QDate &enddate, YearlyMonthData &) const
int yearlyMonthCalcNextAfter (QDate &enddate, YearlyMonthData &) const
int yearlyPosCalc (PeriodFunc, QDate &enddate) const
int yearlyPosCalcEndDate (QDate &enddate, YearlyPosData &) const
int yearlyPosCalcToDate (const QDate &enddate, YearlyPosData &) const
int yearlyPosCalcNextAfter (QDate &enddate, YearlyPosData &) const
int yearlyDayCalc (PeriodFunc, QDate &enddate) const
int yearlyDayCalcEndDate (QDate &enddate, YearlyDayData &) const
int yearlyDayCalcToDate (const QDate &enddate, YearlyDayData &) const
int yearlyDayCalcNextAfter (QDate &enddate, YearlyDayData &) const
int countMonthlyPosDays () const
void getMonthlyPosDays (QValueList< int > &, int daysInMonth, int startDayOfWeek) const
bool getMonthlyDayDays (QValueList< int > &, int daysInMonth) const
bool getYearlyMonthMonths (int day, QValueList< int > &, QValueList< int > &leaplist) const
int getFirstDayInWeek (int startDay, bool useWeekStart=true) const
int getLastDayInWeek (int endDay, bool useWeekStart=true) const
QDate getFirstDateInMonth (const QDate &earliestDate) const
QDate getLastDateInMonth (const QDate &latestDate) const
QDate getFirstDateInYear (const QDate &earliestDate) const
QDate getLastDateInYear (const QDate &latestDate) const

Friends

struct MonthlyData
struct YearlyMonthData
struct YearlyPosData
struct YearlyDayData


Detailed Description

This class represents a recurrence rule for a calendar incidence.

Definition at line 36 of file recurrence.h.


Member Enumeration Documentation

anonymous enum
 

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

Definition at line 40 of file recurrence.h.


Member Function Documentation

QDateTime KCal::Recurrence::recurStart  )  const [inline]
 

Return the start of the recurrence.

Definition at line 56 of file recurrence.h.

int KCal::Recurrence::recurExDatesCount  )  const [inline]
 

Returns the number of exception dates for the recurrence.

Definition at line 58 of file recurrence.h.

void KCal::Recurrence::setRecurStart const QDateTime start  ) 
 

Set start of recurrence, as a date and time.

Referenced by KCal::Incidence::setDtStart().

void KCal::Recurrence::setRecurStart const QDate start  ) 
 

Set start of recurrence, as a date with no time.

Recurrence types which are sub-daily (e.g. rHourly) always have a time; the time is set to 00:00:00 in these cases.

void KCal::Recurrence::setFloats bool  f  ) 
 

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

Recurrence types which are sub-daily (e.g. rHourly) always have a time and cannot be set to float. N.B. This property is derived by default from the parent incidence, or according to whether a time is specified in setRecurStart().

void KCal::Recurrence::setRecurReadOnly bool  readOnly  )  [inline]
 

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

Definition at line 72 of file recurrence.h.

Referenced by KCal::Incidence::setReadOnly().

void KCal::Recurrence::setRecurExDatesCount int  count  )  [inline]
 

Set number of exception dates.

Definition at line 74 of file recurrence.h.

Referenced by KCal::Incidence::addExDate(), and KCal::Incidence::setExDates().

ushort KCal::Recurrence::doesRecur  )  const
 

Returns the event's recurrence status.

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

Referenced by KCal::VCalFormat::eventToVEvent(), KCal::CalFilter::filterEvent(), and KCal::CalendarLocal::insertEvent().

bool KCal::Recurrence::recursOnPure const QDate qd  )  const
 

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

Referenced by KCal::Incidence::recursOn().

bool KCal::Recurrence::recursAtPure const QDateTime  )  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.

void KCal::Recurrence::unsetRecurs  ) 
 

Turns off recurrence for the event.

int KCal::Recurrence::frequency  )  const
 

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

Referenced by KCal::VCalFormat::eventToVEvent().

int KCal::Recurrence::duration  )  const
 

Returns the total number of recurrences, including the initial occurrence.

Referenced by KCal::VCalFormat::eventToVEvent(), and KCal::CalendarLocal::rawEvents().

void KCal::Recurrence::setDuration int  duration  ) 
 

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

int KCal::Recurrence::durationTo const QDate  )  const
 

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

int KCal::Recurrence::durationTo const QDateTime  )  const
 

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

QDate KCal::Recurrence::endDate  )  const
 

Returns the date of the last recurrence.

An invalid date is returned if the recurrence has no end. Note: for some recurrence types, endDate() can involve significant calculation.

Referenced by KCal::VCalFormat::eventToVEvent(), and KCal::CalendarLocal::rawEvents().

QDateTime KCal::Recurrence::endDateTime  )  const
 

Returns the date and time of the last recurrence.

An invalid date is returned if the recurrence has no end. Note: for some recurrence types, endDateTime() can involve significant calculation.

QString KCal::Recurrence::endDateStr bool  shortfmt = true  )  const
 

Returns a string representing the recurrence end date in the format according to the user's locale settings.

int KCal::Recurrence::weekStart  )  const [inline]
 

Returns the first day of the week.

Monday=1 .. Sunday=7.

Definition at line 199 of file recurrence.h.

const QBitArray& KCal::Recurrence::days  )  const
 

Returns week day mask (bit 0 = Monday).

Referenced by KCal::VCalFormat::eventToVEvent().

void KCal::Recurrence::setMonthly short  type,
int  _rFreq,
const QDate endDate
 

same as above, but with ending date not number of recurrences

const QPtrList<rMonthPos>& KCal::Recurrence::monthPositions  )  const
 

Returns list of day positions in months.

Referenced by KCal::VCalFormat::eventToVEvent().

const QPtrList<int>& KCal::Recurrence::monthDays  )  const
 

Returns list of day numbers of a month.

Referenced by KCal::VCalFormat::eventToVEvent().

void KCal::Recurrence::setYearly int  type,
int  freq,
const QDate endDate
 

Sets an event to recur yearly ending at endDate.

void KCal::Recurrence::addYearlyNum short  _rNum  ) 
 

Adds position of day or month in year.

N.B. for recursYearlyPos, addYearlyMonthPos() must also be called to add positions within the month.

Referenced by KCal::VCalFormat::VEventToEvent().

void KCal::Recurrence::addYearlyMonthPos short  _rPos,
const QBitArray _rDays
 

Adds a position to the recursYearlyPos recurrence rule, if it is set.

N.B. addYearlyNum() must also be called to add recurrence months. Parameters are the same as for addMonthlyPos().

const QPtrList<int>& KCal::Recurrence::yearNums  )  const
 

Returns positions of days or months in year.

Referenced by KCal::VCalFormat::eventToVEvent().

const QPtrList<rMonthPos>& KCal::Recurrence::yearMonthPositions  )  const
 

Returns list of day positions in months, for a recursYearlyPos recurrence rule.


The documentation for this class was generated from the following file:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:04 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001