author | zautrix <zautrix> | 2005-04-09 20:54:29 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-09 20:54:29 (UTC) |
commit | ae58b2fe29fcd8b3690dcbb6d64976674f6294e0 (patch) (unidiff) | |
tree | 7a321b610fa1f7cab980370a44bf78fea88bf481 /libkcal | |
parent | 9e43ebbe5867b2da957bb17c35bd357715424cba (diff) | |
download | kdepimpi-ae58b2fe29fcd8b3690dcbb6d64976674f6294e0.zip kdepimpi-ae58b2fe29fcd8b3690dcbb6d64976674f6294e0.tar.gz kdepimpi-ae58b2fe29fcd8b3690dcbb6d64976674f6294e0.tar.bz2 |
cool
-rw-r--r-- | libkcal/todo.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7dee4cd..c008fe1 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -1,334 +1,348 @@ | |||
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 <klocale.h> | 23 | #include <klocale.h> |
23 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <qregexp.h> | ||
24 | 26 | ||
25 | #include "todo.h" | 27 | #include "todo.h" |
26 | 28 | ||
27 | using namespace KCal; | 29 | using namespace KCal; |
28 | 30 | ||
29 | Todo::Todo(): Incidence() | 31 | Todo::Todo(): Incidence() |
30 | { | 32 | { |
31 | // mStatus = TENTATIVE; | 33 | // mStatus = TENTATIVE; |
32 | 34 | ||
33 | mHasDueDate = false; | 35 | mHasDueDate = false; |
34 | setHasStartDate( false ); | 36 | setHasStartDate( false ); |
35 | mCompleted = getEvenTime(QDateTime::currentDateTime()); | 37 | mCompleted = getEvenTime(QDateTime::currentDateTime()); |
36 | mHasCompletedDate = false; | 38 | mHasCompletedDate = false; |
37 | mPercentComplete = 0; | 39 | mPercentComplete = 0; |
38 | mRunning = false; | 40 | mRunning = false; |
39 | mRunSaveTimer = 0; | 41 | mRunSaveTimer = 0; |
40 | } | 42 | } |
41 | 43 | ||
42 | Todo::Todo(const Todo &t) : Incidence(t) | 44 | Todo::Todo(const Todo &t) : Incidence(t) |
43 | { | 45 | { |
44 | mDtDue = t.mDtDue; | 46 | mDtDue = t.mDtDue; |
45 | mHasDueDate = t.mHasDueDate; | 47 | mHasDueDate = t.mHasDueDate; |
46 | mCompleted = t.mCompleted; | 48 | mCompleted = t.mCompleted; |
47 | mHasCompletedDate = t.mHasCompletedDate; | 49 | mHasCompletedDate = t.mHasCompletedDate; |
48 | mPercentComplete = t.mPercentComplete; | 50 | mPercentComplete = t.mPercentComplete; |
49 | mRunning = false; | 51 | mRunning = false; |
50 | mRunSaveTimer = 0; | 52 | mRunSaveTimer = 0; |
51 | } | 53 | } |
52 | 54 | ||
53 | Todo::~Todo() | 55 | Todo::~Todo() |
54 | { | 56 | { |
55 | setRunning( false ); | 57 | setRunning( false ); |
56 | } | 58 | } |
57 | 59 | ||
58 | void Todo::setRunning( bool run ) | 60 | void Todo::setRunning( bool run ) |
59 | { | 61 | { |
60 | if ( run == mRunning ) | 62 | if ( run == mRunning ) |
61 | return; | 63 | return; |
62 | if ( !mRunSaveTimer ) { | 64 | if ( !mRunSaveTimer ) { |
63 | mRunSaveTimer = new QTimer ( this ); | 65 | mRunSaveTimer = new QTimer ( this ); |
64 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); | 66 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); |
65 | } | 67 | } |
66 | mRunning = run; | 68 | mRunning = run; |
67 | if ( mRunning ) { | 69 | if ( mRunning ) { |
68 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min | 70 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min |
69 | mRunStart = QDateTime::currentDateTime(); | 71 | mRunStart = QDateTime::currentDateTime(); |
70 | } else { | 72 | } else { |
71 | mRunSaveTimer->stop(); | 73 | mRunSaveTimer->stop(); |
72 | saveRunningInfoToFile(); | 74 | saveRunningInfoToFile(); |
73 | } | 75 | } |
74 | } | 76 | } |
75 | 77 | ||
76 | void Todo::saveRunningInfoToFile() | 78 | void Todo::saveRunningInfoToFile() |
77 | { | 79 | { |
78 | qDebug("Todo::saveRunningInfoToFile() "); | 80 | qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
81 | |||
82 | QString dir = KGlobalSettings::timeTrackerDir(); | ||
83 | qDebug("%s ", dir.latin1()); | ||
84 | QString file = "%1-%2-%3-%4-%5-%6-%7.tt"; | ||
85 | |||
86 | 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 ).arg( mRunStart.time().msec(), 3 ); | ||
87 | file.replace ( QRegExp (" "), "0" ); | ||
88 | file = dir +"/" +file; | ||
89 | qDebug("%s ", file.latin1()); | ||
90 | |||
91 | |||
92 | |||
79 | } | 93 | } |
80 | 94 | ||
81 | int Todo::runTime() | 95 | int Todo::runTime() |
82 | { | 96 | { |
83 | if ( !mRunning ) | 97 | if ( !mRunning ) |
84 | return 0; | 98 | return 0; |
85 | return mRunStart.secsTo( QDateTime::currentDateTime() ); | 99 | return mRunStart.secsTo( QDateTime::currentDateTime() ); |
86 | } | 100 | } |
87 | bool Todo::hasRunningSub() | 101 | bool Todo::hasRunningSub() |
88 | { | 102 | { |
89 | if ( mRunning ) | 103 | if ( mRunning ) |
90 | return true; | 104 | return true; |
91 | Incidence *aTodo; | 105 | Incidence *aTodo; |
92 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 106 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
93 | if ( ((Todo*)aTodo)->hasRunningSub() ) | 107 | if ( ((Todo*)aTodo)->hasRunningSub() ) |
94 | return true; | 108 | return true; |
95 | } | 109 | } |
96 | return false; | 110 | return false; |
97 | } | 111 | } |
98 | Incidence *Todo::clone() | 112 | Incidence *Todo::clone() |
99 | { | 113 | { |
100 | return new Todo(*this); | 114 | return new Todo(*this); |
101 | } | 115 | } |
102 | 116 | ||
103 | bool Todo::contains ( Todo* from ) | 117 | bool Todo::contains ( Todo* from ) |
104 | { | 118 | { |
105 | 119 | ||
106 | if ( !from->summary().isEmpty() ) | 120 | if ( !from->summary().isEmpty() ) |
107 | if ( !summary().startsWith( from->summary() )) | 121 | if ( !summary().startsWith( from->summary() )) |
108 | return false; | 122 | return false; |
109 | if ( from->hasStartDate() ) { | 123 | if ( from->hasStartDate() ) { |
110 | if ( !hasStartDate() ) | 124 | if ( !hasStartDate() ) |
111 | return false; | 125 | return false; |
112 | if ( from->dtStart() != dtStart()) | 126 | if ( from->dtStart() != dtStart()) |
113 | return false; | 127 | return false; |
114 | } | 128 | } |
115 | if ( from->hasDueDate() ){ | 129 | if ( from->hasDueDate() ){ |
116 | if ( !hasDueDate() ) | 130 | if ( !hasDueDate() ) |
117 | return false; | 131 | return false; |
118 | if ( from->dtDue() != dtDue()) | 132 | if ( from->dtDue() != dtDue()) |
119 | return false; | 133 | return false; |
120 | } | 134 | } |
121 | if ( !from->location().isEmpty() ) | 135 | if ( !from->location().isEmpty() ) |
122 | if ( !location().startsWith( from->location() ) ) | 136 | if ( !location().startsWith( from->location() ) ) |
123 | return false; | 137 | return false; |
124 | if ( !from->description().isEmpty() ) | 138 | if ( !from->description().isEmpty() ) |
125 | if ( !description().startsWith( from->description() )) | 139 | if ( !description().startsWith( from->description() )) |
126 | return false; | 140 | return false; |
127 | if ( from->alarms().count() ) { | 141 | if ( from->alarms().count() ) { |
128 | Alarm *a = from->alarms().first(); | 142 | Alarm *a = from->alarms().first(); |
129 | if ( a->enabled() ){ | 143 | if ( a->enabled() ){ |
130 | if ( !alarms().count() ) | 144 | if ( !alarms().count() ) |
131 | return false; | 145 | return false; |
132 | Alarm *b = alarms().first(); | 146 | Alarm *b = alarms().first(); |
133 | if( ! b->enabled() ) | 147 | if( ! b->enabled() ) |
134 | return false; | 148 | return false; |
135 | if ( ! (a->offset() == b->offset() )) | 149 | if ( ! (a->offset() == b->offset() )) |
136 | return false; | 150 | return false; |
137 | } | 151 | } |
138 | } | 152 | } |
139 | 153 | ||
140 | QStringList cat = categories(); | 154 | QStringList cat = categories(); |
141 | QStringList catFrom = from->categories(); | 155 | QStringList catFrom = from->categories(); |
142 | QString nCat; | 156 | QString nCat; |
143 | unsigned int iii; | 157 | unsigned int iii; |
144 | for ( iii = 0; iii < catFrom.count();++iii ) { | 158 | for ( iii = 0; iii < catFrom.count();++iii ) { |
145 | nCat = catFrom[iii]; | 159 | nCat = catFrom[iii]; |
146 | if ( !nCat.isEmpty() ) | 160 | if ( !nCat.isEmpty() ) |
147 | if ( !cat.contains( nCat )) { | 161 | if ( !cat.contains( nCat )) { |
148 | return false; | 162 | return false; |
149 | } | 163 | } |
150 | } | 164 | } |
151 | if ( from->isCompleted() ) { | 165 | if ( from->isCompleted() ) { |
152 | if ( !isCompleted() ) | 166 | if ( !isCompleted() ) |
153 | return false; | 167 | return false; |
154 | } | 168 | } |
155 | if( priority() != from->priority() ) | 169 | if( priority() != from->priority() ) |
156 | return false; | 170 | return false; |
157 | 171 | ||
158 | 172 | ||
159 | return true; | 173 | return true; |
160 | 174 | ||
161 | } | 175 | } |
162 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) | 176 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) |
163 | { | 177 | { |
164 | 178 | ||
165 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); | 179 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); |
166 | if ( ! ret ) | 180 | if ( ! ret ) |
167 | return false; | 181 | return false; |
168 | if ( t1.hasDueDate() == t2.hasDueDate() ) { | 182 | if ( t1.hasDueDate() == t2.hasDueDate() ) { |
169 | if ( t1.hasDueDate() ) { | 183 | if ( t1.hasDueDate() ) { |
170 | if ( t1.doesFloat() == t2.doesFloat() ) { | 184 | if ( t1.doesFloat() == t2.doesFloat() ) { |
171 | if ( t1.doesFloat() ) { | 185 | if ( t1.doesFloat() ) { |
172 | if ( t1.dtDue().date() != t2.dtDue().date() ) | 186 | if ( t1.dtDue().date() != t2.dtDue().date() ) |
173 | return false; | 187 | return false; |
174 | } else | 188 | } else |
175 | if ( t1.dtDue() != t2.dtDue() ) | 189 | if ( t1.dtDue() != t2.dtDue() ) |
176 | return false; | 190 | return false; |
177 | } else | 191 | } else |
178 | return false;// float != | 192 | return false;// float != |
179 | } | 193 | } |
180 | 194 | ||
181 | } else | 195 | } else |
182 | return false; | 196 | return false; |
183 | if ( t1.percentComplete() != t2.percentComplete() ) | 197 | if ( t1.percentComplete() != t2.percentComplete() ) |
184 | return false; | 198 | return false; |
185 | if ( t1.isCompleted() ) { | 199 | if ( t1.isCompleted() ) { |
186 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { | 200 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { |
187 | if ( t1.hasCompletedDate() ) { | 201 | if ( t1.hasCompletedDate() ) { |
188 | if ( t1.completed() != t2.completed() ) | 202 | if ( t1.completed() != t2.completed() ) |
189 | return false; | 203 | return false; |
190 | } | 204 | } |
191 | 205 | ||
192 | } else | 206 | } else |
193 | return false; | 207 | return false; |
194 | } | 208 | } |
195 | return true; | 209 | return true; |
196 | 210 | ||
197 | } | 211 | } |
198 | 212 | ||
199 | void Todo::setDtDue(const QDateTime &dtDue) | 213 | void Todo::setDtDue(const QDateTime &dtDue) |
200 | { | 214 | { |
201 | //int diffsecs = mDtDue.secsTo(dtDue); | 215 | //int diffsecs = mDtDue.secsTo(dtDue); |
202 | 216 | ||
203 | /*if (mReadOnly) return; | 217 | /*if (mReadOnly) return; |
204 | const QPtrList<Alarm>& alarms = alarms(); | 218 | const QPtrList<Alarm>& alarms = alarms(); |
205 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { | 219 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { |
206 | if (alarm->enabled()) { | 220 | if (alarm->enabled()) { |
207 | alarm->setTime(alarm->time().addSecs(diffsecs)); | 221 | alarm->setTime(alarm->time().addSecs(diffsecs)); |
208 | } | 222 | } |
209 | }*/ | 223 | }*/ |
210 | mDtDue = getEvenTime(dtDue); | 224 | mDtDue = getEvenTime(dtDue); |
211 | 225 | ||
212 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; | 226 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; |
213 | 227 | ||
214 | /*const QPtrList<Alarm>& alarms = alarms(); | 228 | /*const QPtrList<Alarm>& alarms = alarms(); |
215 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) | 229 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) |
216 | alarm->setAlarmStart(mDtDue);*/ | 230 | alarm->setAlarmStart(mDtDue);*/ |
217 | 231 | ||
218 | updated(); | 232 | updated(); |
219 | } | 233 | } |
220 | 234 | ||
221 | QDateTime Todo::dtDue() const | 235 | QDateTime Todo::dtDue() const |
222 | { | 236 | { |
223 | return mDtDue; | 237 | return mDtDue; |
224 | } | 238 | } |
225 | 239 | ||
226 | QString Todo::dtDueTimeStr() const | 240 | QString Todo::dtDueTimeStr() const |
227 | { | 241 | { |
228 | return KGlobal::locale()->formatTime(mDtDue.time()); | 242 | return KGlobal::locale()->formatTime(mDtDue.time()); |
229 | } | 243 | } |
230 | 244 | ||
231 | QString Todo::dtDueDateStr(bool shortfmt) const | 245 | QString Todo::dtDueDateStr(bool shortfmt) const |
232 | { | 246 | { |
233 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | 247 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); |
234 | } | 248 | } |
235 | 249 | ||
236 | QString Todo::dtDueStr(bool shortfmt) const | 250 | QString Todo::dtDueStr(bool shortfmt) const |
237 | { | 251 | { |
238 | if ( doesFloat() ) | 252 | if ( doesFloat() ) |
239 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | 253 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); |
240 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); | 254 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); |
241 | } | 255 | } |
242 | // retval 0 : no found | 256 | // retval 0 : no found |
243 | // 1 : due for date found | 257 | // 1 : due for date found |
244 | // 2 : overdue for date found | 258 | // 2 : overdue for date found |
245 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) | 259 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) |
246 | { | 260 | { |
247 | int retval = 0; | 261 | int retval = 0; |
248 | if ( isCompleted() ) | 262 | if ( isCompleted() ) |
249 | return 0; | 263 | return 0; |
250 | if ( hasDueDate() ) { | 264 | if ( hasDueDate() ) { |
251 | if ( dtDue().date() < date ) | 265 | if ( dtDue().date() < date ) |
252 | return 2; | 266 | return 2; |
253 | // we do not return, because we may find an overdue sub todo | 267 | // we do not return, because we may find an overdue sub todo |
254 | if ( dtDue().date() == date ) | 268 | if ( dtDue().date() == date ) |
255 | retval = 1; | 269 | retval = 1; |
256 | } | 270 | } |
257 | if ( checkSubtodos ) { | 271 | if ( checkSubtodos ) { |
258 | Incidence *aTodo; | 272 | Incidence *aTodo; |
259 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 273 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
260 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); | 274 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); |
261 | if ( ret == 2 ) | 275 | if ( ret == 2 ) |
262 | return 2; | 276 | return 2; |
263 | if ( ret == 1) | 277 | if ( ret == 1) |
264 | retval = 1; | 278 | retval = 1; |
265 | } | 279 | } |
266 | } | 280 | } |
267 | return retval; | 281 | return retval; |
268 | } | 282 | } |
269 | int Todo::hasDueSubTodo( bool checkSubtodos ) //= true | 283 | int Todo::hasDueSubTodo( bool checkSubtodos ) //= true |
270 | { | 284 | { |
271 | return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); | 285 | return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); |
272 | } | 286 | } |
273 | bool Todo::hasDueDate() const | 287 | bool Todo::hasDueDate() const |
274 | { | 288 | { |
275 | return mHasDueDate; | 289 | return mHasDueDate; |
276 | } | 290 | } |
277 | 291 | ||
278 | void Todo::setHasDueDate(bool f) | 292 | void Todo::setHasDueDate(bool f) |
279 | { | 293 | { |
280 | if (mReadOnly) return; | 294 | if (mReadOnly) return; |
281 | mHasDueDate = f; | 295 | mHasDueDate = f; |
282 | updated(); | 296 | updated(); |
283 | } | 297 | } |
284 | 298 | ||
285 | 299 | ||
286 | #if 0 | 300 | #if 0 |
287 | void Todo::setStatus(const QString &statStr) | 301 | void Todo::setStatus(const QString &statStr) |
288 | { | 302 | { |
289 | if (mReadOnly) return; | 303 | if (mReadOnly) return; |
290 | QString ss(statStr.upper()); | 304 | QString ss(statStr.upper()); |
291 | 305 | ||
292 | if (ss == "X-ACTION") | 306 | if (ss == "X-ACTION") |
293 | mStatus = NEEDS_ACTION; | 307 | mStatus = NEEDS_ACTION; |
294 | else if (ss == "NEEDS ACTION") | 308 | else if (ss == "NEEDS ACTION") |
295 | mStatus = NEEDS_ACTION; | 309 | mStatus = NEEDS_ACTION; |
296 | else if (ss == "ACCEPTED") | 310 | else if (ss == "ACCEPTED") |
297 | mStatus = ACCEPTED; | 311 | mStatus = ACCEPTED; |
298 | else if (ss == "SENT") | 312 | else if (ss == "SENT") |
299 | mStatus = SENT; | 313 | mStatus = SENT; |
300 | else if (ss == "TENTATIVE") | 314 | else if (ss == "TENTATIVE") |
301 | mStatus = TENTATIVE; | 315 | mStatus = TENTATIVE; |
302 | else if (ss == "CONFIRMED") | 316 | else if (ss == "CONFIRMED") |
303 | mStatus = CONFIRMED; | 317 | mStatus = CONFIRMED; |
304 | else if (ss == "DECLINED") | 318 | else if (ss == "DECLINED") |
305 | mStatus = DECLINED; | 319 | mStatus = DECLINED; |
306 | else if (ss == "COMPLETED") | 320 | else if (ss == "COMPLETED") |
307 | mStatus = COMPLETED; | 321 | mStatus = COMPLETED; |
308 | else if (ss == "DELEGATED") | 322 | else if (ss == "DELEGATED") |
309 | mStatus = DELEGATED; | 323 | mStatus = DELEGATED; |
310 | 324 | ||
311 | updated(); | 325 | updated(); |
312 | } | 326 | } |
313 | 327 | ||
314 | void Todo::setStatus(int status) | 328 | void Todo::setStatus(int status) |
315 | { | 329 | { |
316 | if (mReadOnly) return; | 330 | if (mReadOnly) return; |
317 | mStatus = status; | 331 | mStatus = status; |
318 | updated(); | 332 | updated(); |
319 | } | 333 | } |
320 | 334 | ||
321 | int Todo::status() const | 335 | int Todo::status() const |
322 | { | 336 | { |
323 | return mStatus; | 337 | return mStatus; |
324 | } | 338 | } |
325 | 339 | ||
326 | QString Todo::statusStr() const | 340 | QString Todo::statusStr() const |
327 | { | 341 | { |
328 | switch(mStatus) { | 342 | switch(mStatus) { |
329 | case NEEDS_ACTION: | 343 | case NEEDS_ACTION: |
330 | return QString("NEEDS ACTION"); | 344 | return QString("NEEDS ACTION"); |
331 | break; | 345 | break; |
332 | case ACCEPTED: | 346 | case ACCEPTED: |
333 | return QString("ACCEPTED"); | 347 | return QString("ACCEPTED"); |
334 | break; | 348 | break; |