summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp79
1 files changed, 42 insertions, 37 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index aa04631..a480baf 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2797,12 +2797,14 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
int addedAddressee = 0;
int addedAddresseeR = 0;
int deletedAddresseeR = 0;
int deletedAddresseeL = 0;
int changedLocal = 0;
int changedRemote = 0;
+ int filteredIN = 0;
+ int filteredOUT = 0;
QString mCurrentSyncName = syncManager->getCurrentSyncName();
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
//QPtrList<Addressee> el = local->rawAddressees();
Addressee addresseeR;
@@ -2986,12 +2988,14 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
} else {
// pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
remote->removeAddressee( inR );
++deletedAddresseeR;
}
}
+ } else {
+ ++filteredIN;
}
}
}
++incCounter;
}
er.clear();
@@ -3007,55 +3011,56 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
if ( incCounter % modulo == 0 )
syncManager->showProgressBar(incCounter);
uid = el[ incCounter ];
bool skipIncidence = false;
if ( uid.left(19) == QString("last-syncAddressee-") )
skipIncidence = true;
- if ( ! skipIncidence ) {
- inL = local->findByUid( uid );
- if ( (!filterOUT.name().isEmpty()) && (! filterOUT.filterAddressee( inL ) ) )
- skipIncidence = true;
- }
if ( !skipIncidence ) {
+ inL = local->findByUid( uid );
if ( !inL.resource() || inL.resource()->includeInSync() ) {
inR = remote->findByUid( uid );
- if ( inR.isEmpty() ) { // no conflict ********** add or delete local
- 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 ( inR.isEmpty() ){
+ if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) {
+ // no conflict ********** add or delete local
+ 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 ) {
- //qDebug("data %s ", inL.revision().toString().latin1());
- // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
- local->removeAddressee( inL );
- ++deletedAddresseeL;
} else {
- if ( ! syncManager->mWriteBackExistingOnly ) {
- ++addedAddresseeR;
- inL.setRevision( modifiedCalendar );
- local->insertAddressee( inL, false );
- inR = inL;
- inR.setIDStr( ":" );
- inR.setResource( 0 );
- remote->insertAddressee( inR, false );
+ if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
+ //qDebug("data %s ", inL.revision().toString().latin1());
+ // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
+ local->removeAddressee( inL );
+ ++deletedAddresseeL;
+ } else {
+ if ( ! syncManager->mWriteBackExistingOnly ) {
+ ++addedAddresseeR;
+ inL.setRevision( modifiedCalendar );
+ local->insertAddressee( inL, false );
+ inR = inL;
+ inR.setIDStr( ":" );
+ inR.setResource( 0 );
+ remote->insertAddressee( inR, false );
+ }
}
}
+ } else {
+ ++filteredOUT;
}
}
}
}
++incCounter;
}
@@ -3077,13 +3082,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
addresseeLSync.setNote( "" );
if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
remote->insertAddressee( addresseeRSync, false );
local->insertAddressee( addresseeLSync, false );
QString mes;
- mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
+ mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT );
qDebug( mes );
mes = i18n("Local addressbook changed!\n") +mes;
if ( syncManager->mShowSyncSummary ) {
if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
i18n("KA/Pi Synchronization"),i18n("Write back"))) {
qDebug("cancelled ");