author | zautrix <zautrix> | 2004-07-10 17:03:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-10 17:03:16 (UTC) |
commit | cf2f3f98a4811668f9e9d0d5f44ea5b51d268cef (patch) (unidiff) | |
tree | 963322cd4c539c084feb43dfde5eabe52ae4385f /libkcal | |
parent | 8cc6d456812b5a9a386e81c9e46baccd56029537 (diff) | |
download | kdepimpi-cf2f3f98a4811668f9e9d0d5f44ea5b51d268cef.zip kdepimpi-cf2f3f98a4811668f9e9d0d5f44ea5b51d268cef.tar.gz kdepimpi-cf2f3f98a4811668f9e9d0d5f44ea5b51d268cef.tar.bz2 |
Fixed some problems with the recurrence
-rw-r--r-- | libkcal/icalformatimpl.cpp | 20 | ||||
-rw-r--r-- | libkcal/recurrence.cpp | 17 | ||||
-rw-r--r-- | libkcal/recurrence.h | 6 |
3 files changed, 30 insertions, 13 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 32a1337..964ffe3 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -1393,5 +1393,5 @@ void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurre | |||
1393 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX && r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) { | 1393 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX && r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX ) { |
1394 | frequ = ICAL_MONTHLY_RECURRENCE; | 1394 | frequ = ICAL_MONTHLY_RECURRENCE; |
1395 | interv = 12; | 1395 | interv = 12* r.interval; |
1396 | } | 1396 | } |
1397 | } | 1397 | } |
@@ -1500,4 +1500,5 @@ void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurre | |||
1500 | case ICAL_YEARLY_RECURRENCE: | 1500 | case ICAL_YEARLY_RECURRENCE: |
1501 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1501 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1502 | qDebug(" YEARLY DAY OF YEAR"); | ||
1502 | if (!icaltime_is_null_time(r.until)) { | 1503 | if (!icaltime_is_null_time(r.until)) { |
1503 | recur->setYearly(Recurrence::rYearlyDay,interv, | 1504 | recur->setYearly(Recurrence::rYearlyDay,interv, |
@@ -1514,4 +1515,5 @@ void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurre | |||
1514 | } else if ( true /*r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX*/) { | 1515 | } else if ( true /*r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX*/) { |
1515 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 1516 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
1517 | qDebug("YEARLY POS NOT SUPPORTED BY GUI"); | ||
1516 | if (!icaltime_is_null_time(r.until)) { | 1518 | if (!icaltime_is_null_time(r.until)) { |
1517 | recur->setYearly(Recurrence::rYearlyPos,interv, | 1519 | recur->setYearly(Recurrence::rYearlyPos,interv, |
@@ -1544,4 +1546,5 @@ void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurre | |||
1544 | } | 1546 | } |
1545 | } else { | 1547 | } else { |
1548 | qDebug("YEARLY MONTH "); | ||
1546 | if (!icaltime_is_null_time(r.until)) { | 1549 | if (!icaltime_is_null_time(r.until)) { |
1547 | recur->setYearly(Recurrence::rYearlyMonth,interv, | 1550 | recur->setYearly(Recurrence::rYearlyMonth,interv, |
@@ -1553,13 +1556,14 @@ void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurre | |||
1553 | recur->setYearly(Recurrence::rYearlyMonth,interv,r.count); | 1556 | recur->setYearly(Recurrence::rYearlyMonth,interv,r.count); |
1554 | } | 1557 | } |
1555 | } | 1558 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX ) { |
1556 | if ( r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX ) { | 1559 | index = 0; |
1557 | index = 0; | 1560 | while((day = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
1558 | while((day = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 1561 | recur->addYearlyNum(day); |
1559 | recur->addYearlyNum(day); | 1562 | } |
1563 | } else { | ||
1564 | recur->addYearlyNum(incidence->dtStart().date().month()); | ||
1560 | } | 1565 | } |
1561 | } else { | ||
1562 | recur->addYearlyNum(incidence->dtStart().date().month()); | ||
1563 | } | 1566 | } |
1567 | |||
1564 | } | 1568 | } |
1565 | break; | 1569 | break; |
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index 5fc5d1f..dd74e10 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp | |||
@@ -655,5 +655,5 @@ void Recurrence::addMonthlyPos_(short _rPos, const QBitArray &_rDays) | |||
655 | void Recurrence::addMonthlyDay(short _rDay) | 655 | void Recurrence::addMonthlyDay(short _rDay) |
656 | { | 656 | { |
657 | if (mRecurReadOnly || recurs != rMonthlyDay | 657 | if (mRecurReadOnly || (recurs != rMonthlyDay && recurs != rYearlyMonth) |
658 | || _rDay == 0 || _rDay > 31 || _rDay < -31) // invalid day number | 658 | || _rDay == 0 || _rDay > 31 || _rDay < -31) // invalid day number |
659 | return; | 659 | return; |
@@ -726,5 +726,18 @@ const QPtrList<int> &Recurrence::yearNums() const | |||
726 | return rYearNums; | 726 | return rYearNums; |
727 | } | 727 | } |
728 | 728 | void Recurrence::addYearlyMonth(short _rPos ) | |
729 | { | ||
730 | if (mRecurReadOnly || recurs != rYearlyMonth) // invalid day/month number | ||
731 | return; | ||
732 | rMonthPos *tmpPos = new rMonthPos; | ||
733 | if ( _rPos > 0) { | ||
734 | tmpPos->rPos = _rPos; | ||
735 | tmpPos->negative = false; | ||
736 | } else { | ||
737 | tmpPos->rPos = -_rPos; // take abs() | ||
738 | tmpPos->negative = true; | ||
739 | } | ||
740 | rMonthPositions.append(tmpPos); | ||
741 | } | ||
729 | void Recurrence::addYearlyNum(short _rNum) | 742 | void Recurrence::addYearlyNum(short _rNum) |
730 | { | 743 | { |
diff --git a/libkcal/recurrence.h b/libkcal/recurrence.h index a0f6d84..b13d14f 100644 --- a/libkcal/recurrence.h +++ b/libkcal/recurrence.h | |||
@@ -289,5 +289,5 @@ class Recurrence | |||
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. |
@@ -295,4 +295,6 @@ class Recurrence | |||
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: |
@@ -347,6 +349,4 @@ class Recurrence | |||
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; |