summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2007-06-06 13:14:20 (UTC)
committer zautrix <zautrix>2007-06-06 13:14:20 (UTC)
commit623b4d4abe87789dacd4c14de88a63b44ca352b7 (patch) (unidiff)
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
@@ -393,12 +393,22 @@ void KOEventViewer::appendEvent(Event *event, int mode )
393 } 393 }
394 394
395 395
396 if (event->isAlarmEnabled()) { 396 if (event->isAlarmEnabled()) {
397 Alarm *alarm =event->alarms().first() ; 397 Alarm *alarm =event->alarms().first() ;
398 QDateTime t = alarm->time(); 398 QDateTime t = alarm->time();
399
400 if (event->doesRecur()) {
401 bool ok = false;
402 int offset = 0;
403 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
404 if ( ok ) {
405 t = next;
406 }
407 }
408
399 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 409 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
400 if(wideScreen ){ 410 if(wideScreen ){
401 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 411 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
402 }else{ 412 }else{
403 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 413 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
404 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 414 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
@@ -515,13 +525,21 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
515 mText.append(i18n("<p><b>Priority:</b> %2</p>") 525 mText.append(i18n("<p><b>Priority:</b> %2</p>")
516 .arg(QString::number(event->priority()))); 526 .arg(QString::number(event->priority())));
517 527
518 if (event->isAlarmEnabled()) { 528 if (event->isAlarmEnabled()) {
519 Alarm *alarm =event->alarms().first() ; 529 Alarm *alarm =event->alarms().first() ;
520 QDateTime t = alarm->time(); 530 QDateTime t = alarm->time();
521 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 531 if (event->doesRecur()) {
532 bool ok = false;
533 int offset = 0;
534 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
535 if ( ok ) {
536 t = next;
537 }
538 }
539 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
522 if ( wideScreen ) { 540 if ( wideScreen ) {
523 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 541 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
524 } else { 542 } else {
525 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 543 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
526 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 544 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
527 } 545 }
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 4dfe16a..733b897 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -132,12 +132,20 @@ void KIncidenceFormatter::setEvent(Event *event)
132 } 132 }
133 133
134 134
135 if (event->isAlarmEnabled()) { 135 if (event->isAlarmEnabled()) {
136 Alarm *alarm =event->alarms().first() ; 136 Alarm *alarm =event->alarms().first() ;
137 QDateTime t = alarm->time(); 137 QDateTime t = alarm->time();
138 if (event->doesRecur()) {
139 bool ok = false;
140 int offset = 0;
141 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
142 if ( ok ) {
143 t = next;
144 }
145 }
138 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 146 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
139 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 147 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
140 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 148 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
141 //addTag("p",s); 149 //addTag("p",s);
142 } 150 }
143 151
@@ -241,12 +249,20 @@ void KIncidenceFormatter::setTodo(Todo *event )
241 mText.append(i18n("<p><b>Priority:</b> %2</p>") 249 mText.append(i18n("<p><b>Priority:</b> %2</p>")
242 .arg(QString::number(event->priority()))); 250 .arg(QString::number(event->priority())));
243 251
244 if (event->isAlarmEnabled()) { 252 if (event->isAlarmEnabled()) {
245 Alarm *alarm =event->alarms().first() ; 253 Alarm *alarm =event->alarms().first() ;
246 QDateTime t = alarm->time(); 254 QDateTime t = alarm->time();
255 if (event->doesRecur()) {
256 bool ok = false;
257 int offset = 0;
258 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
259 if ( ok ) {
260 t = next;
261 }
262 }
247 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 263 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
248 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 264 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
249 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 265 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
250 //addTag("p",s); 266 //addTag("p",s);
251 } 267 }
252 268