-rw-r--r-- | libkcal/todo.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7bf756a..e4508a0 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -569,48 +569,58 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_d for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { if (alarm->enabled()) { if ( alarm->hasTime () ) { if ( alarm->time() < alarmStart ) { alarmStart = alarm->time(); enabled = true; off = alarmStart.secsTo( incidenceStart ); } } else { int secs = alarm->startOffset().asSeconds(); if ( incidenceStart.addSecs( secs ) < alarmStart ) { alarmStart = incidenceStart.addSecs( secs ); enabled = true; off = -secs; } } } } if ( enabled ) { if ( alarmStart > start_dt ) { *ok = true; * offset = off; return alarmStart; } } *ok = false; return QDateTime (); } void Todo::checkSetCompletedFalse() { if ( !mHasRecurrenceID ) { qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); return; } // qDebug("Todo::checkSetCompletedFalse()"); //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); if ( mPercentComplete == 100 ) { QDateTime dt = QDateTime::currentDateTime(); if ( dt > mDtStart && dt > mRecurrenceID ) { qDebug("start: %s --due: %s --recID: %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); setCompleted( false ); qDebug("Todo::checkSetCompletedFalse "); } } } +QString Todo::durationText() +{ + if ( mHasDueDate && hasStartDate() ) { + int sec = dtStart().secsTo( dtDue() ); + if ( doesFloat() ) + sec += 86400; + return durationText4Time( sec ); + } + return "---"; +} |