-rw-r--r-- | libkcal/recurrence.h | 6 |
1 files changed, 3 insertions, 3 deletions
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 | |||
243 | * the rule is to repeat every 2nd Monday and Wednesday in the month. | 243 | * the rule is to repeat every 2nd Monday and Wednesday in the month. |
244 | */ | 244 | */ |
245 | void addMonthlyPos(short _rPos, const QBitArray &_rDays); | 245 | void addMonthlyPos(short _rPos, const QBitArray &_rDays); |
246 | /** Adds a position the the recursMonthlyDay list. | 246 | /** Adds a position the the recursMonthlyDay list. |
247 | * @var _rDay the date in the month to recur. | 247 | * @var _rDay the date in the month to recur. |
248 | */ | 248 | */ |
249 | void addMonthlyDay(short _rDay); | 249 | void addMonthlyDay(short _rDay); |
250 | /** Returns list of day positions in months. */ | 250 | /** Returns list of day positions in months. */ |
251 | const QPtrList<rMonthPos> &monthPositions() const; | 251 | const QPtrList<rMonthPos> &monthPositions() const; |
252 | /** Returns list of day numbers of a month. */ | 252 | /** Returns list of day numbers of a month. */ |
253 | const QPtrList<int> &monthDays() const; | 253 | const QPtrList<int> &monthDays() const; |
254 | 254 | ||
255 | /** Sets an event to recur yearly. | 255 | /** Sets an event to recur yearly. |
256 | * @var type rYearlyMonth, rYearlyPos or rYearlyDay | 256 | * @var type rYearlyMonth, rYearlyPos or rYearlyDay |
257 | * @var freq the frequency to recur, e.g. 3 for every third year. | 257 | * @var freq the frequency to recur, e.g. 3 for every third year. |
258 | * @var duration the number of times the event is to occur, or -1 to recur indefinitely. | 258 | * @var duration the number of times the event is to occur, or -1 to recur indefinitely. |
259 | */ | 259 | */ |
260 | void setYearly(int type, int freq, int duration); | 260 | void setYearly(int type, int freq, int duration); |
261 | /** Sets an event to recur yearly ending at \a endDate. */ | 261 | /** Sets an event to recur yearly ending at \a endDate. */ |
262 | void setYearly(int type, int freq, const QDate &endDate); | 262 | void setYearly(int type, int freq, const QDate &endDate); |
263 | /** Sets an event to recur yearly on specified dates. | 263 | /** Sets an event to recur yearly on specified dates. |
264 | * The dates must be specified by calling addYearlyNum(). | 264 | * The dates must be specified by calling addYearlyNum(). |
265 | * @var type the way recurrences of February 29th are to be handled in non-leap years. | 265 | * @var type the way recurrences of February 29th are to be handled in non-leap years. |
266 | * @var freq the frequency to recur, e.g. 3 for every third year. | 266 | * @var freq the frequency to recur, e.g. 3 for every third year. |
267 | * @var duration the number of times the event is to occur, or -1 to recur indefinitely. | 267 | * @var duration the number of times the event is to occur, or -1 to recur indefinitely. |
268 | */ | 268 | */ |
269 | void setYearlyByDate(Feb29Type type, int freq, int duration); | 269 | void setYearlyByDate(Feb29Type type, int freq, int duration); |
270 | /** Sets an event to recur yearly ending at \a endDate. */ | 270 | /** Sets an event to recur yearly ending at \a endDate. */ |
271 | void setYearlyByDate(Feb29Type type, int freq, const QDate &endDate); | 271 | void setYearlyByDate(Feb29Type type, int freq, const QDate &endDate); |
272 | /** Adds position of day or month in year. | 272 | /** Adds position of day or month in year. |
273 | * N.B. for recursYearlyPos, addYearlyMonthPos() must also be called | 273 | * N.B. for recursYearlyPos, addYearlyMonthPos() must also be called |
274 | * to add positions within the month. */ | 274 | * to add positions within the month. */ |
275 | void addYearlyNum(short _rNum); | 275 | void addYearlyNum(short _rNum); |
276 | /** Adds a position to the recursYearlyPos recurrence rule, if it is set. | 276 | /** Adds a position to the recursYearlyPos recurrence rule, if it is set. |
277 | * N.B. addYearlyNum() must also be called to add recurrence months. | 277 | * N.B. addYearlyNum() must also be called to add recurrence months. |
278 | * Parameters are the same as for addMonthlyPos(). | 278 | * Parameters are the same as for addMonthlyPos(). |
279 | */ | 279 | */ |
280 | void addYearlyMonthPos(short _rPos, const QBitArray &_rDays); | 280 | void addYearlyMonthPos(short _rPos, const QBitArray &_rDays); |
281 | /** Returns positions of days or months in year. */ | 281 | /** Returns positions of days or months in year. */ |
282 | const QPtrList<int> &yearNums() const; | 282 | const QPtrList<int> &yearNums() const; |
283 | /** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */ | 283 | /** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */ |
284 | const QPtrList<rMonthPos> &yearMonthPositions() const; | 284 | const QPtrList<rMonthPos> &yearMonthPositions() const; |
285 | /** Returns how yearly recurrences of February 29th are handled. */ | 285 | /** Returns how yearly recurrences of February 29th are handled. */ |
286 | Feb29Type feb29YearlyType() const { return mFeb29YearlyType; } | 286 | Feb29Type feb29YearlyType() const { return mFeb29YearlyType; } |
287 | /** Sets the default method for handling yearly recurrences of February 29th. */ | 287 | /** Sets the default method for handling yearly recurrences of February 29th. */ |
288 | static void setFeb29YearlyTypeDefault(Feb29Type t) { mFeb29YearlyDefaultType = t; } | 288 | static void setFeb29YearlyTypeDefault(Feb29Type t) { mFeb29YearlyDefaultType = t; } |
289 | /** Returns the default method for handling yearly recurrences of February 29th. */ | 289 | /** Returns the default method for handling yearly recurrences of February 29th. */ |
290 | static Feb29Type setFeb29YearlyTypeDefault() { return mFeb29YearlyDefaultType; } | 290 | static Feb29Type setFeb29YearlyTypeDefault() { return mFeb29YearlyDefaultType; } |
291 | 291 | void addYearlyMonth(short _rPos ); // added LR | |
292 | /** | 292 | /** |
293 | Debug output. | 293 | Debug output. |
294 | */ | 294 | */ |
295 | void dump() const; | 295 | void dump() const; |
296 | QString recurrenceText() const; | 296 | QString recurrenceText() const; |
297 | bool getYearlyMonthMonths(int day, QValueList<int>&, | ||
298 | QValueList<int> &leaplist) const; | ||
297 | 299 | ||
298 | protected: | 300 | protected: |
299 | enum PeriodFunc { END_DATE_AND_COUNT, COUNT_TO_DATE, NEXT_AFTER_DATE }; | 301 | enum PeriodFunc { END_DATE_AND_COUNT, COUNT_TO_DATE, NEXT_AFTER_DATE }; |
300 | struct MonthlyData; friend struct MonthlyData; | 302 | struct MonthlyData; friend struct MonthlyData; |
301 | struct YearlyMonthData; friend struct YearlyMonthData; | 303 | struct YearlyMonthData; friend struct YearlyMonthData; |
302 | struct YearlyPosData; friend struct YearlyPosData; | 304 | struct YearlyPosData; friend struct YearlyPosData; |
303 | struct YearlyDayData; friend struct YearlyDayData; | 305 | struct YearlyDayData; friend struct YearlyDayData; |
304 | 306 | ||
305 | bool recursSecondly(const QDate &, int secondFreq) const; | 307 | bool recursSecondly(const QDate &, int secondFreq) const; |
306 | bool recursMinutelyAt(const QDateTime &dt, int minuteFreq) const; | 308 | bool recursMinutelyAt(const QDateTime &dt, int minuteFreq) const; |
307 | bool recursDaily(const QDate &) const; | 309 | bool recursDaily(const QDate &) const; |
308 | bool recursWeekly(const QDate &) const; | 310 | bool recursWeekly(const QDate &) const; |
309 | bool recursMonthly(const QDate &) const; | 311 | bool recursMonthly(const QDate &) const; |
310 | bool recursYearlyByMonth(const QDate &) const; | 312 | bool recursYearlyByMonth(const QDate &) const; |
311 | bool recursYearlyByPos(const QDate &) const; | 313 | bool recursYearlyByPos(const QDate &) const; |
312 | bool recursYearlyByDay(const QDate &) const; | 314 | bool recursYearlyByDay(const QDate &) const; |
313 | 315 | ||
314 | QDate getNextDateNoTime(const QDate& preDate, bool* last) const; | 316 | QDate getNextDateNoTime(const QDate& preDate, bool* last) const; |
315 | QDate getPreviousDateNoTime(const QDate& afterDate, bool* last) const; | 317 | QDate getPreviousDateNoTime(const QDate& afterDate, bool* last) const; |
316 | 318 | ||
317 | void addMonthlyPos_(short _rPos, const QBitArray &_rDays); | 319 | void addMonthlyPos_(short _rPos, const QBitArray &_rDays); |
318 | void setDailySub(short type, int freq, int duration); | 320 | void setDailySub(short type, int freq, int duration); |
319 | void setYearly_(short type, Feb29Type, int freq, int duration); | 321 | void setYearly_(short type, Feb29Type, int freq, int duration); |
320 | int recurCalc(PeriodFunc, QDate &enddate) const; | 322 | int recurCalc(PeriodFunc, QDate &enddate) const; |
321 | int recurCalc(PeriodFunc, QDateTime &endtime) const; | 323 | int recurCalc(PeriodFunc, QDateTime &endtime) const; |
322 | int secondlyCalc(PeriodFunc, QDateTime& endtime, int freq) const; | 324 | int secondlyCalc(PeriodFunc, QDateTime& endtime, int freq) const; |
323 | int dailyCalc(PeriodFunc, QDate &enddate) const; | 325 | int dailyCalc(PeriodFunc, QDate &enddate) const; |
324 | int weeklyCalc(PeriodFunc, QDate &enddate) const; | 326 | int weeklyCalc(PeriodFunc, QDate &enddate) const; |
325 | int weeklyCalcEndDate(QDate& enddate, int daysPerWeek) const; | 327 | int weeklyCalcEndDate(QDate& enddate, int daysPerWeek) const; |
326 | int weeklyCalcToDate(const QDate& enddate, int daysPerWeek) const; | 328 | int weeklyCalcToDate(const QDate& enddate, int daysPerWeek) const; |
327 | int weeklyCalcNextAfter(QDate& enddate, int daysPerWeek) const; | 329 | int weeklyCalcNextAfter(QDate& enddate, int daysPerWeek) const; |
328 | int monthlyCalc(PeriodFunc, QDate &enddate) const; | 330 | int monthlyCalc(PeriodFunc, QDate &enddate) const; |
329 | int monthlyCalcEndDate(QDate& enddate, MonthlyData&) const; | 331 | int monthlyCalcEndDate(QDate& enddate, MonthlyData&) const; |
330 | int monthlyCalcToDate(const QDate& enddate, MonthlyData&) const; | 332 | int monthlyCalcToDate(const QDate& enddate, MonthlyData&) const; |
331 | int monthlyCalcNextAfter(QDate& enddate, MonthlyData&) const; | 333 | int monthlyCalcNextAfter(QDate& enddate, MonthlyData&) const; |
332 | int yearlyMonthCalc(PeriodFunc, QDate &enddate) const; | 334 | int yearlyMonthCalc(PeriodFunc, QDate &enddate) const; |
333 | int yearlyMonthCalcEndDate(QDate& enddate, YearlyMonthData&) const; | 335 | int yearlyMonthCalcEndDate(QDate& enddate, YearlyMonthData&) const; |
334 | int yearlyMonthCalcToDate(const QDate& enddate, YearlyMonthData&) const; | 336 | int yearlyMonthCalcToDate(const QDate& enddate, YearlyMonthData&) const; |
335 | int yearlyMonthCalcNextAfter(QDate& enddate, YearlyMonthData&) const; | 337 | int yearlyMonthCalcNextAfter(QDate& enddate, YearlyMonthData&) const; |
336 | int yearlyPosCalc(PeriodFunc, QDate &enddate) const; | 338 | int yearlyPosCalc(PeriodFunc, QDate &enddate) const; |
337 | int yearlyPosCalcEndDate(QDate& enddate, YearlyPosData&) const; | 339 | int yearlyPosCalcEndDate(QDate& enddate, YearlyPosData&) const; |
338 | int yearlyPosCalcToDate(const QDate& enddate, YearlyPosData&) const; | 340 | int yearlyPosCalcToDate(const QDate& enddate, YearlyPosData&) const; |
339 | int yearlyPosCalcNextAfter(QDate& enddate, YearlyPosData&) const; | 341 | int yearlyPosCalcNextAfter(QDate& enddate, YearlyPosData&) const; |
340 | int yearlyDayCalc(PeriodFunc, QDate &enddate) const; | 342 | int yearlyDayCalc(PeriodFunc, QDate &enddate) const; |
341 | int yearlyDayCalcEndDate(QDate& enddate, YearlyDayData&) const; | 343 | int yearlyDayCalcEndDate(QDate& enddate, YearlyDayData&) const; |
342 | int yearlyDayCalcToDate(const QDate& enddate, YearlyDayData&) const; | 344 | int yearlyDayCalcToDate(const QDate& enddate, YearlyDayData&) const; |
343 | int yearlyDayCalcNextAfter(QDate& enddate, YearlyDayData&) const; | 345 | int yearlyDayCalcNextAfter(QDate& enddate, YearlyDayData&) const; |
344 | 346 | ||
345 | int countMonthlyPosDays() const; | 347 | int countMonthlyPosDays() const; |
346 | void getMonthlyPosDays(QValueList<int>&, int daysInMonth, | 348 | void getMonthlyPosDays(QValueList<int>&, int daysInMonth, |
347 | int startDayOfWeek) const; | 349 | int startDayOfWeek) const; |
348 | bool getMonthlyDayDays(QValueList<int>&, int daysInMonth) const; | 350 | bool getMonthlyDayDays(QValueList<int>&, int daysInMonth) const; |
349 | bool getYearlyMonthMonths(int day, QValueList<int>&, | ||
350 | QValueList<int> &leaplist) const; | ||
351 | 351 | ||
352 | int getFirstDayInWeek(int startDay, bool useWeekStart = true) const; | 352 | int getFirstDayInWeek(int startDay, bool useWeekStart = true) const; |
353 | int getLastDayInWeek(int endDay, bool useWeekStart = true) const; | 353 | int getLastDayInWeek(int endDay, bool useWeekStart = true) const; |
354 | QDate getFirstDateInMonth(const QDate& earliestDate) const; | 354 | QDate getFirstDateInMonth(const QDate& earliestDate) const; |
355 | QDate getLastDateInMonth(const QDate& latestDate) const; | 355 | QDate getLastDateInMonth(const QDate& latestDate) const; |
356 | QDate getFirstDateInYear(const QDate& earliestDate) const; | 356 | QDate getFirstDateInYear(const QDate& earliestDate) const; |
357 | QDate getLastDateInYear(const QDate& latestDate) const; | 357 | QDate getLastDateInYear(const QDate& latestDate) const; |
358 | 358 | ||
359 | private: | 359 | private: |
360 | // Prohibit copying | 360 | // Prohibit copying |
361 | Recurrence(const Recurrence&); | 361 | Recurrence(const Recurrence&); |
362 | Recurrence &operator=(const Recurrence&); | 362 | Recurrence &operator=(const Recurrence&); |
363 | 363 | ||
364 | short recurs; // should be one of the enums. | 364 | short recurs; // should be one of the enums. |
365 | 365 | ||
366 | int rWeekStart; // day which starts the week, Monday=1 .. Sunday=7 | 366 | int rWeekStart; // day which starts the week, Monday=1 .. Sunday=7 |
367 | QBitArray rDays; // array of days during week it recurs | 367 | QBitArray rDays; // array of days during week it recurs |
368 | 368 | ||
369 | QPtrList<rMonthPos> rMonthPositions; // list of positions during a month | 369 | QPtrList<rMonthPos> rMonthPositions; // list of positions during a month |
370 | // on which an event recurs | 370 | // on which an event recurs |
371 | 371 | ||
372 | QPtrList<int> rMonthDays; // list of days during a month on | 372 | QPtrList<int> rMonthDays; // list of days during a month on |
373 | // which the event recurs | 373 | // which the event recurs |
374 | 374 | ||
375 | QPtrList<int> rYearNums; // either months/days to recur on for rYearly, | 375 | QPtrList<int> rYearNums; // either months/days to recur on for rYearly, |
376 | // sorted in numerical order | 376 | // sorted in numerical order |
377 | 377 | ||
378 | int rFreq; // frequency of period | 378 | int rFreq; // frequency of period |
379 | 379 | ||
380 | // one of the following must be specified | 380 | // one of the following must be specified |
381 | int rDuration; // num times to recur (inc. first occurrence), -1 = infinite | 381 | int rDuration; // num times to recur (inc. first occurrence), -1 = infinite |
382 | QDateTime rEndDateTime; // date/time at which to end recurrence | 382 | QDateTime rEndDateTime; // date/time at which to end recurrence |
383 | 383 | ||
384 | QDateTime mRecurStart; // date/time of first recurrence | 384 | QDateTime mRecurStart; // date/time of first recurrence |
385 | bool mFloats; // the recurrence has no time, just a date | 385 | bool mFloats; // the recurrence has no time, just a date |
386 | bool mRecurReadOnly; | 386 | bool mRecurReadOnly; |
387 | int mRecurExDatesCount; // number of recurrences (in addition to rDuration) which are excluded | 387 | int mRecurExDatesCount; // number of recurrences (in addition to rDuration) which are excluded |
388 | Feb29Type mFeb29YearlyType; // how to handle yearly recurrences of February 29th | 388 | Feb29Type mFeb29YearlyType; // how to handle yearly recurrences of February 29th |
389 | static Feb29Type mFeb29YearlyDefaultType; // default value for mFeb29YearlyType | 389 | static Feb29Type mFeb29YearlyDefaultType; // default value for mFeb29YearlyType |
390 | 390 | ||
391 | // Backwards compatibility for KDE < 3.1. | 391 | // Backwards compatibility for KDE < 3.1. |
392 | int mCompatVersion; // calendar file version for backwards compatibility | 392 | int mCompatVersion; // calendar file version for backwards compatibility |
393 | short mCompatRecurs; // original 'recurs' in old calendar format, or rNone | 393 | short mCompatRecurs; // original 'recurs' in old calendar format, or rNone |
394 | int mCompatDuration; // original 'rDuration' in old calendar format, or 0 | 394 | int mCompatDuration; // original 'rDuration' in old calendar format, or 0 |
395 | 395 | ||
396 | Incidence *mParent; | 396 | Incidence *mParent; |
397 | }; | 397 | }; |
398 | 398 | ||