summaryrefslogtreecommitdiffabout
path: root/libkcal/alarm.cpp
Unidiff
Diffstat (limited to 'libkcal/alarm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp16
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
@@ -291,24 +291,40 @@ void Alarm::setText(const QString &text)
291QString Alarm::text() const 291QString Alarm::text() const
292{ 292{
293 return (mType == Display) ? mDescription : QString::null; 293 return (mType == Display) ? mDescription : QString::null;
294} 294}
295 295
296void Alarm::setTime(const QDateTime &alarmTime) 296void Alarm::setTime(const QDateTime &alarmTime)
297{ 297{
298 mAlarmTime = alarmTime; 298 mAlarmTime = alarmTime;
299 mHasTime = true; 299 mHasTime = true;
300 300
301 mParent->updated(); 301 mParent->updated();
302} 302}
303int Alarm::offset()
304{
305 if ( hasTime() ) {
306 if (mParent->type()=="Todo") {
307 Todo *t = static_cast<Todo*>(mParent);
308 return t->dtDue().secsTo( mAlarmTime ) ;
309 } else
310 return mParent->dtStart().secsTo( mAlarmTime ) ;
311 }
312 else
313 {
314 return mOffset.asSeconds();
315 }
316
317}
318
303 319
304QDateTime Alarm::time() const 320QDateTime Alarm::time() const
305{ 321{
306 if ( hasTime() ) 322 if ( hasTime() )
307 return mAlarmTime; 323 return mAlarmTime;
308 else 324 else
309 { 325 {
310 if (mParent->type()=="Todo") { 326 if (mParent->type()=="Todo") {
311 Todo *t = static_cast<Todo*>(mParent); 327 Todo *t = static_cast<Todo*>(mParent);
312 return mOffset.end( t->dtDue() ); 328 return mOffset.end( t->dtDue() );
313 } else if (mEndOffset) { 329 } else if (mEndOffset) {
314 return mOffset.end( mParent->dtEnd() ); 330 return mOffset.end( mParent->dtEnd() );