summaryrefslogtreecommitdiffabout
path: root/libkcal/kincidenceformatter.cpp
Unidiff
Diffstat (limited to 'libkcal/kincidenceformatter.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp22
1 files changed, 14 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
@@ -103,19 +103,25 @@ void KIncidenceFormatter::setEvent(Event *event)
103 if (event->recurrence()->doesRecur()) { 103 if (event->recurrence()->doesRecur()) {
104 104
105 QString recurText = event->recurrence()->recurrenceText(); 105 QString recurText = event->recurrence()->recurrenceText();
106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
107 bool last; 107
108 bool ok;
108 QDate start = QDate::currentDate(); 109 QDate start = QDate::currentDate();
109 QDate next; 110 QDateTime next;
110 next = event->recurrence()->getPreviousDate( start , &last ); 111 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
111 if ( !last ) { 112 if ( ok ) {
112 next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); 113 addTag("p",i18n("<b>Next recurrence is on:</b>") );
113 addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) ); 114 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
114 //addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 115
115 } else { 116 } else {
117 bool last;
118 QDate nextd;
119 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
120 if ( last ) {
116 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 121 addTag("p",i18n("<b>Last recurrence was on:</b>") );
117 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 122 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
123 }
118 } 124 }
119 } 125 }
120 126
121 127