summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore 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
@@ -1397,107 +1397,112 @@ KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view)
return fi;
}
// qDebug("new KOAgendaItem ");
KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode );
agendaItem->installEventFilter(this);
addChild(agendaItem,0,0);
return agendaItem;
}
KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
{
KOAgendaItem *item;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
if ( item->incidence() == todo ) {
mItems.remove();
return item;
}
}
return 0;
}
void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
{
-
+ // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
KOAgendaItem *item;
item = getItemForTodo ( todo );
//qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
if ( item ) {
blockSignals( true );
//qDebug("item found ");
item->hide();
item->setCellX(-2, -1 );
item->select(false);
mUnusedItems.append( item );
mItems.remove( item );
QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
KOAgendaItem *itemit;
//globalFlagBlockAgendaItemPaint = 1;
for ( itemit=oldconflictItems.first(); itemit != 0;
itemit=oldconflictItems.next() ) {
if ( itemit != item )
placeSubCells(itemit);
}
qApp->processEvents();
//globalFlagBlockAgendaItemPaint = 0;
for ( itemit=oldconflictItems.first(); itemit != 0;
itemit=oldconflictItems.next() ) {
globalFlagBlockAgendaItemUpdate = 0;
if ( itemit != item )
itemit->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
itemit->repaint();
}
blockSignals( false );
}
if ( remove ) {
//qDebug("remove****************************************** ");
return;
}
//qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda );
QDate currentDate;
+ QDateTime dt;
+ if ( todo->hasCompletedDate() )
+ dt = todo->completed();
+ else
+ dt = todo->dtDue();
if ( overdue ) {
currentDate = QDate::currentDate();
days += todo->dtDue().date().daysTo( currentDate );
}
else
- currentDate = todo->dtDue().date();
+ currentDate = dt.date();
if ( todo->doesFloat() || overdue ) {
if ( ! mAllDayMode ) return;
// aldayagenda
globalFlagBlockAgendaItemPaint = 1;
item = insertAllDayItem(todo, currentDate,days, days);
item->show();
}
else {
if ( mAllDayMode ) return;
// mAgenda
globalFlagBlockAgendaItemPaint = 1;
- int endY = timeToY(todo->dtDue().time()) - 1;
+ int endY = timeToY(dt.time()) - 1;
int hi = 12/KOPrefs::instance()->mHourSize;
int startY = endY - 1-hi;
item = insertItem(todo,currentDate,days,startY,endY);
item->show();
}
qApp->processEvents();
globalFlagBlockAgendaItemPaint = 0;
QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
KOAgendaItem *itemit;
for ( itemit=oldconflictItems.first(); itemit != 0;
itemit=oldconflictItems.next() ) {
globalFlagBlockAgendaItemUpdate = 0;
itemit->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
itemit->repaint();
}
globalFlagBlockAgendaItemUpdate = 0;
item->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
item->repaint();
}
/*
Insert KOAgendaItem into agenda.
*/