summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-13 14:23:28 (UTC)
committer zautrix <zautrix>2004-10-13 14:23:28 (UTC)
commit2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6 (patch) (side-by-side diff)
treef1e664ddf31aae347b1a119c9111cbd1c931bf89 /kaddressbook
parentd41893fb0a49fbb080326a4c1fd98e1a032a182a (diff)
downloadkdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.zip
kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.gz
kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.bz2
more sync fixes
Diffstat (limited to 'kaddressbook') (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
@@ -2551,48 +2551,50 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
//inL.setResource( 0 );
//inR.setResource( 0 );
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;
}
}
} else { // no conflict
@@ -2645,38 +2647,40 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
skipIncidence = true;
if ( !skipIncidence ) {
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 );
+ }
}
}
}