summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/filter.cpp24
-rw-r--r--kaddressbook/filter.h1
2 files changed, 18 insertions, 7 deletions
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index 7a869fa..12ab1e3 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -33,3 +33,3 @@
33Filter::Filter() 33Filter::Filter()
34 : mName( QString::null ), mMatchRule( Matching ), mEnabled( true ), 34 : mName( QString::null ), mMatchRule( NotMatching ), mEnabled( true ),
35 mInternal( false ) 35 mInternal( false )
@@ -37,2 +37,3 @@ Filter::Filter()
37 mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; 37 mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
38 noName = true;
38} 39}
@@ -40,3 +41,3 @@ Filter::Filter()
40Filter::Filter( const QString &name ) 41Filter::Filter( const QString &name )
41 : mName( name ), mMatchRule( Matching ), mEnabled( true ), 42 : mName( name ), mMatchRule( NotMatching ), mEnabled( true ),
42 mInternal( false ) 43 mInternal( false )
@@ -44,2 +45,3 @@ Filter::Filter( const QString &name )
44 mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; 45 mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
46 noName = false;
45} 47}
@@ -53,2 +55,3 @@ void Filter::setName( const QString &name )
53 mName = name; 55 mName = name;
56 noName = false;
54} 57}
@@ -66,3 +69,5 @@ bool Filter::isInternal() const
66void Filter::apply( KABC::Addressee::List &addresseeList ) 69void Filter::apply( KABC::Addressee::List &addresseeList )
67{ 70{
71 if ( noName )
72 return;
68 KABC::Addressee::List::Iterator iter; 73 KABC::Addressee::List::Iterator iter;
@@ -84,2 +89,6 @@ bool Filter::filterAddressee( const KABC::Addressee &a )
84{ 89{
90
91 if ( noName )
92 return true;
93 //qDebug("Filter::filterAddressee %s",mName.latin1() );
85 switch ( a.secrecy().type()) { 94 switch ( a.secrecy().type()) {
@@ -103,6 +112,5 @@ bool Filter::filterAddressee( const KABC::Addressee &a )
103 iter = mCategoryList.begin(); 112 iter = mCategoryList.begin();
104 // empty filter always matches
105 113
106 if ( iter == mCategoryList.end() ) 114 if ( iter == mCategoryList.end() )
107 return true; 115 return ( !(mMatchRule == Matching) );
108 116
@@ -146,3 +154,4 @@ void Filter::save( KConfig *config )
146void Filter::restore( KConfig *config ) 154void Filter::restore( KConfig *config )
147{ 155{
156 noName = false;
148 mName = config->readEntry( "Name", "<internal error>" ); 157 mName = config->readEntry( "Name", "<internal error>" );
@@ -207,3 +216,4 @@ Filter::List Filter::restore( KConfig *config, QString baseGroup )
207 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { 216 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
208 Filter filter; 217 Filter filter;
218 filter.noName = false;
209 filter.mName = *it; 219 filter.mName = *it;
diff --git a/kaddressbook/filter.h b/kaddressbook/filter.h
index 93f1352..f4ae123 100644
--- a/kaddressbook/filter.h
+++ b/kaddressbook/filter.h
@@ -148,2 +148,3 @@ class Filter
148 private: 148 private:
149 bool noName;
149 int mCriteria; 150 int mCriteria;