summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-02-05 11:26:35 (UTC)
committer zautrix <zautrix>2005-02-05 11:26:35 (UTC)
commit86c0d35262454a31ed7d50d3e20cbdace954ebdf (patch) (unidiff)
tree7ded091fe9111fe20014f8edbc5f338293e36386 /libkcal
parent3a822a4c4867acb28dc1b3b9557918d0971f732c (diff)
downloadkdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.zip
kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.tar.gz
kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.tar.bz2
another fixx
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/todo.cpp32
-rw-r--r--libkcal/todo.h12
3 files changed, 44 insertions, 2 deletions
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 1807bc4..de2a381 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -266,6 +266,7 @@ class Incidence : public IncidenceBase
266 266
267protected: 267protected:
268 QPtrList<Alarm> mAlarms; 268 QPtrList<Alarm> mAlarms;
269 QPtrList<Incidence> mRelations;
269 private: 270 private:
270 int mRevision; 271 int mRevision;
271 bool mCancelled; 272 bool mCancelled;
@@ -277,7 +278,6 @@ protected:
277 QStringList mCategories; 278 QStringList mCategories;
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;
283 QStringList mResources; 283 QStringList mResources;
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
193{ 193{
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
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
198{ 228{
199 return mHasDueDate; 229 return mHasDueDate;
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 41f5841..137b252 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -62,6 +62,18 @@ class Todo : public Incidence
62 /** sets the event's hasDueDate value. */ 62 /** sets the event's hasDueDate value. */
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
67 * must be a recognized value for the status field, i.e. a string 79 * must be a recognized value for the status field, i.e. a string