-rw-r--r-- | kaddressbook/kaddressbookview.cpp | 20 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 6 |
5 files changed, 23 insertions, 17 deletions
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp index 424d52a..09859c2 100644 --- a/kaddressbook/kaddressbookview.cpp +++ b/kaddressbook/kaddressbookview.cpp | |||
@@ -49,10 +49,26 @@ KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, | |||
49 | 49 | ||
50 | KAddressBookView::~KAddressBookView() | 50 | KAddressBookView::~KAddressBookView() |
51 | { | 51 | { |
52 | kdDebug(5720) << "KAddressBookView::~KAddressBookView: destroying - " | 52 | |
53 | << name() << endl; | ||
54 | } | 53 | } |
55 | 54 | ||
55 | QRegExp KAddressBookView::getRegExp( const QString s ) | ||
56 | { | ||
57 | QRegExp re; | ||
58 | |||
59 | if ( s.length() == 3 && s.mid(1,1) == "-" ) { | ||
60 | QString pattern = "^[" + s.lower() +"]"; | ||
61 | re.setCaseSensitive(false); | ||
62 | re.setPattern( pattern ); | ||
63 | } else { | ||
64 | QString pattern = s.lower()+"*"; | ||
65 | re.setWildcard(true); // most people understand these better. | ||
66 | re.setCaseSensitive(false); | ||
67 | re.setPattern( pattern ); | ||
68 | } | ||
69 | return re; | ||
70 | } | ||
71 | |||
56 | void KAddressBookView::readConfig( KConfig *config ) | 72 | void KAddressBookView::readConfig( KConfig *config ) |
57 | { | 73 | { |
58 | mFieldList = KABC::Field::restoreFields( config, "KABCFields" ); | 74 | mFieldList = KABC::Field::restoreFields( config, "KABCFields" ); |
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 8f31910..6bbb9c2 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -34,6 +34,7 @@ class QDropEvent; | |||
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <kabc/field.h> | 35 | #include <kabc/field.h> |
36 | #include <qwidget.h> | 36 | #include <qwidget.h> |
37 | #include <qregexp.h> | ||
37 | 38 | ||
38 | #include "viewconfigurewidget.h" | 39 | #include "viewconfigurewidget.h" |
39 | #include "filter.h" | 40 | #include "filter.h" |
@@ -245,6 +246,7 @@ class KAddressBookView : public QWidget | |||
245 | around the view (ie: search fields, etc). Do not delete this widget! | 246 | around the view (ie: search fields, etc). Do not delete this widget! |
246 | */ | 247 | */ |
247 | QWidget *viewWidget(); | 248 | QWidget *viewWidget(); |
249 | QRegExp getRegExp( const QString ); | ||
248 | 250 | ||
249 | private: | 251 | private: |
250 | void initGUI(); | 252 | void initGUI(); |
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 9d8c5ce..2b40909 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -300,11 +300,7 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | |||
300 | refresh(); | 300 | refresh(); |
301 | return; | 301 | return; |
302 | } | 302 | } |
303 | QString pattern = s.lower()+"*"; | 303 | QRegExp re = getRegExp( s ); |
304 | QRegExp re; | ||
305 | re.setWildcard(true); // most people understand these better. | ||
306 | re.setCaseSensitive(false); | ||
307 | re.setPattern( pattern ); | ||
308 | if (!re.isValid()) | 304 | if (!re.isValid()) |
309 | return; | 305 | return; |
310 | mCardView->viewport()->setUpdatesEnabled( false ); | 306 | mCardView->viewport()->setUpdatesEnabled( false ); |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index fb53215..3bdfd1a 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -259,11 +259,7 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | |||
259 | refresh(); | 259 | refresh(); |
260 | return; | 260 | return; |
261 | } | 261 | } |
262 | QString pattern = s.lower()+"*"; | 262 | QRegExp re = getRegExp( s ); |
263 | QRegExp re; | ||
264 | re.setWildcard(true); // most people understand these better. | ||
265 | re.setCaseSensitive(false); | ||
266 | re.setPattern( pattern ); | ||
267 | if (!re.isValid()) | 263 | if (!re.isValid()) |
268 | return; | 264 | return; |
269 | KABC::Addressee::List addresseeList = addressees(); | 265 | KABC::Addressee::List addresseeList = addressees(); |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index b73ceaa..f4b008c 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -143,11 +143,7 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | |||
143 | refresh(); | 143 | refresh(); |
144 | return; | 144 | return; |
145 | } | 145 | } |
146 | QString pattern = s.lower()+"*"; | 146 | QRegExp re = getRegExp( s ); |
147 | QRegExp re; | ||
148 | re.setWildcard(true); // most people understand these better. | ||
149 | re.setCaseSensitive(false); | ||
150 | re.setPattern( pattern ); | ||
151 | if (!re.isValid()) | 147 | if (!re.isValid()) |
152 | return; | 148 | return; |
153 | KABC::Addressee::List addresseeList = addressees(); | 149 | KABC::Addressee::List addresseeList = addressees(); |