-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 @@ -250,7 +250,10 @@ void AddressBook::init(const QString &config, const QString &family ) con->setGroup( "Resource_sync" ); - con->writeEntry( "FileFormat", QString("vcard") ); con->writeEntry( "FileName", config ); + con->writeEntry( "FileFormat", QString("vcard") ); con->writeEntry( "ResourceIdentifier", QString("sync") ); con->writeEntry( "ResourceName", QString("sync_res") ); - con->writeEntry( "ResourceType", QString("file") ); + if ( config.right(4) == ".xml" ) + con->writeEntry( "ResourceType", QString("qtopia") ); + else + con->writeEntry( "ResourceType", QString("file") ); //con->sync(); @@ -601,2 +604,23 @@ Addressee AddressBook::findByUid( const QString &uid ) } +Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) +{ + Iterator it; + for ( it = begin(); it != end(); ++it ) { + if ( uid == (*it).getID( profile ) ) + return (*it); + } + return Addressee(); +} +void AddressBook::mergeAB( AddressBook *aBook, const QString& profile ) +{ + Iterator it; + Addressee ad; + for ( it = begin(); it != end(); ++it ) { + ad = aBook->findByExternUid( (*it).externalUID(), profile ); + if ( !ad.isEmpty() ) { + (*it).mergeContact( ad ); + } + } +} + #if 0 |