-rw-r--r-- | kabc/addressbook.cpp | 19 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kabc/addressee.cpp | 2 |
3 files changed, 17 insertions, 6 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 9b196b5..5774c36 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -874,6 +874,13 @@ void AddressBook::removeSyncAddressees( bool removeDeleted ) removeAddressee( it2 ); } else { //qDebug("skipping %s ",(*it).uid().latin1() ); + if ( removeDeleted ) { + // we have no postprocessing in the resource, we have to do it here + // we have to compute csum for all, because it could be the first sync + (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); + + + } ++it; } } @@ -917,21 +924,25 @@ void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool i } mergeAB( aBook ,csd, isSubset ); } -void AddressBook::postExternSync( AddressBook* aBook , const QString& csd) +void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) { //qDebug("AddressBook::postExternSync "); AddressBook::Iterator it; for ( it = begin(); it != end(); ++it ) { - // qDebug("check uid %s ", (*it).uid().latin1() ); + //qDebug("check uid %s ", (*it).uid().latin1() ); if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { Addressee ad = aBook->findByUid( ( (*it).uid() )); if ( ad.isEmpty() ) { qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); } else { + (*it).setIDStr(":"); (*it).computeCsum( csd ); - if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) - ad.setID( csd, (*it).externalUID() ); + if ( setID ) { + if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) + ad.setID( csd, (*it).externalUID() ); + } else + ad.setID( csd, "_" ); ad.setCsum( csd, (*it).getCsum( csd ) ); aBook->insertAddressee( ad ); } diff --git a/kabc/addressbook.h b/kabc/addressbook.h index f124dc9..75f8b51 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h @@ -307,7 +307,7 @@ class AddressBook : public QObject bool containsExternalUid( const QString& uid ); void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); - void postExternSync( AddressBook* aBook, const QString& csd ); + void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); signals: /** Emitted, when the address book has changed on disk. diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index a660a9d..d5a110a 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -266,7 +266,7 @@ void Addressee::computeCsum(const QString &dev) l.append( t[iii] ); } uint cs = getCsum4List(l); - // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); + //qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); setCsum( dev, QString::number (cs )); } |