summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp46
1 files changed, 18 insertions, 28 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
@@ -821,15 +821,18 @@ void AddressbookWindow::slotSetCategory( int c )
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 catMenu->setItemChecked( i, c == (int)i ); 827 if ( catMenu )
828 // Checkmark Category Menu Item Selected 828 catMenu->setItemChecked( i, c == (int)i );
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
@@ -852,9 +855,11 @@ void AddressbookWindow::slotSetCategory( int c )
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";
@@ -868,6 +873,8 @@ 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;
@@ -879,31 +886,26 @@ void AddressbookWindow::slotViewSwitched( int view )
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
899void AddressbookWindow::slotListView() 901void AddressbookWindow::slotListView()
900{ 902{
901 emit slotSetCategory( AbView::TableView +1 ); 903 slotViewSwitched( AbView::TableView );
902} 904}
903 905
904void AddressbookWindow::slotCardView() 906void AddressbookWindow::slotCardView()
905{ 907{
906 emit slotSetCategory( AbView::CardView +1 ); 908 slotViewSwitched( AbView::CardView );
907} 909}
908 910
909void AddressbookWindow::slotSetLetter( char c ) { 911void AddressbookWindow::slotSetLetter( char c ) {
@@ -937,18 +939,6 @@ void AddressbookWindow::populateCategories()
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 );