summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp75
1 files changed, 1 insertions, 74 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 1a1bcff..2a2f904 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -849,80 +849,7 @@ void KABCore::setSearchFields( const KABC::Field::List &fields )
void KABCore::incrementalSearch( const QString& text )
{
- mViewManager->setSelected( QString::null, false );
-
- if ( !text.isEmpty() ) {
- KABC::Field *field = mIncSearchWidget->currentField();
- QString pattern = text.lower()+"*";
- QRegExp re;
- re.setWildcard(true); // most people understand these better.
- re.setCaseSensitive(false);
- re.setPattern( pattern );
- QStringList foundUids;
- if (!re.isValid())
- return;
-#if 1 //KDE_VERSION >= 319
- KABC::AddresseeList list( mAddressBook->allAddressees() );
- if ( field ) {
- list.sortByField( field );
- KABC::AddresseeList::Iterator it;
- for ( it = list.begin(); it != list.end(); ++it ) {
-
-#if QT_VERSION >= 300
- if (re.search(field->value( *it ).lower()) != -1)
-#else
- if (re.match(field->value( *it ).lower()) != -1)
-#endif
- {
- // if ( field->value( *it ).lower().startsWith( pattern ) ) {
- //mViewManager->setSelected( (*it).uid(), true );
- foundUids.append( (*it).uid() );
- //return;
- }
- }
- } else {
- KABC::AddresseeList::Iterator it;
- for ( it = list.begin(); it != list.end(); ++it ) {
- KABC::Field::List fieldList = mIncSearchWidget->fields();
- KABC::Field::List::ConstIterator fieldIt;
- for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
-#if QT_VERSION >= 300
- if (re.search((*fieldIt)->value( *it ).lower()) != -1)
-#else
- if (re.match((*fieldIt)->value( *it ).lower()) != -1)
-#endif
- {
- // if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
- //mViewManager->setSelected( (*it).uid(), true );
- foundUids.append( (*it).uid() );
- //return;
- }
- }
- }
- }
- if ( foundUids.count() > 0 )
- mViewManager->setListSelected( foundUids );
-#else
- KABC::AddressBook::Iterator it;
- for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
- if ( field ) {
- if ( field->value( *it ).lower().startsWith( pattern ) ) {
- mViewManager->setSelected( (*it).uid(), true );
- return;
- }
- } else {
- KABC::Field::List fieldList = mIncSearchWidget->fields();
- KABC::Field::List::ConstIterator fieldIt;
- for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
- if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
- mViewManager->setSelected( (*it).uid(), true );
- return;
- }
- }
- }
- }
-#endif
- }
+ mViewManager->doSearch( text, mIncSearchWidget->currentField() );
}
void KABCore::setModified()