-rw-r--r-- | kabc/addressbook.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 6e8d027..3ec0795 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -424,64 +424,65 @@ void AddressBook::clear() | |||
424 | 424 | ||
425 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) | 425 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) |
426 | { | 426 | { |
427 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; | 427 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; |
428 | 428 | ||
429 | if ( !resource ) | 429 | if ( !resource ) |
430 | { | 430 | { |
431 | qDebug("AddressBook::requestSaveTicket no resource" ); | 431 | qDebug("AddressBook::requestSaveTicket no resource" ); |
432 | resource = standardResource(); | 432 | resource = standardResource(); |
433 | } | 433 | } |
434 | 434 | ||
435 | KRES::Manager<Resource>::ActiveIterator it; | 435 | KRES::Manager<Resource>::ActiveIterator it; |
436 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 436 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
437 | if ( (*it) == resource ) { | 437 | if ( (*it) == resource ) { |
438 | if ( (*it)->readOnly() || !(*it)->isOpen() ) | 438 | if ( (*it)->readOnly() || !(*it)->isOpen() ) |
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 ) | 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 | (*it).setRevision( QDateTime::currentDateTime() ); | 463 | if ( setRev ) |
464 | (*it).setRevision( QDateTime::currentDateTime() ); | ||
464 | (*it).setChanged( true ); | 465 | (*it).setChanged( true ); |
465 | } | 466 | } |
466 | 467 | ||
467 | return; | 468 | return; |
468 | } | 469 | } |
469 | } | 470 | } |
470 | d->mAddressees.append( a ); | 471 | d->mAddressees.append( a ); |
471 | Addressee& addr = d->mAddressees.last(); | 472 | Addressee& addr = d->mAddressees.last(); |
472 | if ( addr.resource() == 0 ) | 473 | if ( addr.resource() == 0 ) |
473 | addr.setResource( standardResource() ); | 474 | addr.setResource( standardResource() ); |
474 | 475 | ||
475 | addr.setChanged( true ); | 476 | addr.setChanged( true ); |
476 | } | 477 | } |
477 | 478 | ||
478 | void AddressBook::removeAddressee( const Addressee &a ) | 479 | void AddressBook::removeAddressee( const Addressee &a ) |
479 | { | 480 | { |
480 | Iterator it; | 481 | Iterator it; |
481 | for ( it = begin(); it != end(); ++it ) { | 482 | for ( it = begin(); it != end(); ++it ) { |
482 | if ( a.uid() == (*it).uid() ) { | 483 | if ( a.uid() == (*it).uid() ) { |
483 | removeAddressee( it ); | 484 | removeAddressee( it ); |
484 | return; | 485 | return; |
485 | } | 486 | } |
486 | } | 487 | } |
487 | } | 488 | } |