-rw-r--r-- | korganizer/koeventviewer.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index de11c13..39921a0 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -304,18 +304,21 @@ void KOEventViewer::appendEvent(Event *event, int mode ) 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 ) ); + 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, shortDate )); - QDateTime nextdt = QDateTime( next, event->dtStart().time()); - mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); + addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); + mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); } 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 )); + } } } else { |