summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
authorzautrix <zautrix>2004-10-10 16:00:04 (UTC)
committer zautrix <zautrix>2004-10-10 16:00:04 (UTC)
commitee6e29a5092d32165b7bf6b39069bd8a1dcd5b0a (patch) (side-by-side diff)
tree1d908bfc23b8a49d43a58bbeadd82c4e08faeff6 /kabc/addressee.cpp
parent213a9d993e5a4751b64e18320cfbebb000681d13 (diff)
downloadkdepimpi-ee6e29a5092d32165b7bf6b39069bd8a1dcd5b0a.zip
kdepimpi-ee6e29a5092d32165b7bf6b39069bd8a1dcd5b0a.tar.gz
kdepimpi-ee6e29a5092d32165b7bf6b39069bd8a1dcd5b0a.tar.bz2
many phone AB sync fixes
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp46
1 files changed, 43 insertions, 3 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 607ae26..548305a 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -305,3 +305,9 @@ void Addressee::mergeContact( const Addressee& ad )
if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
+ PhoneNumber::List phoneAD = phoneNumbers();
+ PhoneNumber::List::Iterator phoneItAD;
+ bool found = false;
+ for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
+
+ }
// pending:
@@ -313,3 +319,3 @@ void Addressee::mergeContact( const Addressee& ad )
// merging keys
- qDebug("merge contact %s ", ad.uid().latin1());
+ //qDebug("merge contact %s ", ad.uid().latin1());
setUid( ad.uid() );
@@ -335,5 +341,39 @@ bool Addressee::removeVoice()
}
+
+bool Addressee::containsAdr(const Addressee& ad )
+{
+ if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false;
+ if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false;
+ if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ;
+ if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ;
+ if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ;
+ if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ;
+ if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ;
+
+ // compare phone numbers
+ PhoneNumber::List phoneN = ad.phoneNumbers();
+ PhoneNumber::List::Iterator phoneIt;
+ bool found = false;
+ for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
+ bool found = false;
+ 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()
{
- if ( mData->addresses.count() < 3 ) return ;
+ int max = 2;
+ if ( mData->url.isValid() )
+ max = 1;
+ if ( mData->addresses.count() <= max ) return ;
int count = 0;
@@ -342,3 +382,3 @@ void Addressee::simplifyAddresses()
for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
- if ( count > 1 )
+ if ( count >= max )
list.append( *it );