-rw-r--r-- | kabc/addressee.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index e571980..19a1845 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -302,32 +302,48 @@ void Addressee::mergeContact( const Addressee& ad ) | |||
302 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 302 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
303 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | 303 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; |
304 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | 304 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; |
305 | 305 | ||
306 | // pending: | 306 | // pending: |
307 | // merging phonenumbers | 307 | // merging phonenumbers |
308 | // merging addresses | 308 | // merging addresses |
309 | // merging emails; | 309 | // merging emails; |
310 | // merging categories; | 310 | // merging categories; |
311 | // merging custom; | 311 | // merging custom; |
312 | // merging keys | 312 | // merging keys |
313 | qDebug("merge contact %s ", ad.uid().latin1()); | 313 | qDebug("merge contact %s ", ad.uid().latin1()); |
314 | setUid( ad.uid() ); | 314 | setUid( ad.uid() ); |
315 | setRevision( ad.revision() ); | 315 | setRevision( ad.revision() ); |
316 | } | 316 | } |
317 | 317 | ||
318 | void Addressee::simplifyAddresses() | ||
319 | { | ||
320 | if ( mData->addresses.count() < 3 ) return ; | ||
321 | int count = 0; | ||
322 | Address::List list; | ||
323 | Address::List::Iterator it; | ||
324 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | ||
325 | if ( count > 1 ) | ||
326 | list.append( *it ); | ||
327 | ++count; | ||
328 | } | ||
329 | for( it = list.begin(); it != list.end(); ++it ) { | ||
330 | removeAddress( (*it) ); | ||
331 | } | ||
332 | } | ||
333 | |||
318 | // removes all emails but the first | 334 | // removes all emails but the first |
319 | // needed by phone sync | 335 | // needed by phone sync |
320 | void Addressee::simplifyEmails() | 336 | void Addressee::simplifyEmails() |
321 | { | 337 | { |
322 | if ( mData->emails.count() == 0 ) return ; | 338 | if ( mData->emails.count() == 0 ) return ; |
323 | QString email = mData->emails.first(); | 339 | QString email = mData->emails.first(); |
324 | detach(); | 340 | detach(); |
325 | mData->emails.clear(); | 341 | mData->emails.clear(); |
326 | mData->emails.append( email ); | 342 | mData->emails.append( email ); |
327 | } | 343 | } |
328 | 344 | ||
329 | void Addressee::simplifyPhoneNumbers() | 345 | void Addressee::simplifyPhoneNumbers() |
330 | { | 346 | { |
331 | KABC::PhoneNumber::List removeNumbers; | 347 | KABC::PhoneNumber::List removeNumbers; |
332 | KABC::PhoneNumber::List::Iterator phoneIter; | 348 | KABC::PhoneNumber::List::Iterator phoneIter; |
333 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 349 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |