From edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 07 Feb 2005 21:06:04 +0000 Subject: recurrence fixes --- (limited to 'libkcal/kincidenceformatter.cpp') diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 6d07d4c..0d9c3f4 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp @@ -104,17 +104,23 @@ void KIncidenceFormatter::setEvent(Event *event) QString recurText = event->recurrence()->recurrenceText(); addTag("p","" + i18n("This is a %1 recurring event.").arg(recurText ) + ""); - 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("Next recurrence is on:") ); + addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); + } else { - addTag("p",i18n("Last recurrence was on:") ); - addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + bool last; + QDate nextd; + nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); + if ( last ) { + addTag("p",i18n("Last recurrence was on:") ); + addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); + } } } -- cgit v0.9.0.2