-rw-r--r-- | kabc/addressbook.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 3ec0795..d03dea3 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -439,50 +439,55 @@ Ticket *AddressBook::requestSaveTicket( Resource *resource ) | |||
439 | return 0; | 439 | return 0; |
440 | else | 440 | else |
441 | return (*it)->requestSaveTicket(); | 441 | return (*it)->requestSaveTicket(); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | 447 | ||
448 | void AddressBook::insertAddressee( const Addressee &a, bool setRev ) | 448 | void AddressBook::insertAddressee( const Addressee &a, bool setRev ) |
449 | { | 449 | { |
450 | Addressee::List::Iterator it; | 450 | Addressee::List::Iterator it; |
451 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 451 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
452 | if ( a.uid() == (*it).uid() ) { | 452 | if ( a.uid() == (*it).uid() ) { |
453 | bool changed = false; | 453 | bool changed = false; |
454 | Addressee addr = a; | 454 | Addressee addr = a; |
455 | if ( addr != (*it) ) | 455 | if ( addr != (*it) ) |
456 | changed = true; | 456 | changed = true; |
457 | 457 | ||
458 | (*it) = a; | 458 | (*it) = a; |
459 | if ( (*it).resource() == 0 ) | 459 | if ( (*it).resource() == 0 ) |
460 | (*it).setResource( standardResource() ); | 460 | (*it).setResource( standardResource() ); |
461 | 461 | ||
462 | if ( changed ) { | 462 | if ( changed ) { |
463 | if ( setRev ) | 463 | if ( setRev ) { |
464 | (*it).setRevision( QDateTime::currentDateTime() ); | 464 | // get rid of micro seconds |
465 | QDateTime dt = QDateTime::currentDateTime(); | ||
466 | QTime t = dt.time(); | ||
467 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | ||
468 | (*it).setRevision( dt ); | ||
469 | } | ||
465 | (*it).setChanged( true ); | 470 | (*it).setChanged( true ); |
466 | } | 471 | } |
467 | 472 | ||
468 | return; | 473 | return; |
469 | } | 474 | } |
470 | } | 475 | } |
471 | d->mAddressees.append( a ); | 476 | d->mAddressees.append( a ); |
472 | Addressee& addr = d->mAddressees.last(); | 477 | Addressee& addr = d->mAddressees.last(); |
473 | if ( addr.resource() == 0 ) | 478 | if ( addr.resource() == 0 ) |
474 | addr.setResource( standardResource() ); | 479 | addr.setResource( standardResource() ); |
475 | 480 | ||
476 | addr.setChanged( true ); | 481 | addr.setChanged( true ); |
477 | } | 482 | } |
478 | 483 | ||
479 | void AddressBook::removeAddressee( const Addressee &a ) | 484 | void AddressBook::removeAddressee( const Addressee &a ) |
480 | { | 485 | { |
481 | Iterator it; | 486 | Iterator it; |
482 | for ( it = begin(); it != end(); ++it ) { | 487 | for ( it = begin(); it != end(); ++it ) { |
483 | if ( a.uid() == (*it).uid() ) { | 488 | if ( a.uid() == (*it).uid() ) { |
484 | removeAddressee( it ); | 489 | removeAddressee( it ); |
485 | return; | 490 | return; |
486 | } | 491 | } |
487 | } | 492 | } |
488 | } | 493 | } |