summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-07-05 09:51:38 (UTC)
committer zautrix <zautrix>2004-07-05 09:51:38 (UTC)
commit93f9b1e0a8935210b03a094ce18949b7197041aa (patch) (side-by-side diff)
treef9d4a531755ead00068367f56c4987446e59af13 /kaddressbook
parent5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0 (diff)
downloadkdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.zip
kdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.tar.gz
kdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.tar.bz2
Fixed searching order
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index b06e1bc..7cba9aa 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -622,97 +622,97 @@ void KABCore::setCategories()
return;
bool merge = false;
QString msg = i18n( "Merge with existing categories?" );
if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
merge = true;
QStringList categories = dlg.selectedCategories();
QStringList uids = mViewManager->selectedUids();
QStringList::Iterator it;
for ( it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee addr = mAddressBook->findByUid( *it );
if ( !addr.isEmpty() ) {
if ( !merge )
addr.setCategories( categories );
else {
QStringList addrCategories = addr.categories();
QStringList::Iterator catIt;
for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
if ( !addrCategories.contains( *catIt ) )
addrCategories.append( *catIt );
}
addr.setCategories( addrCategories );
}
mAddressBook->insertAddressee( addr );
}
}
if ( uids.count() > 0 )
setModified( true );
}
void KABCore::setSearchFields( const KABC::Field::List &fields )
{
mIncSearchWidget->setFields( fields );
}
void KABCore::incrementalSearch( const QString& text )
{
mViewManager->setSelected( QString::null, false );
if ( !text.isEmpty() ) {
KABC::Field *field = mIncSearchWidget->currentField();
QString pattern = text.lower();
-#if KDE_VERSION >= 319
+#if 1 //KDE_VERSION >= 319
KABC::AddresseeList list( mAddressBook->allAddressees() );
if ( field ) {
list.sortByField( field );
KABC::AddresseeList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( field->value( *it ).lower().startsWith( pattern ) ) {
mViewManager->setSelected( (*it).uid(), true );
return;
}
}
} else {
KABC::AddresseeList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
KABC::Field::List fieldList = mIncSearchWidget->fields();
KABC::Field::List::ConstIterator fieldIt;
for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
mViewManager->setSelected( (*it).uid(), true );
return;
}
}
}
}
#else
KABC::AddressBook::Iterator it;
for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( field ) {
if ( field->value( *it ).lower().startsWith( pattern ) ) {
mViewManager->setSelected( (*it).uid(), true );
return;
}
} else {
KABC::Field::List fieldList = mIncSearchWidget->fields();
KABC::Field::List::ConstIterator fieldIt;
for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
mViewManager->setSelected( (*it).uid(), true );
return;
}
}
}
}
#endif
}
}
void KABCore::setModified()
{