author | zautrix <zautrix> | 2005-01-16 12:48:47 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-16 12:48:47 (UTC) |
commit | 3f61f5a339e9c0c67c17b16214abded0d123f246 (patch) (side-by-side diff) | |
tree | e3e858f70d85f5a8c6e1547113eae924be73c5c3 /kaddressbook | |
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 + + // ********** setting filters **************** + Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); + Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); + //qDebug("*************************** "); @@ -2948,30 +2953,32 @@ 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; + } } @@ -2998,2 +3005,4 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo skipIncidence = true; + if ( !filterOUT.name().isEmpty() && ! filterOUT.filterAddressee( inL ) ) + skipIncidence = true; 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 } +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(); +} 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 @@ #include <qdict.h> +#include "filter.h" @@ -61,2 +62,3 @@ class ViewManager : public QWidget KSelectAction * getFilterAction() { return mActionSelectFilter; } + Filter getFilterByName( const QString &name ) const; |