summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2007-06-06 13:14:20 (UTC)
committer zautrix <zautrix>2007-06-06 13:14:20 (UTC)
commit623b4d4abe87789dacd4c14de88a63b44ca352b7 (patch) (side-by-side diff)
treea6bcc1b9359bf904e08b508576c2d2e958cde55c
parentd5c53970b9e12bfe774d1fecd603080aded24e09 (diff)
downloadkdepimpi-623b4d4abe87789dacd4c14de88a63b44ca352b7.zip
kdepimpi-623b4d4abe87789dacd4c14de88a63b44ca352b7.tar.gz
kdepimpi-623b4d4abe87789dacd4c14de88a63b44ca352b7.tar.bz2
display of next alarm of recurring events in event viewer fixed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp20
-rw-r--r--libkcal/kincidenceformatter.cpp16
2 files changed, 35 insertions, 1 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 607e549..92d2a80 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -397,4 +397,14 @@ void KOEventViewer::appendEvent(Event *event, int mode )
Alarm *alarm =event->alarms().first() ;
QDateTime t = alarm->time();
+
+ if (event->doesRecur()) {
+ bool ok = false;
+ int offset = 0;
+ QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
+ if ( ok ) {
+ t = next;
+ }
+ }
+
QString s =i18n("( %1 before )").arg( alarm->offsetText() );
if(wideScreen ){
@@ -519,5 +529,13 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
Alarm *alarm =event->alarms().first() ;
QDateTime t = alarm->time();
- QString s =i18n("( %1 before )").arg( alarm->offsetText() );
+ if (event->doesRecur()) {
+ bool ok = false;
+ int offset = 0;
+ QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
+ if ( ok ) {
+ t = next;
+ }
+ }
+ QString s =i18n("( %1 before )").arg( alarm->offsetText() );
if ( wideScreen ) {
addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 4dfe16a..733b897 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -136,4 +136,12 @@ void KIncidenceFormatter::setEvent(Event *event)
Alarm *alarm =event->alarms().first() ;
QDateTime t = alarm->time();
+ if (event->doesRecur()) {
+ bool ok = false;
+ int offset = 0;
+ QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
+ if ( ok ) {
+ t = next;
+ }
+ }
QString s =i18n("( %1 before )").arg( alarm->offsetText() );
addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
@@ -245,4 +253,12 @@ void KIncidenceFormatter::setTodo(Todo *event )
Alarm *alarm =event->alarms().first() ;
QDateTime t = alarm->time();
+ if (event->doesRecur()) {
+ bool ok = false;
+ int offset = 0;
+ QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
+ if ( ok ) {
+ t = next;
+ }
+ }
QString s =i18n("( %1 before )").arg( alarm->offsetText() );
addTag("p",i18n("<b>Alarm on: ") + s +" </b>");