-rw-r--r-- | kaddressbook/filter.cpp | 22 |
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 @@ -29,4 +29,5 @@ #include "filter.h" +#include <secrecy.h> Filter::Filter() @@ -34,4 +35,5 @@ Filter::Filter() mInternal( false ) { + mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; } @@ -40,4 +42,5 @@ Filter::Filter( const QString &name ) mInternal( false ) { + mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; } @@ -80,4 +83,21 @@ void Filter::apply( KABC::Addressee::List &addresseeList ) 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; iter = mCategoryList.begin(); @@ -121,4 +141,5 @@ void Filter::save( KConfig *config ) config->writeEntry( "Categories", mCategoryList ); config->writeEntry( "MatchRule", (int)mMatchRule ); + config->writeEntry( "Criteria", (int)mCriteria ); } @@ -129,4 +150,5 @@ void Filter::restore( KConfig *config ) mCategoryList = config->readListEntry( "Categories" ); mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching ); + mCriteria = config->readNumEntry( "Criteria", (ShowPublic | ShowPrivate| ShowConfidential) ); } |