summaryrefslogtreecommitdiffabout
path: root/libkcal/todo.cpp
authorzautrix <zautrix>2005-02-05 11:26:35 (UTC)
committer zautrix <zautrix>2005-02-05 11:26:35 (UTC)
commit86c0d35262454a31ed7d50d3e20cbdace954ebdf (patch) (side-by-side diff)
tree7ded091fe9111fe20014f8edbc5f338293e36386 /libkcal/todo.cpp
parent3a822a4c4867acb28dc1b3b9557918d0971f732c (diff)
downloadkdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.zip
kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.tar.gz
kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.tar.bz2
another fixx
Diffstat (limited to 'libkcal/todo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/todo.cpp32
1 files changed, 31 insertions, 1 deletions
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