-rw-r--r-- | kabc/addressee.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 711c261..0157721 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -260,46 +260,50 @@ void Addressee::computeCsum(const QString &dev) | |||
260 | t.sort(); | 260 | t.sort(); |
261 | for ( iii = 0; iii < t.count(); ++iii) | 261 | for ( iii = 0; iii < t.count(); ++iii) |
262 | l.append( t[iii] ); | 262 | l.append( t[iii] ); |
263 | KABC::Address::List::Iterator addressIter; | 263 | KABC::Address::List::Iterator addressIter; |
264 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 264 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
265 | ++addressIter ) { | 265 | ++addressIter ) { |
266 | t = (*addressIter).asList(); | 266 | t = (*addressIter).asList(); |
267 | t.sort(); | 267 | t.sort(); |
268 | for ( iii = 0; iii < t.count(); ++iii) | 268 | for ( iii = 0; iii < t.count(); ++iii) |
269 | l.append( t[iii] ); | 269 | l.append( t[iii] ); |
270 | } | 270 | } |
271 | uint cs = getCsum4List(l); | 271 | uint cs = getCsum4List(l); |
272 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 272 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
273 | setCsum( dev, QString::number (cs )); | 273 | setCsum( dev, QString::number (cs )); |
274 | } | 274 | } |
275 | 275 | ||
276 | void Addressee::mergeContact( Addressee ad ) | 276 | void Addressee::mergeContact( const Addressee& ad ) |
277 | { | 277 | { |
278 | |||
279 | detach(); | ||
280 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | ||
281 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | ||
282 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | ||
283 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | ||
284 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | ||
285 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | ||
286 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | ||
287 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | ||
288 | if ( !mData->birthday.isValid() ) | ||
289 | if ( ad.mData->birthday.isValid()) | ||
290 | mData->birthday = ad.mData->birthday; | ||
291 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | ||
278 | #if 0 | 292 | #if 0 |
279 | if ( !mData->name.isEmpty() ) l.append(mData->name); | 293 | if ( !mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
280 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | ||
281 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | ||
282 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | ||
283 | if ( !mData->additionalName ) l.append( mData->additionalName ); | ||
284 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | ||
285 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | ||
286 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | ||
287 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | ||
288 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | ||
289 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | ||
290 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 294 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
291 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 295 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
292 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 296 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
293 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 297 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
294 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 298 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
295 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 299 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
296 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 300 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
297 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 301 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
298 | #endif | 302 | #endif |
299 | } | 303 | } |
300 | 304 | ||
301 | void Addressee::removeID(const QString &prof) | 305 | void Addressee::removeID(const QString &prof) |
302 | { | 306 | { |
303 | detach(); | 307 | detach(); |
304 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 308 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
305 | 309 | ||