summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
Side-by-side diff
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp22
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();