summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/todo.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 5260051..4ada2d8 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -534,16 +534,30 @@ void Todo::setPercentComplete(int v)
534 if ( v != 100 ) 534 if ( v != 100 )
535 mHasCompletedDate = false; 535 mHasCompletedDate = false;
536 updated(); 536 updated();
537} 537}
538QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const 538QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
539{ 539{
540 if ( isCompleted() || ! hasDueDate() || cancelled() || !alarmEnabled() ) { 540 *ok = false;
541 *ok = false; 541 if ( ! hasDueDate() || cancelled() || !alarmEnabled() ) {
542 return QDateTime (); 542 return QDateTime ();
543 } 543 }
544 // if the recurring todo is set to complete and requested time < start time of todo
545 // we want to get the alarm.
546 bool iscompleted = isCompleted();
547 if ( iscompleted && doesRecur() ) {
548 Todo * to = (Todo*) this;
549 to->checkSetCompletedFalse();
550 iscompleted = isCompleted();
551 if ( hasStartDate() && start_dt < dtStart() ){
552 iscompleted = false;
553 }
554 }
555 if ( iscompleted ) {
556 return QDateTime ();
557 }
544 QDateTime incidenceStart; 558 QDateTime incidenceStart;
545 incidenceStart = dtDue(); 559 incidenceStart = dtDue();
546 bool enabled = false; 560 bool enabled = false;
547 Alarm* alarm; 561 Alarm* alarm;
548 int off = 0; 562 int off = 0;
549 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 563 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;