-rw-r--r-- | korganizer/koagenda.cpp | 11 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 33 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 18 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 13 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 7 |
5 files changed, 54 insertions, 28 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 002234d..7c41cab 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1420,3 +1420,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) { - + // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| KOAgendaItem *item; @@ -1459,2 +1459,7 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) QDate currentDate; + QDateTime dt; + if ( todo->hasCompletedDate() ) + dt = todo->completed(); + else + dt = todo->dtDue(); if ( overdue ) { @@ -1464,3 +1469,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) else - currentDate = todo->dtDue().date(); + currentDate = dt.date(); @@ -1478,3 +1483,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) globalFlagBlockAgendaItemPaint = 1; - int endY = timeToY(todo->dtDue().time()) - 1; + int endY = timeToY(dt.time()) - 1; int hi = 12/KOPrefs::instance()->mHourSize; diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1864e22..bbc43e4 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -952,2 +952,3 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) // todo + qDebug("tooooodoooooo "); if (item->lastMultiItem()) { @@ -967,3 +968,3 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) - + qDebug("to888"); if ( item->incidence()->type() == "Event" ) { @@ -1057,3 +1058,3 @@ void KOAgendaView::fillAgenda() // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. - // Therefore, get all of them. + // Therefore, gtodoset all of them. QPtrList<Todo> todos = calendar()->todos(); @@ -1157,5 +1158,9 @@ void KOAgendaView::fillAgenda() bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; - - if ( ((todo->dtDue().date() == currentDate) && !overdue) || ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| - ((currentDate == today) && overdue) ) { + bool fillIn = false; + if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) + fillIn = true; + if ( ! fillIn && !todo->hasCompletedDate() ) + fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); + qDebug("refill todo "); + if ( fillIn ) { if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue @@ -1505,6 +1510,11 @@ void KOAgendaView::updateTodo( Todo * t, int ) { - + bool remove = false; bool removeAD = false; - if ( ! t->hasDueDate() ) { + QDate da; + if ( t->hasCompletedDate() ) + da = t->completed().date(); + else + da = t->dtDue().date(); + if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { remove = true; @@ -1521,4 +1531,5 @@ void KOAgendaView::updateTodo( Todo * t, int ) else { - if ( t->dtDue().date() < mSelectedDates.first() || - t->dtDue().date() > mSelectedDates.last() ) { + + if ( da < mSelectedDates.first() || + da > mSelectedDates.last() ) { remove = true; @@ -1526,3 +1537,3 @@ void KOAgendaView::updateTodo( Todo * t, int ) } else { - remove = t->doesFloat(); + remove = t->doesFloat() && !t->hasCompletedDate(); removeAD = !remove; @@ -1531,3 +1542,3 @@ void KOAgendaView::updateTodo( Todo * t, int ) } - int days = mSelectedDates.first().daysTo( t->dtDue().date() ); + int days = mSelectedDates.first().daysTo( da ); // qDebug("daysto %d ", days ); diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 36a2947..7dc1880 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -349,2 +349,12 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mMailSubject += i18n( "Todo " )+ event->summary(); + + if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { + mText +="<font color=\"#B00000\">"; + addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); + mText += "</font>"; + } else { + mText.append(i18n("<p><i>%1 % completed</i></p>") + .arg(event->percentComplete())); + } + if (event->cancelled ()) { @@ -381,10 +391,2 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) - if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { - mText.append(i18n("<p><i>Completed on %1</i></p>") - .arg( event->completedStr() )); - } else { - mText.append(i18n("<p><i>%1 % completed</i></p>") - .arg(event->percentComplete())); - } - formatReadOnly(event); diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 8c1953d..14e8b5c 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -336,2 +336,3 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : { + isFlatDisplay = false; mNavigator = 0; @@ -954,6 +955,11 @@ void KOTodoView::itemClicked(QListViewItem *item) } - int completed = todoItem->todo()->isCompleted(); // Completed or not? - +#if 0 + // handled by the item itself + bool completed = todoItem->todo()->isCompleted(); // Completed or not? + qDebug("com %d ",completed ); + qDebug("itemclicked "); if (todoItem->isOn()) { + qDebug("on "); if (!completed) { + qDebug("set true "); todoItem->todo()->setCompleted(QDateTime::currentDateTime()); @@ -961,3 +967,5 @@ void KOTodoView::itemClicked(QListViewItem *item) } else { + qDebug("not on "); if (completed) { + qDebug("set false "); todoItem->todo()->setCompleted(false); @@ -965,2 +973,3 @@ void KOTodoView::itemClicked(QListViewItem *item) } +#endif } diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 21ecb73..2822237 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp @@ -205,4 +205,3 @@ void KOTodoViewItem::stateChange(bool state) if ( m_init ) return; - - kdDebug() << "State changed, modified " << state << endl; + qDebug("KOTodoViewItem::stateChange "); QString keyd = "=="; @@ -210,4 +209,4 @@ void KOTodoViewItem::stateChange(bool state) - if (state) mTodo->setCompleted(state); - else mTodo->setPercentComplete(0); + mTodo->setCompleted(state); + if (state) mTodo->setCompleted(QDateTime::currentDateTime()); if (isOn()!=state) { |