summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
Unidiff
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index ff05f7e..16927e2 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -431,37 +431,45 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem
431 (*it).setTagged( true ); 431 (*it).setTagged( true );
432 insertAddressee( (*it), false, true ); 432 insertAddressee( (*it), false, true );
433 } 433 }
434 if ( removeOld ) 434 if ( removeOld )
435 removeUntagged(); 435 removeUntagged();
436} 436}
437void AddressBook::setUntagged() 437void AddressBook::setUntagged()
438{ 438{
439 Iterator ait; 439 Iterator ait;
440 for ( ait = begin(); ait != end(); ++ait ) { 440 for ( ait = begin(); ait != end(); ++ait ) {
441 (*ait).setTagged( false ); 441 (*ait).setTagged( false );
442 } 442 }
443} 443}
444void AddressBook::removeUntagged() 444void AddressBook::removeUntagged()
445{ 445{
446 Iterator ait; 446 Iterator ait;
447 bool todelete = false;
448 Iterator todel;
447 for ( ait = begin(); ait != end(); ++ait ) { 449 for ( ait = begin(); ait != end(); ++ait ) {
448 if (!(*ait).tagged()) 450 if ( todelete )
449 removeAddressee( ait ); 451 removeAddressee( todel );
450 } 452 if (!(*ait).tagged()) {
451 453 todelete = true;
454 todel = ait;
455 } else
456 todelete = false;
457 }
458 if ( todelete )
459 removeAddressee( todel );
452 deleteRemovedAddressees(); 460 deleteRemovedAddressees();
453} 461}
454bool AddressBook::saveAB() 462bool AddressBook::saveAB()
455{ 463{
456 bool ok = true; 464 bool ok = true;
457 465
458 deleteRemovedAddressees(); 466 deleteRemovedAddressees();
459 Iterator ait; 467 Iterator ait;
460 for ( ait = begin(); ait != end(); ++ait ) { 468 for ( ait = begin(); ait != end(); ++ait ) {
461 if ( !(*ait).IDStr().isEmpty() ) { 469 if ( !(*ait).IDStr().isEmpty() ) {
462 (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); 470 (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
463 } 471 }
464 } 472 }
465 KRES::Manager<Resource>::ActiveIterator it; 473 KRES::Manager<Resource>::ActiveIterator it;
466 KRES::Manager<Resource> *manager = d->mManager; 474 KRES::Manager<Resource> *manager = d->mManager;
467 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 475 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {