summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp28
-rw-r--r--kabc/addressee.h2
2 files changed, 17 insertions, 13 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 711c261..0157721 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -275,16 +275,20 @@ void Addressee::computeCsum(const QString &dev)
-void Addressee::mergeContact( Addressee ad )
+void Addressee::mergeContact( const Addressee& ad )
{
+
+ detach();
+ if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
+ if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
+ if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
+ if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
+ if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
+ if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
+ if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
+ if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
+ if ( !mData->birthday.isValid() )
+ if ( ad.mData->birthday.isValid())
+ mData->birthday = ad.mData->birthday;
+ if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
#if 0
- if ( !mData->name.isEmpty() ) l.append(mData->name);
- if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
- if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
- if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
- if ( !mData->additionalName ) l.append( mData->additionalName );
- if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
- if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
- if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
- if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
- if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
- if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
+ if ( !mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 59fcbd8..3ba7777 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -116,3 +116,3 @@ class Addressee
QString externalUID() const;
- void mergeContact( Addressee ad );
+ void mergeContact( const Addressee& ad );
/**