-rw-r--r-- | libkcal/incidence.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 4643a3a..201f593 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -97,13 +97,42 @@ Incidence::~Incidence() } if (relatedTo()) relatedTo()->removeRelation(this); if ( mRecurrence ) delete mRecurrence; } +QString Incidence::durationText() +{ + return "---"; +} +QString Incidence::durationText4Time( int offset ) +{ + int min = offset/60; + int hours = min /60; + min = min % 60; + int days = hours /24; + hours = hours % 24; + + if ( doesFloat() || ( min == 0 && hours == 0 ) ) { + if ( days == 1 ) + return "1" + i18n(" day"); + else + return QString::number( days )+ i18n(" days"); + } + QString message = QString::number ( hours ) +":"; + if ( min < 10 ) message += "0"; + message += QString::number ( min ); + if ( days > 0 ) { + if ( days == 1 ) + message = "1" + i18n(" day") + " "+message; + else + message = QString::number( days )+ i18n(" days") + " "+message; + } + return message; +} bool Incidence::isHoliday() const { return mHoliday; } bool Incidence::isBirthday() const { |