author | zautrix <zautrix> | 2005-04-04 12:59:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-04 12:59:35 (UTC) |
commit | 919f1060a9ef41e6c865f28132cf9e82c3f67409 (patch) (unidiff) | |
tree | 8e7c1283071ff2af2897ccf1c7e51e8b2b2bfadc | |
parent | 23db4aa99cb7a5feb540b6be578efaee8ec6ef80 (diff) | |
download | kdepimpi-919f1060a9ef41e6c865f28132cf9e82c3f67409.zip kdepimpi-919f1060a9ef41e6c865f28132cf9e82c3f67409.tar.gz kdepimpi-919f1060a9ef41e6c865f28132cf9e82c3f67409.tar.bz2 |
kapi filter fixes
-rw-r--r-- | kaddressbook/filter.cpp | 24 | ||||
-rw-r--r-- | kaddressbook/filter.h | 1 |
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 | |||
@@ -32,15 +32,17 @@ | |||
32 | 32 | ||
33 | Filter::Filter() | 33 | Filter::Filter() |
34 | : mName( QString::null ), mMatchRule( Matching ), mEnabled( true ), | 34 | : mName( QString::null ), mMatchRule( NotMatching ), mEnabled( true ), |
35 | mInternal( false ) | 35 | mInternal( false ) |
36 | { | 36 | { |
37 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; | 37 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; |
38 | noName = true; | ||
38 | } | 39 | } |
39 | 40 | ||
40 | Filter::Filter( const QString &name ) | 41 | Filter::Filter( const QString &name ) |
41 | : mName( name ), mMatchRule( Matching ), mEnabled( true ), | 42 | : mName( name ), mMatchRule( NotMatching ), mEnabled( true ), |
42 | mInternal( false ) | 43 | mInternal( false ) |
43 | { | 44 | { |
44 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; | 45 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; |
46 | noName = false; | ||
45 | } | 47 | } |
46 | 48 | ||
@@ -52,4 +54,5 @@ void Filter::setName( const QString &name ) | |||
52 | { | 54 | { |
53 | mName = name; | 55 | mName = name; |
56 | noName = false; | ||
54 | } | 57 | } |
55 | 58 | ||
@@ -65,5 +68,7 @@ bool Filter::isInternal() const | |||
65 | 68 | ||
66 | void Filter::apply( KABC::Addressee::List &addresseeList ) | 69 | void 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; |
69 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ) { | 74 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ) { |
@@ -83,4 +88,8 @@ void Filter::apply( KABC::Addressee::List &addresseeList ) | |||
83 | bool Filter::filterAddressee( const KABC::Addressee &a ) | 88 | 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()) { |
86 | case KABC::Secrecy::Public: | 95 | case KABC::Secrecy::Public: |
@@ -102,8 +111,7 @@ bool Filter::filterAddressee( const KABC::Addressee &a ) | |||
102 | QStringList::Iterator iter; | 111 | QStringList::Iterator iter; |
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 | ||
109 | for ( ; iter != mCategoryList.end(); ++iter ) { | 117 | for ( ; iter != mCategoryList.end(); ++iter ) { |
@@ -145,5 +153,6 @@ void Filter::save( KConfig *config ) | |||
145 | 153 | ||
146 | void Filter::restore( KConfig *config ) | 154 | void Filter::restore( KConfig *config ) |
147 | { | 155 | { |
156 | noName = false; | ||
148 | mName = config->readEntry( "Name", "<internal error>" ); | 157 | mName = config->readEntry( "Name", "<internal error>" ); |
149 | mEnabled = config->readBoolEntry( "Enabled", true ); | 158 | mEnabled = config->readBoolEntry( "Enabled", true ); |
@@ -206,5 +215,6 @@ Filter::List Filter::restore( KConfig *config, QString baseGroup ) | |||
206 | QStringList cats = KABPrefs::instance()->mCustomCategories; | 215 | QStringList cats = KABPrefs::instance()->mCustomCategories; |
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; |
210 | filter.mEnabled = true; | 220 | filter.mEnabled = true; |
diff --git a/kaddressbook/filter.h b/kaddressbook/filter.h index 93f1352..f4ae123 100644 --- a/kaddressbook/filter.h +++ b/kaddressbook/filter.h | |||
@@ -147,4 +147,5 @@ class Filter | |||
147 | 147 | ||
148 | private: | 148 | private: |
149 | bool noName; | ||
149 | int mCriteria; | 150 | int mCriteria; |
150 | QString mName; | 151 | QString mName; |