summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/kaddressbooktableview.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/views/kaddressbooktableview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 348f491..02fc40a 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -149,60 +149,76 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
}
QRegExp re = getRegExp( s );
if (!re.isValid())
return;
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator it;
if ( field ) {
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
#if QT_VERSION >= 0x030000
if (re.search(field->value( *it ).lower()) == 0)
#else
if (re.match(field->value( *it ).lower()) == 0)
#endif
ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
}
} else {
KABC::Field::List fieldList = allFields();
KABC::Field::List::ConstIterator fieldIt;
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
+ bool match = false;
for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
#if QT_VERSION >= 0x030000
if (re.search((*fieldIt)->value( *it ).lower()) == 0)
#else
if (re.match((*fieldIt)->value( *it ).lower()) == 0)
#endif
{
//qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() );
ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
+ match = true;
break;
}
}
+ if ( ! match ) {
+ if ( (*it).matchPhoneNumber( &re ) ) {
+ ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
+ match = true;
+ break;
+ }
+ }
+ if ( ! match ) {
+ if ( (*it).matchAddress( &re ) ) {
+ ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
+ match = true;
+ break;
+ }
+ }
}
}
// Sometimes the background pixmap gets messed up when we add lots
// of items.
//mListView->repaint();
if ( mListView->firstChild() ) {
mListView->setCurrentItem ( mListView->firstChild() );
mListView->setSelected ( mListView->firstChild(), true );
}
else
emit selected(QString::null);
}
void KAddressBookTableView::writeConfig(KConfig *config)
{
KAddressBookView::writeConfig(config);
mListView->saveLayout(config, config->group());
}
void KAddressBookTableView::readConfig(KConfig *config)
{
KAddressBookView::readConfig( config );
// The config could have changed the fields, so we need to reconstruct