-rw-r--r-- | korganizer/koagendaview.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 13d8398..4ff6899 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -999,7 +999,20 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) item->incidence()->setDtStart(startDt); (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); } else if ( item->incidence()->type() == "Todo" ) { - (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); + Todo* to = static_cast<Todo*>(item->incidence()); + + int len = 0; + if ( to->hasStartDate() && to->hasDueDate() ) + len = to->dtStart().secsTo( to->dtDue()); + to->setDtDue(endDt); + if ( to->hasStartDate() ) { + if ( len>0 ) + to->setDtStart(to->dtDue().addSecs( -len )); + else + if (to->dtStart() > to->dtDue() ) + to->setDtStart(to->dtDue().addDays( -3 )); + } + } //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); item->incidence()->setRevision(item->incidence()->revision()+1); @@ -1180,7 +1193,7 @@ void KOAgendaView::fillAgenda() Todo *todo = todos.at(numTodo); if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date - + // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. // Already completed items can be displayed on their original due date //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |