From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkcal/alarm.cpp | 60 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 16 deletions(-) (limited to 'libkcal/alarm.cpp') diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index b5b9b515..8bc40f00 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp @@ -47,6 +47,30 @@ Alarm::~Alarm() { } +Alarm *Alarm::clone() +{ + return new Alarm( *this ); +} + +Alarm &Alarm::operator=( const Alarm &a ) +{ + mParent = a.mParent; + mType = a.mType; + mDescription = a.mDescription; + mFile = a.mFile; + mMailAttachFiles = a.mMailAttachFiles; + mMailAddresses = a.mMailAddresses; + mMailSubject = a.mMailSubject; + mAlarmSnoozeTime = a.mAlarmSnoozeTime; + mAlarmRepeatCount = a.mAlarmRepeatCount; + mAlarmTime = a.mAlarmTime; + mOffset = a.mOffset; + mEndOffset = a.mEndOffset; + mHasTime = a.mHasTime; + mAlarmEnabled = a.mAlarmEnabled; + return *this; +} + bool Alarm::operator==( const Alarm& rhs ) const { if ( mType != rhs.mType || @@ -304,19 +328,22 @@ void Alarm::setTime(const TQDateTime &alarmTime) TQDateTime Alarm::time() const { - if ( hasTime() ) + if ( hasTime() ) { return mAlarmTime; - else if ( mParent ) - { - if (mParent->type()=="Todo") { - Todo *t = static_cast(mParent); - return mOffset.end( t->dtDue() ); - } else if (mEndOffset) { - return mOffset.end( mParent->dtEnd() ); + } else if ( mParent ) { + if ( mEndOffset ) { + if ( mParent->type() == "Todo" ) { + Todo *t = static_cast( mParent ); + return mOffset.end( t->dtDue() ); + } else { + return mOffset.end( mParent->dtEnd() ); + } } else { return mOffset.end( mParent->dtStart() ); } - } else return TQDateTime(); + } else { + return TQDateTime(); + } } bool Alarm::hasTime() const @@ -324,15 +351,15 @@ bool Alarm::hasTime() const return mHasTime; } -void Alarm::setSnoozeTime(int alarmSnoozeTime) +void Alarm::setSnoozeTime(const Duration &alarmSnoozeTime) { - if (alarmSnoozeTime > 0) { + if (alarmSnoozeTime.value() > 0) { mAlarmSnoozeTime = alarmSnoozeTime; if ( mParent ) mParent->updated(); } } -int Alarm::snoozeTime() const +Duration Alarm::snoozeTime() const { return mAlarmSnoozeTime; } @@ -348,9 +375,10 @@ int Alarm::repeatCount() const return mAlarmRepeatCount; } -int Alarm::duration() const +Duration Alarm::duration() const { - return mAlarmRepeatCount * mAlarmSnoozeTime * 60; + return Duration( mAlarmSnoozeTime.value() * mAlarmRepeatCount, + mAlarmSnoozeTime.type() ); } TQDateTime Alarm::nextRepetition(const TQDateTime& preTime) const @@ -422,7 +450,7 @@ void Alarm::setStartOffset( const Duration &offset ) Duration Alarm::startOffset() const { - return (mHasTime || mEndOffset) ? 0 : mOffset; + return (mHasTime || mEndOffset) ? Duration( 0 ) : mOffset; } bool Alarm::hasStartOffset() const @@ -445,7 +473,7 @@ void Alarm::setEndOffset( const Duration &offset ) Duration Alarm::endOffset() const { - return (mHasTime || !mEndOffset) ? 0 : mOffset; + return (mHasTime || !mEndOffset) ? Duration( 0 ) : mOffset; } void Alarm::setParent( Incidence *parent ) -- cgit v1.2.3