-rw-r--r-- | libkcal/alarm.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index 6de1566..0afa0a7 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp @@ -293,140 +293,140 @@ void Alarm::addMailAttachment(const QString &mailAttachFile) QStringList Alarm::mailAttachments() const { return (mType == Email) ? mMailAttachFiles : QStringList(); } void Alarm::setMailText(const QString &text) { if (mType == Email) { mDescription = text; mParent->updated(); } } QString Alarm::mailText() const { return (mType == Email) ? mDescription : QString::null; } void Alarm::setDisplayAlarm(const QString &text) { mType = Display; mDescription = text; mParent->updated(); } void Alarm::setText(const QString &text) { if (mType == Display) { mDescription = text; mParent->updated(); } } QString Alarm::text() const { return (mType == Display) ? mDescription : QString::null; } void Alarm::setTime(const QDateTime &alarmTime) { mAlarmTime = alarmTime; mHasTime = true; mParent->updated(); } int Alarm::offset() { if ( hasTime() ) { - if (mParent->type()=="Todo") { + if (mParent->typeID() == todoID ) { Todo *t = static_cast<Todo*>(mParent); return t->dtDue().secsTo( mAlarmTime ) ; } else return mParent->dtStart().secsTo( mAlarmTime ) ; } else { return mOffset.asSeconds(); } } 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 { if ( hasTime() ) return mAlarmTime; else { - if (mParent->type()=="Todo") { + if (mParent->typeID() == todoID ) { Todo *t = static_cast<Todo*>(mParent); return mOffset.end( t->dtDue() ); } else if (mEndOffset) { return mOffset.end( mParent->dtEnd() ); } else { return mOffset.end( mParent->dtStart() ); } } } bool Alarm::hasTime() const { return mHasTime; } void Alarm::setSnoozeTime(int alarmSnoozeTime) { mAlarmSnoozeTime = alarmSnoozeTime; mParent->updated(); } int Alarm::snoozeTime() const { return mAlarmSnoozeTime; } void Alarm::setRepeatCount(int alarmRepeatCount) { kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; mAlarmRepeatCount = alarmRepeatCount; mParent->updated(); } int Alarm::repeatCount() const { kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; return mAlarmRepeatCount; } void Alarm::toggleAlarm() { mAlarmEnabled = !mAlarmEnabled; mParent->updated(); } void Alarm::setEnabled(bool enable) { |