author | zautrix <zautrix> | 2005-04-17 08:24:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-17 08:24:43 (UTC) |
commit | fd67a473a94c5a3d63a89c52fb8f612cb19b5363 (patch) (unidiff) | |
tree | d5adc24b8c2662118934fb5ab7f6ac690ae21153 /libkcal/todo.cpp | |
parent | 6cf5cc7d0b12af6bdc722e469f3f5aa293016c7d (diff) | |
download | kdepimpi-fd67a473a94c5a3d63a89c52fb8f612cb19b5363.zip kdepimpi-fd67a473a94c5a3d63a89c52fb8f612cb19b5363.tar.gz kdepimpi-fd67a473a94c5a3d63a89c52fb8f612cb19b5363.tar.bz2 |
fixes
-rw-r--r-- | libkcal/todo.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 6a6c137..002d3f2 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -1,324 +1,324 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <kglobalsettings.h> | 22 | #include <kglobalsettings.h> |
23 | #include <klocale.h> | 23 | #include <klocale.h> |
24 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | #include <qfileinfo.h> | 26 | #include <qfileinfo.h> |
27 | 27 | ||
28 | #include "calendarlocal.h" | 28 | #include "calendarlocal.h" |
29 | #include "icalformat.h" | 29 | #include "icalformat.h" |
30 | #include "todo.h" | 30 | #include "todo.h" |
31 | 31 | ||
32 | using namespace KCal; | 32 | using namespace KCal; |
33 | 33 | ||
34 | Todo::Todo(): QObject(), Incidence() | 34 | Todo::Todo(): QObject(), Incidence() |
35 | { | 35 | { |
36 | // mStatus = TENTATIVE; | 36 | // mStatus = TENTATIVE; |
37 | 37 | ||
38 | mHasDueDate = false; | 38 | mHasDueDate = false; |
39 | setHasStartDate( false ); | 39 | setHasStartDate( false ); |
40 | mCompleted = getEvenTime(QDateTime::currentDateTime()); | 40 | mCompleted = getEvenTime(QDateTime::currentDateTime()); |
41 | mHasCompletedDate = false; | 41 | mHasCompletedDate = false; |
42 | mPercentComplete = 0; | 42 | mPercentComplete = 0; |
43 | mRunning = false; | 43 | mRunning = false; |
44 | mRunSaveTimer = 0; | 44 | mRunSaveTimer = 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | Todo::Todo(const Todo &t) : QObject(),Incidence(t) | 47 | Todo::Todo(const Todo &t) : QObject(),Incidence(t) |
48 | { | 48 | { |
49 | mDtDue = t.mDtDue; | 49 | mDtDue = t.mDtDue; |
50 | mHasDueDate = t.mHasDueDate; | 50 | mHasDueDate = t.mHasDueDate; |
51 | mCompleted = t.mCompleted; | 51 | mCompleted = t.mCompleted; |
52 | mHasCompletedDate = t.mHasCompletedDate; | 52 | mHasCompletedDate = t.mHasCompletedDate; |
53 | mPercentComplete = t.mPercentComplete; | 53 | mPercentComplete = t.mPercentComplete; |
54 | mRunning = false; | 54 | mRunning = false; |
55 | mRunSaveTimer = 0; | 55 | mRunSaveTimer = 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | Todo::~Todo() | 58 | Todo::~Todo() |
59 | { | 59 | { |
60 | setRunning( false ); | 60 | setRunning( false ); |
61 | //qDebug("Todo::~Todo() "); | 61 | //qDebug("Todo::~Todo() "); |
62 | } | 62 | } |
63 | 63 | ||
64 | void Todo::setRunning( bool run ) | 64 | void Todo::setRunning( bool run ) |
65 | { | 65 | { |
66 | if ( run == mRunning ) | 66 | if ( run == mRunning ) |
67 | return; | 67 | return; |
68 | //qDebug("Todo::setRunning %d ", run); | 68 | //qDebug("Todo::setRunning %d ", run); |
69 | if ( !mRunSaveTimer ) { | 69 | if ( !mRunSaveTimer ) { |
70 | mRunSaveTimer = new QTimer ( this ); | 70 | mRunSaveTimer = new QTimer ( this ); |
71 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); | 71 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); |
72 | } | 72 | } |
73 | mRunning = run; | 73 | mRunning = run; |
74 | if ( mRunning ) { | 74 | if ( mRunning ) { |
75 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min | 75 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min |
76 | mRunStart = QDateTime::currentDateTime(); | 76 | mRunStart = QDateTime::currentDateTime(); |
77 | } else { | 77 | } else { |
78 | mRunSaveTimer->stop(); | 78 | mRunSaveTimer->stop(); |
79 | saveRunningInfoToFile(); | 79 | saveRunningInfoToFile(); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | void Todo::saveRunningInfoToFile() | 83 | void Todo::saveRunningInfoToFile() |
84 | { | 84 | { |
85 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); | 85 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
86 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { | 86 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { |
87 | qDebug("Running time < 30 seconds. Skipped. "); | 87 | qDebug("Running time < 30 seconds. Skipped. "); |
88 | return; | 88 | return; |
89 | } | 89 | } |
90 | QString dir = KGlobalSettings::timeTrackerDir(); | 90 | QString dir = KGlobalSettings::timeTrackerDir(); |
91 | //qDebug("%s ", dir.latin1()); | 91 | //qDebug("%s ", dir.latin1()); |
92 | QString file = "%1%2%3-%4%5%6-"; | 92 | QString file = "%1%2%3-%4%5%6-"; |
93 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); | 93 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); |
94 | file.replace ( QRegExp (" "), "0" ); | 94 | file.replace ( QRegExp (" "), "0" ); |
95 | file += uid(); | 95 | file += uid(); |
96 | //qDebug("File %s ",file.latin1() ); | 96 | //qDebug("File %s ",file.latin1() ); |
97 | CalendarLocal cal; | 97 | CalendarLocal cal; |
98 | cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); | 98 | cal.setLocalTime(); |
99 | Todo * to = (Todo*) clone(); | 99 | Todo * to = (Todo*) clone(); |
100 | to->setFloats( false ); | 100 | to->setFloats( false ); |
101 | to->setDtStart( mRunStart ); | 101 | to->setDtStart( mRunStart ); |
102 | to->setHasStartDate( true ); | 102 | to->setHasStartDate( true ); |
103 | to->setDtDue( QDateTime::currentDateTime() ); | 103 | to->setDtDue( QDateTime::currentDateTime() ); |
104 | to->setHasDueDate( true ); | 104 | to->setHasDueDate( true ); |
105 | to->setUid( file ); | 105 | to->setUid( file ); |
106 | cal.addIncidence( to ); | 106 | cal.addIncidence( to ); |
107 | ICalFormat format; | 107 | ICalFormat format; |
108 | file = dir +"/" +file +".ics"; | 108 | file = dir +"/" +file +".ics"; |
109 | format.save( &cal, file ); | 109 | format.save( &cal, file ); |
110 | saveParents(); | 110 | saveParents(); |
111 | 111 | ||
112 | } | 112 | } |
113 | void Todo::saveParents() | 113 | void Todo::saveParents() |
114 | { | 114 | { |
115 | if (!relatedTo() ) | 115 | if (!relatedTo() ) |
116 | return; | 116 | return; |
117 | Incidence * inc = relatedTo(); | 117 | Incidence * inc = relatedTo(); |
118 | if ( inc->type() != "Todo" ) | 118 | if ( inc->type() != "Todo" ) |
119 | return; | 119 | return; |
120 | Todo* to = (Todo*)inc; | 120 | Todo* to = (Todo*)inc; |
121 | bool saveTodo = false; | 121 | bool saveTodo = false; |
122 | QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; | 122 | QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; |
123 | QFileInfo fi ( file ); | 123 | QFileInfo fi ( file ); |
124 | if ( fi.exists() ) { | 124 | if ( fi.exists() ) { |
125 | if ( fi.lastModified () < to->lastModified ()) | 125 | if ( fi.lastModified () < to->lastModified ()) |
126 | saveTodo = true; | 126 | saveTodo = true; |
127 | } else { | 127 | } else { |
128 | saveTodo = true; | 128 | saveTodo = true; |
129 | } | 129 | } |
130 | if ( saveTodo ) { | 130 | if ( saveTodo ) { |
131 | CalendarLocal cal; | 131 | CalendarLocal cal; |
132 | cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); | 132 | cal.setLocalTime(); |
133 | Todo * par = (Todo *) to->clone(); | 133 | Todo * par = (Todo *) to->clone(); |
134 | cal.addIncidence( par ); | 134 | cal.addIncidence( par ); |
135 | ICalFormat format; | 135 | ICalFormat format; |
136 | format.save( &cal, file ); | 136 | format.save( &cal, file ); |
137 | } | 137 | } |
138 | to->saveParents(); | 138 | to->saveParents(); |
139 | } | 139 | } |
140 | 140 | ||
141 | int Todo::runTime() | 141 | int Todo::runTime() |
142 | { | 142 | { |
143 | if ( !mRunning ) | 143 | if ( !mRunning ) |
144 | return 0; | 144 | return 0; |
145 | return mRunStart.secsTo( QDateTime::currentDateTime() ); | 145 | return mRunStart.secsTo( QDateTime::currentDateTime() ); |
146 | } | 146 | } |
147 | bool Todo::hasRunningSub() | 147 | bool Todo::hasRunningSub() |
148 | { | 148 | { |
149 | if ( mRunning ) | 149 | if ( mRunning ) |
150 | return true; | 150 | return true; |
151 | Incidence *aTodo; | 151 | Incidence *aTodo; |
152 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 152 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
153 | if ( ((Todo*)aTodo)->hasRunningSub() ) | 153 | if ( ((Todo*)aTodo)->hasRunningSub() ) |
154 | return true; | 154 | return true; |
155 | } | 155 | } |
156 | return false; | 156 | return false; |
157 | } | 157 | } |
158 | Incidence *Todo::clone() | 158 | Incidence *Todo::clone() |
159 | { | 159 | { |
160 | return new Todo(*this); | 160 | return new Todo(*this); |
161 | } | 161 | } |
162 | 162 | ||
163 | bool Todo::contains ( Todo* from ) | 163 | bool Todo::contains ( Todo* from ) |
164 | { | 164 | { |
165 | 165 | ||
166 | if ( !from->summary().isEmpty() ) | 166 | if ( !from->summary().isEmpty() ) |
167 | if ( !summary().startsWith( from->summary() )) | 167 | if ( !summary().startsWith( from->summary() )) |
168 | return false; | 168 | return false; |
169 | if ( from->hasStartDate() ) { | 169 | if ( from->hasStartDate() ) { |
170 | if ( !hasStartDate() ) | 170 | if ( !hasStartDate() ) |
171 | return false; | 171 | return false; |
172 | if ( from->dtStart() != dtStart()) | 172 | if ( from->dtStart() != dtStart()) |
173 | return false; | 173 | return false; |
174 | } | 174 | } |
175 | if ( from->hasDueDate() ){ | 175 | if ( from->hasDueDate() ){ |
176 | if ( !hasDueDate() ) | 176 | if ( !hasDueDate() ) |
177 | return false; | 177 | return false; |
178 | if ( from->dtDue() != dtDue()) | 178 | if ( from->dtDue() != dtDue()) |
179 | return false; | 179 | return false; |
180 | } | 180 | } |
181 | if ( !from->location().isEmpty() ) | 181 | if ( !from->location().isEmpty() ) |
182 | if ( !location().startsWith( from->location() ) ) | 182 | if ( !location().startsWith( from->location() ) ) |
183 | return false; | 183 | return false; |
184 | if ( !from->description().isEmpty() ) | 184 | if ( !from->description().isEmpty() ) |
185 | if ( !description().startsWith( from->description() )) | 185 | if ( !description().startsWith( from->description() )) |
186 | return false; | 186 | return false; |
187 | if ( from->alarms().count() ) { | 187 | if ( from->alarms().count() ) { |
188 | Alarm *a = from->alarms().first(); | 188 | Alarm *a = from->alarms().first(); |
189 | if ( a->enabled() ){ | 189 | if ( a->enabled() ){ |
190 | if ( !alarms().count() ) | 190 | if ( !alarms().count() ) |
191 | return false; | 191 | return false; |
192 | Alarm *b = alarms().first(); | 192 | Alarm *b = alarms().first(); |
193 | if( ! b->enabled() ) | 193 | if( ! b->enabled() ) |
194 | return false; | 194 | return false; |
195 | if ( ! (a->offset() == b->offset() )) | 195 | if ( ! (a->offset() == b->offset() )) |
196 | return false; | 196 | return false; |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | QStringList cat = categories(); | 200 | QStringList cat = categories(); |
201 | QStringList catFrom = from->categories(); | 201 | QStringList catFrom = from->categories(); |
202 | QString nCat; | 202 | QString nCat; |
203 | unsigned int iii; | 203 | unsigned int iii; |
204 | for ( iii = 0; iii < catFrom.count();++iii ) { | 204 | for ( iii = 0; iii < catFrom.count();++iii ) { |
205 | nCat = catFrom[iii]; | 205 | nCat = catFrom[iii]; |
206 | if ( !nCat.isEmpty() ) | 206 | if ( !nCat.isEmpty() ) |
207 | if ( !cat.contains( nCat )) { | 207 | if ( !cat.contains( nCat )) { |
208 | return false; | 208 | return false; |
209 | } | 209 | } |
210 | } | 210 | } |
211 | if ( from->isCompleted() ) { | 211 | if ( from->isCompleted() ) { |
212 | if ( !isCompleted() ) | 212 | if ( !isCompleted() ) |
213 | return false; | 213 | return false; |
214 | } | 214 | } |
215 | if( priority() != from->priority() ) | 215 | if( priority() != from->priority() ) |
216 | return false; | 216 | return false; |
217 | 217 | ||
218 | 218 | ||
219 | return true; | 219 | return true; |
220 | 220 | ||
221 | } | 221 | } |
222 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) | 222 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) |
223 | { | 223 | { |
224 | 224 | ||
225 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); | 225 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); |
226 | if ( ! ret ) | 226 | if ( ! ret ) |
227 | return false; | 227 | return false; |
228 | if ( t1.hasDueDate() == t2.hasDueDate() ) { | 228 | if ( t1.hasDueDate() == t2.hasDueDate() ) { |
229 | if ( t1.hasDueDate() ) { | 229 | if ( t1.hasDueDate() ) { |
230 | if ( t1.doesFloat() == t2.doesFloat() ) { | 230 | if ( t1.doesFloat() == t2.doesFloat() ) { |
231 | if ( t1.doesFloat() ) { | 231 | if ( t1.doesFloat() ) { |
232 | if ( t1.dtDue().date() != t2.dtDue().date() ) | 232 | if ( t1.dtDue().date() != t2.dtDue().date() ) |
233 | return false; | 233 | return false; |
234 | } else | 234 | } else |
235 | if ( t1.dtDue() != t2.dtDue() ) | 235 | if ( t1.dtDue() != t2.dtDue() ) |
236 | return false; | 236 | return false; |
237 | } else | 237 | } else |
238 | return false;// float != | 238 | return false;// float != |
239 | } | 239 | } |
240 | 240 | ||
241 | } else | 241 | } else |
242 | return false; | 242 | return false; |
243 | if ( t1.percentComplete() != t2.percentComplete() ) | 243 | if ( t1.percentComplete() != t2.percentComplete() ) |
244 | return false; | 244 | return false; |
245 | if ( t1.isCompleted() ) { | 245 | if ( t1.isCompleted() ) { |
246 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { | 246 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { |
247 | if ( t1.hasCompletedDate() ) { | 247 | if ( t1.hasCompletedDate() ) { |
248 | if ( t1.completed() != t2.completed() ) | 248 | if ( t1.completed() != t2.completed() ) |
249 | return false; | 249 | return false; |
250 | } | 250 | } |
251 | 251 | ||
252 | } else | 252 | } else |
253 | return false; | 253 | return false; |
254 | } | 254 | } |
255 | return true; | 255 | return true; |
256 | 256 | ||
257 | } | 257 | } |
258 | 258 | ||
259 | void Todo::setDtDue(const QDateTime &dtDue) | 259 | void Todo::setDtDue(const QDateTime &dtDue) |
260 | { | 260 | { |
261 | //int diffsecs = mDtDue.secsTo(dtDue); | 261 | //int diffsecs = mDtDue.secsTo(dtDue); |
262 | 262 | ||
263 | /*if (mReadOnly) return; | 263 | /*if (mReadOnly) return; |
264 | const QPtrList<Alarm>& alarms = alarms(); | 264 | const QPtrList<Alarm>& alarms = alarms(); |
265 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { | 265 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { |
266 | if (alarm->enabled()) { | 266 | if (alarm->enabled()) { |
267 | alarm->setTime(alarm->time().addSecs(diffsecs)); | 267 | alarm->setTime(alarm->time().addSecs(diffsecs)); |
268 | } | 268 | } |
269 | }*/ | 269 | }*/ |
270 | mDtDue = getEvenTime(dtDue); | 270 | mDtDue = getEvenTime(dtDue); |
271 | 271 | ||
272 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; | 272 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; |
273 | 273 | ||
274 | /*const QPtrList<Alarm>& alarms = alarms(); | 274 | /*const QPtrList<Alarm>& alarms = alarms(); |
275 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) | 275 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) |
276 | alarm->setAlarmStart(mDtDue);*/ | 276 | alarm->setAlarmStart(mDtDue);*/ |
277 | updated(); | 277 | updated(); |
278 | } | 278 | } |
279 | 279 | ||
280 | QDateTime Todo::dtDue() const | 280 | QDateTime Todo::dtDue() const |
281 | { | 281 | { |
282 | return mDtDue; | 282 | return mDtDue; |
283 | } | 283 | } |
284 | 284 | ||
285 | QString Todo::dtDueTimeStr() const | 285 | QString Todo::dtDueTimeStr() const |
286 | { | 286 | { |
287 | return KGlobal::locale()->formatTime(mDtDue.time()); | 287 | return KGlobal::locale()->formatTime(mDtDue.time()); |
288 | } | 288 | } |
289 | 289 | ||
290 | QString Todo::dtDueDateStr(bool shortfmt) const | 290 | QString Todo::dtDueDateStr(bool shortfmt) const |
291 | { | 291 | { |
292 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | 292 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); |
293 | } | 293 | } |
294 | 294 | ||
295 | QString Todo::dtDueStr(bool shortfmt) const | 295 | QString Todo::dtDueStr(bool shortfmt) const |
296 | { | 296 | { |
297 | if ( doesFloat() ) | 297 | if ( doesFloat() ) |
298 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | 298 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); |
299 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); | 299 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); |
300 | } | 300 | } |
301 | // retval 0 : no found | 301 | // retval 0 : no found |
302 | // 1 : due for date found | 302 | // 1 : due for date found |
303 | // 2 : overdue for date found | 303 | // 2 : overdue for date found |
304 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) | 304 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) |
305 | { | 305 | { |
306 | int retval = 0; | 306 | int retval = 0; |
307 | if ( isCompleted() ) | 307 | if ( isCompleted() ) |
308 | return 0; | 308 | return 0; |
309 | if ( hasDueDate() ) { | 309 | if ( hasDueDate() ) { |
310 | if ( dtDue().date() < date ) | 310 | if ( dtDue().date() < date ) |
311 | return 2; | 311 | return 2; |
312 | // we do not return, because we may find an overdue sub todo | 312 | // we do not return, because we may find an overdue sub todo |
313 | if ( dtDue().date() == date ) | 313 | if ( dtDue().date() == date ) |
314 | retval = 1; | 314 | retval = 1; |
315 | } | 315 | } |
316 | if ( checkSubtodos ) { | 316 | if ( checkSubtodos ) { |
317 | Incidence *aTodo; | 317 | Incidence *aTodo; |
318 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 318 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
319 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); | 319 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); |
320 | if ( ret == 2 ) | 320 | if ( ret == 2 ) |
321 | return 2; | 321 | return 2; |
322 | if ( ret == 1) | 322 | if ( ret == 1) |
323 | retval = 1; | 323 | retval = 1; |
324 | } | 324 | } |