summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Unidiff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp11
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
@@ -1415,13 +1415,13 @@ KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
1415 return 0; 1415 return 0;
1416} 1416}
1417 1417
1418 1418
1419void KOAgenda::updateTodo( Todo * todo, int days, bool remove) 1419void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1420{ 1420{
1421 1421 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
1422 KOAgendaItem *item; 1422 KOAgendaItem *item;
1423 item = getItemForTodo ( todo ); 1423 item = getItemForTodo ( todo );
1424 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); 1424 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
1425 if ( item ) { 1425 if ( item ) {
1426 blockSignals( true ); 1426 blockSignals( true );
1427 //qDebug("item found "); 1427 //qDebug("item found ");
@@ -1454,18 +1454,23 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1454 //qDebug("remove****************************************** "); 1454 //qDebug("remove****************************************** ");
1455 return; 1455 return;
1456 } 1456 }
1457 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1457 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1458 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1458 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda );
1459 QDate currentDate; 1459 QDate currentDate;
1460 QDateTime dt;
1461 if ( todo->hasCompletedDate() )
1462 dt = todo->completed();
1463 else
1464 dt = todo->dtDue();
1460 if ( overdue ) { 1465 if ( overdue ) {
1461 currentDate = QDate::currentDate(); 1466 currentDate = QDate::currentDate();
1462 days += todo->dtDue().date().daysTo( currentDate ); 1467 days += todo->dtDue().date().daysTo( currentDate );
1463 } 1468 }
1464 else 1469 else
1465 currentDate = todo->dtDue().date(); 1470 currentDate = dt.date();
1466 1471
1467 if ( todo->doesFloat() || overdue ) { 1472 if ( todo->doesFloat() || overdue ) {
1468 if ( ! mAllDayMode ) return; 1473 if ( ! mAllDayMode ) return;
1469 // aldayagenda 1474 // aldayagenda
1470 globalFlagBlockAgendaItemPaint = 1; 1475 globalFlagBlockAgendaItemPaint = 1;
1471 item = insertAllDayItem(todo, currentDate,days, days); 1476 item = insertAllDayItem(todo, currentDate,days, days);
@@ -1473,13 +1478,13 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1473 1478
1474 } 1479 }
1475 else { 1480 else {
1476 if ( mAllDayMode ) return; 1481 if ( mAllDayMode ) return;
1477 // mAgenda 1482 // mAgenda
1478 globalFlagBlockAgendaItemPaint = 1; 1483 globalFlagBlockAgendaItemPaint = 1;
1479 int endY = timeToY(todo->dtDue().time()) - 1; 1484 int endY = timeToY(dt.time()) - 1;
1480 int hi = 12/KOPrefs::instance()->mHourSize; 1485 int hi = 12/KOPrefs::instance()->mHourSize;
1481 int startY = endY - 1-hi; 1486 int startY = endY - 1-hi;
1482 item = insertItem(todo,currentDate,days,startY,endY); 1487 item = insertItem(todo,currentDate,days,startY,endY);
1483 item->show(); 1488 item->show();
1484 } 1489 }
1485 qApp->processEvents(); 1490 qApp->processEvents();