-rw-r--r-- | korganizer/koeventviewer.cpp | 20 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 16 |
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 @@ -387,24 +387,34 @@ void KOEventViewer::appendEvent(Event *event, int mode ) } } } } else { mMailSubject += i18n(" - " )+event->dtStartStr( true ); } if (event->isAlarmEnabled()) { 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 ){ addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); }else{ addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); } //addTag("p",s); if ( !(event->alarmEnabled() ) ) { addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>"); } @@ -509,25 +519,33 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mMailSubject += i18n(" - " )+event->dtDueStr( true ); } if (!event->location().isEmpty()) { addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); mMailSubject += i18n(" at ") + event->location(); } mText.append(i18n("<p><b>Priority:</b> %2</p>") .arg(QString::number(event->priority()))); if (event->isAlarmEnabled()) { 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 )); } else { addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); } if ( !(event->alarmEnabled() ) ) { addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>"); } } diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 4dfe16a..733b897 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp @@ -126,24 +126,32 @@ void KIncidenceFormatter::setEvent(Event *event) 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 )); } } } if (event->isAlarmEnabled()) { 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 )); //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); //addTag("p",s); } addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); // mText.append(event->secrecyStr()+"<br>"); formatCategories(event); @@ -235,24 +243,32 @@ void KIncidenceFormatter::setTodo(Todo *event ) if (!event->location().isEmpty()) { addTag("b",i18n("Location: ")); mText.append(deTag(event->location())+"<br>"); } mText.append(i18n("<p><b>Priority:</b> %2</p>") .arg(QString::number(event->priority()))); if (event->isAlarmEnabled()) { 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>"); addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); //addTag("p",s); } addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); formatCategories(event); formatAttendees(event); if ( mCreated ) { #ifdef DESKTOP_VERSION |