author | zecke <zecke> | 2003-02-21 16:52:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-21 16:52:49 (UTC) |
commit | 0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7 (patch) (unidiff) | |
tree | f3ce9c9441a1073762f3e0c61cc85f0d5a1fd81d /libopie/pim/otodo.cpp | |
parent | a298235aa1489937e7657079e6352adfc8746acf (diff) | |
download | opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.zip opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.tar.gz opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.tar.bz2 |
-Remove old Todo classes they're deprecated and today I already using the
new API
-Guard against self assignment in OTodo
-Add test apps for OPIM
-Opiefied Event classes
-Added TimeZone handling and pinning of TimeZones to OEvent
-Adjust ORecur and the widget to better timezone behaviour
-rw-r--r-- | libopie/pim/otodo.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index b4d4aa9..049359e 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -295,96 +295,98 @@ bool OTodo::operator>(const OTodo &toDoEvent )const | |||
295 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 295 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
296 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 296 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
297 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 297 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
298 | return priority() > toDoEvent.priority(); | 298 | return priority() > toDoEvent.priority(); |
299 | }else{ | 299 | }else{ |
300 | return dueDate() > toDoEvent.dueDate(); | 300 | return dueDate() > toDoEvent.dueDate(); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | return false; | 303 | return false; |
304 | } | 304 | } |
305 | bool OTodo::operator>=(const OTodo &toDoEvent )const | 305 | bool OTodo::operator>=(const OTodo &toDoEvent )const |
306 | { | 306 | { |
307 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 307 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
308 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 308 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
309 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 309 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
310 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 310 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
311 | return priority() > toDoEvent.priority(); | 311 | return priority() > toDoEvent.priority(); |
312 | }else{ | 312 | }else{ |
313 | return dueDate() > toDoEvent.dueDate(); | 313 | return dueDate() > toDoEvent.dueDate(); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | return true; | 316 | return true; |
317 | } | 317 | } |
318 | bool OTodo::operator==(const OTodo &toDoEvent )const | 318 | bool OTodo::operator==(const OTodo &toDoEvent )const |
319 | { | 319 | { |
320 | if ( data->priority != toDoEvent.data->priority ) return false; | 320 | if ( data->priority != toDoEvent.data->priority ) return false; |
321 | if ( data->priority != toDoEvent.data->prog ) return false; | 321 | if ( data->priority != toDoEvent.data->prog ) return false; |
322 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; | 322 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; |
323 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; | 323 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; |
324 | if ( data->date != toDoEvent.data->date ) return false; | 324 | if ( data->date != toDoEvent.data->date ) return false; |
325 | if ( data->sum != toDoEvent.data->sum ) return false; | 325 | if ( data->sum != toDoEvent.data->sum ) return false; |
326 | if ( data->desc != toDoEvent.data->desc ) return false; | 326 | if ( data->desc != toDoEvent.data->desc ) return false; |
327 | if ( data->maintainer != toDoEvent.data->maintainer ) | 327 | if ( data->maintainer != toDoEvent.data->maintainer ) |
328 | return false; | 328 | return false; |
329 | 329 | ||
330 | return OPimRecord::operator==( toDoEvent ); | 330 | return OPimRecord::operator==( toDoEvent ); |
331 | } | 331 | } |
332 | void OTodo::deref() { | 332 | void OTodo::deref() { |
333 | 333 | ||
334 | // qWarning("deref in ToDoEvent"); | 334 | // qWarning("deref in ToDoEvent"); |
335 | if ( data->deref() ) { | 335 | if ( data->deref() ) { |
336 | // qWarning("deleting"); | 336 | // qWarning("deleting"); |
337 | delete data; | 337 | delete data; |
338 | data= 0; | 338 | data= 0; |
339 | } | 339 | } |
340 | } | 340 | } |
341 | OTodo &OTodo::operator=(const OTodo &item ) | 341 | OTodo &OTodo::operator=(const OTodo &item ) |
342 | { | 342 | { |
343 | if ( *this == item ) return *this; | ||
344 | |||
343 | OPimRecord::operator=( item ); | 345 | OPimRecord::operator=( item ); |
344 | //qWarning("operator= ref "); | 346 | //qWarning("operator= ref "); |
345 | item.data->ref(); | 347 | item.data->ref(); |
346 | deref(); | 348 | deref(); |
347 | data = item.data; | 349 | data = item.data; |
348 | 350 | ||
349 | return *this; | 351 | return *this; |
350 | } | 352 | } |
351 | 353 | ||
352 | QMap<int, QString> OTodo::toMap() const { | 354 | QMap<int, QString> OTodo::toMap() const { |
353 | QMap<int, QString> map; | 355 | QMap<int, QString> map; |
354 | 356 | ||
355 | map.insert( Uid, QString::number( uid() ) ); | 357 | map.insert( Uid, QString::number( uid() ) ); |
356 | map.insert( Category, idsToString( categories() ) ); | 358 | map.insert( Category, idsToString( categories() ) ); |
357 | map.insert( HasDate, QString::number( data->hasDate ) ); | 359 | map.insert( HasDate, QString::number( data->hasDate ) ); |
358 | map.insert( Completed, QString::number( data->isCompleted ) ); | 360 | map.insert( Completed, QString::number( data->isCompleted ) ); |
359 | map.insert( Description, data->desc ); | 361 | map.insert( Description, data->desc ); |
360 | map.insert( Summary, data->sum ); | 362 | map.insert( Summary, data->sum ); |
361 | map.insert( Priority, QString::number( data->priority ) ); | 363 | map.insert( Priority, QString::number( data->priority ) ); |
362 | map.insert( DateDay, QString::number( data->date.day() ) ); | 364 | map.insert( DateDay, QString::number( data->date.day() ) ); |
363 | map.insert( DateMonth, QString::number( data->date.month() ) ); | 365 | map.insert( DateMonth, QString::number( data->date.month() ) ); |
364 | map.insert( DateYear, QString::number( data->date.year() ) ); | 366 | map.insert( DateYear, QString::number( data->date.year() ) ); |
365 | map.insert( Progress, QString::number( data->prog ) ); | 367 | map.insert( Progress, QString::number( data->prog ) ); |
366 | // map.insert( CrossReference, crossToString() ); | 368 | // map.insert( CrossReference, crossToString() ); |
367 | /* FIXME!!! map.insert( State, ); | 369 | /* FIXME!!! map.insert( State, ); |
368 | map.insert( Recurrence, ); | 370 | map.insert( Recurrence, ); |
369 | map.insert( Reminders, ); | 371 | map.insert( Reminders, ); |
370 | map. | 372 | map. |
371 | */ | 373 | */ |
372 | return map; | 374 | return map; |
373 | } | 375 | } |
374 | 376 | ||
375 | QMap<QString, QString> OTodo::toExtraMap()const { | 377 | QMap<QString, QString> OTodo::toExtraMap()const { |
376 | return data->extra; | 378 | return data->extra; |
377 | } | 379 | } |
378 | /** | 380 | /** |
379 | * change or modify looks at the ref count and either | 381 | * change or modify looks at the ref count and either |
380 | * creates a new QShared Object or it can modify it | 382 | * creates a new QShared Object or it can modify it |
381 | * right in place | 383 | * right in place |
382 | */ | 384 | */ |
383 | void OTodo::changeOrModify() { | 385 | void OTodo::changeOrModify() { |
384 | if ( data->count != 1 ) { | 386 | if ( data->count != 1 ) { |
385 | qWarning("changeOrModify"); | 387 | qWarning("changeOrModify"); |
386 | data->deref(); | 388 | data->deref(); |
387 | OTodoData* d2 = new OTodoData(); | 389 | OTodoData* d2 = new OTodoData(); |
388 | copy(data, d2 ); | 390 | copy(data, d2 ); |
389 | data = d2; | 391 | data = d2; |
390 | } | 392 | } |