From 7bd83e913399b8be68a7d37e8f02118ec9eab90e Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 13 Feb 2005 19:07:45 +0000 Subject: todo fixi --- (limited to 'korganizer') diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7c8316f..3dac20b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -2263,6 +2263,9 @@ void CalendarView::slotSelectPickerDate( QDate d) if ( mMoveIncidence->type() == "Todo" ) { Todo * to = (Todo *) mMoveIncidence; QTime tim; + int len = 0; + if ( to->hasStartDate() && to->hasDueDate() ) + len = to->dtStart().secsTo( to->dtDue()); if ( to->hasDueDate() ) tim = to->dtDue().time(); else { @@ -2272,6 +2275,15 @@ void CalendarView::slotSelectPickerDate( QDate d) } QDateTime dt ( d,tim ); to->setDtDue( dt ); + + if ( to->hasStartDate() ) { + if ( len>0 ) + to->setDtStart(to->dtDue().addSecs( -len )); + else + if (to->dtStart() > to->dtDue() ) + to->setDtStart(to->dtDue().addDays( -3 )); + } + todoChanged( to ); } else { if ( mMoveIncidence->doesRecur() ) { @@ -3810,7 +3822,7 @@ bool CalendarView::removeCompletedSubTodos( Todo* t ) deleteTodo = false; } if ( deleteTodo ) { - if ( t->isCompleted() ) { + if ( t->isCompleted() && !t->doesRecur()) { checkExternalId( t ); mCalendar->deleteTodo( t ); changeTodoDisplay( t,KOGlobals::EVENTDELETED ); diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 13d8398..4ff6899 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -999,7 +999,20 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) item->incidence()->setDtStart(startDt); (static_cast(item->incidence()))->setDtEnd(endDt); } else if ( item->incidence()->type() == "Todo" ) { - (static_cast(item->incidence()))->setDtDue(endDt); + Todo* to = static_cast(item->incidence()); + + int len = 0; + if ( to->hasStartDate() && to->hasDueDate() ) + len = to->dtStart().secsTo( to->dtDue()); + to->setDtDue(endDt); + if ( to->hasStartDate() ) { + if ( len>0 ) + to->setDtStart(to->dtDue().addSecs( -len )); + else + if (to->dtStart() > to->dtDue() ) + to->setDtStart(to->dtDue().addDays( -3 )); + } + } //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); item->incidence()->setRevision(item->incidence()->revision()+1); @@ -1180,7 +1193,7 @@ void KOAgendaView::fillAgenda() Todo *todo = todos.at(numTodo); 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 diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 39921a0..f6c9624 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -402,6 +402,13 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mText.append(event->location()+"
"); mMailSubject += i18n(" at ") + event->location(); } + + if (event->recurrence()->doesRecur()) { + + QString recurText = event->recurrence()->recurrenceText(); + addTag("p","" + i18n("This is a %1 recurring todo.").arg(recurText ) + ""); + + } if (event->hasStartDate()) { mText.append(i18n("

Start on: %1

").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); } diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index acd9265..d8e940b 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -156,7 +156,7 @@ bool ListItemVisitor::visit(Todo *t) mItem->setText(3,"---"); mItem->setText(4,"---"); mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); - mItem->setText(6,"---"); + mItem->setText(6, t->recurrence()->recurrenceText()); if (t->hasDueDate()) { mItem->setText(7,t->dtDueDateStr()); if (t->doesFloat()) { diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index f595d35..d0380e3 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -581,6 +581,9 @@ void MonthViewCell::insertTodo(Todo *todo) pal = mStandardPalette ; } item->setPalette( pal ); + item->setRecur( todo->recurrence()->doesRecur() ); + item->setAlarm( todo->isAlarmEnabled() ); + item->setMoreInfo( todo->description().length() > 0 ); mItemList->insertItem( item ); mToolTip += text+"\n"; } diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 391b3bb..18dc656 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -667,6 +667,12 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) mText +="["; mText += "i"; needClose =true; + } + if ( ev->doesRecur() ) { + if ( !needClose) + mText +="["; + mText += "r"; + needClose =true; } // if ( ev->recurrence()->doesRecur() ) { // if ( !needClose) -- cgit v0.9.0.2