-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 | |||
@@ -1419,5 +1419,5 @@ KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) | |||
1419 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | 1419 | void 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 ); |
@@ -1458,4 +1458,9 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | |||
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(); |
@@ -1463,5 +1468,5 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | |||
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 ) { |
@@ -1477,5 +1482,5 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | |||
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; |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1864e22..bbc43e4 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -951,4 +951,5 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | |||
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)); |
@@ -966,5 +967,5 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | |||
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); |
@@ -1056,5 +1057,5 @@ void KOAgendaView::fillAgenda() | |||
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 | ||
@@ -1156,7 +1157,11 @@ void KOAgendaView::fillAgenda() | |||
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 ) |
@@ -1504,8 +1509,13 @@ void KOAgendaView::setStartHour( int h ) | |||
1504 | void KOAgendaView::updateTodo( Todo * t, int ) | 1509 | 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; |
@@ -1520,15 +1530,16 @@ void KOAgendaView::updateTodo( Todo * t, int ) | |||
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); |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 36a2947..7dc1880 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -348,4 +348,14 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
348 | } | 348 | } |
349 | mMailSubject += i18n( "Todo " )+ event->summary(); | 349 | mMailSubject += i18n( "Todo " )+ event->summary(); |
350 | |||
351 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | ||
352 | mText +="<font color=\"#B00000\">"; | ||
353 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | ||
354 | mText += "</font>"; | ||
355 | } else { | ||
356 | mText.append(i18n("<p><i>%1 % completed</i></p>") | ||
357 | .arg(event->percentComplete())); | ||
358 | } | ||
359 | |||
350 | if (event->cancelled ()) { | 360 | if (event->cancelled ()) { |
351 | mText +="<font color=\"#B00000\">"; | 361 | mText +="<font color=\"#B00000\">"; |
@@ -380,12 +390,4 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
380 | .arg(QString::number(event->priority()))); | 390 | .arg(QString::number(event->priority()))); |
381 | 391 | ||
382 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | ||
383 | mText.append(i18n("<p><i>Completed on %1</i></p>") | ||
384 | .arg( event->completedStr() )); | ||
385 | } else { | ||
386 | mText.append(i18n("<p><i>%1 % completed</i></p>") | ||
387 | .arg(event->percentComplete())); | ||
388 | } | ||
389 | |||
390 | formatReadOnly(event); | 392 | formatReadOnly(event); |
391 | formatAttendees(event); | 393 | formatAttendees(event); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 8c1953d..14e8b5c 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -335,4 +335,5 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
335 | KOrg::BaseView(calendar,parent,name) | 335 | KOrg::BaseView(calendar,parent,name) |
336 | { | 336 | { |
337 | isFlatDisplay = false; | ||
337 | mNavigator = 0; | 338 | mNavigator = 0; |
338 | QBoxLayout *topLayout = new QVBoxLayout(this); | 339 | QBoxLayout *topLayout = new QVBoxLayout(this); |
@@ -953,15 +954,23 @@ void KOTodoView::itemClicked(QListViewItem *item) | |||
953 | } | 954 | } |
954 | } | 955 | } |
955 | int completed = todoItem->todo()->isCompleted(); // Completed or not? | 956 | #if 0 |
956 | 957 | // handled by the item itself | |
958 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? | ||
959 | qDebug("com %d ",completed ); | ||
960 | qDebug("itemclicked "); | ||
957 | if (todoItem->isOn()) { | 961 | if (todoItem->isOn()) { |
962 | qDebug("on "); | ||
958 | if (!completed) { | 963 | if (!completed) { |
964 | qDebug("set true "); | ||
959 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 965 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
960 | } | 966 | } |
961 | } else { | 967 | } else { |
968 | qDebug("not on "); | ||
962 | if (completed) { | 969 | if (completed) { |
970 | qDebug("set false "); | ||
963 | todoItem->todo()->setCompleted(false); | 971 | todoItem->todo()->setCompleted(false); |
964 | } | 972 | } |
965 | } | 973 | } |
974 | #endif | ||
966 | } | 975 | } |
967 | 976 | ||
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 21ecb73..2822237 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -204,11 +204,10 @@ void KOTodoViewItem::stateChange(bool state) | |||
204 | // do not change setting on startup | 204 | // do not change setting on startup |
205 | if ( m_init ) return; | 205 | if ( m_init ) return; |
206 | 206 | qDebug("KOTodoViewItem::stateChange "); | |
207 | kdDebug() << "State changed, modified " << state << endl; | ||
208 | QString keyd = "=="; | 207 | QString keyd = "=="; |
209 | QString keyt = "=="; | 208 | QString keyt = "=="; |
210 | 209 | ||
211 | if (state) mTodo->setCompleted(state); | 210 | mTodo->setCompleted(state); |
212 | else mTodo->setPercentComplete(0); | 211 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); |
213 | if (isOn()!=state) { | 212 | if (isOn()!=state) { |
214 | setOn(state); | 213 | setOn(state); |