author | zautrix <zautrix> | 2005-04-02 14:07:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-02 14:07:31 (UTC) |
commit | b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd (patch) (unidiff) | |
tree | 942bcf89b35cf165e9147c1e4a5efa817c48007f /libkcal | |
parent | 997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (diff) | |
download | kdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.zip kdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.tar.gz kdepimpi-b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd.tar.bz2 |
fixes
-rw-r--r-- | libkcal/alarm.cpp | 24 | ||||
-rw-r--r-- | libkcal/alarm.h | 1 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 14 |
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 | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <kdebug.h> | 22 | #include <kdebug.h> |
23 | #include <klocale.h> | ||
23 | 24 | ||
24 | #include "incidence.h" | 25 | #include "incidence.h" |
25 | #include "todo.h" | 26 | #include "todo.h" |
@@ -349,6 +350,29 @@ int Alarm::offset() | |||
349 | } | 350 | } |
350 | 351 | ||
351 | } | 352 | } |
353 | QString 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 | ||
353 | 377 | ||
354 | QDateTime Alarm::time() const | 378 | QDateTime Alarm::time() const |
diff --git a/libkcal/alarm.h b/libkcal/alarm.h index 682b626..ac6ea0d 100644 --- a/libkcal/alarm.h +++ b/libkcal/alarm.h | |||
@@ -59,6 +59,7 @@ class Alarm : public CustomProperties | |||
59 | /** Return the type of the alarm */ | 59 | /** Return the type of the alarm */ |
60 | Type type() const; | 60 | Type type() const; |
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. |
63 | @param text text to display when the alarm is triggered. | 64 | @param text text to display when the alarm is triggered. |
64 | */ | 65 | */ |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index e506a96..d67ad52 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -131,13 +131,14 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
131 | if (event->isAlarmEnabled()) { | 131 | if (event->isAlarmEnabled()) { |
132 | Alarm *alarm =event->alarms().first() ; | 132 | Alarm *alarm =event->alarms().first() ; |
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 )); |
137 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 136 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
138 | //addTag("p",s); | 137 | //addTag("p",s); |
139 | } | 138 | } |
140 | 139 | ||
140 | |||
141 | |||
141 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 142 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
142 | // mText.append(event->secrecyStr()+"<br>"); | 143 | // mText.append(event->secrecyStr()+"<br>"); |
143 | formatCategories(event); | 144 | formatCategories(event); |
@@ -224,6 +225,15 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
224 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 225 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
225 | .arg(QString::number(event->priority()))); | 226 | .arg(QString::number(event->priority()))); |
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() ); |
228 | formatCategories(event); | 238 | formatCategories(event); |
229 | if ( mDetails ) { | 239 | if ( mDetails ) { |