summaryrefslogtreecommitdiffabout
path: root/libkcal/todo.cpp
Unidiff
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
195} 195}
196 196// retval 0 : no found
197// 1 : due for date found
198// 2 : overdue for date found
199int 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}
223int Todo::hasDueSubTodo( bool checkSubtodos ) //= true
224{
225 return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos );
226}
197bool Todo::hasDueDate() const 227bool Todo::hasDueDate() const