-rw-r--r-- | libkcal/todo.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 5260051..4ada2d8 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -539,4 +539,18 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_d { - if ( isCompleted() || ! hasDueDate() || cancelled() || !alarmEnabled() ) { *ok = false; + if ( ! hasDueDate() || cancelled() || !alarmEnabled() ) { + return QDateTime (); + } + // if the recurring todo is set to complete and requested time < start time of todo + // we want to get the alarm. + bool iscompleted = isCompleted(); + if ( iscompleted && doesRecur() ) { + Todo * to = (Todo*) this; + to->checkSetCompletedFalse(); + iscompleted = isCompleted(); + if ( hasStartDate() && start_dt < dtStart() ){ + iscompleted = false; + } + } + if ( iscompleted ) { return QDateTime (); |