-rw-r--r-- | kabc/addressee.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 295ee4f..2564894 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -448,4 +448,24 @@ bool Addressee::containsAdr(const Addressee& ad ) void Addressee::simplifyAddresses() { + + + Address::List list; + Address::List::Iterator it; + Address::List::Iterator it2; + for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { + it2 = it; + ++it2; + for( ; it2 != mData->addresses.end(); ++it2 ) { + if ( (*it) == (*it2) ) { + list.append( *it ); + break; + } + } + } + for( it = list.begin(); it != list.end(); ++it ) { + removeAddress( (*it) ); + } + + list.clear(); int max = 2; if ( mData->url.isValid() ) @@ -453,6 +473,4 @@ void Addressee::simplifyAddresses() if ( mData->addresses.count() <= max ) return ; int count = 0; - Address::List list; - Address::List::Iterator it; for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { if ( count >= max ) |