summaryrefslogtreecommitdiffabout
path: root/libkcal/kincidenceformatter.cpp
authorzautrix <zautrix>2005-02-07 21:06:04 (UTC)
committer zautrix <zautrix>2005-02-07 21:06:04 (UTC)
commitedaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e (patch) (side-by-side diff)
tree7653e521f003a0c4e316530d38c09f3190c4edaf /libkcal/kincidenceformatter.cpp
parentda5e47069d88fa9aa656423ce4c60bf505728e1c (diff)
downloadkdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.zip
kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.gz
kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.bz2
recurrence fixes
Diffstat (limited to 'libkcal/kincidenceformatter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp24
1 files changed, 15 insertions, 9 deletions
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","<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 {
- addTag("p",i18n("<b>Last recurrence was on:</b>") );
- addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
+ 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( nextd, shortDate ));
+ }
}
}