-rw-r--r-- | kabc/addressbook.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index f9e4387..fe59fcb 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -943,12 +943,29 @@ void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool i for ( it = begin(); it != end(); ++it ) { (*it).setID( csd, (*it).externalUID() ); (*it).computeCsum( csd ); } mergeAB( aBook ,csd, isSubset ); } +void AddressBook::preOLSync( AddressBook* aBook, const QString& csd ) +{ + //qDebug("AddressBook::preExternSync "); + AddressBook::Iterator it; + for ( it = begin(); it != end(); ++it ) { + (*it).setID( csd, (*it).externalUID() ); + (*it).computeCsum( csd ); + } + + Addressee ad; + for ( it = begin(); it != end(); ++it ) { + ad = aBook->findByExternUid( (*it).externalUID(), csd ); + if ( !ad.isEmpty() ) { + (*it).mergeOLContact( ad ); + } + } +} void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) { //qDebug("AddressBook::postExternSync "); AddressBook::Iterator it; int foundEmpty = 0; for ( it = begin(); it != end(); ++it ) { @@ -962,13 +979,14 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); } else { (*it).setIDStr(":"); if ( setID ) { if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) - ad.setID( csd, (*it).externalUID() ); + ad.setID( csd, (*it).externalUID() );{ + } } else ad.setID( csd, (*it).uid() ); (*it).computeCsum( csd ); ad.setCsum( csd, (*it).getCsum( csd ) ); //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); aBook->insertAddressee( ad , false); |