author | zautrix <zautrix> | 2005-06-08 09:15:20 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-08 09:15:20 (UTC) |
commit | 39d84e2fc3099bd5d7596e8be5dc6783826cec01 (patch) (side-by-side diff) | |
tree | a811365972a94c65cfd4f78c802ae8e9b09d7d12 | |
parent | 876dca14867d6a47b661c60a9c96ac3a70591d0c (diff) | |
download | kdepimpi-39d84e2fc3099bd5d7596e8be5dc6783826cec01.zip kdepimpi-39d84e2fc3099bd5d7596e8be5dc6783826cec01.tar.gz kdepimpi-39d84e2fc3099bd5d7596e8be5dc6783826cec01.tar.bz2 |
rec todo fix
-rw-r--r-- | libkcal/todo.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 473247a..38ba2c7 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -476,102 +476,105 @@ void Todo::setCompleted(const QDateTime &completed) bool Todo::hasCompletedDate() const { return mHasCompletedDate; } int Todo::percentComplete() const { return mPercentComplete; } bool Todo::setRecurDates() { if ( !mHasRecurrenceID ) return true; int secs = mDtStart.secsTo( dtDue() ); bool ok; qDebug("T:setRecurDates() "); //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); QDateTime next = getNextOccurence( mRecurrenceID, &ok ); if ( ok ) { mRecurrenceID = next; mDtStart = next; setDtDue( next.addSecs( secs ) ); if ( QDateTime::currentDateTime() > next) return false; } else { setHasRecurrenceID( false ); recurrence()->unsetRecurs(); } return true; } void Todo::setPercentComplete(int v) { if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { if ( !setRecurDates() ) v = 0; } mPercentComplete = v; if ( v != 100 ) mHasCompletedDate = false; updated(); } QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const { if ( isCompleted() || ! hasDueDate() || cancelled() ) { *ok = false; return QDateTime (); } QDateTime incidenceStart; incidenceStart = dtDue(); bool enabled = false; Alarm* alarm; int off = 0; QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; // if ( QDateTime::currentDateTime() > incidenceStart ){ // *ok = false; // return incidenceStart; // } 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 ( !hasRecurrenceID() ) { qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); } // qDebug("Todo::checkSetCompletedFalse()"); //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); - if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) { - qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); - setCompleted( false ); - qDebug("Todo::checkSetCompletedFalse "); + 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 "); + } } } |