summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views
Unidiff
Diffstat (limited to 'kaddressbook/views') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp4
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp4
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp6
3 files changed, 13 insertions, 1 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index 15f154e..2c9b162 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -270,45 +270,49 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field )
270 if ( s.isEmpty() || s == "*" ) { 270 if ( s.isEmpty() || s == "*" ) {
271 refresh(); 271 refresh();
272 return; 272 return;
273 } 273 }
274 QString pattern = s.lower()+"*"; 274 QString pattern = s.lower()+"*";
275 QRegExp re; 275 QRegExp re;
276 re.setWildcard(true); // most people understand these better. 276 re.setWildcard(true); // most people understand these better.
277 re.setCaseSensitive(false); 277 re.setCaseSensitive(false);
278 re.setPattern( pattern ); 278 re.setPattern( pattern );
279 if (!re.isValid()) 279 if (!re.isValid())
280 return; 280 return;
281 mCardView->viewport()->setUpdatesEnabled( false ); 281 mCardView->viewport()->setUpdatesEnabled( false );
282 KABC::Addressee::List addresseeList = addressees(); 282 KABC::Addressee::List addresseeList = addressees();
283 KABC::Addressee::List::Iterator it; 283 KABC::Addressee::List::Iterator it;
284 if ( field ) { 284 if ( field ) {
285 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 285 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
286 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
287 continue;
286#if QT_VERSION >= 300 288#if QT_VERSION >= 300
287 if (re.search(field->value( *it ).lower()) != -1) 289 if (re.search(field->value( *it ).lower()) != -1)
288#else 290#else
289 if (re.match(field->value( *it ).lower()) != -1) 291 if (re.match(field->value( *it ).lower()) != -1)
290#endif 292#endif
291 new AddresseeCardViewItem(fields(), mShowEmptyFields, 293 new AddresseeCardViewItem(fields(), mShowEmptyFields,
292 addressBook(), *it, mCardView); 294 addressBook(), *it, mCardView);
293 295
294 } 296 }
295 } else { 297 } else {
296 KABC::Field::List fieldList = fields(); 298 KABC::Field::List fieldList = fields();
297 KABC::Field::List::ConstIterator fieldIt; 299 KABC::Field::List::ConstIterator fieldIt;
298 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 300 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
301 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
302 continue;
299 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 303 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
300#if QT_VERSION >= 300 304#if QT_VERSION >= 300
301 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 305 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
302#else 306#else
303 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 307 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
304#endif 308#endif
305 { 309 {
306 new AddresseeCardViewItem(fields(), mShowEmptyFields, 310 new AddresseeCardViewItem(fields(), mShowEmptyFields,
307 addressBook(), *it, mCardView); 311 addressBook(), *it, mCardView);
308 continue; 312 continue;
309 } 313 }
310 } 314 }
311 } 315 }
312 } 316 }
313 mCardView->viewport()->setUpdatesEnabled( true ); 317 mCardView->viewport()->setUpdatesEnabled( true );
314 mCardView->viewport()->update(); 318 mCardView->viewport()->update();
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp
index 41c3cb2..0ce56c8 100644
--- a/kaddressbook/views/kaddressbookiconview.cpp
+++ b/kaddressbook/views/kaddressbookiconview.cpp
@@ -257,45 +257,49 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
257 mIconList.clear(); 257 mIconList.clear();
258 if ( s.isEmpty() || s == "*" ) { 258 if ( s.isEmpty() || s == "*" ) {
259 refresh(); 259 refresh();
260 return; 260 return;
261 } 261 }
262 QString pattern = s.lower()+"*"; 262 QString pattern = s.lower()+"*";
263 QRegExp re; 263 QRegExp re;
264 re.setWildcard(true); // most people understand these better. 264 re.setWildcard(true); // most people understand these better.
265 re.setCaseSensitive(false); 265 re.setCaseSensitive(false);
266 re.setPattern( pattern ); 266 re.setPattern( pattern );
267 if (!re.isValid()) 267 if (!re.isValid())
268 return; 268 return;
269 KABC::Addressee::List addresseeList = addressees(); 269 KABC::Addressee::List addresseeList = addressees();
270 KABC::Addressee::List::Iterator it; 270 KABC::Addressee::List::Iterator it;
271 if ( field ) { 271 if ( field ) {
272 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 272 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
273 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
274 continue;
273#if QT_VERSION >= 300 275#if QT_VERSION >= 300
274 if (re.search(field->value( *it ).lower()) != -1) 276 if (re.search(field->value( *it ).lower()) != -1)
275#else 277#else
276 if (re.match(field->value( *it ).lower()) != -1) 278 if (re.match(field->value( *it ).lower()) != -1)
277#endif 279#endif
278 mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); 280 mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
279 281
280 282
281 } 283 }
282 } else { 284 } else {
283 KABC::Field::List fieldList = fields(); 285 KABC::Field::List fieldList = fields();
284 KABC::Field::List::ConstIterator fieldIt; 286 KABC::Field::List::ConstIterator fieldIt;
285 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 287 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
288 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
289 continue;
286 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 290 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
287#if QT_VERSION >= 300 291#if QT_VERSION >= 300
288 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 292 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
289#else 293#else
290 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 294 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
291#endif 295#endif
292 { 296 {
293 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); 297 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
294 continue; 298 continue;
295 } 299 }
296 } 300 }
297 } 301 }
298 } 302 }
299 mIconView->arrangeItemsInGrid( true ); 303 mIconView->arrangeItemsInGrid( true );
300 if ( mIconView->firstItem() ) { 304 if ( mIconView->firstItem() ) {
301 mIconView->setCurrentItem ( mIconView->firstItem() ); 305 mIconView->setCurrentItem ( mIconView->firstItem() );
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 6f20e05..89053c2 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -138,45 +138,49 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
138{ 138{
139 mListView->clear(); 139 mListView->clear();
140 if ( s.isEmpty() || s == "*" ) { 140 if ( s.isEmpty() || s == "*" ) {
141 refresh(); 141 refresh();
142 return; 142 return;
143 } 143 }
144 QString pattern = s.lower()+"*"; 144 QString pattern = s.lower()+"*";
145 QRegExp re; 145 QRegExp re;
146 re.setWildcard(true); // most people understand these better. 146 re.setWildcard(true); // most people understand these better.
147 re.setCaseSensitive(false); 147 re.setCaseSensitive(false);
148 re.setPattern( pattern ); 148 re.setPattern( pattern );
149 if (!re.isValid()) 149 if (!re.isValid())
150 return; 150 return;
151 KABC::Addressee::List addresseeList = addressees(); 151 KABC::Addressee::List addresseeList = addressees();
152 KABC::Addressee::List::Iterator it; 152 KABC::Addressee::List::Iterator it;
153 if ( field ) { 153 if ( field ) {
154 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 154 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
155 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
156 continue;
155#if QT_VERSION >= 300 157#if QT_VERSION >= 300
156 if (re.search(field->value( *it ).lower()) != -1) 158 if (re.search(field->value( *it ).lower()) != -1)
157#else 159#else
158 if (re.match(field->value( *it ).lower()) != -1) 160 if (re.match(field->value( *it ).lower()) != -1)
159#endif 161#endif
160 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 162 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
161 163
162 } 164 }
163 } else { 165 } else {
164 KABC::Field::List fieldList = fields(); 166 KABC::Field::List fieldList = fields();
165 KABC::Field::List::ConstIterator fieldIt; 167 KABC::Field::List::ConstIterator fieldIt;
166 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 168 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
169 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
170 continue;
167 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 171 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
168#if QT_VERSION >= 300 172#if QT_VERSION >= 300
169 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 173 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
170#else 174#else
171 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 175 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
172#endif 176#endif
173 { 177 {
174 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 178 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
175 break; 179 break;
176 } 180 }
177 } 181 }
178 } 182 }
179 } 183 }
180 // Sometimes the background pixmap gets messed up when we add lots 184 // Sometimes the background pixmap gets messed up when we add lots
181 // of items. 185 // of items.
182 mListView->repaint(); 186 mListView->repaint();