-rw-r--r-- | kabc/addressbook.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 64832f1..86dc7c2 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -599,12 +599,44 @@ Addressee AddressBook::findByUid( const QString &uid ) if ( uid == (*it).uid() ) { return *it; } } return Addressee(); } +void AddressBook::preExternSync( 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 ); + } + mergeAB( aBook ,csd ); +} +void AddressBook::postExternSync( AddressBook* aBook , const QString& csd) +{ + qDebug("AddressBook::postExternSync "); + AddressBook::Iterator it; + for ( it = begin(); it != end(); ++it ) { + if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || + (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { + Addressee ad = aBook->findByUid( ( (*it).uid() )); + if ( ad.isEmpty() ) { + qDebug("ERROR ad empty "); + } else { + (*it).computeCsum( csd ); + if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) + ad.setID( csd, (*it).externalUID() ); + ad.setCsum( csd, (*it).getCsum( csd ) ); + aBook->insertAddressee( ad ); + } + } + } +} + + Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) { Iterator it; for ( it = begin(); it != end(); ++it ) { if ( uid == (*it).getID( profile ) ) return (*it); |