summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-05 09:51:38 (UTC)
committer zautrix <zautrix>2004-07-05 09:51:38 (UTC)
commit93f9b1e0a8935210b03a094ce18949b7197041aa (patch) (unidiff)
treef9d4a531755ead00068367f56c4987446e59af13
parent5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0 (diff)
downloadkdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.zip
kdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.tar.gz
kdepimpi-93f9b1e0a8935210b03a094ce18949b7197041aa.tar.bz2
Fixed searching order
Diffstat (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
@@ -574,193 +574,193 @@ void KABCore::cutContacts()
574 UndoStack::instance()->push( command ); 574 UndoStack::instance()->push( command );
575 RedoStack::instance()->clear(); 575 RedoStack::instance()->clear();
576 576
577 setModified( true ); 577 setModified( true );
578 } 578 }
579} 579}
580 580
581void KABCore::pasteContacts() 581void KABCore::pasteContacts()
582{ 582{
583 QClipboard *cb = QApplication::clipboard(); 583 QClipboard *cb = QApplication::clipboard();
584 584
585 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 585 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
586 586
587 pasteContacts( list ); 587 pasteContacts( list );
588} 588}
589 589
590void KABCore::pasteContacts( KABC::Addressee::List &list ) 590void KABCore::pasteContacts( KABC::Addressee::List &list )
591{ 591{
592 KABC::Resource *resource = requestResource( this ); 592 KABC::Resource *resource = requestResource( this );
593 KABC::Addressee::List::Iterator it; 593 KABC::Addressee::List::Iterator it;
594 for ( it = list.begin(); it != list.end(); ++it ) 594 for ( it = list.begin(); it != list.end(); ++it )
595 (*it).setResource( resource ); 595 (*it).setResource( resource );
596 596
597 PwPasteCommand *command = new PwPasteCommand( this, list ); 597 PwPasteCommand *command = new PwPasteCommand( this, list );
598 UndoStack::instance()->push( command ); 598 UndoStack::instance()->push( command );
599 RedoStack::instance()->clear(); 599 RedoStack::instance()->clear();
600 600
601 setModified( true ); 601 setModified( true );
602} 602}
603 603
604void KABCore::setWhoAmI() 604void KABCore::setWhoAmI()
605{ 605{
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
618void KABCore::setCategories() 618void 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
656void KABCore::setSearchFields( const KABC::Field::List &fields ) 656void KABCore::setSearchFields( const KABC::Field::List &fields )
657{ 657{
658 mIncSearchWidget->setFields( fields ); 658 mIncSearchWidget->setFields( fields );
659} 659}
660 660
661void KABCore::incrementalSearch( const QString& text ) 661void 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
717void KABCore::setModified() 717void KABCore::setModified()
718{ 718{
719 setModified( true ); 719 setModified( true );
720} 720}
721 721
722void KABCore::setModifiedWOrefresh() 722void 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}
732void KABCore::setModified( bool modified ) 732void KABCore::setModified( bool modified )
733{ 733{
734 mModified = modified; 734 mModified = modified;
735 mActionSave->setEnabled( mModified ); 735 mActionSave->setEnabled( mModified );
736 736
737 if ( modified ) 737 if ( modified )
738 mJumpButtonBar->recreateButtons(); 738 mJumpButtonBar->recreateButtons();
739 739
740 mViewManager->refreshView(); 740 mViewManager->refreshView();
741 mDetails->refreshView(); 741 mDetails->refreshView();
742 742
743} 743}
744 744
745bool KABCore::modified() const 745bool KABCore::modified() const
746{ 746{
747 return mModified; 747 return mModified;
748} 748}
749 749
750void KABCore::contactModified( const KABC::Addressee &addr ) 750void KABCore::contactModified( const KABC::Addressee &addr )
751{ 751{
752 752
753 Command *command = 0; 753 Command *command = 0;
754 QString uid; 754 QString uid;
755 755
756 // check if it exists already 756 // check if it exists already
757 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 757 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
758 if ( origAddr.isEmpty() ) 758 if ( origAddr.isEmpty() )
759 command = new PwNewCommand( mAddressBook, addr ); 759 command = new PwNewCommand( mAddressBook, addr );
760 else { 760 else {
761 command = new PwEditCommand( mAddressBook, origAddr, addr ); 761 command = new PwEditCommand( mAddressBook, origAddr, addr );
762 uid = addr.uid(); 762 uid = addr.uid();
763 } 763 }
764 764
765 UndoStack::instance()->push( command ); 765 UndoStack::instance()->push( command );
766 RedoStack::instance()->clear(); 766 RedoStack::instance()->clear();