-rw-r--r-- | korganizer/koagenda.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 002234d..7c41cab 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1409,25 +1409,25 @@ KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) for ( item=mItems.first(); item != 0; item=mItems.next() ) { if ( item->incidence() == todo ) { mItems.remove(); return item; } } return 0; } void KOAgenda::updateTodo( Todo * todo, int days, bool remove) { - + // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| KOAgendaItem *item; item = getItemForTodo ( todo ); //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); if ( item ) { blockSignals( true ); //qDebug("item found "); item->hide(); item->setCellX(-2, -1 ); item->select(false); mUnusedItems.append( item ); mItems.remove( item ); QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); @@ -1448,44 +1448,49 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) globalFlagBlockAgendaItemUpdate = 1; itemit->repaint(); } blockSignals( false ); } if ( remove ) { //qDebug("remove****************************************** "); return; } //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); QDate currentDate; + QDateTime dt; + if ( todo->hasCompletedDate() ) + dt = todo->completed(); + else + dt = todo->dtDue(); if ( overdue ) { currentDate = QDate::currentDate(); days += todo->dtDue().date().daysTo( currentDate ); } else - currentDate = todo->dtDue().date(); + currentDate = dt.date(); if ( todo->doesFloat() || overdue ) { if ( ! mAllDayMode ) return; // aldayagenda globalFlagBlockAgendaItemPaint = 1; item = insertAllDayItem(todo, currentDate,days, days); item->show(); } else { if ( mAllDayMode ) return; // mAgenda globalFlagBlockAgendaItemPaint = 1; - int endY = timeToY(todo->dtDue().time()) - 1; + int endY = timeToY(dt.time()) - 1; int hi = 12/KOPrefs::instance()->mHourSize; int startY = endY - 1-hi; item = insertItem(todo,currentDate,days,startY,endY); item->show(); } qApp->processEvents(); globalFlagBlockAgendaItemPaint = 0; QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); KOAgendaItem *itemit; for ( itemit=oldconflictItems.first(); itemit != 0; itemit=oldconflictItems.next() ) { globalFlagBlockAgendaItemUpdate = 0; |