author | zautrix <zautrix> | 2004-09-12 19:26:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-12 19:26:13 (UTC) |
commit | 5b434dd78f71bcea5e6067fc8ae0faaaea313f9d (patch) (side-by-side diff) | |
tree | ed532e602a3b503b72a46ea18d40e3a5dc97aa3f /libkcal/alarm.cpp | |
parent | bc4153a99e205f43d0144e2e910730dd1a14d402 (diff) | |
download | kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.zip kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.tar.gz kdepimpi-5b434dd78f71bcea5e6067fc8ae0faaaea313f9d.tar.bz2 |
phone fixes
-rw-r--r-- | libkcal/alarm.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index 07812c2..29e6205 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp @@ -255,96 +255,112 @@ 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") { + Todo *t = static_cast<Todo*>(mParent); + return t->dtDue().secsTo( mAlarmTime ) ; + } else + return mParent->dtStart().secsTo( mAlarmTime ) ; + } + else + { + return mOffset.asSeconds(); + } + +} + QDateTime Alarm::time() const { if ( hasTime() ) return mAlarmTime; else { if (mParent->type()=="Todo") { 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; } |