author | zautrix <zautrix> | 2005-01-18 09:31:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-18 09:31:59 (UTC) |
commit | 2d6776d79732f6771885a549de5c37f9e75f7641 (patch) (unidiff) | |
tree | 5dc2abf48a99e2a35f8e1458f731b3ef9210ac7e /kabc/addressee.cpp | |
parent | 522486966ecf041a6e49913b6e420d58d4284837 (diff) | |
download | kdepimpi-2d6776d79732f6771885a549de5c37f9e75f7641.zip kdepimpi-2d6776d79732f6771885a549de5c37f9e75f7641.tar.gz kdepimpi-2d6776d79732f6771885a549de5c37f9e75f7641.tar.bz2 |
fixed merging
-rw-r--r-- | kabc/addressee.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 3b238f5..82b4b9b 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -284,8 +284,11 @@ void Addressee::computeCsum(const QString &dev) | |||
284 | 284 | ||
285 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | 285 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) |
286 | { | 286 | { |
287 | // merge all standard non-outlook fields. | ||
288 | //if isSubSet (e.g. mobile phone sync) merge all fields | ||
287 | 289 | ||
288 | detach(); | 290 | detach(); |
291 | if ( isSubSet ) { | ||
289 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 292 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
290 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 293 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
291 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 294 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
@@ -293,26 +296,29 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
293 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 296 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
294 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 297 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
295 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 298 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
299 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | ||
300 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | ||
296 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 301 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
302 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | ||
303 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | ||
304 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | ||
305 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | ||
297 | if ( !mData->birthday.isValid() ) | 306 | if ( !mData->birthday.isValid() ) |
298 | if ( ad.mData->birthday.isValid()) | 307 | if ( ad.mData->birthday.isValid()) |
299 | mData->birthday = ad.mData->birthday; | 308 | mData->birthday = ad.mData->birthday; |
309 | |||
310 | } | ||
300 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 311 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
301 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 312 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
302 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 313 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
303 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | ||
304 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | ||
305 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | ||
306 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | ||
307 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 314 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
308 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 315 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
309 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | ||
310 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | ||
311 | QStringList t; | 316 | QStringList t; |
312 | QStringList tAD; | 317 | QStringList tAD; |
313 | uint iii; | 318 | uint iii; |
314 | 319 | ||
315 | // ********** phone numbers | 320 | // ********** phone numbers |
321 | if ( isSubSet ) { | ||
316 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 322 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
317 | PhoneNumber::List::Iterator phoneItAD; | 323 | PhoneNumber::List::Iterator phoneItAD; |
318 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 324 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
@@ -330,6 +336,7 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
330 | if ( ! found ) // LR try this one... | 336 | if ( ! found ) // LR try this one... |
331 | mData->phoneNumbers.append( *phoneItAD ); | 337 | mData->phoneNumbers.append( *phoneItAD ); |
332 | } | 338 | } |
339 | } | ||
333 | if ( isSubSet ) { | 340 | if ( isSubSet ) { |
334 | // ************* emails; | 341 | // ************* emails; |
335 | t = mData->emails; | 342 | t = mData->emails; |
@@ -340,11 +347,13 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
340 | } | 347 | } |
341 | 348 | ||
342 | // ************* categories; | 349 | // ************* categories; |
350 | if ( isSubSet ) { | ||
343 | t = mData->categories; | 351 | t = mData->categories; |
344 | tAD = ad.mData->categories; | 352 | tAD = ad.mData->categories; |
345 | for ( iii = 0; iii < tAD.count(); ++iii) | 353 | for ( iii = 0; iii < tAD.count(); ++iii) |
346 | if ( !t.contains(tAD[iii] ) ) | 354 | if ( !t.contains(tAD[iii] ) ) |
347 | mData->categories.append( tAD[iii] ); | 355 | mData->categories.append( tAD[iii] ); |
356 | } | ||
348 | QStringList::ConstIterator it; | 357 | QStringList::ConstIterator it; |
349 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { | 358 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { |
350 | QString qualifiedName = (*it).left( (*it).find( ":" )); | 359 | QString qualifiedName = (*it).left( (*it).find( ":" )); |
@@ -389,6 +398,7 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
389 | } | 398 | } |
390 | } | 399 | } |
391 | } | 400 | } |
401 | if ( isSubSet ) { | ||
392 | KABC::Address::List::Iterator addressIterA; | 402 | KABC::Address::List::Iterator addressIterA; |
393 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { | 403 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { |
394 | bool found = false; | 404 | bool found = false; |
@@ -406,6 +416,7 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
406 | mData->addresses.append( *addressIterA ); | 416 | mData->addresses.append( *addressIterA ); |
407 | } | 417 | } |
408 | } | 418 | } |
419 | } | ||
409 | //qDebug("merge contact %s ", ad.uid().latin1()); | 420 | //qDebug("merge contact %s ", ad.uid().latin1()); |
410 | setUid( ad.uid() ); | 421 | setUid( ad.uid() ); |
411 | setRevision( ad.revision() ); | 422 | setRevision( ad.revision() ); |