author | zautrix <zautrix> | 2004-10-14 07:24:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-14 07:24:50 (UTC) |
commit | 57bd80b04dddd40a897dce8b6902d1046d71c631 (patch) (side-by-side diff) | |
tree | c51cb1985344173951109f4bffb12bb6a68ea7f7 /kabc | |
parent | a6dff815a9c6d3a91094573d23c28a8553fc7cc2 (diff) | |
download | kdepimpi-57bd80b04dddd40a897dce8b6902d1046d71c631.zip kdepimpi-57bd80b04dddd40a897dce8b6902d1046d71c631.tar.gz kdepimpi-57bd80b04dddd40a897dce8b6902d1046d71c631.tar.bz2 |
phone fixes
-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 @@ -434,39 +434,57 @@ bool Addressee::containsAdr(const Addressee& ad ) PhoneNumber::List phoneL = ad.phoneNumbers(); PhoneNumber::List::Iterator phoneItL; for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { found = true; break; } } if ( ! found ) return false; } return true; } 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() ) max = 1; 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 ) list.append( *it ); ++count; } for( it = list.begin(); it != list.end(); ++it ) { removeAddress( (*it) ); } } // removes all emails but the first // needed by phone sync void Addressee::simplifyEmails() { if ( mData->emails.count() == 0 ) return ; QString email = mData->emails.first(); |