summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp24
-rw-r--r--libkcal/alarm.h1
-rw-r--r--libkcal/kincidenceformatter.cpp14
3 files changed, 37 insertions, 2 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 1fc7169..d8f15b5 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -22,2 +22,3 @@
22#include <kdebug.h> 22#include <kdebug.h>
23#include <klocale.h>
23 24
@@ -351,2 +352,25 @@ int Alarm::offset()
351} 352}
353QString Alarm::offsetText()
354{
355 int min = -offset()/60;
356 int hours = min /60;
357 min = min % 60;
358 int days = hours /24;
359 hours = hours % 24;
360 QString message;
361 qDebug("%d %d %d ", days, hours, min );
362 if ( days > 0 )
363 message += i18n("%1d").arg( days );
364 if ( hours > 0 ) {
365 if ( !message.isEmpty() ) message += "/";
366 message += i18n("%1h").arg( hours );
367 }
368 if ( min > 0 ) {
369 if ( !message.isEmpty() ) message += "/";
370 message += i18n("%1min").arg( min );
371 }
372 if ( message.isEmpty() )
373 message = i18n("%1min").arg( 0 );
374 return message;
375}
352 376
diff --git a/libkcal/alarm.h b/libkcal/alarm.h
index 682b626..ac6ea0d 100644
--- a/libkcal/alarm.h
+++ b/libkcal/alarm.h
@@ -61,2 +61,3 @@ class Alarm : public CustomProperties
61 int offset(); 61 int offset();
62 QString offsetText();
62 /** Set the alarm to be a display alarm. 63 /** Set the alarm to be a display alarm.
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index e506a96..d67ad52 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -133,4 +133,3 @@ void KIncidenceFormatter::setEvent(Event *event)
133 QDateTime t = alarm->time(); 133 QDateTime t = alarm->time();
134 int min = t.secsTo( event->dtStart() )/60; 134 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
135 QString s =i18n("(%1 min before)").arg( min );
136 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 135 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
@@ -140,2 +139,4 @@ void KIncidenceFormatter::setEvent(Event *event)
140 139
140
141
141 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 142 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
@@ -226,2 +227,11 @@ void KIncidenceFormatter::setTodo(Todo *event )
226 227
228 if (event->isAlarmEnabled()) {
229 Alarm *alarm =event->alarms().first() ;
230 QDateTime t = alarm->time();
231 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
232 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
233 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
234 //addTag("p",s);
235 }
236
227 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 237 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );