-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 @@ -95,17 +95,46 @@ Incidence::~Incidence() for (ev=Relations.first();ev;ev=Relations.next()) { if (ev->relatedTo() == this) ev->setRelatedTo(0); } 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 { return mBirthday ; |