summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 1864e22..bbc43e4 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -949,8 +949,9 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
949 } 949 }
950 } 950 }
951 } else { 951 } else {
952 // todo 952 // todo
953 qDebug("tooooodoooooo ");
953 if (item->lastMultiItem()) { 954 if (item->lastMultiItem()) {
954 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 955 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
955 endDt.setDate(startDate. 956 endDt.setDate(startDate.
956 addDays(item->lastMultiItem()->cellX() - item->cellX())); 957 addDays(item->lastMultiItem()->cellX() - item->cellX()));
@@ -964,9 +965,9 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
964 } 965 }
965 } 966 }
966 } 967 }
967 968
968 969 qDebug("to888");
969 if ( item->incidence()->type() == "Event" ) { 970 if ( item->incidence()->type() == "Event" ) {
970 item->incidence()->setDtStart(startDt); 971 item->incidence()->setDtStart(startDt);
971 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 972 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
972 } else if ( item->incidence()->type() == "Todo" ) { 973 } else if ( item->incidence()->type() == "Todo" ) {
@@ -1054,9 +1055,9 @@ void KOAgendaView::fillAgenda()
1054 1055
1055 QPtrList<Event> dayEvents; 1056 QPtrList<Event> dayEvents;
1056 1057
1057 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1058 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1058 // Therefore, get all of them. 1059 // Therefore, gtodoset all of them.
1059 QPtrList<Todo> todos = calendar()->todos(); 1060 QPtrList<Todo> todos = calendar()->todos();
1060 1061
1061 mAgenda->setDateList(mSelectedDates); 1062 mAgenda->setDateList(mSelectedDates);
1062 1063
@@ -1154,11 +1155,15 @@ void KOAgendaView::fillAgenda()
1154 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1155 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1155 // Already completed items can be displayed on their original due date 1156 // Already completed items can be displayed on their original due date
1156 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1157 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1157 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1158 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
1158 1159 bool fillIn = false;
1159 if ( ((todo->dtDue().date() == currentDate) && !overdue) || ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| 1160 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
1160 ((currentDate == today) && overdue) ) { 1161 fillIn = true;
1162 if ( ! fillIn && !todo->hasCompletedDate() )
1163 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
1164 qDebug("refill todo ");
1165 if ( fillIn ) {
1161 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue 1166 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1162 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1167 if ( KOPrefs::instance()->mShowTodoInAgenda )
1163 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1168 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1164 } 1169 }
@@ -1505,9 +1510,14 @@ void KOAgendaView::updateTodo( Todo * t, int )
1505{ 1510{
1506 1511
1507 bool remove = false; 1512 bool remove = false;
1508 bool removeAD = false; 1513 bool removeAD = false;
1509 if ( ! t->hasDueDate() ) { 1514 QDate da;
1515 if ( t->hasCompletedDate() )
1516 da = t->completed().date();
1517 else
1518 da = t->dtDue().date();
1519 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) {
1510 remove = true; 1520 remove = true;
1511 removeAD = true; 1521 removeAD = true;
1512 } 1522 }
1513 else { 1523 else {
@@ -1518,19 +1528,20 @@ void KOAgendaView::updateTodo( Todo * t, int )
1518 removeAD = false; 1528 removeAD = false;
1519 remove = true; 1529 remove = true;
1520 } 1530 }
1521 else { 1531 else {
1522 if ( t->dtDue().date() < mSelectedDates.first() || 1532
1523 t->dtDue().date() > mSelectedDates.last() ) { 1533 if ( da < mSelectedDates.first() ||
1534 da > mSelectedDates.last() ) {
1524 remove = true; 1535 remove = true;
1525 removeAD = true; 1536 removeAD = true;
1526 } else { 1537 } else {
1527 remove = t->doesFloat(); 1538 remove = t->doesFloat() && !t->hasCompletedDate();
1528 removeAD = !remove; 1539 removeAD = !remove;
1529 } 1540 }
1530 } 1541 }
1531 } 1542 }
1532 int days = mSelectedDates.first().daysTo( t->dtDue().date() ); 1543 int days = mSelectedDates.first().daysTo( da );
1533 // qDebug("daysto %d ", days ); 1544 // qDebug("daysto %d ", days );
1534 mAgenda->updateTodo( t , days, remove); 1545 mAgenda->updateTodo( t , days, remove);
1535 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1546 if ( KOPrefs::instance()->mShowTodoInAgenda )
1536 mAllDayAgenda->updateTodo( t , days, removeAD); 1547 mAllDayAgenda->updateTodo( t , days, removeAD);