author | zautrix <zautrix> | 2004-07-05 09:51:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-05 09:51:38 (UTC) |
commit | 93f9b1e0a8935210b03a094ce18949b7197041aa (patch) (unidiff) | |
tree | f9d4a531755ead00068367f56c4987446e59af13 | |
parent | 5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0 (diff) | |
download | kdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.zip kdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.tar.gz kdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.tar.bz2 |
Fixed searching order
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 |
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() | |||
622 | return; | 622 | return; |
623 | 623 | ||
624 | bool merge = false; | 624 | bool merge = false; |
625 | QString msg = i18n( "Merge with existing categories?" ); | 625 | QString msg = i18n( "Merge with existing categories?" ); |
626 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 626 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
627 | merge = true; | 627 | merge = true; |
628 | 628 | ||
629 | QStringList categories = dlg.selectedCategories(); | 629 | QStringList categories = dlg.selectedCategories(); |
630 | 630 | ||
631 | QStringList uids = mViewManager->selectedUids(); | 631 | QStringList uids = mViewManager->selectedUids(); |
632 | QStringList::Iterator it; | 632 | QStringList::Iterator it; |
633 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 633 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
634 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 634 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
635 | if ( !addr.isEmpty() ) { | 635 | if ( !addr.isEmpty() ) { |
636 | if ( !merge ) | 636 | if ( !merge ) |
637 | addr.setCategories( categories ); | 637 | addr.setCategories( categories ); |
638 | else { | 638 | else { |
639 | QStringList addrCategories = addr.categories(); | 639 | QStringList addrCategories = addr.categories(); |
640 | QStringList::Iterator catIt; | 640 | QStringList::Iterator catIt; |
641 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 641 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
642 | if ( !addrCategories.contains( *catIt ) ) | 642 | if ( !addrCategories.contains( *catIt ) ) |
643 | addrCategories.append( *catIt ); | 643 | addrCategories.append( *catIt ); |
644 | } | 644 | } |
645 | addr.setCategories( addrCategories ); | 645 | addr.setCategories( addrCategories ); |
646 | } | 646 | } |
647 | 647 | ||
648 | mAddressBook->insertAddressee( addr ); | 648 | mAddressBook->insertAddressee( addr ); |
649 | } | 649 | } |
650 | } | 650 | } |
651 | 651 | ||
652 | if ( uids.count() > 0 ) | 652 | if ( uids.count() > 0 ) |
653 | setModified( true ); | 653 | setModified( true ); |
654 | } | 654 | } |
655 | 655 | ||
656 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 656 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
657 | { | 657 | { |
658 | mIncSearchWidget->setFields( fields ); | 658 | mIncSearchWidget->setFields( fields ); |
659 | } | 659 | } |
660 | 660 | ||
661 | void KABCore::incrementalSearch( const QString& text ) | 661 | void KABCore::incrementalSearch( const QString& text ) |
662 | { | 662 | { |
663 | mViewManager->setSelected( QString::null, false ); | 663 | mViewManager->setSelected( QString::null, false ); |
664 | 664 | ||
665 | if ( !text.isEmpty() ) { | 665 | if ( !text.isEmpty() ) { |
666 | KABC::Field *field = mIncSearchWidget->currentField(); | 666 | KABC::Field *field = mIncSearchWidget->currentField(); |
667 | 667 | ||
668 | QString pattern = text.lower(); | 668 | QString pattern = text.lower(); |
669 | 669 | ||
670 | #if KDE_VERSION >= 319 | 670 | #if 1 //KDE_VERSION >= 319 |
671 | KABC::AddresseeList list( mAddressBook->allAddressees() ); | 671 | KABC::AddresseeList list( mAddressBook->allAddressees() ); |
672 | if ( field ) { | 672 | if ( field ) { |
673 | list.sortByField( field ); | 673 | list.sortByField( field ); |
674 | KABC::AddresseeList::Iterator it; | 674 | KABC::AddresseeList::Iterator it; |
675 | for ( it = list.begin(); it != list.end(); ++it ) { | 675 | for ( it = list.begin(); it != list.end(); ++it ) { |
676 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 676 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
677 | mViewManager->setSelected( (*it).uid(), true ); | 677 | mViewManager->setSelected( (*it).uid(), true ); |
678 | return; | 678 | return; |
679 | } | 679 | } |
680 | } | 680 | } |
681 | } else { | 681 | } else { |
682 | KABC::AddresseeList::Iterator it; | 682 | KABC::AddresseeList::Iterator it; |
683 | for ( it = list.begin(); it != list.end(); ++it ) { | 683 | for ( it = list.begin(); it != list.end(); ++it ) { |
684 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 684 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
685 | KABC::Field::List::ConstIterator fieldIt; | 685 | KABC::Field::List::ConstIterator fieldIt; |
686 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 686 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
687 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 687 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
688 | mViewManager->setSelected( (*it).uid(), true ); | 688 | mViewManager->setSelected( (*it).uid(), true ); |
689 | return; | 689 | return; |
690 | } | 690 | } |
691 | } | 691 | } |
692 | } | 692 | } |
693 | } | 693 | } |
694 | #else | 694 | #else |
695 | KABC::AddressBook::Iterator it; | 695 | KABC::AddressBook::Iterator it; |
696 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 696 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
697 | if ( field ) { | 697 | if ( field ) { |
698 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 698 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
699 | mViewManager->setSelected( (*it).uid(), true ); | 699 | mViewManager->setSelected( (*it).uid(), true ); |
700 | return; | 700 | return; |
701 | } | 701 | } |
702 | } else { | 702 | } else { |
703 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 703 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
704 | KABC::Field::List::ConstIterator fieldIt; | 704 | KABC::Field::List::ConstIterator fieldIt; |
705 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 705 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
706 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 706 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
707 | mViewManager->setSelected( (*it).uid(), true ); | 707 | mViewManager->setSelected( (*it).uid(), true ); |
708 | return; | 708 | return; |
709 | } | 709 | } |
710 | } | 710 | } |
711 | } | 711 | } |
712 | } | 712 | } |
713 | #endif | 713 | #endif |
714 | } | 714 | } |
715 | } | 715 | } |
716 | 716 | ||
717 | void KABCore::setModified() | 717 | void KABCore::setModified() |
718 | { | 718 | { |