Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 3b2e4b8..5d588da 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -818,21 +818,24 @@ void AddressbookWindow::slotSetCategory( int c ) | |||
818 | QString cat, book; | 818 | QString cat, book; |
819 | AbView::Views view = AbView::TableView; | 819 | AbView::Views view = AbView::TableView; |
820 | 820 | ||
821 | if ( c <= 0 ) | 821 | if ( c <= 0 ) |
822 | return; | 822 | return; |
823 | 823 | ||
824 | // Checkmark Book Menu Item Selected | 824 | // Switch view |
825 | if ( c < 3 ) | 825 | if ( c < 3 ) |
826 | for ( unsigned int i = 1; i < 3; i++ ) | 826 | for ( unsigned int i = 1; i < 3; i++ ){ |
827 | if ( catMenu ) | ||
827 | catMenu->setItemChecked( i, c == (int)i ); | 828 | catMenu->setItemChecked( i, c == (int)i ); |
828 | // Checkmark Category Menu Item Selected | 829 | } |
829 | else | 830 | else |
831 | // Checkmark Category Menu Item Selected | ||
830 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 832 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
831 | catMenu->setItemChecked( i, c == (int)i ); | 833 | catMenu->setItemChecked( i, c == (int)i ); |
832 | 834 | ||
835 | // Now switch to the selected category | ||
833 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 836 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
834 | if (catMenu->isItemChecked( i )) { | 837 | if (catMenu->isItemChecked( i )) { |
835 | if ( i == 1 ){ // default List view | 838 | if ( i == 1 ){ // default List view |
836 | book = QString::null; | 839 | book = QString::null; |
837 | view = AbView::TableView; | 840 | view = AbView::TableView; |
838 | }else if ( i == 2 ){ | 841 | }else if ( i == 2 ){ |
@@ -849,15 +852,17 @@ void AddressbookWindow::slotSetCategory( int c ) | |||
849 | }else{ | 852 | }else{ |
850 | cat = m_abView->categories()[i - 4]; | 853 | cat = m_abView->categories()[i - 4]; |
851 | } | 854 | } |
852 | } | 855 | } |
853 | } | 856 | } |
854 | 857 | ||
858 | // Switch to the selected View | ||
855 | slotViewSwitched( view ); | 859 | slotViewSwitched( view ); |
856 | 860 | ||
857 | m_abView -> setShowByCategory( view, cat ); | 861 | // Tell the view about the selected category |
862 | m_abView -> setShowByCategory( cat ); | ||
858 | 863 | ||
859 | if ( book.isEmpty() ) | 864 | if ( book.isEmpty() ) |
860 | book = "List"; | 865 | book = "List"; |
861 | if ( cat.isEmpty() ) | 866 | if ( cat.isEmpty() ) |
862 | cat = "All"; | 867 | cat = "All"; |
863 | 868 | ||
@@ -865,48 +870,45 @@ void AddressbookWindow::slotSetCategory( int c ) | |||
865 | } | 870 | } |
866 | 871 | ||
867 | void AddressbookWindow::slotViewSwitched( int view ) | 872 | void AddressbookWindow::slotViewSwitched( int view ) |
868 | { | 873 | { |
869 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); | 874 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); |
870 | int menu = 0; | 875 | int menu = 0; |
876 | |||
877 | // Switch to selected view | ||
871 | switch ( view ){ | 878 | switch ( view ){ |
872 | case AbView::TableView: | 879 | case AbView::TableView: |
873 | menu = 1; | 880 | menu = 1; |
874 | m_tableViewButton->setOn(true); | 881 | m_tableViewButton->setOn(true); |
875 | m_cardViewButton->setOn(false); | 882 | m_cardViewButton->setOn(false); |
876 | break; | 883 | break; |
877 | case AbView::CardView: | 884 | case AbView::CardView: |
878 | menu = 2; | 885 | menu = 2; |
879 | m_tableViewButton->setOn(false); | 886 | m_tableViewButton->setOn(false); |
880 | m_cardViewButton->setOn(true); | 887 | m_cardViewButton->setOn(true); |
881 | break; | 888 | break; |
882 | // case AbView::PersonalView: | ||
883 | // menu = 3; | ||
884 | // break; | ||
885 | // case AbView::CompanyBook: | ||
886 | // menu = 3; | ||
887 | // break; | ||
888 | // case AbView::EmailBook: | ||
889 | // menu = 4; | ||
890 | // break; | ||
891 | } | 889 | } |
892 | for ( unsigned int i = 1; i < 3; i++ ){ | 890 | for ( unsigned int i = 1; i < 3; i++ ){ |
893 | if ( catMenu ) | 891 | if ( catMenu ) |
894 | catMenu->setItemChecked( i, menu == (int)i ); | 892 | catMenu->setItemChecked( i, menu == (int)i ); |
895 | } | 893 | } |
894 | |||
895 | // Tell the view about the selected view | ||
896 | m_abView -> setShowToView ( (AbView::Views) view ); | ||
897 | |||
896 | } | 898 | } |
897 | 899 | ||
898 | 900 | ||
899 | void AddressbookWindow::slotListView() | 901 | void AddressbookWindow::slotListView() |
900 | { | 902 | { |
901 | emit slotSetCategory( AbView::TableView +1 ); | 903 | slotViewSwitched( AbView::TableView ); |
902 | } | 904 | } |
903 | 905 | ||
904 | void AddressbookWindow::slotCardView() | 906 | void AddressbookWindow::slotCardView() |
905 | { | 907 | { |
906 | emit slotSetCategory( AbView::CardView +1 ); | 908 | slotViewSwitched( AbView::CardView ); |
907 | } | 909 | } |
908 | 910 | ||
909 | void AddressbookWindow::slotSetLetter( char c ) { | 911 | void AddressbookWindow::slotSetLetter( char c ) { |
910 | 912 | ||
911 | m_abView->setShowByLetter( c ); | 913 | m_abView->setShowByLetter( c ); |
912 | 914 | ||
@@ -934,24 +936,12 @@ void AddressbookWindow::populateCategories() | |||
934 | catMenu->insertItem( *it, id ); | 936 | catMenu->insertItem( *it, id ); |
935 | if ( *it == m_abView -> showCategory() ) | 937 | if ( *it == m_abView -> showCategory() ) |
936 | rememberId = id; | 938 | rememberId = id; |
937 | ++id; | 939 | ++id; |
938 | } | 940 | } |
939 | 941 | ||
940 | // :SX | ||
941 | // if ( abList->showBook().isEmpty() ) { | ||
942 | // catMenu->setItemChecked( 1, true ); | ||
943 | // } else if ( abList->showBook() == "Phone" ) { | ||
944 | // catMenu->setItemChecked( 2, true ); | ||
945 | // } else if ( abList->showBook() == "Company" ) { | ||
946 | // catMenu->setItemChecked( 3, true ); | ||
947 | // } else if ( abList->showBook() == "Email" ) { | ||
948 | // catMenu->setItemChecked( 4, true ); | ||
949 | // } else if ( abList->showBook() == "Cards" ) { | ||
950 | // catMenu->setItemChecked( 5, true ); | ||
951 | // } | ||
952 | 942 | ||
953 | if ( m_abView -> showCategory().isEmpty() ) { | 943 | if ( m_abView -> showCategory().isEmpty() ) { |
954 | slotSetCategory( 3 ); | 944 | slotSetCategory( 3 ); |
955 | } | 945 | } |
956 | else { | 946 | else { |
957 | slotSetCategory( rememberId ); | 947 | slotSetCategory( rememberId ); |