Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 46 |
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 @@ -822,13 +822,16 @@ void AddressbookWindow::slotSetCategory( int c ) return; - // Checkmark Book Menu Item Selected + // Switch view if ( c < 3 ) - for ( unsigned int i = 1; i < 3; i++ ) - catMenu->setItemChecked( i, c == (int)i ); - // Checkmark Category Menu Item Selected + for ( unsigned int i = 1; i < 3; i++ ){ + if ( catMenu ) + catMenu->setItemChecked( i, c == (int)i ); + } else + // Checkmark Category Menu Item Selected for ( unsigned int i = 3; i < catMenu->count(); i++ ) catMenu->setItemChecked( i, c == (int)i ); + // Now switch to the selected category for ( unsigned int i = 1; i < catMenu->count(); i++ ) { if (catMenu->isItemChecked( i )) { @@ -853,7 +856,9 @@ void AddressbookWindow::slotSetCategory( int c ) } + // Switch to the selected View slotViewSwitched( view ); - m_abView -> setShowByCategory( view, cat ); + // Tell the view about the selected category + m_abView -> setShowByCategory( cat ); if ( book.isEmpty() ) @@ -869,4 +874,6 @@ void AddressbookWindow::slotViewSwitched( int view ) qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); int menu = 0; + + // Switch to selected view switch ( view ){ case AbView::TableView: @@ -880,13 +887,4 @@ void AddressbookWindow::slotViewSwitched( int view ) m_cardViewButton->setOn(true); break; -// case AbView::PersonalView: -// menu = 3; -// break; -// case AbView::CompanyBook: -// menu = 3; -// break; -// case AbView::EmailBook: -// menu = 4; -// break; } for ( unsigned int i = 1; i < 3; i++ ){ @@ -894,4 +892,8 @@ void AddressbookWindow::slotViewSwitched( int view ) catMenu->setItemChecked( i, menu == (int)i ); } + + // Tell the view about the selected view + m_abView -> setShowToView ( (AbView::Views) view ); + } @@ -899,10 +901,10 @@ void AddressbookWindow::slotViewSwitched( int view ) void AddressbookWindow::slotListView() { - emit slotSetCategory( AbView::TableView +1 ); + slotViewSwitched( AbView::TableView ); } void AddressbookWindow::slotCardView() { - emit slotSetCategory( AbView::CardView +1 ); + slotViewSwitched( AbView::CardView ); } @@ -938,16 +940,4 @@ void AddressbookWindow::populateCategories() } - // :SX -// if ( abList->showBook().isEmpty() ) { -// catMenu->setItemChecked( 1, true ); -// } else if ( abList->showBook() == "Phone" ) { -// catMenu->setItemChecked( 2, true ); -// } else if ( abList->showBook() == "Company" ) { -// catMenu->setItemChecked( 3, true ); -// } else if ( abList->showBook() == "Email" ) { -// catMenu->setItemChecked( 4, true ); -// } else if ( abList->showBook() == "Cards" ) { -// catMenu->setItemChecked( 5, true ); -// } if ( m_abView -> showCategory().isEmpty() ) { |