summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp9
-rw-r--r--kaddressbook/viewmanager.cpp9
-rw-r--r--kaddressbook/viewmanager.h2
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
@@ -2864,12 +2864,17 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
if ( mCurrentSyncDevice == "deleteaftersync" ) {
mLastAddressbookSync = loadedFileVersion;
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();
Addressee inL;
@@ -2943,12 +2948,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
local->insertAddressee( inL , false );
++changedLocal;
}
}
}
} 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 );
remote->insertAddressee( inR, false );
++deletedAddresseeR;
@@ -2975,12 +2981,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
remote->removeAddressee( inR );
++deletedAddresseeR;
}
}
}
}
+ }
++incCounter;
}
er.clear();
QStringList el = local->uidList();
modulo = (el.count()/10)+1;
@@ -2993,12 +3000,14 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
if ( incCounter % modulo == 0 )
syncManager->showProgressBar(incCounter);
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 );
if ( inR.isEmpty() ) { // no conflict ********** add or delete local
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 59bddd9..9c3a641 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -615,12 +615,21 @@ QStringList ViewManager::filterNames() const
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
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;
Filter::List::ConstIterator it;
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h
index a03a83f..272e1b0 100644
--- a/kaddressbook/viewmanager.h
+++ b/kaddressbook/viewmanager.h
@@ -25,12 +25,13 @@
#define VIEWMANAGER_H
#include <qwidget.h>
#include <qstringlist.h>
#include <kaddressbookview.h>
#include <qdict.h>
+#include "filter.h"
class KAction;
class KSelectAction;
class KABCore;
class QWidgetStack;
@@ -56,12 +57,13 @@ class ViewManager : public QWidget
void restoreSettings();
void saveSettings();
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;
void setListSelected(QStringList);
void setFocusAV();