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
@@ -1409,25 +1409,25 @@ KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
1409 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1409 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1410 if ( item->incidence() == todo ) { 1410 if ( item->incidence() == todo ) {
1411 mItems.remove(); 1411 mItems.remove();
1412 return item; 1412 return item;
1413 } 1413 }
1414 } 1414 }
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 ");
1428 item->hide(); 1428 item->hide();
1429 item->setCellX(-2, -1 ); 1429 item->setCellX(-2, -1 );
1430 item->select(false); 1430 item->select(false);
1431 mUnusedItems.append( item ); 1431 mUnusedItems.append( item );
1432 mItems.remove( item ); 1432 mItems.remove( item );
1433 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1433 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
@@ -1448,44 +1448,49 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1448 globalFlagBlockAgendaItemUpdate = 1; 1448 globalFlagBlockAgendaItemUpdate = 1;
1449 itemit->repaint(); 1449 itemit->repaint();
1450 } 1450 }
1451 blockSignals( false ); 1451 blockSignals( false );
1452 } 1452 }
1453 if ( remove ) { 1453 if ( 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);
1472 item->show(); 1477 item->show();
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();
1486 globalFlagBlockAgendaItemPaint = 0; 1491 globalFlagBlockAgendaItemPaint = 0;
1487 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1492 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1488 KOAgendaItem *itemit; 1493 KOAgendaItem *itemit;
1489 for ( itemit=oldconflictItems.first(); itemit != 0; 1494 for ( itemit=oldconflictItems.first(); itemit != 0;
1490 itemit=oldconflictItems.next() ) { 1495 itemit=oldconflictItems.next() ) {
1491 globalFlagBlockAgendaItemUpdate = 0; 1496 globalFlagBlockAgendaItemUpdate = 0;