-rw-r--r-- | kabc/addressbook.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 5774c36..6194d6d 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -848,130 +848,130 @@ void AddressBook::removeAddressee( const Addressee &a ) } } } if ( found ) removeAddressee( it2 ); } void AddressBook::removeSyncAddressees( bool removeDeleted ) { Iterator it = begin(); Iterator it2 ; QDateTime dt ( QDate( 2004,1,1) ); while ( it != end() ) { (*it).setRevision( dt ); if (( *it).IDStr() != "changed" ) { // "changed" is used for tagging changed addressees when syncing with KDE or OL (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); (*it).setIDStr(""); } if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { it2 = it; //qDebug("removing %s ",(*it).uid().latin1() ); ++it; 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).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); } ++it; } } deleteRemovedAddressees(); } void AddressBook::removeAddressee( const Iterator &it ) { d->mRemovedAddressees.append( (*it) ); d->mAddressees.remove( it.d->mIt ); } AddressBook::Iterator AddressBook::find( const Addressee &a ) { Iterator it; for ( it = begin(); it != end(); ++it ) { if ( a.uid() == (*it).uid() ) { return it; } } return end(); } Addressee AddressBook::findByUid( const QString &uid ) { Iterator it; for ( it = begin(); it != end(); ++it ) { if ( uid == (*it).uid() ) { return *it; } } return Addressee(); } void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) { //qDebug("AddressBook::preExternSync "); AddressBook::Iterator it; for ( it = begin(); it != end(); ++it ) { (*it).setID( csd, (*it).externalUID() ); (*it).computeCsum( csd ); } mergeAB( aBook ,csd, isSubset ); } 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() ); 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 ( setID ) { if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) ad.setID( csd, (*it).externalUID() ); } else - ad.setID( csd, "_" ); + ad.setID( csd, (*it).uid() ); ad.setCsum( csd, (*it).getCsum( csd ) ); aBook->insertAddressee( ad ); } } } } bool AddressBook::containsExternalUid( const QString& uid ) { Iterator it; for ( it = begin(); it != end(); ++it ) { if ( uid == (*it).externalUID( ) ) return true; } return false; } 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 , bool isSubset ) { Iterator it; Addressee ad; for ( it = begin(); it != end(); ++it ) { ad = aBook->findByExternUid( (*it).externalUID(), profile ); if ( !ad.isEmpty() ) { |