-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 | |||
@@ -325,33 +325,33 @@ void Alarm::setText(const QString &text) | |||
325 | 325 | ||
326 | QString Alarm::text() const | 326 | QString Alarm::text() const |
327 | { | 327 | { |
328 | return (mType == Display) ? mDescription : QString::null; | 328 | return (mType == Display) ? mDescription : QString::null; |
329 | } | 329 | } |
330 | 330 | ||
331 | void Alarm::setTime(const QDateTime &alarmTime) | 331 | void Alarm::setTime(const QDateTime &alarmTime) |
332 | { | 332 | { |
333 | mAlarmTime = alarmTime; | 333 | mAlarmTime = alarmTime; |
334 | mHasTime = true; | 334 | mHasTime = true; |
335 | 335 | ||
336 | mParent->updated(); | 336 | mParent->updated(); |
337 | } | 337 | } |
338 | int Alarm::offset() | 338 | int Alarm::offset() |
339 | { | 339 | { |
340 | if ( hasTime() ) { | 340 | if ( hasTime() ) { |
341 | if (mParent->type()=="Todo") { | 341 | if (mParent->typeID() == todoID ) { |
342 | Todo *t = static_cast<Todo*>(mParent); | 342 | Todo *t = static_cast<Todo*>(mParent); |
343 | return t->dtDue().secsTo( mAlarmTime ) ; | 343 | return t->dtDue().secsTo( mAlarmTime ) ; |
344 | } else | 344 | } else |
345 | return mParent->dtStart().secsTo( mAlarmTime ) ; | 345 | return mParent->dtStart().secsTo( mAlarmTime ) ; |
346 | } | 346 | } |
347 | else | 347 | else |
348 | { | 348 | { |
349 | return mOffset.asSeconds(); | 349 | return mOffset.asSeconds(); |
350 | } | 350 | } |
351 | 351 | ||
352 | } | 352 | } |
353 | QString Alarm::offsetText() | 353 | QString Alarm::offsetText() |
354 | { | 354 | { |
355 | int min = -offset()/60; | 355 | int min = -offset()/60; |
356 | int hours = min /60; | 356 | int hours = min /60; |
357 | min = min % 60; | 357 | min = min % 60; |
@@ -368,33 +368,33 @@ QString Alarm::offsetText() | |||
368 | if ( min > 0 ) { | 368 | if ( min > 0 ) { |
369 | if ( !message.isEmpty() ) message += "/"; | 369 | if ( !message.isEmpty() ) message += "/"; |
370 | message += i18n("%1min").arg( min ); | 370 | message += i18n("%1min").arg( min ); |
371 | } | 371 | } |
372 | if ( message.isEmpty() ) | 372 | if ( message.isEmpty() ) |
373 | message = i18n("%1min").arg( 0 ); | 373 | message = i18n("%1min").arg( 0 ); |
374 | return message; | 374 | return message; |
375 | } | 375 | } |
376 | 376 | ||
377 | 377 | ||
378 | QDateTime Alarm::time() const | 378 | QDateTime Alarm::time() const |
379 | { | 379 | { |
380 | if ( hasTime() ) | 380 | if ( hasTime() ) |
381 | return mAlarmTime; | 381 | return mAlarmTime; |
382 | else | 382 | else |
383 | { | 383 | { |
384 | if (mParent->type()=="Todo") { | 384 | if (mParent->typeID() == todoID ) { |
385 | Todo *t = static_cast<Todo*>(mParent); | 385 | Todo *t = static_cast<Todo*>(mParent); |
386 | return mOffset.end( t->dtDue() ); | 386 | return mOffset.end( t->dtDue() ); |
387 | } else if (mEndOffset) { | 387 | } else if (mEndOffset) { |
388 | return mOffset.end( mParent->dtEnd() ); | 388 | return mOffset.end( mParent->dtEnd() ); |
389 | } else { | 389 | } else { |
390 | return mOffset.end( mParent->dtStart() ); | 390 | return mOffset.end( mParent->dtStart() ); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | bool Alarm::hasTime() const | 395 | bool Alarm::hasTime() const |
396 | { | 396 | { |
397 | return mHasTime; | 397 | return mHasTime; |
398 | } | 398 | } |
399 | 399 | ||
400 | void Alarm::setSnoozeTime(int alarmSnoozeTime) | 400 | void Alarm::setSnoozeTime(int alarmSnoozeTime) |