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
@@ -50,8 +50,24 @@ KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent,
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
@@ -35,4 +35,5 @@ class QDropEvent;
#include <kabc/field.h>
#include <qwidget.h>
+#include <qregexp.h>
#include "viewconfigurewidget.h"
@@ -246,4 +247,5 @@ class KAddressBookView : public QWidget
*/
QWidget *viewWidget();
+ QRegExp getRegExp( const QString );
private:
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
@@ -301,9 +301,5 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field )
return;
}
- 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())
return;
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
@@ -260,9 +260,5 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
return;
}
- 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())
return;
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
@@ -144,9 +144,5 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
return;
}
- 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())
return;