summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index b3d88de..8f3ca9b 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2928,13 +2928,7 @@ bool KABCore::syncAB(QString filename, int mode)
if ( filename.right(4) == ".xml") {
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
- AddressBook::Iterator it;
- for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
- (*it).setID( mCurrentSyncDevice, (*it).externalUID() );
- (*it).computeCsum( mCurrentSyncDevice );
- }
- abLocal.mergeAB( mAddressBook ,mCurrentSyncDevice );
-
+ abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
} else {
Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
if ( ! lse.isEmpty() ) {
@@ -2978,22 +2972,7 @@ bool KABCore::syncAB(QString filename, int mode)
abLocal.saveAB();
if ( external && filename.right(4) == ".xml") {
// afterwrite processing
- AddressBook::Iterator it;
- for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
- if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
- (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) {
- Addressee ad = mAddressBook->findByUid( ( (*it).uid() ));
- if ( ad.isEmpty() ) {
- qDebug("ERROR ad empty ");
- } else {
- (*it).computeCsum( mCurrentSyncDevice );
- if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
- ad.setID( mCurrentSyncDevice, (*it).externalUID() );
- ad.setCsum( mCurrentSyncDevice, (*it).getCsum( mCurrentSyncDevice ) );
- mAddressBook->insertAddressee( ad );
- }
- }
- }
+ abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
}
}
}