summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp146
1 files changed, 75 insertions, 71 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index ea34be2..47ed858 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2553,44 +2553,46 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
- if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
- //qDebug("take %d %s ", take, inL.summary().latin1());
- if ( take == 3 )
- return false;
- if ( take == 1 ) {// take local
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
- inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
- inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
- local->insertAddressee( inL, false );
- idS = inR.externalUID();
- OidS = inR.originalExternalUID();
- }
- else
- idS = inR.IDStr();
- remote->removeAddressee( inR );
- inR = inL;
- inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
- inR.setOriginalExternalUID( OidS );
- inR.setExternalUID( idS );
- } else {
- inR.setIDStr( idS );
- }
- inR.setResource( 0 );
- remote->insertAddressee( inR , false);
- ++changedRemote;
- } else { // take == 2 take remote
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
- if ( inR.revision().date().year() < 2004 )
- inR.setRevision( modifiedCalendar );
- }
- idS = inL.IDStr();
- local->removeAddressee( inL );
- inL = inR;
- inL.setIDStr( idS );
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
- inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
- inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
+ if ( !inL.resource() || inL.resource()->includeInSync() ) {
+ if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
+ //qDebug("take %d %s ", take, inL.summary().latin1());
+ if ( take == 3 )
+ return false;
+ if ( take == 1 ) {// take local
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
+ inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
+ inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
+ local->insertAddressee( inL, false );
+ idS = inR.externalUID();
+ OidS = inR.originalExternalUID();
+ }
+ else
+ idS = inR.IDStr();
+ remote->removeAddressee( inR );
+ inR = inL;
+ inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
+ inR.setOriginalExternalUID( OidS );
+ inR.setExternalUID( idS );
+ } else {
+ inR.setIDStr( idS );
+ }
+ inR.setResource( 0 );
+ remote->insertAddressee( inR , false);
+ ++changedRemote;
+ } else { // take == 2 take remote
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
+ if ( inR.revision().date().year() < 2004 )
+ inR.setRevision( modifiedCalendar );
+ }
+ idS = inL.IDStr();
+ local->removeAddressee( inL );
+ inL = inR;
+ inL.setIDStr( idS );
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
+ inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
+ inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
+ }
+ inL.setResource( 0 );
+ local->insertAddressee( inL , false );
+ ++changedLocal;
}
- inL.setResource( 0 );
- local->insertAddressee( inL , false );
- ++changedLocal;
}
@@ -2647,34 +2649,36 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
inL = local->findByUid( uid );
- inR = remote->findByUid( uid );
- if ( inR.isEmpty() ) {
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
- if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
- // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
- local->removeAddressee( inL );
- ++deletedAddresseeL;
- } else {
- if ( ! syncManager->mWriteBackExistingOnly ) {
- inL.removeID(mCurrentSyncDevice );
- ++addedAddresseeR;
- inL.setRevision( modifiedCalendar );
- local->insertAddressee( inL, false );
- inR = inL;
- inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
- inR.setResource( 0 );
- remote->insertAddressee( inR, false );
+ if ( !inL.resource() || inL.resource()->includeInSync() ) {
+ inR = remote->findByUid( uid );
+ if ( inR.isEmpty() ) {
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
+ if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
+ // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
+ local->removeAddressee( inL );
+ ++deletedAddresseeL;
+ } else {
+ if ( ! syncManager->mWriteBackExistingOnly ) {
+ inL.removeID(mCurrentSyncDevice );
+ ++addedAddresseeR;
+ inL.setRevision( modifiedCalendar );
+ local->insertAddressee( inL, false );
+ inR = inL;
+ inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
+ inR.setResource( 0 );
+ remote->insertAddressee( inR, false );
+ }
}
- }
- } else {
- if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
- // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
- local->removeAddressee( inL );
- ++deletedAddresseeL;
} else {
- if ( ! syncManager->mWriteBackExistingOnly ) {
- ++addedAddresseeR;
- inL.setRevision( modifiedCalendar );
- local->insertAddressee( inL, false );
- inR = inL;
- inR.setResource( 0 );
- remote->insertAddressee( inR, false );
+ if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
+ // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
+ local->removeAddressee( inL );
+ ++deletedAddresseeL;
+ } else {
+ if ( ! syncManager->mWriteBackExistingOnly ) {
+ ++addedAddresseeR;
+ inL.setRevision( modifiedCalendar );
+ local->insertAddressee( inL, false );
+ inR = inL;
+ inR.setResource( 0 );
+ remote->insertAddressee( inR, false );
+ }
}