diff options
| author | Frank Reininghaus <[email protected]> | 2009-03-12 22:40:32 +0000 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2009-03-12 22:40:32 +0000 |
| commit | b9b9df729649b17290fc574cf617f53722583f03 (patch) | |
| tree | fb2b5aa2825ff5d2eb8ace92cf967c12fd215198 /src/dolphinmainwindow.cpp | |
| parent | ec48b26a156c8dbe5cbb90c0c89e8643010f5dbe (diff) | |
Ask for confirmation when closing a Dolphin window with more than one tab. This can be disabled by checking the "Do not ask again" checkbox in the confirmation dialog or in Dolphin's settings dialog.
FEATURE: 168417
svn path=/trunk/KDE/kdebase/apps/; revision=938767
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 0151d48b1..fe1066025 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -425,6 +425,50 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event) { DolphinSettings& settings = DolphinSettings::instance(); GeneralSettings* generalSettings = settings.generalSettings(); + + if ((m_viewTab.count() > 1) && generalSettings->confirmClosingMultipleTabs()) { + // Ask the user if he really wants to quit and close all tabs. + // Open a confirmation dialog with 3 buttons: + // KDialog::Yes -> Quit + // KDialog::No -> Close only the current tab + // KDialog::Cancel -> do nothing + KDialog *dialog = new KDialog(this, Qt::Dialog); + dialog->setCaption(i18nc("@title:window", "Confirmation")); + dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel); + dialog->setModal(true); + dialog->showButtonSeparator(true); + dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit()); + dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close"))); + dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel()); + dialog->setDefaultButton(KDialog::Yes); + + bool doNotAskAgainCheckboxResult = false; + + const int result = KMessageBox::createKMessageBox(dialog, + QMessageBox::Warning, + i18n("You have multiple tabs open in this window, are you sure you want to quit?"), + QStringList(), + i18n("Do not ask again"), + &doNotAskAgainCheckboxResult, + KMessageBox::Notify); + + if (doNotAskAgainCheckboxResult) { + generalSettings->setConfirmClosingMultipleTabs(false); + } + + switch (result) { + case KDialog::Yes: + // Quit + break; + case KDialog::No: + // Close only the current tab + closeTab(); + default: + event->ignore(); + return; + } + } + generalSettings->setFirstRun(false); settings.save(); |
