From b0d17f8f2ef9b09b7d8b8aa0f6cc34f400f8fddd Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 02 Apr 2005 14:07:31 +0000 Subject: fixes --- (limited to 'libkcal/alarm.cpp') 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 @@ */ #include +#include #include "incidence.h" #include "todo.h" @@ -349,6 +350,29 @@ int Alarm::offset() } } +QString Alarm::offsetText() +{ + int min = -offset()/60; + int hours = min /60; + min = min % 60; + int days = hours /24; + hours = hours % 24; + QString message; + qDebug("%d %d %d ", days, hours, min ); + if ( days > 0 ) + message += i18n("%1d").arg( days ); + if ( hours > 0 ) { + if ( !message.isEmpty() ) message += "/"; + message += i18n("%1h").arg( hours ); + } + if ( min > 0 ) { + if ( !message.isEmpty() ) message += "/"; + message += i18n("%1min").arg( min ); + } + if ( message.isEmpty() ) + message = i18n("%1min").arg( 0 ); + return message; +} QDateTime Alarm::time() const -- cgit v0.9.0.2