summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp16
-rw-r--r--kabc/addressee.h1
2 files changed, 17 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
@@ -312,12 +312,28 @@ void Addressee::mergeContact( const Addressee& ad )
// 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();
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 4cafa86..44f0629 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -115,12 +115,13 @@ class Addressee
void setExternalUID( const QString &id );
QString externalUID() const;
void setOriginalExternalUID( const QString &id );
QString originalExternalUID() const;
void mergeContact( const Addressee& ad );
void simplifyEmails();
+ void simplifyAddresses();
void simplifyPhoneNumbers();
void simplifyPhoneNumberTypes();
/**
Set unique identifier.
*/