author | zautrix <zautrix> | 2005-02-07 21:06:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-07 21:06:04 (UTC) |
commit | edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e (patch) (side-by-side diff) | |
tree | 7653e521f003a0c4e316530d38c09f3190c4edaf /libkcal | |
parent | da5e47069d88fa9aa656423ce4c60bf505728e1c (diff) | |
download | kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.zip kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.gz kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.bz2 |
recurrence fixes
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 22 | ||||
-rw-r--r-- | libkcal/recurrence.cpp | 2 |
2 files changed, 16 insertions, 8 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 6d07d4c..0d9c3f4 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp @@ -99,27 +99,33 @@ void KIncidenceFormatter::setEvent(Event *event) .arg(event->dtEndTimeStr())); } } if (event->recurrence()->doesRecur()) { QString recurText = event->recurrence()->recurrenceText(); addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); - bool last; + + bool ok; QDate start = QDate::currentDate(); - QDate next; - next = event->recurrence()->getPreviousDate( start , &last ); - if ( !last ) { - next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); - addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) ); - //addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + QDateTime next; + next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); + if ( ok ) { + addTag("p",i18n("<b>Next recurrence is on:</b>") ); + addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); + } else { + bool last; + QDate nextd; + nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); + if ( last ) { addTag("p",i18n("<b>Last recurrence was on:</b>") ); - addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); + } } } if (event->isAlarmEnabled()) { Alarm *alarm =event->alarms().first() ; QDateTime t = alarm->time(); int min = t.secsTo( event->dtStart() )/60; diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index e84f672..5181eaf 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp @@ -874,16 +874,17 @@ QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date(); case rDaily: case rWeekly: case rMonthlyPos: case rMonthlyDay: case rYearlyMonth: case rYearlyDay: case rYearlyPos: + qDebug("Recurrence::getNextDate: MAY BE BROKEN "); return getNextDateNoTime(preDate, last); default: return QDate(); } } QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const @@ -1161,16 +1162,17 @@ bool Recurrence::recursYearlyByDay(const QDate &qd) const /* Get the date of the next recurrence, after the specified date. * If 'last' is non-null, '*last' is set to true if the next recurrence is the * last recurrence, else false. * Reply = date of next recurrence, or invalid date if none. */ QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const { + if (last) *last = false; QDate dStart = mRecurStart.date(); if (preDate < dStart) return dStart; QDate earliestDate = preDate.addDays(1); QDate nextDate; |