-rw-r--r-- | kabc/addressee.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 82b4b9b..bfcfab5 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -323,32 +323,51 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
323 | PhoneNumber::List::Iterator phoneItAD; | 323 | PhoneNumber::List::Iterator phoneItAD; |
324 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 324 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
325 | bool found = false; | 325 | bool found = false; |
326 | PhoneNumber::List::Iterator it; | 326 | PhoneNumber::List::Iterator it; |
327 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 327 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
328 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 328 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
329 | found = true; | 329 | found = true; |
330 | (*it).setType( ( *phoneItAD ).type() ); | 330 | (*it).setType( ( *phoneItAD ).type() ); |
331 | (*it).setNumber( ( *phoneItAD ).number() ); | 331 | (*it).setNumber( ( *phoneItAD ).number() ); |
332 | break; | 332 | break; |
333 | } | 333 | } |
334 | } | 334 | } |
335 | // if ( isSubSet && ! found ) | 335 | // if ( isSubSet && ! found ) |
336 | if ( ! found ) // LR try this one... | 336 | if ( ! found ) // LR try this one... |
337 | mData->phoneNumbers.append( *phoneItAD ); | 337 | mData->phoneNumbers.append( *phoneItAD ); |
338 | } | 338 | } |
339 | } else { | ||
340 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | ||
341 | PhoneNumber::List::Iterator phoneItAD; | ||
342 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | ||
343 | bool found = false; | ||
344 | PhoneNumber::List::Iterator it; | ||
345 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | ||
346 | if ( ( *phoneItAD ).contains( (*it) ) ) { | ||
347 | found = true; | ||
348 | (*it).setType( ( *phoneItAD ).type() ); | ||
349 | (*it).setNumber( ( *phoneItAD ).number() ); | ||
350 | break; | ||
351 | } | ||
352 | } | ||
353 | if ( ! found ) { // append numbers which do not have work or home type | ||
354 | if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) ) | ||
355 | mData->phoneNumbers.append( *phoneItAD ); | ||
356 | } | ||
357 | } | ||
339 | } | 358 | } |
340 | if ( isSubSet ) { | 359 | if ( isSubSet ) { |
341 | // ************* emails; | 360 | // ************* emails; |
342 | t = mData->emails; | 361 | t = mData->emails; |
343 | tAD = ad.mData->emails; | 362 | tAD = ad.mData->emails; |
344 | for ( iii = 0; iii < tAD.count(); ++iii) | 363 | for ( iii = 0; iii < tAD.count(); ++iii) |
345 | if ( !t.contains(tAD[iii] ) ) | 364 | if ( !t.contains(tAD[iii] ) ) |
346 | mData->emails.append( tAD[iii] ); | 365 | mData->emails.append( tAD[iii] ); |
347 | } | 366 | } |
348 | 367 | ||
349 | // ************* categories; | 368 | // ************* categories; |
350 | if ( isSubSet ) { | 369 | if ( isSubSet ) { |
351 | t = mData->categories; | 370 | t = mData->categories; |
352 | tAD = ad.mData->categories; | 371 | tAD = ad.mData->categories; |
353 | for ( iii = 0; iii < tAD.count(); ++iii) | 372 | for ( iii = 0; iii < tAD.count(); ++iii) |
354 | if ( !t.contains(tAD[iii] ) ) | 373 | if ( !t.contains(tAD[iii] ) ) |