-rw-r--r-- | kabc/addressbook.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 46a9cf4..64832f1 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -248,11 +248,14 @@ void AddressBook::init(const QString &config, const QString &family ) | |||
248 | con->writeEntry( "ResourceKeys", QString("sync") ); | 248 | con->writeEntry( "ResourceKeys", QString("sync") ); |
249 | con->writeEntry( "Standard", QString("sync") ); | 249 | con->writeEntry( "Standard", QString("sync") ); |
250 | con->setGroup( "Resource_sync" ); | 250 | con->setGroup( "Resource_sync" ); |
251 | con->writeEntry( "FileFormat", QString("vcard") ); | ||
252 | con->writeEntry( "FileName", config ); | 251 | con->writeEntry( "FileName", config ); |
252 | con->writeEntry( "FileFormat", QString("vcard") ); | ||
253 | con->writeEntry( "ResourceIdentifier", QString("sync") ); | 253 | con->writeEntry( "ResourceIdentifier", QString("sync") ); |
254 | con->writeEntry( "ResourceName", QString("sync_res") ); | 254 | con->writeEntry( "ResourceName", QString("sync_res") ); |
255 | con->writeEntry( "ResourceType", QString("file") ); | 255 | if ( config.right(4) == ".xml" ) |
256 | con->writeEntry( "ResourceType", QString("qtopia") ); | ||
257 | else | ||
258 | con->writeEntry( "ResourceType", QString("file") ); | ||
256 | //con->sync(); | 259 | //con->sync(); |
257 | d->mConfig = con; | 260 | d->mConfig = con; |
258 | } | 261 | } |
@@ -599,6 +602,27 @@ Addressee AddressBook::findByUid( const QString &uid ) | |||
599 | } | 602 | } |
600 | return Addressee(); | 603 | return Addressee(); |
601 | } | 604 | } |
605 | Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) | ||
606 | { | ||
607 | Iterator it; | ||
608 | for ( it = begin(); it != end(); ++it ) { | ||
609 | if ( uid == (*it).getID( profile ) ) | ||
610 | return (*it); | ||
611 | } | ||
612 | return Addressee(); | ||
613 | } | ||
614 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile ) | ||
615 | { | ||
616 | Iterator it; | ||
617 | Addressee ad; | ||
618 | for ( it = begin(); it != end(); ++it ) { | ||
619 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); | ||
620 | if ( !ad.isEmpty() ) { | ||
621 | (*it).mergeContact( ad ); | ||
622 | } | ||
623 | } | ||
624 | } | ||
625 | |||
602 | #if 0 | 626 | #if 0 |
603 | Addressee::List AddressBook::getExternLastSyncAddressees() | 627 | Addressee::List AddressBook::getExternLastSyncAddressees() |
604 | { | 628 | { |