summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-09-19 20:27:44 (UTC)
committer zautrix <zautrix>2004-09-19 20:27:44 (UTC)
commit3da2cfeab2edbe64a17251662e56668fe143f7a3 (patch) (side-by-side diff)
tree37e8d4445fca84bd4e93af38c96c5c489f9cbca8 /kaddressbook
parentafa28a62314117555d6b32291188eedd1a576284 (diff)
downloadkdepimpi-3da2cfeab2edbe64a17251662e56668fe143f7a3.zip
kdepimpi-3da2cfeab2edbe64a17251662e56668fe143f7a3.tar.gz
kdepimpi-3da2cfeab2edbe64a17251662e56668fe143f7a3.tar.bz2
more AB sync
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
@@ -2925,19 +2925,13 @@ bool KABCore::syncAB(QString filename, int mode)
if ( abLocal.load() ) {
qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
bool external = false;
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() ) {
if ( lse.familyName().left(4) == "!E: " )
external = true;
} else {
@@ -2975,28 +2969,13 @@ bool KABCore::syncAB(QString filename, int mode)
if ( external && filename.right(4) != ".xml")
abLocal.removeDeletedAddressees();
qDebug("Saving remote AB ");
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 );
}
}
}
setModified();
}