summaryrefslogtreecommitdiffabout
path: root/libkcal/recurrence.h
Side-by-side diff
Diffstat (limited to 'libkcal/recurrence.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/recurrence.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/libkcal/recurrence.h b/libkcal/recurrence.h
index b13d14f..5b5aab1 100644
--- a/libkcal/recurrence.h
+++ b/libkcal/recurrence.h
@@ -3,49 +3,51 @@
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_RECURRENCE_H
#define KCAL_RECURRENCE_H
#include <qstring.h>
#include <qbitarray.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
namespace KCal {
class Incidence;
/**
This class represents a recurrence rule for a calendar incidence.
*/
class Recurrence
{
public:
/** enumeration for describing how an event recurs, if at all. */
enum { rNone = 0, rMinutely = 0x001, rHourly = 0x0002, rDaily = 0x0003,
rWeekly = 0x0004, rMonthlyPos = 0x0005, rMonthlyDay = 0x0006,
rYearlyMonth = 0x0007, rYearlyDay = 0x0008, rYearlyPos = 0x0009 };
/** Enumeration for specifying what date yearly recurrences of February 29th occur
* in non-leap years. */
enum Feb29Type {
rMar1, // recur on March 1st (default)
rFeb28, // recur on February 28th
rFeb29 // only recur on February 29th, i.e. don't recur in non-leap years
};
@@ -227,96 +229,96 @@ class Recurrence
const QBitArray &days() const;
/** Sets an event to recur monthly.
* @var type rMonthlyPos or rMonthlyDay
* @var _rFreq the frequency to recur, e.g. 3 for every third month.
* @var duration the number of times the event is to occur, or -1 to recur indefinitely.
*/
void setMonthly(short type, int _rFreq, int duration);
/** same as above, but with ending date not number of recurrences */
void setMonthly(short type, int _rFreq, const QDate &endDate);
/** Adds a position to the recursMonthlyPos recurrence rule, if it is
* set.
* @var _rPos the position in the month for the recurrence, with valid
* values being 1-5 (5 weeks max in a month).
* @var _rDays the days for the position to recur on (bit 0 = Monday).
* Example: _rPos = 2, and bits 0 and 2 are set in _rDays:
* 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;
+ const Q3PtrList<rMonthPos> &monthPositions() const;
/** Returns list of day numbers of a month. */
- const QPtrList<int> &monthDays() const;
+ const Q3PtrList<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;
+ const Q3PtrList<int> &yearNums() const;
/** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */
- const QPtrList<rMonthPos> &yearMonthPositions() const;
+ const Q3PtrList<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;
+ bool getYearlyMonthMonths(int day, Q3ValueList<int>&,
+ Q3ValueList<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;
@@ -324,76 +326,76 @@ class Recurrence
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,
+ void getMonthlyPosDays(Q3ValueList<int>&, int daysInMonth,
int startDayOfWeek) const;
- bool getMonthlyDayDays(QValueList<int>&, int daysInMonth) const;
+ bool getMonthlyDayDays(Q3ValueList<int>&, int daysInMonth) 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
+ Q3PtrList<rMonthPos> rMonthPositions; // list of positions during a month
// on which an event recurs
- QPtrList<int> rMonthDays; // list of days during a month on
+ Q3PtrList<int> rMonthDays; // list of days during a month on
// which the event recurs
- QPtrList<int> rYearNums; // either months/days to recur on for rYearly,
+ Q3PtrList<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;
};
}