-rw-r--r-- | kaddressbook/kabcore.cpp | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index c6288fa..c5a36e2 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2867,6 +2867,11 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } #endif + + // ********** setting filters **************** + Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); + Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); + //qDebug("*************************** "); // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); QStringList er = remote->uidList(); @@ -2946,34 +2951,36 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } } } else { // no conflict ********** add or delete remote - if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { - QString des = addresseeLSync.note(); - if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it - inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); - remote->insertAddressee( inR, false ); - ++deletedAddresseeR; - } else { - inR.setRevision( modifiedCalendar ); - remote->insertAddressee( inR, false ); - inL = inR; - inL.setIDStr( ":" ); - inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); - inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); - inL.setResource( 0 ); - local->insertAddressee( inL , false); - ++addedAddressee; - } - } else { - if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { - inR.setRevision( modifiedCalendar ); - remote->insertAddressee( inR, false ); - inR.setResource( 0 ); - local->insertAddressee( inR, false ); - ++addedAddressee; + if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { + QString des = addresseeLSync.note(); + if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it + inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); + remote->insertAddressee( inR, false ); + ++deletedAddresseeR; + } else { + inR.setRevision( modifiedCalendar ); + remote->insertAddressee( inR, false ); + inL = inR; + inL.setIDStr( ":" ); + inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); + inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); + inL.setResource( 0 ); + local->insertAddressee( inL , false); + ++addedAddressee; + } } else { - // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); - remote->removeAddressee( inR ); - ++deletedAddresseeR; + if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { + inR.setRevision( modifiedCalendar ); + remote->insertAddressee( inR, false ); + inR.setResource( 0 ); + local->insertAddressee( inR, false ); + ++addedAddressee; + } else { + // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); + remote->removeAddressee( inR ); + ++deletedAddresseeR; + } } } } @@ -2996,6 +3003,8 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo bool skipIncidence = false; if ( uid.left(19) == QString("last-syncAddressee-") ) skipIncidence = true; + if ( !filterOUT.name().isEmpty() && ! filterOUT.filterAddressee( inL ) ) + skipIncidence = true; if ( !skipIncidence ) { inL = local->findByUid( uid ); if ( !inL.resource() || inL.resource()->includeInSync() ) { |