summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp8
-rw-r--r--core/pim/addressbook/addressbook.h2
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
@@ -726,49 +726,53 @@ void AddressbookWindow::slotPersonalView()
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" ),
@@ -873,49 +877,49 @@ 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();
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
@@ -111,27 +111,29 @@ private:
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