-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 42 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 6 |
5 files changed, 48 insertions, 15 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 94c37e7..2ffa357 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp | |||
@@ -69,8 +69,11 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) | |||
69 | 69 | ||
70 | #ifdef DESKTOP_VERSION | ||
71 | // for performance reasons, we do a search on the pda only after return is pressed | ||
70 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), | 72 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), |
71 | SLOT( announceDoSearch() ) ); | 73 | SLOT( announceDoSearch() ) ); |
72 | connect( mSearchText, SIGNAL( returnPressed() ), | ||
73 | SLOT( announceDoSearch() ) ); | ||
74 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 74 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
75 | SLOT( announceDoSearch() ) ); | 75 | SLOT( announceDoSearch() ) ); |
76 | #endif | ||
77 | connect( mSearchText, SIGNAL( returnPressed() ), | ||
78 | SLOT( announceDoSearch() ) ); | ||
76 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 79 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index f0f08f4..4299ebd 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -835,5 +835,10 @@ void KABCore::incrementalSearch( const QString& text ) | |||
835 | KABC::Field *field = mIncSearchWidget->currentField(); | 835 | KABC::Field *field = mIncSearchWidget->currentField(); |
836 | 836 | QString pattern = text.lower()+"*"; | |
837 | QString pattern = text.lower(); | 837 | QRegExp re; |
838 | 838 | re.setWildcard(true); // most people understand these better. | |
839 | re.setCaseSensitive(false); | ||
840 | re.setPattern( pattern ); | ||
841 | QStringList foundUids; | ||
842 | if (!re.isValid()) | ||
843 | return; | ||
839 | #if 1 //KDE_VERSION >= 319 | 844 | #if 1 //KDE_VERSION >= 319 |
@@ -844,6 +849,14 @@ void KABCore::incrementalSearch( const QString& text ) | |||
844 | for ( it = list.begin(); it != list.end(); ++it ) { | 849 | for ( it = list.begin(); it != list.end(); ++it ) { |
845 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 850 | |
846 | mViewManager->setSelected( (*it).uid(), true ); | 851 | #if QT_VERSION >= 300 |
847 | return; | 852 | if (re.search(field->value( *it ).lower()) != -1) |
848 | } | 853 | #else |
854 | if (re.match(field->value( *it ).lower()) != -1) | ||
855 | #endif | ||
856 | { | ||
857 | // if ( field->value( *it ).lower().startsWith( pattern ) ) { | ||
858 | //mViewManager->setSelected( (*it).uid(), true ); | ||
859 | foundUids.append( (*it).uid() ); | ||
860 | //return; | ||
861 | } | ||
849 | } | 862 | } |
@@ -855,5 +868,12 @@ void KABCore::incrementalSearch( const QString& text ) | |||
855 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 868 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
856 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 869 | #if QT_VERSION >= 300 |
857 | mViewManager->setSelected( (*it).uid(), true ); | 870 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
858 | return; | 871 | #else |
872 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | ||
873 | #endif | ||
874 | { | ||
875 | // if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | ||
876 | //mViewManager->setSelected( (*it).uid(), true ); | ||
877 | foundUids.append( (*it).uid() ); | ||
878 | //return; | ||
859 | } | 879 | } |
@@ -862,2 +882,4 @@ void KABCore::incrementalSearch( const QString& text ) | |||
862 | } | 882 | } |
883 | if ( foundUids.count() > 0 ) | ||
884 | mViewManager->setListSelected( foundUids ); | ||
863 | #else | 885 | #else |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 45c7b55..c93d51a 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -180,2 +180,9 @@ void ViewManager::setSelected( const QString &uid, bool selected ) | |||
180 | 180 | ||
181 | void ViewManager::setListSelected(QStringList list) | ||
182 | { | ||
183 | int i, count = list.count(); | ||
184 | for ( i = 0; i < count;++i ) | ||
185 | setSelected( list[i], true ); | ||
186 | |||
187 | } | ||
181 | void ViewManager::unloadViews() | 188 | void ViewManager::unloadViews() |
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index a18e87d..97c2275 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -64,2 +64,3 @@ class ViewManager : public QWidget | |||
64 | KABC::Addressee::List selectedAddressees() const; | 64 | KABC::Addressee::List selectedAddressees() const; |
65 | void setListSelected(QStringList); | ||
65 | 66 | ||
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 66a3f0b..0847b64 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -124,2 +124,5 @@ void KAddressBookTableView::readConfig(KConfig *config) | |||
124 | KAddressBookView::readConfig( config ); | 124 | KAddressBookView::readConfig( config ); |
125 | // The config could have changed the fields, so we need to reconstruct | ||
126 | // the listview. | ||
127 | reconstructListView(); | ||
125 | 128 | ||
@@ -169,5 +172,2 @@ void KAddressBookTableView::readConfig(KConfig *config) | |||
169 | 172 | ||
170 | // The config could have changed the fields, so we need to reconstruct | ||
171 | // the listview. | ||
172 | reconstructListView(); | ||
173 | 173 | ||