From 86c0d35262454a31ed7d50d3e20cbdace954ebdf Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 05 Feb 2005 11:26:35 +0000 Subject: another fixx --- (limited to 'libkcal/todo.cpp') diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7f1de78..d81a68f 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -193,7 +193,37 @@ 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; -- cgit v0.9.0.2