author | eilers <eilers> | 2003-08-01 13:57:54 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-08-01 13:57:54 (UTC) |
commit | 5346424fc26bde232a15aa34fbb720f86218b26f (patch) (unidiff) | |
tree | b6ce224b1fb517e8b31db1b9e0ef30cf539f6f6f | |
parent | 307b353d11842b0994827e4130b48386454b3f94 (diff) | |
download | opie-5346424fc26bde232a15aa34fbb720f86218b26f.zip opie-5346424fc26bde232a15aa34fbb720f86218b26f.tar.gz opie-5346424fc26bde232a15aa34fbb720f86218b26f.tar.bz2 |
Icon bug.. fixed.
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 6819085..03c96c8 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -649,409 +649,409 @@ static void parseName( const QString& name, QString *first, QString *middle, | |||
649 | } | 649 | } |
650 | 650 | ||
651 | 651 | ||
652 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 652 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
653 | { | 653 | { |
654 | bool needShow = FALSE; | 654 | bool needShow = FALSE; |
655 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); | 655 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); |
656 | 656 | ||
657 | 657 | ||
658 | if (msg == "editPersonal()") { | 658 | if (msg == "editPersonal()") { |
659 | editPersonal(); | 659 | editPersonal(); |
660 | } else if (msg == "editPersonalAndClose()") { | 660 | } else if (msg == "editPersonalAndClose()") { |
661 | editPersonal(); | 661 | editPersonal(); |
662 | close(); | 662 | close(); |
663 | } else if ( msg == "addContact(QString,QString)" ) { | 663 | } else if ( msg == "addContact(QString,QString)" ) { |
664 | QDataStream stream(data,IO_ReadOnly); | 664 | QDataStream stream(data,IO_ReadOnly); |
665 | QString name, email; | 665 | QString name, email; |
666 | stream >> name >> email; | 666 | stream >> name >> email; |
667 | 667 | ||
668 | OContact cnt; | 668 | OContact cnt; |
669 | QString fn, mn, ln; | 669 | QString fn, mn, ln; |
670 | parseName( name, &fn, &mn, &ln ); | 670 | parseName( name, &fn, &mn, &ln ); |
671 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 671 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
672 | cnt.setFirstName( fn ); | 672 | cnt.setFirstName( fn ); |
673 | cnt.setMiddleName( mn ); | 673 | cnt.setMiddleName( mn ); |
674 | cnt.setLastName( ln ); | 674 | cnt.setLastName( ln ); |
675 | cnt.insertEmails( email ); | 675 | cnt.insertEmails( email ); |
676 | cnt.setDefaultEmail( email ); | 676 | cnt.setDefaultEmail( email ); |
677 | cnt.setFileAs(); | 677 | cnt.setFileAs(); |
678 | 678 | ||
679 | m_abView -> addEntry( cnt ); | 679 | m_abView -> addEntry( cnt ); |
680 | 680 | ||
681 | // :SXm_abView()->init( cnt ); | 681 | // :SXm_abView()->init( cnt ); |
682 | editEntry( EditEntry ); | 682 | editEntry( EditEntry ); |
683 | } else if ( msg == "beamBusinessCard()" ) { | 683 | } else if ( msg == "beamBusinessCard()" ) { |
684 | QString beamFilename = addressbookPersonalVCardName(); | 684 | QString beamFilename = addressbookPersonalVCardName(); |
685 | if ( !QFile::exists( beamFilename ) ) | 685 | if ( !QFile::exists( beamFilename ) ) |
686 | return; // can't beam a non-existent file | 686 | return; // can't beam a non-existent file |
687 | 687 | ||
688 | Ir *ir = new Ir( this ); | 688 | Ir *ir = new Ir( this ); |
689 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 689 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
690 | QString description = "mycard.vcf"; | 690 | QString description = "mycard.vcf"; |
691 | ir->send( beamFilename, description, "text/x-vCard" ); | 691 | ir->send( beamFilename, description, "text/x-vCard" ); |
692 | } else if ( msg == "show(int)" ) { | 692 | } else if ( msg == "show(int)" ) { |
693 | raise(); | 693 | raise(); |
694 | QDataStream stream(data,IO_ReadOnly); | 694 | QDataStream stream(data,IO_ReadOnly); |
695 | int uid; | 695 | int uid; |
696 | stream >> uid; | 696 | stream >> uid; |
697 | 697 | ||
698 | qWarning( "Showing uid: %d" , uid ); | 698 | qWarning( "Showing uid: %d" , uid ); |
699 | 699 | ||
700 | // Deactivate Personal View.. | 700 | // Deactivate Personal View.. |
701 | if ( actionPersonal->isOn() ){ | 701 | if ( actionPersonal->isOn() ){ |
702 | actionPersonal->setOn( false ); | 702 | actionPersonal->setOn( false ); |
703 | slotPersonalView(); | 703 | slotPersonalView(); |
704 | } | 704 | } |
705 | 705 | ||
706 | // Reset category and show as card.. | 706 | // Reset category and show as card.. |
707 | m_abView -> setShowByCategory( QString::null ); | 707 | m_abView -> setShowByCategory( QString::null ); |
708 | m_abView -> setCurrentUid( uid ); | 708 | m_abView -> setCurrentUid( uid ); |
709 | slotViewSwitched ( AbView::CardView ); | 709 | slotViewSwitched ( AbView::CardView ); |
710 | 710 | ||
711 | needShow = true; | 711 | needShow = true; |
712 | 712 | ||
713 | 713 | ||
714 | } else if ( msg == "edit(int)" ) { | 714 | } else if ( msg == "edit(int)" ) { |
715 | QDataStream stream(data,IO_ReadOnly); | 715 | QDataStream stream(data,IO_ReadOnly); |
716 | int uid; | 716 | int uid; |
717 | stream >> uid; | 717 | stream >> uid; |
718 | 718 | ||
719 | // Deactivate Personal View.. | 719 | // Deactivate Personal View.. |
720 | if ( actionPersonal->isOn() ){ | 720 | if ( actionPersonal->isOn() ){ |
721 | actionPersonal->setOn( false ); | 721 | actionPersonal->setOn( false ); |
722 | slotPersonalView(); | 722 | slotPersonalView(); |
723 | } | 723 | } |
724 | 724 | ||
725 | // Reset category and edit.. | 725 | // Reset category and edit.. |
726 | m_abView -> setShowByCategory( QString::null ); | 726 | m_abView -> setShowByCategory( QString::null ); |
727 | m_abView -> setCurrentUid( uid ); | 727 | m_abView -> setCurrentUid( uid ); |
728 | slotViewEdit(); | 728 | slotViewEdit(); |
729 | } | 729 | } |
730 | 730 | ||
731 | if (needShow) | 731 | if (needShow) |
732 | QPEApplication::setKeepRunning(); | 732 | QPEApplication::setKeepRunning(); |
733 | 733 | ||
734 | } | 734 | } |
735 | 735 | ||
736 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 736 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
737 | { | 737 | { |
738 | OContact entry; | 738 | OContact entry; |
739 | if ( !abEditor ) { | 739 | if ( !abEditor ) { |
740 | abEditor = new ContactEditor( entry, this, "editor" ); | 740 | abEditor = new ContactEditor( entry, this, "editor" ); |
741 | } | 741 | } |
742 | if ( entryMode == EditEntry ) | 742 | if ( entryMode == EditEntry ) |
743 | abEditor->setEntry( m_abView -> currentEntry() ); | 743 | abEditor->setEntry( m_abView -> currentEntry() ); |
744 | else if ( entryMode == NewEntry ) | 744 | else if ( entryMode == NewEntry ) |
745 | abEditor->setEntry( entry ); | 745 | abEditor->setEntry( entry ); |
746 | // other things may change the caption. | 746 | // other things may change the caption. |
747 | abEditor->setCaption( tr("Edit Address") ); | 747 | abEditor->setCaption( tr("Edit Address") ); |
748 | 748 | ||
749 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 749 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
750 | abEditor->showMaximized(); | 750 | abEditor->showMaximized(); |
751 | #endif | 751 | #endif |
752 | // fix the foxus... | 752 | // fix the foxus... |
753 | abEditor->setNameFocus(); | 753 | abEditor->setNameFocus(); |
754 | if ( abEditor->exec() ) { | 754 | if ( abEditor->exec() ) { |
755 | setFocus(); | 755 | setFocus(); |
756 | if ( entryMode == NewEntry ) { | 756 | if ( entryMode == NewEntry ) { |
757 | OContact insertEntry = abEditor->entry(); | 757 | OContact insertEntry = abEditor->entry(); |
758 | insertEntry.assignUid(); | 758 | insertEntry.assignUid(); |
759 | m_abView -> addEntry( insertEntry ); | 759 | m_abView -> addEntry( insertEntry ); |
760 | m_abView -> setCurrentUid( insertEntry.uid() ); | 760 | m_abView -> setCurrentUid( insertEntry.uid() ); |
761 | } else { | 761 | } else { |
762 | OContact replEntry = abEditor->entry(); | 762 | OContact replEntry = abEditor->entry(); |
763 | 763 | ||
764 | if ( !replEntry.isValidUid() ) | 764 | if ( !replEntry.isValidUid() ) |
765 | replEntry.assignUid(); | 765 | replEntry.assignUid(); |
766 | 766 | ||
767 | m_abView -> replaceEntry( replEntry ); | 767 | m_abView -> replaceEntry( replEntry ); |
768 | } | 768 | } |
769 | } | 769 | } |
770 | // populateCategories(); | 770 | // populateCategories(); |
771 | 771 | ||
772 | } | 772 | } |
773 | 773 | ||
774 | void AddressbookWindow::editPersonal() | 774 | void AddressbookWindow::editPersonal() |
775 | { | 775 | { |
776 | OContact entry; | 776 | OContact entry; |
777 | 777 | ||
778 | // Switch to personal view if not selected | 778 | // Switch to personal view if not selected |
779 | // but take care of the menu, too | 779 | // but take care of the menu, too |
780 | if ( ! actionPersonal->isOn() ){ | 780 | if ( ! actionPersonal->isOn() ){ |
781 | qWarning("*** ++++"); | 781 | qWarning("*** ++++"); |
782 | actionPersonal->setOn( true ); | 782 | actionPersonal->setOn( true ); |
783 | slotPersonalView(); | 783 | slotPersonalView(); |
784 | } | 784 | } |
785 | 785 | ||
786 | if ( !abEditor ) { | 786 | if ( !abEditor ) { |
787 | abEditor = new ContactEditor( entry, this, "editor" ); | 787 | abEditor = new ContactEditor( entry, this, "editor" ); |
788 | } | 788 | } |
789 | 789 | ||
790 | abEditor->setCaption(tr("Edit My Personal Details")); | 790 | abEditor->setCaption(tr("Edit My Personal Details")); |
791 | abEditor->setPersonalView( true ); | 791 | abEditor->setPersonalView( true ); |
792 | editEntry( EditEntry ); | 792 | editEntry( EditEntry ); |
793 | abEditor->setPersonalView( false ); | 793 | abEditor->setPersonalView( false ); |
794 | 794 | ||
795 | } | 795 | } |
796 | 796 | ||
797 | 797 | ||
798 | void AddressbookWindow::slotPersonalView() | 798 | void AddressbookWindow::slotPersonalView() |
799 | { | 799 | { |
800 | qWarning("slotPersonalView()"); | 800 | qWarning("slotPersonalView()"); |
801 | if (!actionPersonal->isOn()) { | 801 | if (!actionPersonal->isOn()) { |
802 | // we just turned it off | 802 | // we just turned it off |
803 | qWarning("slotPersonalView()-> OFF"); | 803 | qWarning("slotPersonalView()-> OFF"); |
804 | setCaption( tr("Contacts") ); | 804 | setCaption( tr("Contacts") ); |
805 | actionNew->setEnabled(TRUE); | 805 | actionNew->setEnabled(TRUE); |
806 | actionTrash->setEnabled(TRUE); | 806 | actionTrash->setEnabled(TRUE); |
807 | actionFind->setEnabled(TRUE); | 807 | actionFind->setEnabled(TRUE); |
808 | actionMail->setEnabled(TRUE); | 808 | actionMail->setEnabled(TRUE); |
809 | // slotUpdateToolbar(); | 809 | // slotUpdateToolbar(); |
810 | 810 | ||
811 | m_abView->showPersonal( false ); | 811 | m_abView->showPersonal( false ); |
812 | 812 | ||
813 | return; | 813 | return; |
814 | } | 814 | } |
815 | 815 | ||
816 | qWarning("slotPersonalView()-> ON"); | 816 | qWarning("slotPersonalView()-> ON"); |
817 | // XXX need to disable some QActions. | 817 | // XXX need to disable some QActions. |
818 | actionNew->setEnabled(FALSE); | 818 | actionNew->setEnabled(FALSE); |
819 | actionTrash->setEnabled(FALSE); | 819 | actionTrash->setEnabled(FALSE); |
820 | actionFind->setEnabled(FALSE); | 820 | actionFind->setEnabled(FALSE); |
821 | actionMail->setEnabled(FALSE); | 821 | actionMail->setEnabled(FALSE); |
822 | 822 | ||
823 | setCaption( tr("Contacts - My Personal Details") ); | 823 | setCaption( tr("Contacts - My Personal Details") ); |
824 | 824 | ||
825 | m_abView->showPersonal( true ); | 825 | m_abView->showPersonal( true ); |
826 | 826 | ||
827 | } | 827 | } |
828 | 828 | ||
829 | 829 | ||
830 | void AddressbookWindow::listIsEmpty( bool empty ) | 830 | void AddressbookWindow::listIsEmpty( bool empty ) |
831 | { | 831 | { |
832 | if ( !empty ) { | 832 | if ( !empty ) { |
833 | deleteButton->setEnabled( TRUE ); | 833 | deleteButton->setEnabled( TRUE ); |
834 | } | 834 | } |
835 | } | 835 | } |
836 | 836 | ||
837 | void AddressbookWindow::reload() | 837 | void AddressbookWindow::reload() |
838 | { | 838 | { |
839 | syncing = FALSE; | 839 | syncing = FALSE; |
840 | m_abView->clear(); | 840 | m_abView->clear(); |
841 | m_abView->reload(); | 841 | m_abView->reload(); |
842 | } | 842 | } |
843 | 843 | ||
844 | void AddressbookWindow::flush() | 844 | void AddressbookWindow::flush() |
845 | { | 845 | { |
846 | syncing = TRUE; | 846 | syncing = TRUE; |
847 | m_abView->save(); | 847 | m_abView->save(); |
848 | } | 848 | } |
849 | 849 | ||
850 | 850 | ||
851 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 851 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
852 | { | 852 | { |
853 | if(active_view == AbView::CardView){ | 853 | if(active_view == AbView::CardView){ |
854 | slotViewSwitched( AbView::TableView ); | 854 | slotViewSwitched( AbView::TableView ); |
855 | e->ignore(); | 855 | e->ignore(); |
856 | return; | 856 | return; |
857 | } | 857 | } |
858 | if(syncing) { | 858 | if(syncing) { |
859 | /* shouldn't we save, I hear you say? well its already been set | 859 | /* shouldn't we save, I hear you say? well its already been set |
860 | so that an edit can not occur during a sync, and we flushed | 860 | so that an edit can not occur during a sync, and we flushed |
861 | at the start of the sync, so there is no need to save | 861 | at the start of the sync, so there is no need to save |
862 | Saving however itself would cause problems. */ | 862 | Saving however itself would cause problems. */ |
863 | e->accept(); | 863 | e->accept(); |
864 | return; | 864 | return; |
865 | } | 865 | } |
866 | //################## shouldn't always save | 866 | //################## shouldn't always save |
867 | // True, but the database handles this automatically ! (se) | 867 | // True, but the database handles this automatically ! (se) |
868 | if ( save() ) | 868 | if ( save() ) |
869 | e->accept(); | 869 | e->accept(); |
870 | else | 870 | else |
871 | e->ignore(); | 871 | e->ignore(); |
872 | } | 872 | } |
873 | 873 | ||
874 | /* | 874 | /* |
875 | Returns TRUE if it is OK to exit | 875 | Returns TRUE if it is OK to exit |
876 | */ | 876 | */ |
877 | 877 | ||
878 | bool AddressbookWindow::save() | 878 | bool AddressbookWindow::save() |
879 | { | 879 | { |
880 | if ( !m_abView->save() ) { | 880 | if ( !m_abView->save() ) { |
881 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 881 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
882 | tr("Unable to save information.\n" | 882 | tr("Unable to save information.\n" |
883 | "Free up some space\n" | 883 | "Free up some space\n" |
884 | "and try again.\n" | 884 | "and try again.\n" |
885 | "\nQuit anyway?"), | 885 | "\nQuit anyway?"), |
886 | QMessageBox::Yes|QMessageBox::Escape, | 886 | QMessageBox::Yes|QMessageBox::Escape, |
887 | QMessageBox::No|QMessageBox::Default ) | 887 | QMessageBox::No|QMessageBox::Default ) |
888 | != QMessageBox::No ) | 888 | != QMessageBox::No ) |
889 | return TRUE; | 889 | return TRUE; |
890 | else | 890 | else |
891 | return FALSE; | 891 | return FALSE; |
892 | } | 892 | } |
893 | return TRUE; | 893 | return TRUE; |
894 | } | 894 | } |
895 | 895 | ||
896 | #ifdef __DEBUG_RELEASE | 896 | #ifdef __DEBUG_RELEASE |
897 | void AddressbookWindow::slotSave() | 897 | void AddressbookWindow::slotSave() |
898 | { | 898 | { |
899 | save(); | 899 | save(); |
900 | } | 900 | } |
901 | #endif | 901 | #endif |
902 | 902 | ||
903 | 903 | ||
904 | void AddressbookWindow::slotNotFound() | 904 | void AddressbookWindow::slotNotFound() |
905 | { | 905 | { |
906 | qWarning("Got notfound signal!"); | 906 | qWarning("Got notfound signal!"); |
907 | QMessageBox::information( this, tr( "Not Found" ), | 907 | QMessageBox::information( this, tr( "Not Found" ), |
908 | "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); | 908 | "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); |
909 | 909 | ||
910 | 910 | ||
911 | } | 911 | } |
912 | void AddressbookWindow::slotWrapAround() | 912 | void AddressbookWindow::slotWrapAround() |
913 | { | 913 | { |
914 | qWarning("Got wrap signal!"); | 914 | qWarning("Got wrap signal!"); |
915 | // if ( doNotifyWrapAround ) | 915 | // if ( doNotifyWrapAround ) |
916 | // QMessageBox::information( this, tr( "End of list" ), | 916 | // QMessageBox::information( this, tr( "End of list" ), |
917 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 917 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
918 | 918 | ||
919 | } | 919 | } |
920 | 920 | ||
921 | void AddressbookWindow::slotSetCategory( int c ) | 921 | void AddressbookWindow::slotSetCategory( int c ) |
922 | { | 922 | { |
923 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); | 923 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); |
924 | 924 | ||
925 | QString cat, book; | 925 | QString cat, book; |
926 | AbView::Views view = AbView::TableView; | 926 | AbView::Views view = AbView::TableView; |
927 | 927 | ||
928 | if ( c <= 0 ) | 928 | if ( c <= 0 ) |
929 | return; | 929 | return; |
930 | 930 | ||
931 | // Switch view | 931 | // Switch view |
932 | if ( c < 3 ) | 932 | if ( c < 3 ) |
933 | for ( unsigned int i = 1; i < 3; i++ ){ | 933 | for ( unsigned int i = 1; i < 3; i++ ){ |
934 | if ( catMenu ) | 934 | if ( catMenu ) |
935 | catMenu->setItemChecked( i, c == (int)i ); | 935 | catMenu->setItemChecked( i, c == (int)i ); |
936 | } | 936 | } |
937 | else | 937 | else |
938 | // Checkmark Category Menu Item Selected | 938 | // Checkmark Category Menu Item Selected |
939 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 939 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
940 | catMenu->setItemChecked( i, c == (int)i ); | 940 | catMenu->setItemChecked( i, c == (int)i ); |
941 | 941 | ||
942 | // Now switch to the selected category | 942 | // Now switch to the selected category |
943 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 943 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
944 | if (catMenu->isItemChecked( i )) { | 944 | if (catMenu->isItemChecked( i )) { |
945 | if ( i == 1 ){ // default List view | 945 | if ( i == 1 ){ // default List view |
946 | book = QString::null; | 946 | book = QString::null; |
947 | view = AbView::TableView; | 947 | view = AbView::TableView; |
948 | }else if ( i == 2 ){ | 948 | }else if ( i == 2 ){ |
949 | book = tr( "Cards" ); | 949 | book = tr( "Cards" ); |
950 | view = AbView::CardView; | 950 | view = AbView::CardView; |
951 | // }else if ( i == 3 ){ | 951 | // }else if ( i == 3 ){ |
952 | // book = tr( "Personal" ); | 952 | // book = tr( "Personal" ); |
953 | // view = AbView:: PersonalView; | 953 | // view = AbView:: PersonalView; |
954 | }else if ( i == 3 ){ // default All Categories | 954 | }else if ( i == 3 ){ // default All Categories |
955 | cat = QString::null; | 955 | cat = QString::null; |
956 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled | 956 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled |
957 | cat = "Unfiled"; | 957 | cat = "Unfiled"; |
958 | qWarning ("Unfiled selected!"); | 958 | qWarning ("Unfiled selected!"); |
959 | }else{ | 959 | }else{ |
960 | cat = m_abView->categories()[i - 4]; | 960 | cat = m_abView->categories()[i - 4]; |
961 | } | 961 | } |
962 | } | 962 | } |
963 | } | 963 | } |
964 | 964 | ||
965 | // Switch to the selected View | 965 | // Switch to the selected View |
966 | slotViewSwitched( view ); | 966 | slotViewSwitched( view ); |
967 | 967 | ||
968 | // Tell the view about the selected category | 968 | // Tell the view about the selected category |
969 | m_abView -> setShowByCategory( cat ); | 969 | m_abView -> setShowByCategory( cat ); |
970 | 970 | ||
971 | if ( book.isEmpty() ) | 971 | if ( book.isEmpty() ) |
972 | book = "List"; | 972 | book = "List"; |
973 | if ( cat.isEmpty() ) | 973 | if ( cat.isEmpty() ) |
974 | cat = "All"; | 974 | cat = "All"; |
975 | 975 | ||
976 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | 976 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); |
977 | } | 977 | } |
978 | 978 | ||
979 | void AddressbookWindow::slotViewSwitched( int view ) | 979 | void AddressbookWindow::slotViewSwitched( int view ) |
980 | { | 980 | { |
981 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); | 981 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); |
982 | int menu = 0; | 982 | int menu = 0; |
983 | 983 | ||
984 | // Switch to selected view | 984 | // Switch to selected view |
985 | switch ( view ){ | 985 | switch ( view ){ |
986 | case AbView::TableView: | 986 | case AbView::TableView: |
987 | menu = 1; | 987 | menu = 1; |
988 | m_tableViewButton->setOn(true); | 988 | m_tableViewButton->setOn(true); |
989 | m_cardViewButton->setOn(false); | 989 | m_cardViewButton->setOn(false); |
990 | break; | 990 | break; |
991 | case AbView::CardView: | 991 | case AbView::CardView: |
992 | menu = 2; | 992 | menu = 2; |
993 | m_tableViewButton->setOn(false); | 993 | m_tableViewButton->setOn(false); |
994 | m_cardViewButton->setOn(true); | 994 | m_cardViewButton->setOn(true); |
995 | break; | 995 | break; |
996 | } | 996 | } |
997 | for ( unsigned int i = 1; i < 3; i++ ){ | 997 | for ( unsigned int i = 1; i < 3; i++ ){ |
998 | if ( catMenu ) | 998 | if ( catMenu ) |
999 | catMenu->setItemChecked( i, menu == (int)i ); | 999 | catMenu->setItemChecked( i, menu == (int)i ); |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | // Tell the view about the selected view | 1002 | // Tell the view about the selected view |
1003 | m_abView -> setShowToView ( (AbView::Views) view ); | 1003 | m_abView -> setShowToView ( (AbView::Views) view ); |
1004 | active_view = view; | 1004 | active_view = view; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | 1007 | ||
1008 | void AddressbookWindow::slotListView() | 1008 | void AddressbookWindow::slotListView() |
1009 | { | 1009 | { |
1010 | slotViewSwitched( AbView::TableView ); | 1010 | slotViewSwitched( AbView::TableView ); |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | void AddressbookWindow::slotCardView() | 1013 | void AddressbookWindow::slotCardView() |
1014 | { | 1014 | { |
1015 | slotViewSwitched( AbView::CardView ); | 1015 | slotViewSwitched( AbView::CardView ); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | void AddressbookWindow::slotSetLetter( char c ) { | 1018 | void AddressbookWindow::slotSetLetter( char c ) { |
1019 | 1019 | ||
1020 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); | 1020 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); |
1021 | 1021 | ||
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | 1024 | ||
1025 | void AddressbookWindow::populateCategories() | 1025 | void AddressbookWindow::populateCategories() |
1026 | { | 1026 | { |
1027 | catMenu->clear(); | 1027 | catMenu->clear(); |
1028 | 1028 | ||
1029 | int id, rememberId; | 1029 | int id, rememberId; |
1030 | id = 1; | 1030 | id = 1; |
1031 | rememberId = 0; | 1031 | rememberId = 0; |
1032 | 1032 | ||
1033 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); | 1033 | catMenu->insertItem( Resource::loadPixmap( "addressbook/listview" ), tr( "List" ), id++ ); |
1034 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); | 1034 | catMenu->insertItem( Resource::loadPixmap( "addressbook/cardview" ), tr( "Cards" ), id++ ); |
1035 | // catMenu->insertItem( tr( "Personal" ), id++ ); | 1035 | // catMenu->insertItem( tr( "Personal" ), id++ ); |
1036 | catMenu->insertSeparator(); | 1036 | catMenu->insertSeparator(); |
1037 | 1037 | ||
1038 | catMenu->insertItem( tr( "All" ), id++ ); | 1038 | catMenu->insertItem( tr( "All" ), id++ ); |
1039 | QStringList categories = m_abView->categories(); | 1039 | QStringList categories = m_abView->categories(); |
1040 | categories.append( tr( "Unfiled" ) ); | 1040 | categories.append( tr( "Unfiled" ) ); |
1041 | for ( QStringList::Iterator it = categories.begin(); | 1041 | for ( QStringList::Iterator it = categories.begin(); |
1042 | it != categories.end(); ++it ) { | 1042 | it != categories.end(); ++it ) { |
1043 | catMenu->insertItem( *it, id ); | 1043 | catMenu->insertItem( *it, id ); |
1044 | if ( *it == m_abView -> showCategory() ) | 1044 | if ( *it == m_abView -> showCategory() ) |
1045 | rememberId = id; | 1045 | rememberId = id; |
1046 | ++id; | 1046 | ++id; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | 1049 | ||
1050 | if ( m_abView -> showCategory().isEmpty() ) { | 1050 | if ( m_abView -> showCategory().isEmpty() ) { |
1051 | slotSetCategory( 3 ); | 1051 | slotSetCategory( 3 ); |
1052 | } | 1052 | } |
1053 | else { | 1053 | else { |
1054 | slotSetCategory( rememberId ); | 1054 | slotSetCategory( rememberId ); |
1055 | } | 1055 | } |
1056 | } | 1056 | } |
1057 | 1057 | ||