summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kaddressbookview.cpp20
-rw-r--r--kaddressbook/kaddressbookview.h2
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp6
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp6
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp6
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
@@ -51,6 +51,22 @@ KAddressBookView::~KAddressBookView()
{
- kdDebug(5720) << "KAddressBookView::~KAddressBookView: destroying - "
- << name() << endl;
+
}
+QRegExp KAddressBookView::getRegExp( const QString s )
+{
+ QRegExp re;
+
+ if ( s.length() == 3 && s.mid(1,1) == "-" ) {
+ QString pattern = "^[" + s.lower() +"]";
+ re.setCaseSensitive(false);
+ re.setPattern( pattern );
+ } else {
+ QString pattern = s.lower()+"*";
+ re.setWildcard(true); // most people understand these better.
+ re.setCaseSensitive(false);
+ re.setPattern( pattern );
+ }
+ return re;
+}
+
void KAddressBookView::readConfig( KConfig *config )
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 8f31910..6bbb9c2 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -36,2 +36,3 @@ class QDropEvent;
#include <qwidget.h>
+#include <qregexp.h>
@@ -247,2 +248,3 @@ class KAddressBookView : public QWidget
QWidget *viewWidget();
+ QRegExp getRegExp( const QString );
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
@@ -302,7 +302,3 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field )
}
- QString pattern = s.lower()+"*";
- QRegExp re;
- re.setWildcard(true); // most people understand these better.
- re.setCaseSensitive(false);
- re.setPattern( pattern );
+ QRegExp re = getRegExp( s );
if (!re.isValid())
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
@@ -261,7 +261,3 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
}
- QString pattern = s.lower()+"*";
- QRegExp re;
- re.setWildcard(true); // most people understand these better.
- re.setCaseSensitive(false);
- re.setPattern( pattern );
+ QRegExp re = getRegExp( s );
if (!re.isValid())
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
@@ -145,7 +145,3 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
}
- QString pattern = s.lower()+"*";
- QRegExp re;
- re.setWildcard(true); // most people understand these better.
- re.setCaseSensitive(false);
- re.setPattern( pattern );
+ QRegExp re = getRegExp( s );
if (!re.isValid())