summaryrefslogtreecommitdiffabout
path: root/kaddressbook/filter.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/filter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/filter.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index 39d2ae4..9cb4c2d 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -30,2 +30,3 @@
#include "filter.h"
+#include <secrecy.h>
@@ -35,2 +36,3 @@ Filter::Filter()
{
+ mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
}
@@ -41,2 +43,3 @@ Filter::Filter( const QString &name )
{
+ mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
}
@@ -81,2 +84,19 @@ bool Filter::filterAddressee( const KABC::Addressee &a )
{
+ switch ( a.secrecy().type()) {
+ case KABC::Secrecy::Public:
+ if (! (mCriteria & ShowPublic ))
+ return false;
+ break;
+ case KABC::Secrecy::Private:
+ if (! (mCriteria & ShowPrivate ))
+ return false;
+ break;
+ case KABC::Secrecy::Confidential:
+ if (! (mCriteria & ShowConfidential ))
+ return false;
+ break;
+ default:
+ return false;
+ break;
+ }
QStringList::Iterator iter;
@@ -122,2 +142,3 @@ void Filter::save( KConfig *config )
config->writeEntry( "MatchRule", (int)mMatchRule );
+ config->writeEntry( "Criteria", (int)mCriteria );
}
@@ -130,2 +151,3 @@ void Filter::restore( KConfig *config )
mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching );
+ mCriteria = config->readNumEntry( "Criteria", (ShowPublic | ShowPrivate| ShowConfidential) );
}