-rw-r--r-- | libkcal/alarm.cpp | 24 |
1 files changed, 24 insertions, 0 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 | } |
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 | ||