summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabprefs.cpp2
-rw-r--r--kaddressbook/kaddressbookmain.cpp86
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp36
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h1
4 files changed, 52 insertions, 73 deletions
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 03c5e76..2425158 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -48,5 +48,5 @@ KABPrefs::KABPrefs()
48 48
49#ifdef KAB_EMBEDDED 49#ifdef KAB_EMBEDDED
50 addItemBool("AskForQuit",&mAskForQuit,false); 50 addItemBool("AskForQuit",&mAskForQuit,true);
51 addItemBool("ToolBarHor",&mToolBarHor, true ); 51 addItemBool("ToolBarHor",&mToolBarHor, true );
52 addItemBool("ToolBarUp",&mToolBarUp, false ); 52 addItemBool("ToolBarUp",&mToolBarUp, false );
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 8ebb93a..f48f214 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -200,73 +200,37 @@ void KAddressBookMain::configureKeys()
200void KAddressBookMain::closeEvent( QCloseEvent* ce ) 200void KAddressBookMain::closeEvent( QCloseEvent* ce )
201{ 201{
202 QString mess = i18n( "Close KA/Pi?"); 202 bool mModified = mCore->modified();
203 if ( mCore->modified() ) 203 bool mAskForQuit = KABPrefs::instance()->mAskForQuit;
204 mess += i18n( "\n\nChanges will be saved!");
205 else
206 mess += i18n( "\n\nNo unsaved changes detected!\nNothing will be saved!");
207
208 switch( QMessageBox::information( this, "KA/Pi", mess ,
209 i18n("Yes!"), i18n("No"), 0, 0 ) ) {
210 case 0:
211
212 break;
213 case 1:
214 return;
215 break;
216 case 2:
217 return;
218 break;
219
220 default:
221 return;
222 break;
223 }
224 204
225#if 0 205 QString mess = i18n( "Close KA/Pi?");
206 if ( mModified == true )
207 mess += i18n( "\nChanges will be saved!");
208 else
209 mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!");
226 210
227 if ( mCore->modified() ) { 211 bool mQuit = true;
228 QString text = i18n( "The address book has been modified.\nDo you want to save your changes?" );
229 212
230#ifndef KAB_EMBEDDED
231 int ret = KMessageBox::warningYesNoCancel( this, text, "",
232 KStdGuiItem::yes(),
233 KStdGuiItem::no(), "AskForSave" );
234 switch ( ret ) {
235 case KMessageBox::Yes:
236 save();
237 break;
238 case KMessageBox::No:
239 return true;
240 break;
241 default: //cancel
242 return ;
243 break;
244 }
245 213
246#else //KAB_EMBEDDED 214 if (mAskForQuit)
247 switch( QMessageBox::information( this, "KA/Pi", 215 {
248 text, 216
249 i18n("Yes!"), i18n("No"), 0, 0 ) ) { 217 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 );
250 case 0: 218 if (res == 0)
251 save(); 219 mQuit = true;
252 break; 220 else
253 case 1: 221 mQuit = false;
254 break;
255 case 2:
256 return;
257 default:
258 return;
259 break;
260 }
261#endif //KAB_EMBEDDED
262 } 222 }
263 223
264#endif 224 if (mQuit == false)
225 return;
226
227 if (mModified == true)
228 {
229 save();
230 mCore->saveSettings();
231 KABPrefs::instance()->writeConfig();
232 }
265 233
266 save();
267 mCore->saveSettings();
268 KABPrefs::instance()->writeConfig();
269 ce->accept(); 234 ce->accept();
270
271} 235}
272 236
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 31ab7b5..3a2ccbb 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -32,4 +32,5 @@
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qvbox.h>
34 35
35#include <kconfig.h> 36#include <kconfig.h>
@@ -99,26 +100,35 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
99 KDialog::spacingHintSmall() ); 100 KDialog::spacingHintSmall() );
100 //general groupbox 101 //general groupbox
101 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); 102 QVBox *vBox = new QVBox( generalPage, "qvbox" );
102 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); 103 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" );
103 boxLayout->setAlignment( Qt::AlignTop ); 104 boxLayout->setAlignment( Qt::AlignTop );
104 boxLayout->setMargin(KDialog::marginHintSmall() ); 105 boxLayout->setMargin(KDialog::marginHintSmall() );
105 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; 106 vBox->layout()->setMargin(KDialog::marginHintSmall()) ;
106 groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); 107 vBox->layout()->setSpacing(KDialog::spacingHintSmall());
107 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 108 boxLayout->setSpacing( KDialog::spacingHintSmall() );
108 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); 109 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
109 boxLayout->addWidget( mViewsSingleClickBox ); 110 boxLayout->addWidget( mViewsSingleClickBox );
110 111
111 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); 112 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
112 boxLayout->addWidget( mNameParsing ); 113 boxLayout->addWidget( mNameParsing );
113 114
114 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), groupBox, "mdisplay" ); 115 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
115 boxLayout->addWidget( mMultipleViewsAtOnce ); 116 boxLayout->addWidget( mMultipleViewsAtOnce );
116 117
117 layout->addWidget( groupBox ); 118 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
119 boxLayout->addWidget( mAskForQuit );
118 120
121 layout->addWidget( vBox );
122
123 tabWidget->addTab( generalPage, i18n( "General" ) );
124
125 // Extension page
126 QWidget *extensionPage = new QWidget( this );
127 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
128 KDialog::spacingHintSmall() );
119 129
120 //extensions groupbox 130 //extensions groupbox
121 131
122 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), generalPage ); 132 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
123 boxLayout = new QVBoxLayout( groupBox->layout() ); 133 boxLayout = new QVBoxLayout( groupBox->layout() );
124 boxLayout->setAlignment( Qt::AlignTop ); 134 boxLayout->setAlignment( Qt::AlignTop );
@@ -139,9 +149,10 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
139 boxLayout->addWidget( mConfigureButton ); 149 boxLayout->addWidget( mConfigureButton );
140 150
141 layout->addWidget( groupBox ); 151 extensionLayout->addWidget( groupBox );
142 152
143 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 153 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
144 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 154 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
145 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 155 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
156 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
146 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 157 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
147 SLOT( selectionChanged( QListViewItem* ) ) ); 158 SLOT( selectionChanged( QListViewItem* ) ) );
@@ -151,5 +162,5 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
151 SLOT( configureExtension() ) ); 162 SLOT( configureExtension() ) );
152 163
153 tabWidget->addTab( generalPage, i18n( "General" ) ); 164 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
154 165
155 // Addressee page 166 // Addressee page
@@ -171,4 +182,5 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs)
171 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 182 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
172 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 183 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
184 mAskForQuit->setChecked( prefs->mAskForQuit );
173 185
174 mAddresseeWidget->restoreSettings(); 186 mAddresseeWidget->restoreSettings();
@@ -186,4 +198,5 @@ void KABConfigWidget::saveSettings(KABPrefs* prefs)
186 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 198 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
187 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 199 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
200 prefs->mAskForQuit = mAskForQuit->isChecked();
188 201
189 mAddresseeWidget->saveSettings(); 202 mAddresseeWidget->saveSettings();
@@ -200,4 +213,5 @@ void KABConfigWidget::defaults(KABPrefs* prefs)
200 mViewsSingleClickBox->setChecked( false ); 213 mViewsSingleClickBox->setChecked( false );
201 mMultipleViewsAtOnce->setChecked( true ); 214 mMultipleViewsAtOnce->setChecked( true );
215 mAskForQuit->setChecked (true);
202 216
203 emit changed( true ); 217 emit changed( true );
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 2928495..831efc1 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -70,4 +70,5 @@ class KABConfigWidget : public QWidget
70 QCheckBox *mViewsSingleClickBox; 70 QCheckBox *mViewsSingleClickBox;
71 QCheckBox *mMultipleViewsAtOnce; 71 QCheckBox *mMultipleViewsAtOnce;
72 QCheckBox *mAskForQuit;
72 73
73 QPushButton *mConfigureButton; 74 QPushButton *mConfigureButton;