-rw-r--r-- | kabc/addressbook.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index ff05f7e..16927e2 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -435,29 +435,37 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem removeUntagged(); } void AddressBook::setUntagged() { Iterator ait; for ( ait = begin(); ait != end(); ++ait ) { (*ait).setTagged( false ); } } void AddressBook::removeUntagged() { Iterator ait; + bool todelete = false; + Iterator todel; for ( ait = begin(); ait != end(); ++ait ) { - if (!(*ait).tagged()) - removeAddressee( ait ); + if ( todelete ) + removeAddressee( todel ); + if (!(*ait).tagged()) { + todelete = true; + todel = ait; + } else + todelete = false; } - + if ( todelete ) + removeAddressee( todel ); deleteRemovedAddressees(); } bool AddressBook::saveAB() { bool ok = true; deleteRemovedAddressees(); Iterator ait; for ( ait = begin(); ait != end(); ++ait ) { if ( !(*ait).IDStr().isEmpty() ) { (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); } |