summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2004-07-10 17:03:16 (UTC)
committer zautrix <zautrix>2004-07-10 17:03:16 (UTC)
commitcf2f3f98a4811668f9e9d0d5f44ea5b51d268cef (patch) (side-by-side diff)
tree963322cd4c539c084feb43dfde5eabe52ae4385f /libkcal
parent8cc6d456812b5a9a386e81c9e46baccd56029537 (diff)
downloadkdepimpi-cf2f3f98a4811668f9e9d0d5f44ea5b51d268cef.zip
kdepimpi-cf2f3f98a4811668f9e9d0d5f44ea5b51d268cef.tar.gz
kdepimpi-cf2f3f98a4811668f9e9d0d5f44ea5b51d268cef.tar.bz2
Fixed some problems with the recurrence
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/icalformatimpl.cpp8
-rw-r--r--libkcal/recurrence.cpp17
-rw-r--r--libkcal/recurrence.h6
3 files changed, 24 insertions, 7 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 32a1337..964ffe3 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -1347,97 +1347,97 @@ void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties
{
QMap<QCString, QString> customProperties;
icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY);
while (p) {
QString value = QString::fromUtf8(icalproperty_get_x(p));
customProperties[icalproperty_get_x_name(p)] = value;
//qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) );
p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY);
}
properties->setCustomProperties(customProperties);
}
void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence)
{
// kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl;
Recurrence *recur = incidence->recurrence();
recur->setCompatVersion(mCalendarVersion);
recur->unsetRecurs();
struct icalrecurrencetype r = rrule;
dumpIcalRecurrence(r);
readRecurrence( r, recur, incidence);
}
void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur, Incidence *incidence)
{
int wkst;
int index = 0;
short day = 0;
QBitArray qba(7);
int frequ = r.freq;
int interv = r.interval;
// preprocessing for odd recurrence definitions
if ( r.freq == ICAL_MONTHLY_RECURRENCE ) {
if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) {
interv = 12;
}
}
if ( r.freq == ICAL_YEARLY_RECURRENCE ) {
if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX && r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) {
frequ = ICAL_MONTHLY_RECURRENCE;
- interv = 12;
+ interv = 12* r.interval;
}
}
switch (frequ) {
case ICAL_MINUTELY_RECURRENCE:
if (!icaltime_is_null_time(r.until)) {
recur->setMinutely(interv,readICalDateTime(r.until));
} else {
if (r.count == 0)
recur->setMinutely(interv,-1);
else
recur->setMinutely(interv,r.count);
}
break;
case ICAL_HOURLY_RECURRENCE:
if (!icaltime_is_null_time(r.until)) {
recur->setHourly(interv,readICalDateTime(r.until));
} else {
if (r.count == 0)
recur->setHourly(interv,-1);
else
recur->setHourly(interv,r.count);
}
break;
case ICAL_DAILY_RECURRENCE:
if (!icaltime_is_null_time(r.until)) {
recur->setDaily(interv,readICalDate(r.until));
} else {
if (r.count == 0)
recur->setDaily(interv,-1);
else
recur->setDaily(interv,r.count);
}
break;
case ICAL_WEEKLY_RECURRENCE:
// kdDebug(5800) << "WEEKLY_RECURRENCE" << endl;
wkst = (r.week_start + 5)%7 + 1;
if (!icaltime_is_null_time(r.until)) {
recur->setWeekly(interv,qba,readICalDate(r.until),wkst);
} else {
if (r.count == 0)
recur->setWeekly(interv,qba,-1,wkst);
else
recur->setWeekly(interv,qba,r.count,wkst);
}
if ( r.by_day[0] == ICAL_RECURRENCE_ARRAY_MAX) {
int wday = incidence->dtStart().date().dayOfWeek ()-1;
//qDebug("weekly error found ");
@@ -1454,159 +1454,163 @@ void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurre
if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
if (!icaltime_is_null_time(r.until)) {
recur->setMonthly(Recurrence::rMonthlyPos,interv,
readICalDate(r.until));
} else {
if (r.count == 0)
recur->setMonthly(Recurrence::rMonthlyPos,interv,-1);
else
recur->setMonthly(Recurrence::rMonthlyPos,interv,r.count);
}
bool useSetPos = false;
short pos = 0;
while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
// kdDebug(5800) << "----a " << index << ": " << day << endl;
pos = icalrecurrencetype_day_position(day);
if (pos) {
day = icalrecurrencetype_day_day_of_week(day);
QBitArray ba(7); // don't wipe qba
ba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0
recur->addMonthlyPos(pos,ba);
} else {
qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0
useSetPos = true;
}
}
if (useSetPos) {
if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) {
recur->addMonthlyPos(r.by_set_pos[0],qba);
}
}
} else if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
if (!icaltime_is_null_time(r.until)) {
recur->setMonthly(Recurrence::rMonthlyDay,interv,
readICalDate(r.until));
} else {
if (r.count == 0)
recur->setMonthly(Recurrence::rMonthlyDay,interv,-1);
else
recur->setMonthly(Recurrence::rMonthlyDay,interv,r.count);
}
while((day = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
// kdDebug(5800) << "----b " << day << endl;
recur->addMonthlyDay(day);
}
}
break;
case ICAL_YEARLY_RECURRENCE:
if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
+ qDebug(" YEARLY DAY OF YEAR");
if (!icaltime_is_null_time(r.until)) {
recur->setYearly(Recurrence::rYearlyDay,interv,
readICalDate(r.until));
} else {
if (r.count == 0)
recur->setYearly(Recurrence::rYearlyDay,interv,-1);
else
recur->setYearly(Recurrence::rYearlyDay,interv,r.count);
}
while((day = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
recur->addYearlyNum(day);
}
} else if ( true /*r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX*/) {
if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
+ qDebug("YEARLY POS NOT SUPPORTED BY GUI");
if (!icaltime_is_null_time(r.until)) {
recur->setYearly(Recurrence::rYearlyPos,interv,
readICalDate(r.until));
} else {
if (r.count == 0)
recur->setYearly(Recurrence::rYearlyPos,interv,-1);
else
recur->setYearly(Recurrence::rYearlyPos,interv,r.count);
}
bool useSetPos = false;
short pos = 0;
while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
// kdDebug(5800) << "----a " << index << ": " << day << endl;
pos = icalrecurrencetype_day_position(day);
if (pos) {
day = icalrecurrencetype_day_day_of_week(day);
QBitArray ba(7); // don't wipe qba
ba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0
recur->addYearlyMonthPos(pos,ba);
} else {
qba.setBit((day+5)%7); // convert from Sunday=1 to Monday=0
useSetPos = true;
}
}
if (useSetPos) {
if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) {
recur->addYearlyMonthPos(r.by_set_pos[0],qba);
}
}
} else {
+ qDebug("YEARLY MONTH ");
if (!icaltime_is_null_time(r.until)) {
recur->setYearly(Recurrence::rYearlyMonth,interv,
readICalDate(r.until));
} else {
if (r.count == 0)
recur->setYearly(Recurrence::rYearlyMonth,interv,-1);
else
recur->setYearly(Recurrence::rYearlyMonth,interv,r.count);
}
- }
if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX ) {
index = 0;
while((day = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
recur->addYearlyNum(day);
}
} else {
recur->addYearlyNum(incidence->dtStart().date().month());
}
}
+
+ }
break;
default:
;
break;
}
}
void ICalFormatImpl::readAlarm(icalcomponent *alarm,Incidence *incidence)
{
//kdDebug(5800) << "Read alarm for " << incidence->summary() << endl;
Alarm* ialarm = incidence->newAlarm();
ialarm->setRepeatCount(0);
ialarm->setEnabled(true);
// Determine the alarm's action type
icalproperty *p = icalcomponent_get_first_property(alarm,ICAL_ACTION_PROPERTY);
if ( !p ) {
return;
}
icalproperty_action action = icalproperty_get_action(p);
Alarm::Type type = Alarm::Display;
switch ( action ) {
case ICAL_ACTION_DISPLAY: type = Alarm::Display; break;
case ICAL_ACTION_AUDIO: type = Alarm::Audio; break;
case ICAL_ACTION_PROCEDURE: type = Alarm::Procedure; break;
case ICAL_ACTION_EMAIL: type = Alarm::Email; break;
default:
;
return;
}
ialarm->setType(type);
p = icalcomponent_get_first_property(alarm,ICAL_ANY_PROPERTY);
while (p) {
icalproperty_kind kind = icalproperty_isa(p);
switch (kind) {
case ICAL_TRIGGER_PROPERTY: {
icaltriggertype trigger = icalproperty_get_trigger(p);
if (icaltime_is_null_time(trigger.time)) {
if (icaldurationtype_is_null_duration(trigger.duration)) {
kdDebug(5800) << "ICalFormatImpl::readAlarm(): Trigger has no time and no duration." << endl;
} else {
Duration duration = icaldurationtype_as_int( trigger.duration );
icalparameter *param = icalproperty_get_first_parameter(p,ICAL_RELATED_PARAMETER);
if (param && icalparameter_get_related(param) == ICAL_RELATED_END)
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index 5fc5d1f..dd74e10 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -609,168 +609,181 @@ void Recurrence::addMonthlyPos(short _rPos, const QBitArray &_rDays)
addMonthlyPos_(_rPos, _rDays);
}
void Recurrence::addMonthlyPos_(short _rPos, const QBitArray &_rDays)
{
if (mRecurReadOnly
|| _rPos == 0 || _rPos > 5 || _rPos < -5) // invalid week number
return;
for (rMonthPos* it = rMonthPositions.first(); it; it = rMonthPositions.next()) {
int itPos = it->negative ? -it->rPos : it->rPos;
if (_rPos == itPos) {
// This week is already in the list.
// Combine the specified days with those in the list.
it->rDays |= _rDays;
if (mParent) mParent->updated();
return;
}
}
// Add the new position to the list
rMonthPos *tmpPos = new rMonthPos;
if (_rPos > 0) {
tmpPos->rPos = _rPos;
tmpPos->negative = false;
} else {
tmpPos->rPos = -_rPos; // take abs()
tmpPos->negative = true;
}
tmpPos->rDays = _rDays;
tmpPos->rDays.detach();
rMonthPositions.append(tmpPos);
if (mCompatVersion < 310 && mCompatDuration > 0) {
// Backwards compatibility for KDE < 3.1.
// rDuration was set to the number of time periods to recur.
// Convert this to the number of occurrences.
int monthsAhead = (mCompatDuration-1+mRecurExDatesCount) * rFreq;
int month = mRecurStart.date().month() - 1 + monthsAhead;
QDate end(mRecurStart.date().year() + month/12, month%12 + 1, 31);
rDuration = INT_MAX; // ensure that recurCalc() does its job correctly
rDuration = recurCalc(COUNT_TO_DATE, end);
}
if (mParent) mParent->updated();
}
void Recurrence::addMonthlyDay(short _rDay)
{
- if (mRecurReadOnly || recurs != rMonthlyDay
+ if (mRecurReadOnly || (recurs != rMonthlyDay && recurs != rYearlyMonth)
|| _rDay == 0 || _rDay > 31 || _rDay < -31) // invalid day number
return;
for (int* it = rMonthDays.first(); it; it = rMonthDays.next()) {
if (_rDay == *it)
return; // this day is already in the list - avoid duplication
}
int *tmpDay = new int;
*tmpDay = _rDay;
rMonthDays.append(tmpDay);
if (mCompatVersion < 310 && mCompatDuration > 0) {
// Backwards compatibility for KDE < 3.1.
// rDuration was set to the number of time periods to recur.
// Convert this to the number of occurrences.
int monthsAhead = (mCompatDuration-1+mRecurExDatesCount) * rFreq;
int month = mRecurStart.date().month() - 1 + monthsAhead;
QDate end(mRecurStart.date().year() + month/12, month%12 + 1, 31);
rDuration = INT_MAX; // ensure that recurCalc() does its job correctly
rDuration = recurCalc(COUNT_TO_DATE, end);
}
if (mParent) mParent->updated();
}
void Recurrence::setYearly(int type, int _rFreq, int _rDuration)
{
if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
return;
if (mCompatVersion < 310)
mCompatDuration = (_rDuration > 0) ? _rDuration : 0;
setYearly_(type, mFeb29YearlyDefaultType, _rFreq, _rDuration);
}
void Recurrence::setYearly(int type, int _rFreq, const QDate &_rEndDate)
{
if (mRecurReadOnly) return;
rEndDateTime.setDate(_rEndDate);
rEndDateTime.setTime(mRecurStart.time());
mCompatDuration = 0;
setYearly_(type, mFeb29YearlyDefaultType, _rFreq, 0);
}
void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, int _rDuration)
{
if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
return;
if (mCompatVersion < 310)
mCompatDuration = (_rDuration > 0) ? _rDuration : 0;
setYearly_(rYearlyMonth, type, _rFreq, _rDuration);
}
void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, const QDate &_rEndDate)
{
if (mRecurReadOnly) return;
rEndDateTime.setDate(_rEndDate);
rEndDateTime.setTime(mRecurStart.time());
mCompatDuration = 0;
setYearly_(rYearlyMonth, type, _rFreq, 0);
}
void Recurrence::addYearlyMonthPos(short _rPos, const QBitArray &_rDays)
{
if (recurs == rYearlyPos)
addMonthlyPos_(_rPos, _rDays);
}
const QPtrList<int> &Recurrence::yearNums() const
{
return rYearNums;
}
-
+void Recurrence::addYearlyMonth(short _rPos )
+{
+ if (mRecurReadOnly || recurs != rYearlyMonth) // invalid day/month number
+ return;
+ rMonthPos *tmpPos = new rMonthPos;
+ if ( _rPos > 0) {
+ tmpPos->rPos = _rPos;
+ tmpPos->negative = false;
+ } else {
+ tmpPos->rPos = -_rPos; // take abs()
+ tmpPos->negative = true;
+ }
+ rMonthPositions.append(tmpPos);
+}
void Recurrence::addYearlyNum(short _rNum)
{
if (mRecurReadOnly
|| (recurs != rYearlyMonth && recurs != rYearlyDay && recurs != rYearlyPos)
|| _rNum <= 0) // invalid day/month number
return;
if (mCompatVersion < 310 && mCompatRecurs == rYearlyDay) {
// Backwards compatibility for KDE < 3.1.
// Dates were stored as day numbers, with a fiddle to take account of leap years.
// Convert the day number to a month.
if (_rNum <= 0 || _rNum > 366 || (_rNum == 366 && mRecurStart.date().daysInYear() < 366))
return; // invalid day number
_rNum = QDate(mRecurStart.date().year(), 1, 1).addDays(_rNum - 1).month();
} else
if ((recurs == rYearlyMonth || recurs == rYearlyPos) && _rNum > 12
|| recurs == rYearlyDay && _rNum > 366)
return; // invalid day number
uint i = 0;
for (int* it = rYearNums.first(); it && _rNum >= *it; it = rYearNums.next()) {
if (_rNum == *it)
return; // this day/month is already in the list - avoid duplication
++i;
}
int *tmpNum = new int;
*tmpNum = _rNum;
rYearNums.insert(i, tmpNum); // insert the day/month in a sorted position
if (mCompatVersion < 310 && mCompatDuration > 0) {
// Backwards compatibility for KDE < 3.1.
// rDuration was set to the number of time periods to recur.
// Convert this to the number of occurrences.
QDate end(mRecurStart.date().year() + (mCompatDuration-1+mRecurExDatesCount)*rFreq, 12, 31);
rDuration = INT_MAX; // ensure that recurCalc() does its job correctly
rDuration = recurCalc(COUNT_TO_DATE, end);
}
if (mParent) mParent->updated();
}
QDateTime Recurrence::getNextDateTime(const QDateTime &preDateTime, bool *last) const
{
if (last)
*last = false;
int freq;
diff --git a/libkcal/recurrence.h b/libkcal/recurrence.h
index a0f6d84..b13d14f 100644
--- a/libkcal/recurrence.h
+++ b/libkcal/recurrence.h
@@ -243,156 +243,156 @@ class Recurrence
* the rule is to repeat every 2nd Monday and Wednesday in the month.
*/
void addMonthlyPos(short _rPos, const QBitArray &_rDays);
/** Adds a position the the recursMonthlyDay list.
* @var _rDay the date in the month to recur.
*/
void addMonthlyDay(short _rDay);
/** Returns list of day positions in months. */
const QPtrList<rMonthPos> &monthPositions() const;
/** Returns list of day numbers of a month. */
const QPtrList<int> &monthDays() const;
/** Sets an event to recur yearly.
* @var type rYearlyMonth, rYearlyPos or rYearlyDay
* @var freq the frequency to recur, e.g. 3 for every third year.
* @var duration the number of times the event is to occur, or -1 to recur indefinitely.
*/
void setYearly(int type, int freq, int duration);
/** Sets an event to recur yearly ending at \a endDate. */
void setYearly(int type, int freq, const QDate &endDate);
/** Sets an event to recur yearly on specified dates.
* The dates must be specified by calling addYearlyNum().
* @var type the way recurrences of February 29th are to be handled in non-leap years.
* @var freq the frequency to recur, e.g. 3 for every third year.
* @var duration the number of times the event is to occur, or -1 to recur indefinitely.
*/
void setYearlyByDate(Feb29Type type, int freq, int duration);
/** Sets an event to recur yearly ending at \a endDate. */
void setYearlyByDate(Feb29Type type, int freq, const QDate &endDate);
/** Adds position of day or month in year.
* N.B. for recursYearlyPos, addYearlyMonthPos() must also be called
* to add positions within the month. */
void addYearlyNum(short _rNum);
/** 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().
*/
void addYearlyMonthPos(short _rPos, const QBitArray &_rDays);
/** Returns positions of days or months in year. */
const QPtrList<int> &yearNums() const;
/** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */
const QPtrList<rMonthPos> &yearMonthPositions() const;
/** Returns how yearly recurrences of February 29th are handled. */
Feb29Type feb29YearlyType() const { return mFeb29YearlyType; }
/** Sets the default method for handling yearly recurrences of February 29th. */
static void setFeb29YearlyTypeDefault(Feb29Type t) { mFeb29YearlyDefaultType = t; }
/** Returns the default method for handling yearly recurrences of February 29th. */
static Feb29Type setFeb29YearlyTypeDefault() { return mFeb29YearlyDefaultType; }
-
+ void addYearlyMonth(short _rPos ); // added LR
/**
Debug output.
*/
void dump() const;
QString recurrenceText() const;
+ bool getYearlyMonthMonths(int day, QValueList<int>&,
+ QValueList<int> &leaplist) const;
protected:
enum PeriodFunc { END_DATE_AND_COUNT, COUNT_TO_DATE, NEXT_AFTER_DATE };
struct MonthlyData; friend struct MonthlyData;
struct YearlyMonthData; friend struct YearlyMonthData;
struct YearlyPosData; friend struct YearlyPosData;
struct YearlyDayData; friend struct YearlyDayData;
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, Feb29Type, 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;
private:
// Prohibit copying
Recurrence(const Recurrence&);
Recurrence &operator=(const Recurrence&);
short recurs; // should be one of the enums.
int rWeekStart; // day which starts the week, Monday=1 .. Sunday=7
QBitArray rDays; // array of days during week it recurs
QPtrList<rMonthPos> rMonthPositions; // list of positions during a month
// on which an event recurs
QPtrList<int> rMonthDays; // list of days during a month on
// which the event recurs
QPtrList<int> rYearNums; // either months/days to recur on for rYearly,
// sorted in numerical order
int rFreq; // frequency of period
// one of the following must be specified
int rDuration; // num times to recur (inc. first occurrence), -1 = infinite
QDateTime rEndDateTime; // date/time at which to end recurrence
QDateTime mRecurStart; // date/time of first recurrence
bool mFloats; // the recurrence has no time, just a date
bool mRecurReadOnly;
int mRecurExDatesCount; // number of recurrences (in addition to rDuration) which are excluded
Feb29Type mFeb29YearlyType; // how to handle yearly recurrences of February 29th
static Feb29Type mFeb29YearlyDefaultType; // default value for mFeb29YearlyType
// Backwards compatibility for KDE < 3.1.
int mCompatVersion; // calendar file version for backwards compatibility
short mCompatRecurs; // original 'recurs' in old calendar format, or rNone
int mCompatDuration; // original 'rDuration' in old calendar format, or 0
Incidence *mParent;
};