author | zautrix <zautrix> | 2005-01-16 12:48:47 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-16 12:48:47 (UTC) |
commit | 3f61f5a339e9c0c67c17b16214abded0d123f246 (patch) (unidiff) | |
tree | e3e858f70d85f5a8c6e1547113eae924be73c5c3 | |
parent | f3f63a1a1363cba9f58790812e43d6eda14f733c (diff) | |
download | kdepimpi-3f61f5a339e9c0c67c17b16214abded0d123f246.zip kdepimpi-3f61f5a339e9c0c67c17b16214abded0d123f246.tar.gz kdepimpi-3f61f5a339e9c0c67c17b16214abded0d123f246.tar.bz2 |
applied AB filters
-rw-r--r-- | kaddressbook/kabcore.cpp | 63 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 2 |
3 files changed, 47 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 | |||
@@ -2869,2 +2869,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
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("*************************** "); |
@@ -2948,30 +2953,32 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2948 | } else { // no conflict ********** add or delete remote | 2953 | } else { // no conflict ********** add or delete remote |
2949 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2954 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { |
2950 | QString des = addresseeLSync.note(); | 2955 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2951 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 2956 | QString des = addresseeLSync.note(); |
2952 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 2957 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
2953 | remote->insertAddressee( inR, false ); | 2958 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
2954 | ++deletedAddresseeR; | 2959 | remote->insertAddressee( inR, false ); |
2955 | } else { | 2960 | ++deletedAddresseeR; |
2956 | inR.setRevision( modifiedCalendar ); | 2961 | } else { |
2957 | remote->insertAddressee( inR, false ); | 2962 | inR.setRevision( modifiedCalendar ); |
2958 | inL = inR; | 2963 | remote->insertAddressee( inR, false ); |
2959 | inL.setIDStr( ":" ); | 2964 | inL = inR; |
2960 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2965 | inL.setIDStr( ":" ); |
2961 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2966 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2962 | inL.setResource( 0 ); | 2967 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2963 | local->insertAddressee( inL , false); | 2968 | inL.setResource( 0 ); |
2964 | ++addedAddressee; | 2969 | local->insertAddressee( inL , false); |
2965 | } | 2970 | ++addedAddressee; |
2966 | } else { | 2971 | } |
2967 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | ||
2968 | inR.setRevision( modifiedCalendar ); | ||
2969 | remote->insertAddressee( inR, false ); | ||
2970 | inR.setResource( 0 ); | ||
2971 | local->insertAddressee( inR, false ); | ||
2972 | ++addedAddressee; | ||
2973 | } else { | 2972 | } else { |
2974 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 2973 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
2975 | remote->removeAddressee( inR ); | 2974 | inR.setRevision( modifiedCalendar ); |
2976 | ++deletedAddresseeR; | 2975 | remote->insertAddressee( inR, false ); |
2976 | inR.setResource( 0 ); | ||
2977 | local->insertAddressee( inR, false ); | ||
2978 | ++addedAddressee; | ||
2979 | } else { | ||
2980 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | ||
2981 | remote->removeAddressee( inR ); | ||
2982 | ++deletedAddresseeR; | ||
2983 | } | ||
2977 | } | 2984 | } |
@@ -2998,2 +3005,4 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2998 | skipIncidence = true; | 3005 | skipIncidence = true; |
3006 | if ( !filterOUT.name().isEmpty() && ! filterOUT.filterAddressee( inL ) ) | ||
3007 | skipIncidence = true; | ||
2999 | if ( !skipIncidence ) { | 3008 | if ( !skipIncidence ) { |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 59bddd9..9c3a641 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -620,2 +620,11 @@ QStringList ViewManager::filterNames() const | |||
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 | ||
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index a03a83f..272e1b0 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -30,2 +30,3 @@ | |||
30 | #include <qdict.h> | 30 | #include <qdict.h> |
31 | #include "filter.h" | ||
31 | 32 | ||
@@ -61,2 +62,3 @@ class ViewManager : public QWidget | |||
61 | KSelectAction * getFilterAction() { return mActionSelectFilter; } | 62 | KSelectAction * getFilterAction() { return mActionSelectFilter; } |
63 | Filter getFilterByName( const QString &name ) const; | ||
62 | 64 | ||