-rw-r--r-- | kaddressbook/kabcore.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 2 |
3 files changed, 20 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index c6288fa..c5a36e2 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2866,8 +2866,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo qDebug("setting mLastAddressbookSync "); } #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(); Addressee inR ;//= er.first(); @@ -2945,8 +2950,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } } } } else { // no conflict ********** add or delete remote + 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 ); @@ -2977,8 +2983,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } } } } + } ++incCounter; } er.clear(); QStringList el = local->uidList(); @@ -2995,8 +3002,10 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo uid = el[ incCounter ]; 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() ) { inR = remote->findByUid( uid ); diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 59bddd9..9c3a641 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -617,8 +617,17 @@ QStringList ViewManager::filterNames() const names.append( (*it).name() ); return names; } +Filter ViewManager::getFilterByName( const QString &name ) const +{ + Filter::List::ConstIterator it; + for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) + if ( name == (*it).name() ) + return (*it); + + return Filter(); +} int ViewManager::filterPosition( const QString &name ) const { int pos = 0; diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index a03a83f..272e1b0 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h @@ -27,8 +27,9 @@ #include <qwidget.h> #include <qstringlist.h> #include <kaddressbookview.h> #include <qdict.h> +#include "filter.h" class KAction; class KSelectAction; @@ -58,8 +59,9 @@ class ViewManager : public QWidget void doSearch( const QString& s ,KABC::Field *field ); void unloadViews(); KSelectAction * getFilterAction() { return mActionSelectFilter; } + Filter getFilterByName( const QString &name ) const; QStringList selectedUids() const; QStringList selectedEmails() const; KABC::Addressee::List selectedAddressees() const; |