summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--korganizer/komonthview.cpp2
-rw-r--r--korganizer/kotodoviewitem.cpp18
-rw-r--r--korganizer/mainwindow.cpp9
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/todo.cpp32
-rw-r--r--libkcal/todo.h12
7 files changed, 64 insertions, 15 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
@@ -19,3 +19,5 @@ 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.
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 31c5659..cb519b2 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1204,3 +1204,3 @@ void KOMonthView::updateView()
//qDebug("invalid %s", event->summary().latin1());
- incidenceStart = QDateTime( mStartDate );
+ incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
}
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 6bdee18..78d4027 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -331,16 +331,12 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
}
- 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);
+
+ int odue = mTodo->hasDueSubTodo( !isOpen());
+ if (odue == 2) {
colorToSet = KOPrefs::instance()->mTodoOverdueColor;
setColor = true;
+ } else if ( odue == 1 ) {
+ colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
+ setColor = true;
}
- }
+
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index a2c20a8..5bc8c00 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1348,2 +1348,11 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
"-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
+ 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);
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 1807bc4..de2a381 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -268,2 +268,3 @@ protected:
QPtrList<Alarm> mAlarms;
+ QPtrList<Incidence> mRelations;
private:
@@ -279,3 +280,2 @@ protected:
QString mRelatedToUid;
- QPtrList<Incidence> mRelations;
DateList mExDates;
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7f1de78..d81a68f 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -195,3 +195,33 @@ QString Todo::dtDueStr(bool shortfmt) const
}
-
+// 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
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 41f5841..137b252 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -64,2 +64,14 @@ class Todo : public Incidence
+ /*
+ 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 );
+