-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 | |||
@@ -18,5 +18,7 @@ Scroll in cell with coursor keys, scroll in time (next week) with | |||
18 | Shift/Control + coursorkeys. | 18 | Shift/Control + coursorkeys. |
19 | 19 | ||
20 | Fixeg bug that the todo view flat mode was reset after first view update. | 20 | Fixed bug that the todo view flat mode was reset after first view update. |
21 | |||
22 | 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. | ||
21 | 23 | ||
22 | ********** VERSION 2.0.2 ************ | 24 | ********** VERSION 2.0.2 ************ |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 31c5659..cb519b2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1203,5 +1203,5 @@ void KOMonthView::updateView() | |||
1203 | invalid = true; | 1203 | invalid = true; |
1204 | //qDebug("invalid %s", event->summary().latin1()); | 1204 | //qDebug("invalid %s", event->summary().latin1()); |
1205 | incidenceStart = QDateTime( mStartDate ); | 1205 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1206 | } | 1206 | } |
1207 | if ( last ) | 1207 | if ( last ) |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 6bdee18..78d4027 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -329,19 +329,15 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
329 | } else | 329 | } else |
330 | setColor = false; | 330 | setColor = false; |
331 | } | 331 | } |
332 | if (mTodo->hasDueDate()) { | 332 | |
333 | if (mTodo->dtDue().date()==QDate::currentDate() && | 333 | int odue = mTodo->hasDueSubTodo( !isOpen()); |
334 | !mTodo->isCompleted()) { | 334 | if (odue == 2) { |
335 | //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor); | 335 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
336 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 336 | setColor = true; |
337 | setColor = true; | 337 | } else if ( odue == 1 ) { |
338 | } | 338 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
339 | if (mTodo->dtDue().date() < QDate::currentDate() && | 339 | setColor = true; |
340 | !mTodo->isCompleted()) { | 340 | } |
341 | //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); | 341 | |
342 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | ||
343 | setColor = true; | ||
344 | } | ||
345 | } | ||
346 | 342 | ||
347 | if ( setColor ) { | 343 | if ( setColor ) { |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a2c20a8..5bc8c00 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1347,5 +1347,14 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) | |||
1347 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1347 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1348 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1348 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1349 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1349 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1350 | bool ok; | ||
1351 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | ||
1352 | if ( ok ) { | ||
1353 | int years = noc.date().year() - incidence->dtStart().date().year(); | ||
1354 | startString += i18n(" (%1 y.)"). arg( years ); | ||
1355 | } | ||
1356 | } | ||
1357 | else | ||
1358 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | ||
1350 | } | 1359 | } |
1351 | 1360 | ||
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 1807bc4..de2a381 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -267,4 +267,5 @@ class Incidence : public IncidenceBase | |||
267 | protected: | 267 | protected: |
268 | QPtrList<Alarm> mAlarms; | 268 | QPtrList<Alarm> mAlarms; |
269 | QPtrList<Incidence> mRelations; | ||
269 | private: | 270 | private: |
270 | int mRevision; | 271 | int mRevision; |
@@ -278,5 +279,4 @@ protected: | |||
278 | Incidence *mRelatedTo; | 279 | Incidence *mRelatedTo; |
279 | QString mRelatedToUid; | 280 | QString mRelatedToUid; |
280 | QPtrList<Incidence> mRelations; | ||
281 | DateList mExDates; | 281 | DateList mExDates; |
282 | QPtrList<Attachment> mAttachments; | 282 | QPtrList<Attachment> mAttachments; |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7f1de78..d81a68f 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -194,5 +194,35 @@ QString Todo::dtDueStr(bool shortfmt) const | |||
194 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); | 194 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); |
195 | } | 195 | } |
196 | 196 | // retval 0 : no found | |
197 | // 1 : due for date found | ||
198 | // 2 : overdue for date found | ||
199 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) | ||
200 | { | ||
201 | int retval = 0; | ||
202 | if ( isCompleted() ) | ||
203 | return 0; | ||
204 | if ( hasDueDate() ) { | ||
205 | if ( dtDue().date() < date ) | ||
206 | return 2; | ||
207 | // we do not return, because we may find an overdue sub todo | ||
208 | if ( dtDue().date() == date ) | ||
209 | retval = 1; | ||
210 | } | ||
211 | if ( checkSubtodos ) { | ||
212 | Incidence *aTodo; | ||
213 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | ||
214 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); | ||
215 | if ( ret == 2 ) | ||
216 | return 2; | ||
217 | if ( ret == 1) | ||
218 | retval = 1; | ||
219 | } | ||
220 | } | ||
221 | return retval; | ||
222 | } | ||
223 | int Todo::hasDueSubTodo( bool checkSubtodos ) //= true | ||
224 | { | ||
225 | return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); | ||
226 | } | ||
197 | bool Todo::hasDueDate() const | 227 | bool Todo::hasDueDate() const |
198 | { | 228 | { |
diff --git a/libkcal/todo.h b/libkcal/todo.h index 41f5841..137b252 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -63,4 +63,16 @@ class Todo : public Incidence | |||
63 | void setHasDueDate(bool f); | 63 | void setHasDueDate(bool f); |
64 | 64 | ||
65 | /* | ||
66 | Looks for a subtodo (including itself ) which is not complete and is | ||
67 | - overdue, or | ||
68 | - due today. | ||
69 | It returns 0 for nothing found, | ||
70 | 1 for found a todo which is due today and no overdue found | ||
71 | 2 for found a overdue todo | ||
72 | */ | ||
73 | int hasDueSubTodo( bool checkSubtodos = true ); | ||
74 | /* same as above, but a specific date can be specified*/ | ||
75 | int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); | ||
76 | |||
65 | 77 | ||
66 | /** sets the event's status to the string specified. The string | 78 | /** sets the event's status to the string specified. The string |