author | eilers <eilers> | 2003-09-25 10:57:55 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-09-25 10:57:55 (UTC) |
commit | fe97b1386099f519826392a5734d2bbe567fb786 (patch) (unidiff) | |
tree | 133731278965c30a2c072f1c8e9b2e9a361cb1a1 | |
parent | 5a81b7fa962aa83a10a01706135250f3aba8e315 (diff) | |
download | opie-fe97b1386099f519826392a5734d2bbe567fb786.zip opie-fe97b1386099f519826392a5734d2bbe567fb786.tar.gz opie-fe97b1386099f519826392a5734d2bbe567fb786.tar.bz2 |
Fixed inconsistencies between Description and NoteFixed inconsistencies between Description and Notess
-rw-r--r-- | libopie/pim/otodo.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index 5a18c37..189bf94 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -162,257 +162,257 @@ QDate OTodo::completedDate()const { | |||
162 | } | 162 | } |
163 | QString OTodo::description()const | 163 | QString OTodo::description()const |
164 | { | 164 | { |
165 | return data->desc; | 165 | return data->desc; |
166 | } | 166 | } |
167 | bool OTodo::hasState() const{ | 167 | bool OTodo::hasState() const{ |
168 | if (!data->state ) return false; | 168 | if (!data->state ) return false; |
169 | return ( data->state->state() != OPimState::Undefined ); | 169 | return ( data->state->state() != OPimState::Undefined ); |
170 | } | 170 | } |
171 | OPimState OTodo::state()const { | 171 | OPimState OTodo::state()const { |
172 | if (!data->state ) { | 172 | if (!data->state ) { |
173 | OPimState state; | 173 | OPimState state; |
174 | return state; | 174 | return state; |
175 | } | 175 | } |
176 | 176 | ||
177 | return (*data->state); | 177 | return (*data->state); |
178 | } | 178 | } |
179 | bool OTodo::hasRecurrence()const { | 179 | bool OTodo::hasRecurrence()const { |
180 | if (!data->recur) return false; | 180 | if (!data->recur) return false; |
181 | return data->recur->doesRecur(); | 181 | return data->recur->doesRecur(); |
182 | } | 182 | } |
183 | ORecur OTodo::recurrence()const { | 183 | ORecur OTodo::recurrence()const { |
184 | if (!data->recur) return ORecur(); | 184 | if (!data->recur) return ORecur(); |
185 | 185 | ||
186 | return (*data->recur); | 186 | return (*data->recur); |
187 | } | 187 | } |
188 | bool OTodo::hasMaintainer()const { | 188 | bool OTodo::hasMaintainer()const { |
189 | if (!data->maintainer) return false; | 189 | if (!data->maintainer) return false; |
190 | 190 | ||
191 | return (data->maintainer->mode() != OPimMaintainer::Undefined ); | 191 | return (data->maintainer->mode() != OPimMaintainer::Undefined ); |
192 | } | 192 | } |
193 | OPimMaintainer OTodo::maintainer()const { | 193 | OPimMaintainer OTodo::maintainer()const { |
194 | if (!data->maintainer) return OPimMaintainer(); | 194 | if (!data->maintainer) return OPimMaintainer(); |
195 | 195 | ||
196 | return (*data->maintainer); | 196 | return (*data->maintainer); |
197 | } | 197 | } |
198 | void OTodo::setCompleted( bool completed ) | 198 | void OTodo::setCompleted( bool completed ) |
199 | { | 199 | { |
200 | changeOrModify(); | 200 | changeOrModify(); |
201 | data->isCompleted = completed; | 201 | data->isCompleted = completed; |
202 | } | 202 | } |
203 | void OTodo::setHasDueDate( bool hasDate ) | 203 | void OTodo::setHasDueDate( bool hasDate ) |
204 | { | 204 | { |
205 | changeOrModify(); | 205 | changeOrModify(); |
206 | data->hasDate = hasDate; | 206 | data->hasDate = hasDate; |
207 | } | 207 | } |
208 | void OTodo::setDescription(const QString &desc ) | 208 | void OTodo::setDescription(const QString &desc ) |
209 | { | 209 | { |
210 | // qWarning( "desc " + desc ); | 210 | // qWarning( "desc " + desc ); |
211 | changeOrModify(); | 211 | changeOrModify(); |
212 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 212 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
213 | } | 213 | } |
214 | void OTodo::setSummary( const QString& sum ) | 214 | void OTodo::setSummary( const QString& sum ) |
215 | { | 215 | { |
216 | changeOrModify(); | 216 | changeOrModify(); |
217 | data->sum = sum; | 217 | data->sum = sum; |
218 | } | 218 | } |
219 | void OTodo::setPriority(int prio ) | 219 | void OTodo::setPriority(int prio ) |
220 | { | 220 | { |
221 | changeOrModify(); | 221 | changeOrModify(); |
222 | data->priority = prio; | 222 | data->priority = prio; |
223 | } | 223 | } |
224 | void OTodo::setDueDate( const QDate& date ) | 224 | void OTodo::setDueDate( const QDate& date ) |
225 | { | 225 | { |
226 | changeOrModify(); | 226 | changeOrModify(); |
227 | data->date = date; | 227 | data->date = date; |
228 | } | 228 | } |
229 | void OTodo::setStartDate( const QDate& date ) { | 229 | void OTodo::setStartDate( const QDate& date ) { |
230 | changeOrModify(); | 230 | changeOrModify(); |
231 | data->start = date; | 231 | data->start = date; |
232 | } | 232 | } |
233 | void OTodo::setCompletedDate( const QDate& date ) { | 233 | void OTodo::setCompletedDate( const QDate& date ) { |
234 | changeOrModify(); | 234 | changeOrModify(); |
235 | data->completed = date; | 235 | data->completed = date; |
236 | } | 236 | } |
237 | void OTodo::setState( const OPimState& state ) { | 237 | void OTodo::setState( const OPimState& state ) { |
238 | changeOrModify(); | 238 | changeOrModify(); |
239 | if (data->state ) | 239 | if (data->state ) |
240 | (*data->state) = state; | 240 | (*data->state) = state; |
241 | else | 241 | else |
242 | data->state = new OPimState( state ); | 242 | data->state = new OPimState( state ); |
243 | } | 243 | } |
244 | void OTodo::setRecurrence( const ORecur& rec) { | 244 | void OTodo::setRecurrence( const ORecur& rec) { |
245 | changeOrModify(); | 245 | changeOrModify(); |
246 | if (data->recur ) | 246 | if (data->recur ) |
247 | (*data->recur) = rec; | 247 | (*data->recur) = rec; |
248 | else | 248 | else |
249 | data->recur = new ORecur( rec ); | 249 | data->recur = new ORecur( rec ); |
250 | } | 250 | } |
251 | void OTodo::setMaintainer( const OPimMaintainer& pim ) { | 251 | void OTodo::setMaintainer( const OPimMaintainer& pim ) { |
252 | changeOrModify(); | 252 | changeOrModify(); |
253 | 253 | ||
254 | if (data->maintainer ) | 254 | if (data->maintainer ) |
255 | (*data->maintainer) = pim; | 255 | (*data->maintainer) = pim; |
256 | else | 256 | else |
257 | data->maintainer = new OPimMaintainer( pim ); | 257 | data->maintainer = new OPimMaintainer( pim ); |
258 | } | 258 | } |
259 | bool OTodo::isOverdue( ) | 259 | bool OTodo::isOverdue( ) |
260 | { | 260 | { |
261 | if( data->hasDate && !data->isCompleted) | 261 | if( data->hasDate && !data->isCompleted) |
262 | return QDate::currentDate() > data->date; | 262 | return QDate::currentDate() > data->date; |
263 | return false; | 263 | return false; |
264 | } | 264 | } |
265 | void OTodo::setProgress(ushort progress ) | 265 | void OTodo::setProgress(ushort progress ) |
266 | { | 266 | { |
267 | changeOrModify(); | 267 | changeOrModify(); |
268 | data->prog = progress; | 268 | data->prog = progress; |
269 | } | 269 | } |
270 | QString OTodo::toShortText() const { | 270 | QString OTodo::toShortText() const { |
271 | return summary(); | 271 | return summary(); |
272 | } | 272 | } |
273 | /*! | 273 | /*! |
274 | Returns a richt text string | 274 | Returns a richt text string |
275 | */ | 275 | */ |
276 | QString OTodo::toRichText() const | 276 | QString OTodo::toRichText() const |
277 | { | 277 | { |
278 | QString text; | 278 | QString text; |
279 | QStringList catlist; | 279 | QStringList catlist; |
280 | 280 | ||
281 | // summary | 281 | // summary |
282 | text += "<b><h3><img src=\"todo/TodoList\"> "; | 282 | text += "<b><h3><img src=\"todo/TodoList\"> "; |
283 | if ( !summary().isEmpty() ) { | 283 | if ( !summary().isEmpty() ) { |
284 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); | 284 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); |
285 | } | 285 | } |
286 | text += "</h3></b><br><hr><br>"; | 286 | text += "</h3></b><br><hr><br>"; |
287 | 287 | ||
288 | // description | 288 | // description |
289 | if( !description().isEmpty() ){ | 289 | if( !description().isEmpty() ){ |
290 | text += "<b>" + QObject::tr( "Notes:" ) + "</b><br>"; | 290 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
291 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 291 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
292 | } | 292 | } |
293 | 293 | ||
294 | // priority | 294 | // priority |
295 | int priorityval = priority(); | 295 | int priorityval = priority(); |
296 | text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" + | 296 | text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" + |
297 | QString::number( priorityval ) + "\"> "; | 297 | QString::number( priorityval ) + "\"> "; |
298 | 298 | ||
299 | switch ( priorityval ) | 299 | switch ( priorityval ) |
300 | { | 300 | { |
301 | case 1 : text += QObject::tr( "Very high" ); | 301 | case 1 : text += QObject::tr( "Very high" ); |
302 | break; | 302 | break; |
303 | case 2 : text += QObject::tr( "High" ); | 303 | case 2 : text += QObject::tr( "High" ); |
304 | break; | 304 | break; |
305 | case 3 : text += QObject::tr( "Normal" ); | 305 | case 3 : text += QObject::tr( "Normal" ); |
306 | break; | 306 | break; |
307 | case 4 : text += QObject::tr( "Low" ); | 307 | case 4 : text += QObject::tr( "Low" ); |
308 | break; | 308 | break; |
309 | case 5 : text += QObject::tr( "Very low" ); | 309 | case 5 : text += QObject::tr( "Very low" ); |
310 | break; | 310 | break; |
311 | }; | 311 | }; |
312 | text += "<br>"; | 312 | text += "<br>"; |
313 | 313 | ||
314 | // progress | 314 | // progress |
315 | text += "<b>" + QObject::tr( "Progress:") + " </b>" | 315 | text += "<b>" + QObject::tr( "Progress:") + " </b>" |
316 | + QString::number( progress() ) + " %<br>"; | 316 | + QString::number( progress() ) + " %<br>"; |
317 | 317 | ||
318 | // due date | 318 | // due date |
319 | if (hasDueDate() ){ | 319 | if (hasDueDate() ){ |
320 | QDate dd = dueDate(); | 320 | QDate dd = dueDate(); |
321 | int off = QDate::currentDate().daysTo( dd ); | 321 | int off = QDate::currentDate().daysTo( dd ); |
322 | 322 | ||
323 | text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\""; | 323 | text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\""; |
324 | if ( off < 0 ) | 324 | if ( off < 0 ) |
325 | text += "#FF0000"; | 325 | text += "#FF0000"; |
326 | else if ( off == 0 ) | 326 | else if ( off == 0 ) |
327 | text += "#FFFF00"; | 327 | text += "#FFFF00"; |
328 | else if ( off > 0 ) | 328 | else if ( off > 0 ) |
329 | text += "#00FF00"; | 329 | text += "#00FF00"; |
330 | 330 | ||
331 | text += "\">" + dd.toString() + "</font><br>"; | 331 | text += "\">" + dd.toString() + "</font><br>"; |
332 | } | 332 | } |
333 | 333 | ||
334 | // categories | 334 | // categories |
335 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 335 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
336 | text += categoryNames( "Todo List" ).join(", "); | 336 | text += categoryNames( "Todo List" ).join(", "); |
337 | text += "<br>"; | 337 | text += "<br>"; |
338 | 338 | ||
339 | return text; | 339 | return text; |
340 | } | 340 | } |
341 | bool OTodo::hasNotifiers()const { | 341 | bool OTodo::hasNotifiers()const { |
342 | if (!data->notifiers) return false; | 342 | if (!data->notifiers) return false; |
343 | return !data->notifiers->isEmpty(); | 343 | return !data->notifiers->isEmpty(); |
344 | } | 344 | } |
345 | OPimNotifyManager& OTodo::notifiers() { | 345 | OPimNotifyManager& OTodo::notifiers() { |
346 | if (!data->notifiers ) | 346 | if (!data->notifiers ) |
347 | data->notifiers = new OPimNotifyManager; | 347 | data->notifiers = new OPimNotifyManager; |
348 | return (*data->notifiers); | 348 | return (*data->notifiers); |
349 | } | 349 | } |
350 | const OPimNotifyManager& OTodo::notifiers()const{ | 350 | const OPimNotifyManager& OTodo::notifiers()const{ |
351 | if (!data->notifiers ) | 351 | if (!data->notifiers ) |
352 | data->notifiers = new OPimNotifyManager; | 352 | data->notifiers = new OPimNotifyManager; |
353 | 353 | ||
354 | return (*data->notifiers); | 354 | return (*data->notifiers); |
355 | } | 355 | } |
356 | 356 | ||
357 | bool OTodo::operator<( const OTodo &toDoEvent )const{ | 357 | bool OTodo::operator<( const OTodo &toDoEvent )const{ |
358 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 358 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
359 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 359 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
360 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 360 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
361 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 361 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
362 | return priority() < toDoEvent.priority(); | 362 | return priority() < toDoEvent.priority(); |
363 | }else{ | 363 | }else{ |
364 | return dueDate() < toDoEvent.dueDate(); | 364 | return dueDate() < toDoEvent.dueDate(); |
365 | } | 365 | } |
366 | } | 366 | } |
367 | return false; | 367 | return false; |
368 | } | 368 | } |
369 | bool OTodo::operator<=(const OTodo &toDoEvent )const | 369 | bool OTodo::operator<=(const OTodo &toDoEvent )const |
370 | { | 370 | { |
371 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 371 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
372 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; | 372 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; |
373 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 373 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
374 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 374 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
375 | return priority() <= toDoEvent.priority(); | 375 | return priority() <= toDoEvent.priority(); |
376 | }else{ | 376 | }else{ |
377 | return dueDate() <= toDoEvent.dueDate(); | 377 | return dueDate() <= toDoEvent.dueDate(); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | return true; | 380 | return true; |
381 | } | 381 | } |
382 | bool OTodo::operator>(const OTodo &toDoEvent )const | 382 | bool OTodo::operator>(const OTodo &toDoEvent )const |
383 | { | 383 | { |
384 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; | 384 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; |
385 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 385 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
386 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 386 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
387 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 387 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
388 | return priority() > toDoEvent.priority(); | 388 | return priority() > toDoEvent.priority(); |
389 | }else{ | 389 | }else{ |
390 | return dueDate() > toDoEvent.dueDate(); | 390 | return dueDate() > toDoEvent.dueDate(); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | return false; | 393 | return false; |
394 | } | 394 | } |
395 | bool OTodo::operator>=(const OTodo &toDoEvent )const | 395 | bool OTodo::operator>=(const OTodo &toDoEvent )const |
396 | { | 396 | { |
397 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 397 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
398 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 398 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
399 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 399 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
400 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 400 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
401 | return priority() > toDoEvent.priority(); | 401 | return priority() > toDoEvent.priority(); |
402 | }else{ | 402 | }else{ |
403 | return dueDate() > toDoEvent.dueDate(); | 403 | return dueDate() > toDoEvent.dueDate(); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | return true; | 406 | return true; |
407 | } | 407 | } |
408 | bool OTodo::operator==(const OTodo &toDoEvent )const | 408 | bool OTodo::operator==(const OTodo &toDoEvent )const |
409 | { | 409 | { |
410 | if ( data->priority != toDoEvent.data->priority ) return false; | 410 | if ( data->priority != toDoEvent.data->priority ) return false; |
411 | if ( data->priority != toDoEvent.data->prog ) return false; | 411 | if ( data->priority != toDoEvent.data->prog ) return false; |
412 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; | 412 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; |
413 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; | 413 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; |
414 | if ( data->date != toDoEvent.data->date ) return false; | 414 | if ( data->date != toDoEvent.data->date ) return false; |
415 | if ( data->sum != toDoEvent.data->sum ) return false; | 415 | if ( data->sum != toDoEvent.data->sum ) return false; |
416 | if ( data->desc != toDoEvent.data->desc ) return false; | 416 | if ( data->desc != toDoEvent.data->desc ) return false; |
417 | if ( data->maintainer != toDoEvent.data->maintainer ) | 417 | if ( data->maintainer != toDoEvent.data->maintainer ) |
418 | return false; | 418 | return false; |
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index 5a18c37..189bf94 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp | |||
@@ -162,257 +162,257 @@ QDate OTodo::completedDate()const { | |||
162 | } | 162 | } |
163 | QString OTodo::description()const | 163 | QString OTodo::description()const |
164 | { | 164 | { |
165 | return data->desc; | 165 | return data->desc; |
166 | } | 166 | } |
167 | bool OTodo::hasState() const{ | 167 | bool OTodo::hasState() const{ |
168 | if (!data->state ) return false; | 168 | if (!data->state ) return false; |
169 | return ( data->state->state() != OPimState::Undefined ); | 169 | return ( data->state->state() != OPimState::Undefined ); |
170 | } | 170 | } |
171 | OPimState OTodo::state()const { | 171 | OPimState OTodo::state()const { |
172 | if (!data->state ) { | 172 | if (!data->state ) { |
173 | OPimState state; | 173 | OPimState state; |
174 | return state; | 174 | return state; |
175 | } | 175 | } |
176 | 176 | ||
177 | return (*data->state); | 177 | return (*data->state); |
178 | } | 178 | } |
179 | bool OTodo::hasRecurrence()const { | 179 | bool OTodo::hasRecurrence()const { |
180 | if (!data->recur) return false; | 180 | if (!data->recur) return false; |
181 | return data->recur->doesRecur(); | 181 | return data->recur->doesRecur(); |
182 | } | 182 | } |
183 | ORecur OTodo::recurrence()const { | 183 | ORecur OTodo::recurrence()const { |
184 | if (!data->recur) return ORecur(); | 184 | if (!data->recur) return ORecur(); |
185 | 185 | ||
186 | return (*data->recur); | 186 | return (*data->recur); |
187 | } | 187 | } |
188 | bool OTodo::hasMaintainer()const { | 188 | bool OTodo::hasMaintainer()const { |
189 | if (!data->maintainer) return false; | 189 | if (!data->maintainer) return false; |
190 | 190 | ||
191 | return (data->maintainer->mode() != OPimMaintainer::Undefined ); | 191 | return (data->maintainer->mode() != OPimMaintainer::Undefined ); |
192 | } | 192 | } |
193 | OPimMaintainer OTodo::maintainer()const { | 193 | OPimMaintainer OTodo::maintainer()const { |
194 | if (!data->maintainer) return OPimMaintainer(); | 194 | if (!data->maintainer) return OPimMaintainer(); |
195 | 195 | ||
196 | return (*data->maintainer); | 196 | return (*data->maintainer); |
197 | } | 197 | } |
198 | void OTodo::setCompleted( bool completed ) | 198 | void OTodo::setCompleted( bool completed ) |
199 | { | 199 | { |
200 | changeOrModify(); | 200 | changeOrModify(); |
201 | data->isCompleted = completed; | 201 | data->isCompleted = completed; |
202 | } | 202 | } |
203 | void OTodo::setHasDueDate( bool hasDate ) | 203 | void OTodo::setHasDueDate( bool hasDate ) |
204 | { | 204 | { |
205 | changeOrModify(); | 205 | changeOrModify(); |
206 | data->hasDate = hasDate; | 206 | data->hasDate = hasDate; |
207 | } | 207 | } |
208 | void OTodo::setDescription(const QString &desc ) | 208 | void OTodo::setDescription(const QString &desc ) |
209 | { | 209 | { |
210 | // qWarning( "desc " + desc ); | 210 | // qWarning( "desc " + desc ); |
211 | changeOrModify(); | 211 | changeOrModify(); |
212 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 212 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
213 | } | 213 | } |
214 | void OTodo::setSummary( const QString& sum ) | 214 | void OTodo::setSummary( const QString& sum ) |
215 | { | 215 | { |
216 | changeOrModify(); | 216 | changeOrModify(); |
217 | data->sum = sum; | 217 | data->sum = sum; |
218 | } | 218 | } |
219 | void OTodo::setPriority(int prio ) | 219 | void OTodo::setPriority(int prio ) |
220 | { | 220 | { |
221 | changeOrModify(); | 221 | changeOrModify(); |
222 | data->priority = prio; | 222 | data->priority = prio; |
223 | } | 223 | } |
224 | void OTodo::setDueDate( const QDate& date ) | 224 | void OTodo::setDueDate( const QDate& date ) |
225 | { | 225 | { |
226 | changeOrModify(); | 226 | changeOrModify(); |
227 | data->date = date; | 227 | data->date = date; |
228 | } | 228 | } |
229 | void OTodo::setStartDate( const QDate& date ) { | 229 | void OTodo::setStartDate( const QDate& date ) { |
230 | changeOrModify(); | 230 | changeOrModify(); |
231 | data->start = date; | 231 | data->start = date; |
232 | } | 232 | } |
233 | void OTodo::setCompletedDate( const QDate& date ) { | 233 | void OTodo::setCompletedDate( const QDate& date ) { |
234 | changeOrModify(); | 234 | changeOrModify(); |
235 | data->completed = date; | 235 | data->completed = date; |
236 | } | 236 | } |
237 | void OTodo::setState( const OPimState& state ) { | 237 | void OTodo::setState( const OPimState& state ) { |
238 | changeOrModify(); | 238 | changeOrModify(); |
239 | if (data->state ) | 239 | if (data->state ) |
240 | (*data->state) = state; | 240 | (*data->state) = state; |
241 | else | 241 | else |
242 | data->state = new OPimState( state ); | 242 | data->state = new OPimState( state ); |
243 | } | 243 | } |
244 | void OTodo::setRecurrence( const ORecur& rec) { | 244 | void OTodo::setRecurrence( const ORecur& rec) { |
245 | changeOrModify(); | 245 | changeOrModify(); |
246 | if (data->recur ) | 246 | if (data->recur ) |
247 | (*data->recur) = rec; | 247 | (*data->recur) = rec; |
248 | else | 248 | else |
249 | data->recur = new ORecur( rec ); | 249 | data->recur = new ORecur( rec ); |
250 | } | 250 | } |
251 | void OTodo::setMaintainer( const OPimMaintainer& pim ) { | 251 | void OTodo::setMaintainer( const OPimMaintainer& pim ) { |
252 | changeOrModify(); | 252 | changeOrModify(); |
253 | 253 | ||
254 | if (data->maintainer ) | 254 | if (data->maintainer ) |
255 | (*data->maintainer) = pim; | 255 | (*data->maintainer) = pim; |
256 | else | 256 | else |
257 | data->maintainer = new OPimMaintainer( pim ); | 257 | data->maintainer = new OPimMaintainer( pim ); |
258 | } | 258 | } |
259 | bool OTodo::isOverdue( ) | 259 | bool OTodo::isOverdue( ) |
260 | { | 260 | { |
261 | if( data->hasDate && !data->isCompleted) | 261 | if( data->hasDate && !data->isCompleted) |
262 | return QDate::currentDate() > data->date; | 262 | return QDate::currentDate() > data->date; |
263 | return false; | 263 | return false; |
264 | } | 264 | } |
265 | void OTodo::setProgress(ushort progress ) | 265 | void OTodo::setProgress(ushort progress ) |
266 | { | 266 | { |
267 | changeOrModify(); | 267 | changeOrModify(); |
268 | data->prog = progress; | 268 | data->prog = progress; |
269 | } | 269 | } |
270 | QString OTodo::toShortText() const { | 270 | QString OTodo::toShortText() const { |
271 | return summary(); | 271 | return summary(); |
272 | } | 272 | } |
273 | /*! | 273 | /*! |
274 | Returns a richt text string | 274 | Returns a richt text string |
275 | */ | 275 | */ |
276 | QString OTodo::toRichText() const | 276 | QString OTodo::toRichText() const |
277 | { | 277 | { |
278 | QString text; | 278 | QString text; |
279 | QStringList catlist; | 279 | QStringList catlist; |
280 | 280 | ||
281 | // summary | 281 | // summary |
282 | text += "<b><h3><img src=\"todo/TodoList\"> "; | 282 | text += "<b><h3><img src=\"todo/TodoList\"> "; |
283 | if ( !summary().isEmpty() ) { | 283 | if ( !summary().isEmpty() ) { |
284 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); | 284 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); |
285 | } | 285 | } |
286 | text += "</h3></b><br><hr><br>"; | 286 | text += "</h3></b><br><hr><br>"; |
287 | 287 | ||
288 | // description | 288 | // description |
289 | if( !description().isEmpty() ){ | 289 | if( !description().isEmpty() ){ |
290 | text += "<b>" + QObject::tr( "Notes:" ) + "</b><br>"; | 290 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
291 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 291 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
292 | } | 292 | } |
293 | 293 | ||
294 | // priority | 294 | // priority |
295 | int priorityval = priority(); | 295 | int priorityval = priority(); |
296 | text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" + | 296 | text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" + |
297 | QString::number( priorityval ) + "\"> "; | 297 | QString::number( priorityval ) + "\"> "; |
298 | 298 | ||
299 | switch ( priorityval ) | 299 | switch ( priorityval ) |
300 | { | 300 | { |
301 | case 1 : text += QObject::tr( "Very high" ); | 301 | case 1 : text += QObject::tr( "Very high" ); |
302 | break; | 302 | break; |
303 | case 2 : text += QObject::tr( "High" ); | 303 | case 2 : text += QObject::tr( "High" ); |
304 | break; | 304 | break; |
305 | case 3 : text += QObject::tr( "Normal" ); | 305 | case 3 : text += QObject::tr( "Normal" ); |
306 | break; | 306 | break; |
307 | case 4 : text += QObject::tr( "Low" ); | 307 | case 4 : text += QObject::tr( "Low" ); |
308 | break; | 308 | break; |
309 | case 5 : text += QObject::tr( "Very low" ); | 309 | case 5 : text += QObject::tr( "Very low" ); |
310 | break; | 310 | break; |
311 | }; | 311 | }; |
312 | text += "<br>"; | 312 | text += "<br>"; |
313 | 313 | ||
314 | // progress | 314 | // progress |
315 | text += "<b>" + QObject::tr( "Progress:") + " </b>" | 315 | text += "<b>" + QObject::tr( "Progress:") + " </b>" |
316 | + QString::number( progress() ) + " %<br>"; | 316 | + QString::number( progress() ) + " %<br>"; |
317 | 317 | ||
318 | // due date | 318 | // due date |
319 | if (hasDueDate() ){ | 319 | if (hasDueDate() ){ |
320 | QDate dd = dueDate(); | 320 | QDate dd = dueDate(); |
321 | int off = QDate::currentDate().daysTo( dd ); | 321 | int off = QDate::currentDate().daysTo( dd ); |
322 | 322 | ||
323 | text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\""; | 323 | text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\""; |
324 | if ( off < 0 ) | 324 | if ( off < 0 ) |
325 | text += "#FF0000"; | 325 | text += "#FF0000"; |
326 | else if ( off == 0 ) | 326 | else if ( off == 0 ) |
327 | text += "#FFFF00"; | 327 | text += "#FFFF00"; |
328 | else if ( off > 0 ) | 328 | else if ( off > 0 ) |
329 | text += "#00FF00"; | 329 | text += "#00FF00"; |
330 | 330 | ||
331 | text += "\">" + dd.toString() + "</font><br>"; | 331 | text += "\">" + dd.toString() + "</font><br>"; |
332 | } | 332 | } |
333 | 333 | ||
334 | // categories | 334 | // categories |
335 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 335 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
336 | text += categoryNames( "Todo List" ).join(", "); | 336 | text += categoryNames( "Todo List" ).join(", "); |
337 | text += "<br>"; | 337 | text += "<br>"; |
338 | 338 | ||
339 | return text; | 339 | return text; |
340 | } | 340 | } |
341 | bool OTodo::hasNotifiers()const { | 341 | bool OTodo::hasNotifiers()const { |
342 | if (!data->notifiers) return false; | 342 | if (!data->notifiers) return false; |
343 | return !data->notifiers->isEmpty(); | 343 | return !data->notifiers->isEmpty(); |
344 | } | 344 | } |
345 | OPimNotifyManager& OTodo::notifiers() { | 345 | OPimNotifyManager& OTodo::notifiers() { |
346 | if (!data->notifiers ) | 346 | if (!data->notifiers ) |
347 | data->notifiers = new OPimNotifyManager; | 347 | data->notifiers = new OPimNotifyManager; |
348 | return (*data->notifiers); | 348 | return (*data->notifiers); |
349 | } | 349 | } |
350 | const OPimNotifyManager& OTodo::notifiers()const{ | 350 | const OPimNotifyManager& OTodo::notifiers()const{ |
351 | if (!data->notifiers ) | 351 | if (!data->notifiers ) |
352 | data->notifiers = new OPimNotifyManager; | 352 | data->notifiers = new OPimNotifyManager; |
353 | 353 | ||
354 | return (*data->notifiers); | 354 | return (*data->notifiers); |
355 | } | 355 | } |
356 | 356 | ||
357 | bool OTodo::operator<( const OTodo &toDoEvent )const{ | 357 | bool OTodo::operator<( const OTodo &toDoEvent )const{ |
358 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 358 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
359 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 359 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
360 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 360 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
361 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 361 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
362 | return priority() < toDoEvent.priority(); | 362 | return priority() < toDoEvent.priority(); |
363 | }else{ | 363 | }else{ |
364 | return dueDate() < toDoEvent.dueDate(); | 364 | return dueDate() < toDoEvent.dueDate(); |
365 | } | 365 | } |
366 | } | 366 | } |
367 | return false; | 367 | return false; |
368 | } | 368 | } |
369 | bool OTodo::operator<=(const OTodo &toDoEvent )const | 369 | bool OTodo::operator<=(const OTodo &toDoEvent )const |
370 | { | 370 | { |
371 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 371 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
372 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; | 372 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; |
373 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 373 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
374 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 374 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
375 | return priority() <= toDoEvent.priority(); | 375 | return priority() <= toDoEvent.priority(); |
376 | }else{ | 376 | }else{ |
377 | return dueDate() <= toDoEvent.dueDate(); | 377 | return dueDate() <= toDoEvent.dueDate(); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | return true; | 380 | return true; |
381 | } | 381 | } |
382 | bool OTodo::operator>(const OTodo &toDoEvent )const | 382 | bool OTodo::operator>(const OTodo &toDoEvent )const |
383 | { | 383 | { |
384 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; | 384 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; |
385 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 385 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
386 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 386 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
387 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 387 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
388 | return priority() > toDoEvent.priority(); | 388 | return priority() > toDoEvent.priority(); |
389 | }else{ | 389 | }else{ |
390 | return dueDate() > toDoEvent.dueDate(); | 390 | return dueDate() > toDoEvent.dueDate(); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | return false; | 393 | return false; |
394 | } | 394 | } |
395 | bool OTodo::operator>=(const OTodo &toDoEvent )const | 395 | bool OTodo::operator>=(const OTodo &toDoEvent )const |
396 | { | 396 | { |
397 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 397 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
398 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 398 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
399 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 399 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
400 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 400 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
401 | return priority() > toDoEvent.priority(); | 401 | return priority() > toDoEvent.priority(); |
402 | }else{ | 402 | }else{ |
403 | return dueDate() > toDoEvent.dueDate(); | 403 | return dueDate() > toDoEvent.dueDate(); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | return true; | 406 | return true; |
407 | } | 407 | } |
408 | bool OTodo::operator==(const OTodo &toDoEvent )const | 408 | bool OTodo::operator==(const OTodo &toDoEvent )const |
409 | { | 409 | { |
410 | if ( data->priority != toDoEvent.data->priority ) return false; | 410 | if ( data->priority != toDoEvent.data->priority ) return false; |
411 | if ( data->priority != toDoEvent.data->prog ) return false; | 411 | if ( data->priority != toDoEvent.data->prog ) return false; |
412 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; | 412 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; |
413 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; | 413 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; |
414 | if ( data->date != toDoEvent.data->date ) return false; | 414 | if ( data->date != toDoEvent.data->date ) return false; |
415 | if ( data->sum != toDoEvent.data->sum ) return false; | 415 | if ( data->sum != toDoEvent.data->sum ) return false; |
416 | if ( data->desc != toDoEvent.data->desc ) return false; | 416 | if ( data->desc != toDoEvent.data->desc ) return false; |
417 | if ( data->maintainer != toDoEvent.data->maintainer ) | 417 | if ( data->maintainer != toDoEvent.data->maintainer ) |
418 | return false; | 418 | return false; |