summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kaddressbookmain.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kaddressbookmain.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kaddressbookmain.cpp74
1 files changed, 19 insertions, 55 deletions
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 8ebb93a..f48f214 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -199,75 +199,39 @@ void KAddressBookMain::configureKeys()
199 199
200void KAddressBookMain::closeEvent( QCloseEvent* ce ) 200void KAddressBookMain::closeEvent( QCloseEvent* ce )
201{ 201{
202 bool mModified = mCore->modified();
203 bool mAskForQuit = KABPrefs::instance()->mAskForQuit;
204
202 QString mess = i18n( "Close KA/Pi?"); 205 QString mess = i18n( "Close KA/Pi?");
203 if ( mCore->modified() ) 206 if ( mModified == true )
204 mess += i18n( "\n\nChanges will be saved!"); 207 mess += i18n( "\nChanges will be saved!");
205 else 208 else
206 mess += i18n( "\n\nNo unsaved changes detected!\nNothing will be saved!"); 209 mess += i18n( "\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 210
220 default: 211 bool mQuit = true;
221 return;
222 break;
223 }
224 212
225#if 0
226 213
227 if ( mCore->modified() ) { 214 if (mAskForQuit)
228 QString text = i18n( "The address book has been modified.\nDo you want to save your changes?" ); 215 {
229 216
230#ifndef KAB_EMBEDDED 217 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 );
231 int ret = KMessageBox::warningYesNoCancel( this, text, "", 218 if (res == 0)
232 KStdGuiItem::yes(), 219 mQuit = true;
233 KStdGuiItem::no(), "AskForSave" ); 220 else
234 switch ( ret ) { 221 mQuit = false;
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 } 222 }
245 223
246#else //KAB_EMBEDDED 224 if (mQuit == false)
247 switch( QMessageBox::information( this, "KA/Pi",
248 text,
249 i18n("Yes!"), i18n("No"), 0, 0 ) ) {
250 case 0:
251 save();
252 break;
253 case 1:
254 break;
255 case 2:
256 return; 225 return;
257 default:
258 return;
259 break;
260 }
261#endif //KAB_EMBEDDED
262 }
263
264#endif
265 226
227 if (mModified == true)
228 {
266 save(); 229 save();
267 mCore->saveSettings(); 230 mCore->saveSettings();
268 KABPrefs::instance()->writeConfig(); 231 KABPrefs::instance()->writeConfig();
269 ce->accept(); 232 }
270 233
234 ce->accept();
271} 235}
272 236
273#ifndef KAB_EMBEDDED 237#ifndef KAB_EMBEDDED