-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 | |||
@@ -606,129 +606,129 @@ void KABCore::setWhoAmI() | |||
606 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 606 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
607 | 607 | ||
608 | if ( addrList.count() > 1 ) { | 608 | if ( addrList.count() > 1 ) { |
609 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 609 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
610 | return; | 610 | return; |
611 | } | 611 | } |
612 | 612 | ||
613 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 613 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
614 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 614 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
615 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 615 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
616 | } | 616 | } |
617 | 617 | ||
618 | void KABCore::setCategories() | 618 | void KABCore::setCategories() |
619 | { | 619 | { |
620 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 620 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
621 | if ( !dlg.exec() ) | 621 | if ( !dlg.exec() ) |
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 | { |
719 | setModified( true ); | 719 | setModified( true ); |
720 | } | 720 | } |
721 | 721 | ||
722 | void KABCore::setModifiedWOrefresh() | 722 | void KABCore::setModifiedWOrefresh() |
723 | { | 723 | { |
724 | // qDebug("KABCore::setModifiedWOrefresh() "); | 724 | // qDebug("KABCore::setModifiedWOrefresh() "); |
725 | mModified = true; | 725 | mModified = true; |
726 | mActionSave->setEnabled( mModified ); | 726 | mActionSave->setEnabled( mModified ); |
727 | #ifdef DESKTOP_VERSION | 727 | #ifdef DESKTOP_VERSION |
728 | mDetails->refreshView(); | 728 | mDetails->refreshView(); |
729 | #endif | 729 | #endif |
730 | 730 | ||
731 | } | 731 | } |
732 | void KABCore::setModified( bool modified ) | 732 | void KABCore::setModified( bool modified ) |
733 | { | 733 | { |
734 | mModified = modified; | 734 | mModified = modified; |