summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
authorzautrix <zautrix>2005-02-13 19:07:45 (UTC)
committer zautrix <zautrix>2005-02-13 19:07:45 (UTC)
commit7bd83e913399b8be68a7d37e8f02118ec9eab90e (patch) (side-by-side diff)
tree284d1592687ea4d3e0c220fafd289a702718dee4 /korganizer/koagendaview.cpp
parent293271fe9e6a9061da329183f8f488d79580f7da (diff)
downloadkdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.zip
kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.gz
kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.bz2
todo fixi
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp17
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