summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
Side-by-side diff
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressee.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index e571980..19a1845 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -302,32 +302,48 @@ void Addressee::mergeContact( const Addressee& ad )
if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
// pending:
// merging phonenumbers
// merging addresses
// merging emails;
// merging categories;
// merging custom;
// merging keys
qDebug("merge contact %s ", ad.uid().latin1());
setUid( ad.uid() );
setRevision( ad.revision() );
}
+void Addressee::simplifyAddresses()
+{
+ if ( mData->addresses.count() < 3 ) return ;
+ int count = 0;
+ Address::List list;
+ Address::List::Iterator it;
+ for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
+ if ( count > 1 )
+ 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();
detach();
mData->emails.clear();
mData->emails.append( email );
}
void Addressee::simplifyPhoneNumbers()
{
KABC::PhoneNumber::List removeNumbers;
KABC::PhoneNumber::List::Iterator phoneIter;
for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();