summaryrefslogtreecommitdiffabout
path: root/kaddressbook/filter.cpp
Unidiff
Diffstat (limited to 'kaddressbook/filter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/filter.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index b0d04ca..39d2ae4 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -171,35 +171,36 @@ Filter::List Filter::restore( KConfig *config, QString baseGroup )
171 count = config->readNumEntry( "Count", 0 ); 171 count = config->readNumEntry( "Count", 0 );
172 } 172 }
173 173
174 for ( int i = 0; i < count; i++ ) { 174 for ( int i = 0; i < count; i++ ) {
175 { 175 {
176 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); 176 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) );
177 f.restore( config ); 177 f.restore( config );
178 } 178 }
179 179
180 list.append( f ); 180 list.append( f );
181 } 181 }
182 182
183 QStringList cats = KABPrefs::instance()->mCustomCategories; 183 if ( list.isEmpty()) {
184 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { 184 QStringList cats = KABPrefs::instance()->mCustomCategories;
185 Filter filter; 185 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
186 filter.mName = *it; 186 Filter filter;
187 filter.mEnabled = true; 187 filter.mName = *it;
188 filter.mCategoryList = *it; 188 filter.mEnabled = true;
189 filter.mMatchRule = Matching; 189 filter.mCategoryList = *it;
190 filter.mInternal = true; 190 filter.mMatchRule = Matching;
191 list.append( filter ); 191 filter.mInternal = true;
192 list.append( filter );
193 }
192 } 194 }
193
194 return list; 195 return list;
195} 196}
196 197
197void Filter::setMatchRule( MatchRule rule ) 198void Filter::setMatchRule( MatchRule rule )
198{ 199{
199 mMatchRule = rule; 200 mMatchRule = rule;
200} 201}
201 202
202Filter::MatchRule Filter::matchRule() const 203Filter::MatchRule Filter::matchRule() const
203{ 204{
204 return mMatchRule; 205 return mMatchRule;
205} 206}