summaryrefslogtreecommitdiffabout
path: root/kaddressbook/filter.cpp
Unidiff
Diffstat (limited to 'kaddressbook/filter.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/filter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index 12ab1e3..6462310 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -173,66 +173,66 @@ void Filter::save( KConfig *config, QString baseGroup, Filter::List &list )
173 config->deleteGroup( QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); 173 config->deleteGroup( QString( "%1_%2" ).arg( baseGroup ).arg( i ) );
174 */ 174 */
175 } 175 }
176 176
177 int index = 0; 177 int index = 0;
178 Filter::List::Iterator iter; 178 Filter::List::Iterator iter;
179 for ( iter = list.begin(); iter != list.end(); ++iter ) { 179 for ( iter = list.begin(); iter != list.end(); ++iter ) {
180 if ( !(*iter).mInternal ) { 180 if ( !(*iter).mInternal ) {
181 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( index ) ); 181 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( index ) );
182 182
183 (*iter).save( config ); 183 (*iter).save( config );
184 index++; 184 index++;
185 } 185 }
186 } 186 }
187 187
188 KConfigGroupSaver s( config, baseGroup ); 188 KConfigGroupSaver s( config, baseGroup );
189 189
190 config->writeEntry( "Count", index ); 190 config->writeEntry( "Count", index );
191 191
192} 192}
193 193
194Filter::List Filter::restore( KConfig *config, QString baseGroup ) 194Filter::List Filter::restore( KConfig *config, QString baseGroup )
195{ 195{
196 Filter::List list; 196 Filter::List list;
197 int count = 0; 197 int count = 0;
198 Filter f; 198 Filter f;
199 199
200 { 200 {
201 KConfigGroupSaver s( config, baseGroup ); 201 KConfigGroupSaver s( config, baseGroup );
202 count = config->readNumEntry( "Count", 0 ); 202 count = config->readNumEntry( "Count", 0 );
203 } 203 }
204 204
205 for ( int i = 0; i < count; i++ ) { 205 for ( int i = 0; i < count; i++ ) {
206 { 206 {
207 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); 207 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) );
208 f.restore( config ); 208 f.restore( config );
209 } 209 }
210 210
211 list.append( f ); 211 list.append( f );
212 } 212 }
213 213
214 if ( list.isEmpty()) { 214 if ( list.isEmpty()) {
215 QStringList cats = KABPrefs::instance()->mCustomCategories; 215 QStringList cats = KABPrefs::instance()->mCustomCategories;
216 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { 216 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
217 Filter filter; 217 Filter filter;
218 filter.noName = false; 218 filter.noName = false;
219 filter.mName = *it; 219 filter.mName = *it;
220 filter.mEnabled = true; 220 filter.mEnabled = true;
221 filter.mCategoryList = *it; 221 filter.mCategoryList = QStringList(*it);
222 filter.mMatchRule = Matching; 222 filter.mMatchRule = Matching;
223 filter.mInternal = true; 223 filter.mInternal = true;
224 list.append( filter ); 224 list.append( filter );
225 } 225 }
226 } 226 }
227 return list; 227 return list;
228} 228}
229 229
230void Filter::setMatchRule( MatchRule rule ) 230void Filter::setMatchRule( MatchRule rule )
231{ 231{
232 mMatchRule = rule; 232 mMatchRule = rule;
233} 233}
234 234
235Filter::MatchRule Filter::matchRule() const 235Filter::MatchRule Filter::matchRule() const
236{ 236{
237 return mMatchRule; 237 return mMatchRule;
238} 238}