summaryrefslogtreecommitdiffstats
path: root/libkcal/alarm.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /libkcal/alarm.cpp
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz
tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip
* 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
Diffstat (limited to 'libkcal/alarm.cpp')
-rw-r--r--libkcal/alarm.cpp60
1 files changed, 44 insertions, 16 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index b5b9b515a..8bc40f001 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<Todo*>(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<Todo*>( 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 )