Diffstat (limited to 'kaddressbook/views/kaddressbookcardview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 2c9b162..2d7ed08 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -250,97 +250,97 @@ void KAddressBookCardView::readConfig(KConfig *config) | |||
250 | if (KABPrefs::instance()->mHonorSingleClick) | 250 | if (KABPrefs::instance()->mHonorSingleClick) |
251 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 251 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
252 | this, SLOT(addresseeExecuted(CardViewItem *))); | 252 | this, SLOT(addresseeExecuted(CardViewItem *))); |
253 | else | 253 | else |
254 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), | 254 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), |
255 | this, SLOT(addresseeExecuted(CardViewItem *))); | 255 | this, SLOT(addresseeExecuted(CardViewItem *))); |
256 | #endif | 256 | #endif |
257 | 257 | ||
258 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), | 258 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), |
259 | this, SLOT(addresseeExecuted(CardViewItem *))); | 259 | this, SLOT(addresseeExecuted(CardViewItem *))); |
260 | } | 260 | } |
261 | 261 | ||
262 | void KAddressBookCardView::writeConfig( KConfig *config ) | 262 | void KAddressBookCardView::writeConfig( KConfig *config ) |
263 | { | 263 | { |
264 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); | 264 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); |
265 | KAddressBookView::writeConfig( config ); | 265 | KAddressBookView::writeConfig( config ); |
266 | } | 266 | } |
267 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | 267 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) |
268 | { | 268 | { |
269 | mCardView->clear(); | 269 | mCardView->clear(); |
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-") ) | 286 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
287 | continue; | 287 | continue; |
288 | #if QT_VERSION >= 300 | 288 | #if QT_VERSION >= 300 |
289 | if (re.search(field->value( *it ).lower()) != -1) | 289 | if (re.search(field->value( *it ).lower()) != -1) |
290 | #else | 290 | #else |
291 | if (re.match(field->value( *it ).lower()) != -1) | 291 | if (re.match(field->value( *it ).lower()) != -1) |
292 | #endif | 292 | #endif |
293 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 293 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
294 | addressBook(), *it, mCardView); | 294 | addressBook(), *it, mCardView); |
295 | 295 | ||
296 | } | 296 | } |
297 | } else { | 297 | } else { |
298 | KABC::Field::List fieldList = fields(); | 298 | KABC::Field::List fieldList = allFields(); |
299 | KABC::Field::List::ConstIterator fieldIt; | 299 | KABC::Field::List::ConstIterator fieldIt; |
300 | 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-") ) | 301 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
302 | continue; | 302 | continue; |
303 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 303 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
304 | #if QT_VERSION >= 300 | 304 | #if QT_VERSION >= 300 |
305 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 305 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
306 | #else | 306 | #else |
307 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 307 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
308 | #endif | 308 | #endif |
309 | { | 309 | { |
310 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 310 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
311 | addressBook(), *it, mCardView); | 311 | addressBook(), *it, mCardView); |
312 | continue; | 312 | continue; |
313 | } | 313 | } |
314 | } | 314 | } |
315 | } | 315 | } |
316 | } | 316 | } |
317 | mCardView->viewport()->setUpdatesEnabled( true ); | 317 | mCardView->viewport()->setUpdatesEnabled( true ); |
318 | mCardView->viewport()->update(); | 318 | mCardView->viewport()->update(); |
319 | if ( mCardView->firstItem() ) { | 319 | if ( mCardView->firstItem() ) { |
320 | mCardView->setCurrentItem ( mCardView->firstItem() ); | 320 | mCardView->setCurrentItem ( mCardView->firstItem() ); |
321 | mCardView->setSelected ( mCardView->firstItem() , true ); | 321 | mCardView->setSelected ( mCardView->firstItem() , true ); |
322 | } | 322 | } |
323 | else | 323 | else |
324 | emit selected(QString::null); | 324 | emit selected(QString::null); |
325 | } | 325 | } |
326 | QStringList KAddressBookCardView::selectedUids() | 326 | QStringList KAddressBookCardView::selectedUids() |
327 | { | 327 | { |
328 | QStringList uidList; | 328 | QStringList uidList; |
329 | CardViewItem *item; | 329 | CardViewItem *item; |
330 | AddresseeCardViewItem *aItem; | 330 | AddresseeCardViewItem *aItem; |
331 | 331 | ||
332 | for (item = mCardView->firstItem(); item; item = item->nextItem()) | 332 | for (item = mCardView->firstItem(); item; item = item->nextItem()) |
333 | { | 333 | { |
334 | if (item->isSelected()) | 334 | if (item->isSelected()) |
335 | { | 335 | { |
336 | #ifndef KAB_EMBEDDED | 336 | #ifndef KAB_EMBEDDED |
337 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 337 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
338 | #else //KAB_EMBEDDED | 338 | #else //KAB_EMBEDDED |
339 | aItem = (AddresseeCardViewItem*)(item); | 339 | aItem = (AddresseeCardViewItem*)(item); |
340 | #endif //KAB_EMBEDDED | 340 | #endif //KAB_EMBEDDED |
341 | if (aItem) | 341 | if (aItem) |
342 | uidList << aItem->addressee().uid(); | 342 | uidList << aItem->addressee().uid(); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | return uidList; | 346 | return uidList; |