From eea0ff04703dffdbe8b67a0dc9f592597d7450c1 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 19 Sep 2004 11:32:40 +0000 Subject: more AB sync --- (limited to 'kabc/addressbook.cpp') 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 ) con->writeEntry( "ResourceKeys", QString("sync") ); con->writeEntry( "Standard", QString("sync") ); 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(); d->mConfig = con; } @@ -599,6 +602,27 @@ Addressee AddressBook::findByUid( const QString &uid ) } return Addressee(); } +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 Addressee::List AddressBook::getExternLastSyncAddressees() { -- cgit v0.9.0.2