author | tille <tille> | 2002-12-08 16:47:12 (UTC) |
---|---|---|
committer | tille <tille> | 2002-12-08 16:47:12 (UTC) |
commit | aea4a628b4500f8551255d715c9f8696c6ad3280 (patch) (side-by-side diff) | |
tree | 96fbc930732b4574490fe7e59fa19a35fb5b8596 | |
parent | a2840f80792c7e40ee3b44be0ec48302d8816cc0 (diff) | |
download | opie-aea4a628b4500f8551255d715c9f8696c6ad3280.zip opie-aea4a628b4500f8551255d715c9f8696c6ad3280.tar.gz opie-aea4a628b4500f8551255d715c9f8696c6ad3280.tar.bz2 |
do not close ab while in cardview, rather switch back to listview
as the old version did
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 8 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 055124c..60db2b4 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -702,97 +702,101 @@ void AddressbookWindow::slotPersonalView() setCaption( tr("Contacts") ); actionNew->setEnabled(TRUE); actionTrash->setEnabled(TRUE); actionFind->setEnabled(TRUE); actionMail->setEnabled(TRUE); // slotUpdateToolbar(); m_abView->showPersonal( false ); return; } // XXX need to disable some QActions. actionNew->setEnabled(FALSE); actionTrash->setEnabled(FALSE); actionFind->setEnabled(FALSE); actionMail->setEnabled(FALSE); setCaption( tr("Contacts - My Personal Details") ); m_abView->showPersonal( true ); } void AddressbookWindow::listIsEmpty( bool empty ) { if ( !empty ) { deleteButton->setEnabled( TRUE ); } } void AddressbookWindow::reload() { syncing = FALSE; m_abView->clear(); m_abView->reload(); } void AddressbookWindow::flush() { syncing = TRUE; m_abView->save(); } void AddressbookWindow::closeEvent( QCloseEvent *e ) { - + if(active_view == AbView::CardView){ + slotViewSwitched( AbView::TableView ); + e->ignore(); + return; + } if(syncing) { /* shouldn't we save, I hear you say? well its already been set so that an edit can not occur during a sync, and we flushed at the start of the sync, so there is no need to save Saving however itself would cause problems. */ e->accept(); return; } //################## shouldn't always save // True, but the database handles this automatically ! (se) if ( save() ) e->accept(); else e->ignore(); } /* Returns TRUE if it is OK to exit */ bool AddressbookWindow::save() { if ( !m_abView->save() ) { if ( QMessageBox::critical( 0, tr( "Out of space" ), tr("Unable to save information.\n" "Free up some space\n" "and try again.\n" "\nQuit anyway?"), QMessageBox::Yes|QMessageBox::Escape, QMessageBox::No|QMessageBox::Default ) != QMessageBox::No ) return TRUE; else return FALSE; } return TRUE; } #ifdef __DEBUG_RELEASE void AddressbookWindow::slotSave() { save(); } #endif void AddressbookWindow::slotNotFound() { @@ -849,97 +853,97 @@ void AddressbookWindow::slotSetCategory( int c ) }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled cat = "Unfiled"; qWarning ("Unfiled selected!!!"); }else{ cat = m_abView->categories()[i - 4]; } } } // Switch to the selected View slotViewSwitched( view ); // Tell the view about the selected category m_abView -> setShowByCategory( cat ); if ( book.isEmpty() ) book = "List"; if ( cat.isEmpty() ) cat = "All"; setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); } void AddressbookWindow::slotViewSwitched( int view ) { qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); int menu = 0; // Switch to selected view switch ( view ){ case AbView::TableView: menu = 1; m_tableViewButton->setOn(true); m_cardViewButton->setOn(false); break; case AbView::CardView: menu = 2; m_tableViewButton->setOn(false); m_cardViewButton->setOn(true); break; } for ( unsigned int i = 1; i < 3; i++ ){ if ( catMenu ) catMenu->setItemChecked( i, menu == (int)i ); } // Tell the view about the selected view m_abView -> setShowToView ( (AbView::Views) view ); - + active_view = view; } void AddressbookWindow::slotListView() { slotViewSwitched( AbView::TableView ); } void AddressbookWindow::slotCardView() { slotViewSwitched( AbView::CardView ); } void AddressbookWindow::slotSetLetter( char c ) { m_abView->setShowByLetter( c ); } void AddressbookWindow::populateCategories() { catMenu->clear(); int id, rememberId; id = 1; rememberId = 0; catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); // catMenu->insertItem( tr( "Personal" ), id++ ); catMenu->insertSeparator(); catMenu->insertItem( tr( "All" ), id++ ); QStringList categories = m_abView->categories(); categories.append( tr( "Unfiled" ) ); for ( QStringList::Iterator it = categories.begin(); it != categories.end(); ++it ) { catMenu->insertItem( *it, id ); if ( *it == m_abView -> showCategory() ) rememberId = id; ++id; } if ( m_abView -> showCategory().isEmpty() ) { slotSetCategory( 3 ); } diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h index 4c1e2f2..2bedc0b 100644 --- a/core/pim/addressbook/addressbook.h +++ b/core/pim/addressbook/addressbook.h @@ -87,51 +87,53 @@ private slots: void slotSetFont(int); void slotFindOpen(); void slotFindClose(); void slotFind(); void slotNotFound(); void slotWrapAround(); void slotViewSwitched( int ); void slotListView(); void slotCardView(); void slotConfig(); private: // void initFields(); // inititialize our fields... // AbLabel *abView(); void populateCategories(); QPopupMenu *catMenu; QPEToolBar *listTools; QToolButton *deleteButton; // QValueList<int> allFields, orderedFields; // QStringList slOrderedFields; enum Panes { paneList=0, paneView, paneEdit }; ContactEditor *abEditor; LetterPicker *pLabel; AbView* m_abView; QWidget *listContainer; // Searching stuff OFloatBar* searchBar; QLineEdit* searchEdit; QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail; int viewMargin; bool syncing; QFont *defaultFont; int m_curFontSize; bool isLoading; AbConfig m_config; QAction* m_tableViewButton; QAction* m_cardViewButton; + + int active_view; }; #endif |