Diffstat (limited to 'kaddressbook/views/kaddressbookiconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index ef0a23a..fb53215 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp @@ -211,145 +211,145 @@ KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, KAddressBookIconView::~KAddressBookIconView() { } void KAddressBookIconView::setFocusAV() { if ( mIconView ) mIconView->setFocus(); } void KAddressBookIconView::scrollUP() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); QApplication::postEvent( mIconView, ev ); } void KAddressBookIconView::scrollDOWN() { QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); QApplication::postEvent( mIconView, ev ); } void KAddressBookIconView::readConfig(KConfig *config) { KAddressBookView::readConfig(config); //US method executed is part of KIconView //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), //US this, SLOT(addresseeExecuted(QIconViewItem *))); disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), this, SLOT(addresseeExecuted(QIconViewItem *))); //US method executed is part of KIconView. Use selectionChanged instead /*US if (KABPrefs::instance()->mHonorSingleClick) connect(mIconView, SIGNAL(executed(QIconViewItem *)), this, SLOT(addresseeExecuted(QIconViewItem *))); else connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), this, SLOT(addresseeExecuted(QIconViewItem *))); */ connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), this, SLOT(addresseeExecuted(QIconViewItem *))); } void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) { mIconView->clear(); mIconList.clear(); if ( s.isEmpty() || s == "*" ) { refresh(); return; } QString pattern = s.lower()+"*"; QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); re.setPattern( pattern ); if (!re.isValid()) return; KABC::Addressee::List addresseeList = addressees(); KABC::Addressee::List::Iterator it; if ( field ) { for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 if (re.search(field->value( *it ).lower()) != -1) #else if (re.match(field->value( *it ).lower()) != -1) #endif mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); } } else { KABC::Field::List fieldList = allFields(); KABC::Field::List::ConstIterator fieldIt; for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 if (re.search((*fieldIt)->value( *it ).lower()) != -1) #else if (re.match((*fieldIt)->value( *it ).lower()) != -1) #endif { mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); break; } } } } mIconView->arrangeItemsInGrid( true ); if ( mIconView->firstItem() ) { mIconView->setCurrentItem ( mIconView->firstItem() ); mIconView->setSelected ( mIconView->firstItem() , true ); } else emit selected(QString::null); } QStringList KAddressBookIconView::selectedUids() { QStringList uidList; QIconViewItem *item; AddresseeIconViewItem *aItem; for (item = mIconView->firstItem(); item; item = item->nextItem()) { if (item->isSelected()) { #ifndef KAB_EMBEDDED aItem = dynamic_cast<AddresseeIconViewItem*>(item); #else //KAB_EMBEDDED aItem = (AddresseeIconViewItem*)(item); #endif //KAB_EMBEDDED if (aItem) uidList << aItem->addressee().uid(); } } return uidList; } void KAddressBookIconView::refresh(QString uid) { QIconViewItem *item; AddresseeIconViewItem *aItem; if ( uid.isNull() ) { // Rebuild the view mIconView->clear(); mIconList.clear(); KABC::Addressee::List addresseeList = addressees(); KABC::Addressee::List::Iterator iter; for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) continue; aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); } mIconView->arrangeItemsInGrid( true ); for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { |