-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 26 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 11 | ||||
-rw-r--r-- | libkcal/incidence.h | 2 | ||||
-rw-r--r-- | libkcal/todo.cpp | 32 | ||||
-rw-r--r-- | libkcal/todo.h | 12 |
7 files changed, 69 insertions, 20 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 14dcdac..9ba4f3e 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -8,25 +8,27 @@ Open list view (or search dialog), select the desired items and choose in the popup menu: Set alarm for selected... Added to the event/todo viewer the option to send an email to all attendees or all selected (with RSVP) attendees. Made the week-month mode changing in month view faster. Made month view better useable with keyboard. Now TAB key jumps to next cell with an event/todo. Scroll in cell with coursor keys, scroll in time (next week) with Shift/Control + coursorkeys. -Fixeg bug that the todo view flat mode was reset after first view update. +Fixed bug that the todo view flat mode was reset after first view update. + +If a todo is displayed closed in the todo view, it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. ********** VERSION 2.0.2 ************ KO/Pi: Fixed the layout problem of the day label buttons of the agenda view introduced in version 2.0.1. Added WhatsThis support for the todo view and the list view. Added a quite useful feature to the montview. Just click on the week numbers on the left. And in the top right corner of month view/agenda view diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 31c5659..cb519b2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1193,25 +1193,25 @@ void KOMonthView::updateView() if ( end > timeSpan ) end = timeSpan; int iii; //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); for ( iii = st;iii<= end;++iii) (*cells)[iii]->insertEvent( event ); } } } else { if ( invalid ) break; invalid = true; //qDebug("invalid %s", event->summary().latin1()); - incidenceStart = QDateTime( mStartDate ); + incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; } if ( last ) break; bool ok; incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); if ( ! ok ) break; if ( incidenceStart.date() > endDate ) break; } } else { // no recur int st = event->dtStart().date().daysTo( endDate ); diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 6bdee18..78d4027 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp @@ -319,39 +319,35 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i //#ifndef KORG_NOLVALTERNATION // if (isAlternate()) // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; QColor colorToSet; if ( setColor ) { QStringList categories = mTodo->categories(); QString cat = categories.first(); if ( !cat.isEmpty()) { colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); } else setColor = false; - } - if (mTodo->hasDueDate()) { - if (mTodo->dtDue().date()==QDate::currentDate() && - !mTodo->isCompleted()) { - //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor); - colorToSet = KOPrefs::instance()->mTodoDueTodayColor; - setColor = true; - } - if (mTodo->dtDue().date() < QDate::currentDate() && - !mTodo->isCompleted()) { - //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); - colorToSet = KOPrefs::instance()->mTodoOverdueColor; - setColor = true; - } - } + } + + int odue = mTodo->hasDueSubTodo( !isOpen()); + if (odue == 2) { + colorToSet = KOPrefs::instance()->mTodoOverdueColor; + setColor = true; + } else if ( odue == 1 ) { + colorToSet = KOPrefs::instance()->mTodoDueTodayColor; + setColor = true; + } + if ( setColor ) { _cg.setColor(role,colorToSet ); if ( role == QColorGroup::Base) { int rgb = colorToSet.red(); rgb += colorToSet.blue()/2; rgb += colorToSet.green(); if ( rgb < 200 ) _cg.setColor(QColorGroup::Text,Qt::white ); } } //#endif diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a2c20a8..5bc8c00 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1337,25 +1337,34 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); } else { startString = ": "+incidence->dtStartStr(true); startString += " --- "+((Event*)incidence)->dtEndStr(true); } } else { if ( incidence->dtStart().time() != incidence->dtEnd().time() ) startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); - startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); + if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { + bool ok; + QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); + if ( ok ) { + int years = noc.date().year() - incidence->dtStart().date().year(); + startString += i18n(" (%1 y.)"). arg( years ); + } + } + else + startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); } } else startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); if ( !incidence->location().isEmpty() ) startString += " (" +incidence->location()+")"; setCaption( incidence->summary()+startString); enableIncidenceActions( true ); if ( incidence->type() == "Event" ) { diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 1807bc4..de2a381 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -257,36 +257,36 @@ class Incidence : public IncidenceBase /** return the event's/todo's location. Do _not_ use it with journal */ QString location() const; /** returns TRUE or FALSE depending on whether the todo has a start date */ bool hasStartDate() const; /** sets the event's hasStartDate value. */ void setHasStartDate(bool f); QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; bool cancelled() const; void setCancelled( bool b ); protected: QPtrList<Alarm> mAlarms; + QPtrList<Incidence> mRelations; private: int mRevision; bool mCancelled; // base components of jounal, event and todo QDateTime mCreated; QString mDescription; QString mSummary; QStringList mCategories; Incidence *mRelatedTo; QString mRelatedToUid; - QPtrList<Incidence> mRelations; DateList mExDates; QPtrList<Attachment> mAttachments; QStringList mResources; bool mHasStartDate; // if todo has associated start date int mSecrecy; int mPriority; // 1 = highest, 2 = less, etc. //QPtrList<Alarm> mAlarms; Recurrence *mRecurrence; QString mLocation; diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7f1de78..d81a68f 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -184,25 +184,55 @@ QString Todo::dtDueTimeStr() const return KGlobal::locale()->formatTime(mDtDue.time()); } QString Todo::dtDueDateStr(bool shortfmt) const { return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); } QString Todo::dtDueStr(bool shortfmt) const { return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); } - +// retval 0 : no found +// 1 : due for date found +// 2 : overdue for date found +int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) +{ + int retval = 0; + if ( isCompleted() ) + return 0; + if ( hasDueDate() ) { + if ( dtDue().date() < date ) + return 2; + // we do not return, because we may find an overdue sub todo + if ( dtDue().date() == date ) + retval = 1; + } + if ( checkSubtodos ) { + Incidence *aTodo; + for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { + int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); + if ( ret == 2 ) + return 2; + if ( ret == 1) + retval = 1; + } + } + return retval; +} +int Todo::hasDueSubTodo( bool checkSubtodos ) //= true +{ + return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); +} bool Todo::hasDueDate() const { return mHasDueDate; } void Todo::setHasDueDate(bool f) { if (mReadOnly) return; mHasDueDate = f; updated(); } diff --git a/libkcal/todo.h b/libkcal/todo.h index 41f5841..137b252 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h @@ -53,24 +53,36 @@ class Todo : public Incidence /** returns an event's due date as a string formatted according to the users locale settings */ QString dtDueDateStr(bool shortfmt=true) const; /** returns an event's due date and time as a string formatted according to the users locale settings */ QString dtDueStr(bool shortfmt=true) const; /** returns TRUE or FALSE depending on whether the todo has a due date */ bool hasDueDate() const; /** sets the event's hasDueDate value. */ void setHasDueDate(bool f); + /* + Looks for a subtodo (including itself ) which is not complete and is + - overdue, or + - due today. + It returns 0 for nothing found, + 1 for found a todo which is due today and no overdue found + 2 for found a overdue todo + */ + int hasDueSubTodo( bool checkSubtodos = true ); + /* same as above, but a specific date can be specified*/ + int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); + /** sets the event's status to the string specified. The string * must be a recognized value for the status field, i.e. a string * equivalent of the possible status enumerations previously described. */ // void setStatus(const QString &statStr); /** sets the event's status to the value specified. See the enumeration * above for possible values. */ // void setStatus(int); /** return the event's status. */ // int status() const; /** return the event's status in string format. */ // QString statusStr() const; |