author | ulf69 <ulf69> | 2004-09-02 23:07:29 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-02 23:07:29 (UTC) |
commit | a2d8fcc8f1fcd64c01e41cb8ba31ae17a5ea5a8b (patch) (side-by-side diff) | |
tree | 80ecec37a7aa38ece91ac77409bf9f504e8e009e /kaddressbook/kaddressbookmain.cpp | |
parent | 436f0b8e6b73d7c3db1ac17da5ff245e6b12a18c (diff) | |
download | kdepimpi-a2d8fcc8f1fcd64c01e41cb8ba31ae17a5ea5a8b.zip kdepimpi-a2d8fcc8f1fcd64c01e41cb8ba31ae17a5ea5a8b.tar.gz kdepimpi-a2d8fcc8f1fcd64c01e41cb8ba31ae17a5ea5a8b.tar.bz2 |
sourceforge 1014892, quit dialog now configurable
Diffstat (limited to 'kaddressbook/kaddressbookmain.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 86 |
1 files changed, 25 insertions, 61 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() void KAddressBookMain::closeEvent( QCloseEvent* ce ) { - QString mess = i18n( "Close KA/Pi?"); - if ( mCore->modified() ) - mess += i18n( "\n\nChanges will be saved!"); - else - mess += i18n( "\n\nNo unsaved changes detected!\nNothing will be saved!"); - - switch( QMessageBox::information( this, "KA/Pi", mess , - i18n("Yes!"), i18n("No"), 0, 0 ) ) { - case 0: - - break; - case 1: - return; - break; - case 2: - return; - break; - - default: - return; - break; - } + bool mModified = mCore->modified(); + bool mAskForQuit = KABPrefs::instance()->mAskForQuit; -#if 0 + QString mess = i18n( "Close KA/Pi?"); + if ( mModified == true ) + mess += i18n( "\nChanges will be saved!"); + else + mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); - if ( mCore->modified() ) { - QString text = i18n( "The address book has been modified.\nDo you want to save your changes?" ); + bool mQuit = true; -#ifndef KAB_EMBEDDED - int ret = KMessageBox::warningYesNoCancel( this, text, "", - KStdGuiItem::yes(), - KStdGuiItem::no(), "AskForSave" ); - switch ( ret ) { - case KMessageBox::Yes: - save(); - break; - case KMessageBox::No: - return true; - break; - default: //cancel - return ; - break; - } -#else //KAB_EMBEDDED - switch( QMessageBox::information( this, "KA/Pi", - text, - i18n("Yes!"), i18n("No"), 0, 0 ) ) { - case 0: - save(); - break; - case 1: - break; - case 2: - return; - default: - return; - break; - } -#endif //KAB_EMBEDDED + if (mAskForQuit) + { + + int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); + if (res == 0) + mQuit = true; + else + mQuit = false; } -#endif + if (mQuit == false) + return; + + if (mModified == true) + { + save(); + mCore->saveSettings(); + KABPrefs::instance()->writeConfig(); + } - save(); - mCore->saveSettings(); - KABPrefs::instance()->writeConfig(); ce->accept(); - } #ifndef KAB_EMBEDDED |