author | zautrix <zautrix> | 2005-01-30 10:57:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-30 10:57:34 (UTC) |
commit | 446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8 (patch) (side-by-side diff) | |
tree | 26260551e87a4074651a5cdceee5e788f743a02d | |
parent | 949c6e28c83668176fd9c29e12668322c6ae627f (diff) | |
download | kdepimpi-446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8.zip kdepimpi-446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8.tar.gz kdepimpi-446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8.tar.bz2 |
bugs from last commit fixed
-rw-r--r-- | korganizer/koagenda.cpp | 11 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 31 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 18 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 13 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 7 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 16 | ||||
-rw-r--r-- | libkcal/todo.cpp | 5 | ||||
-rw-r--r-- | libkcal/todo.h | 2 |
8 files changed, 65 insertions, 38 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 ) 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 "); @@ -1454,18 +1454,23 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool 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); @@ -1473,13 +1478,13 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) } 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(); diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1864e22..bbc43e4 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -947,12 +947,13 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); endDt.setDate(startDate); } } } else { // todo + qDebug("tooooodoooooo "); if (item->lastMultiItem()) { endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); endDt.setDate(startDate. addDays(item->lastMultiItem()->cellX() - item->cellX())); } else { //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); @@ -962,13 +963,13 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); endDt.setDate(startDate); } } } - + qDebug("to888"); if ( item->incidence()->type() == "Event" ) { item->incidence()->setDtStart(startDt); (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); } else if ( item->incidence()->type() == "Todo" ) { (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); } @@ -1052,13 +1053,13 @@ void KOAgendaView::fillAgenda() mMinY.resize(mSelectedDates.count()); mMaxY.resize(mSelectedDates.count()); QPtrList<Event> dayEvents; // 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(); mAgenda->setDateList(mSelectedDates); QDate today = QDate::currentDate(); @@ -1152,15 +1153,19 @@ void KOAgendaView::fillAgenda() if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. // Already completed items can be displayed on their original due date //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 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 if ( KOPrefs::instance()->mShowTodoInAgenda ) mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); } else { QDateTime dt; @@ -1503,36 +1508,42 @@ void KOAgendaView::setStartHour( int h ) 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; removeAD = true; } else { bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; if ( overdue && QDate::currentDate() >= mSelectedDates.first() && QDate::currentDate() <= mSelectedDates.last()) { removeAD = false; remove = true; } else { - if ( t->dtDue().date() < mSelectedDates.first() || - t->dtDue().date() > mSelectedDates.last() ) { + + if ( da < mSelectedDates.first() || + da > mSelectedDates.last() ) { remove = true; removeAD = true; } else { - remove = t->doesFloat(); + remove = t->doesFloat() && !t->hasCompletedDate(); removeAD = !remove; } } } - int days = mSelectedDates.first().daysTo( t->dtDue().date() ); + int days = mSelectedDates.first().daysTo( da ); // qDebug("daysto %d ", days ); mAgenda->updateTodo( t , days, remove); if ( KOPrefs::instance()->mShowTodoInAgenda ) mAllDayAgenda->updateTodo( t , days, removeAD); //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 36a2947..7dc1880 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -344,12 +344,22 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) } addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); if ( mColorMode ) mText += "</font>"; } 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 ()) { mText +="<font color=\"#B00000\">"; addTag("i",i18n("This todo has been cancelled!")); mText.append("<br>"); mText += "</font>"; mMailSubject += i18n("(cancelled)"); @@ -376,20 +386,12 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) formatCategories(event); mText.append(i18n("<p><b>Priority:</b> %2</p>") .arg(QString::number(event->priority()))); - 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); formatAttendees(event); if ( event->relatedTo() ) { addTag("b",i18n("Parent todo: ")); mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); } diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 8c1953d..14e8b5c 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -331,12 +331,13 @@ void KOQuickTodo::focusOutEvent(QFocusEvent *ev) ///////////////////////////////////////////////////////////////////////////// KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : KOrg::BaseView(calendar,parent,name) { + isFlatDisplay = false; mNavigator = 0; QBoxLayout *topLayout = new QVBoxLayout(this); mName = QString ( name ); mBlockUpdate = false; mQuickAdd = new KOQuickTodo(this); topLayout->addWidget(mQuickAdd); @@ -949,23 +950,31 @@ void KOTodoView::itemClicked(QListViewItem *item) Todo* newSub = pendingSubtodo->todo(); pendingSubtodo = 0; emit reparentTodoSignal( newParent,newSub ); return; } } - 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()); } } else { + qDebug("not on "); if (completed) { + qDebug("set false "); todoItem->todo()->setCompleted(false); } } +#endif } void KOTodoView::setDocumentId( const QString &id ) { kdDebug() << "KOTodoView::setDocumentId()" << endl; diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 21ecb73..2822237 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp @@ -200,19 +200,18 @@ void KOTodoViewItem::setMyPixmap() } void KOTodoViewItem::stateChange(bool state) { // qDebug("KOTodoViewItem::stateChange "); // do not change setting on startup if ( m_init ) return; - - kdDebug() << "State changed, modified " << state << endl; + qDebug("KOTodoViewItem::stateChange "); QString keyd = "=="; QString keyt = "=="; - if (state) mTodo->setCompleted(state); - else mTodo->setPercentComplete(0); + mTodo->setCompleted(state); + if (state) mTodo->setCompleted(QDateTime::currentDateTime()); if (isOn()!=state) { setOn(state); } if (mTodo->hasDueDate()) { setText(3, mTodo->dtDueDateStr()); diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index c52f2b3..6d07d4c 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp @@ -164,12 +164,20 @@ void KIncidenceFormatter::setTodo(Todo *event ) addTag("h2",i18n( "Remote: " ) +event->summary()); } addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); if ( mColorMode ) mText += "</font>"; } + if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { + mText +="<font color=\"#B00000\">"; + addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); + mText += "</font>"; + } else { + mText.append(i18n("<p><i>%1 % completed</i></p>") + .arg(event->percentComplete())); + } if (event->cancelled ()) { mText +="<font color=\"#B00000\">"; addTag("i",i18n("This todo has been cancelled!")); mText.append("<br>"); mText += "</font>"; } @@ -181,20 +189,12 @@ void KIncidenceFormatter::setTodo(Todo *event ) if (event->hasDueDate()) { mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); } mText.append(i18n("<p><b>Priority:</b> %2</p>") .arg(QString::number(event->priority()))); - 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())); - } - addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); formatCategories(event); if (!event->description().isEmpty()) { addTag("p",i18n("<b>Details: </b>")); addTag("p",event->description()); } diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7362bdf..7d04793 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -297,19 +297,20 @@ void Todo::setCompleted(bool completed) QDateTime Todo::completed() const { return mCompleted; } -QString Todo::completedStr() const +QString Todo::completedStr( bool shortF ) const { - return KGlobal::locale()->formatDateTime(mCompleted); + return KGlobal::locale()->formatDateTime(mCompleted, shortF); } void Todo::setCompleted(const QDateTime &completed) { + qDebug("Todo::setCompleted "); mHasCompletedDate = true; mPercentComplete = 100; mCompleted = getEvenTime(completed); updated(); } diff --git a/libkcal/todo.h b/libkcal/todo.h index 0f22c59..41f5841 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h @@ -90,13 +90,13 @@ class Todo : public Incidence range from 0 to 100. */ void setPercentComplete(int); /** return date and time when todo was completed */ QDateTime completed() const; - QString completedStr() const; + QString completedStr(bool shortF = true) const; /** set date and time of completion */ void setCompleted(const QDateTime &completed); /** Return true, if todo has a date associated with completion */ bool hasCompletedDate() const; bool contains ( Todo*); |