-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 | |||
2866 | qDebug("setting mLastAddressbookSync "); | 2866 | qDebug("setting mLastAddressbookSync "); |
2867 | } | 2867 | } |
2868 | #endif | 2868 | #endif |
2869 | 2869 | ||
2870 | |||
2871 | // ********** setting filters **************** | ||
2872 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); | ||
2873 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); | ||
2874 | |||
2870 | //qDebug("*************************** "); | 2875 | //qDebug("*************************** "); |
2871 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 2876 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
2872 | QStringList er = remote->uidList(); | 2877 | QStringList er = remote->uidList(); |
2873 | Addressee inR ;//= er.first(); | 2878 | Addressee inR ;//= er.first(); |
@@ -2945,8 +2950,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2945 | } | 2950 | } |
2946 | } | 2951 | } |
2947 | } | 2952 | } |
2948 | } else { // no conflict ********** add or delete remote | 2953 | } else { // no conflict ********** add or delete remote |
2954 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { | ||
2949 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2955 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2950 | QString des = addresseeLSync.note(); | 2956 | QString des = addresseeLSync.note(); |
2951 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 2957 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
2952 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 2958 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
@@ -2977,8 +2983,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2977 | } | 2983 | } |
2978 | } | 2984 | } |
2979 | } | 2985 | } |
2980 | } | 2986 | } |
2987 | } | ||
2981 | ++incCounter; | 2988 | ++incCounter; |
2982 | } | 2989 | } |
2983 | er.clear(); | 2990 | er.clear(); |
2984 | QStringList el = local->uidList(); | 2991 | QStringList el = local->uidList(); |
@@ -2995,8 +3002,10 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2995 | uid = el[ incCounter ]; | 3002 | uid = el[ incCounter ]; |
2996 | bool skipIncidence = false; | 3003 | bool skipIncidence = false; |
2997 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 3004 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2998 | skipIncidence = true; | 3005 | skipIncidence = true; |
3006 | if ( !filterOUT.name().isEmpty() && ! filterOUT.filterAddressee( inL ) ) | ||
3007 | skipIncidence = true; | ||
2999 | if ( !skipIncidence ) { | 3008 | if ( !skipIncidence ) { |
3000 | inL = local->findByUid( uid ); | 3009 | inL = local->findByUid( uid ); |
3001 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 3010 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
3002 | inR = remote->findByUid( uid ); | 3011 | 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 | |||
617 | names.append( (*it).name() ); | 617 | names.append( (*it).name() ); |
618 | 618 | ||
619 | return names; | 619 | return names; |
620 | } | 620 | } |
621 | Filter ViewManager::getFilterByName( const QString &name ) const | ||
622 | { | ||
623 | Filter::List::ConstIterator it; | ||
624 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | ||
625 | if ( name == (*it).name() ) | ||
626 | return (*it); | ||
627 | |||
628 | return Filter(); | ||
629 | } | ||
621 | 630 | ||
622 | int ViewManager::filterPosition( const QString &name ) const | 631 | int ViewManager::filterPosition( const QString &name ) const |
623 | { | 632 | { |
624 | int pos = 0; | 633 | 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 @@ | |||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <kaddressbookview.h> | 29 | #include <kaddressbookview.h> |
30 | #include <qdict.h> | 30 | #include <qdict.h> |
31 | #include "filter.h" | ||
31 | 32 | ||
32 | class KAction; | 33 | class KAction; |
33 | class KSelectAction; | 34 | class KSelectAction; |
34 | 35 | ||
@@ -58,8 +59,9 @@ class ViewManager : public QWidget | |||
58 | void doSearch( const QString& s ,KABC::Field *field ); | 59 | void doSearch( const QString& s ,KABC::Field *field ); |
59 | 60 | ||
60 | void unloadViews(); | 61 | void unloadViews(); |
61 | KSelectAction * getFilterAction() { return mActionSelectFilter; } | 62 | KSelectAction * getFilterAction() { return mActionSelectFilter; } |
63 | Filter getFilterByName( const QString &name ) const; | ||
62 | 64 | ||
63 | QStringList selectedUids() const; | 65 | QStringList selectedUids() const; |
64 | QStringList selectedEmails() const; | 66 | QStringList selectedEmails() const; |
65 | KABC::Addressee::List selectedAddressees() const; | 67 | KABC::Addressee::List selectedAddressees() const; |