In confirm close dialog, remove 'close current tab' option

Summary:
When there is only one tab and a process is running, remove the
'close current tab' option when attempting to close Konsole.

Test Plan:
1. Open Konsole (assuming you have not check 'Do not ask again')
2. Start any process (ie top)
3.  Try to close Konsole

Should only be 2 options,  'Close window' and 'Cancel'

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, ngraham, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D23146
wilder-portage
Andrey Yashkin 7 years ago committed by Kurt Hindenburg
parent 2da796b62a
commit 276a6dca66
  1. 59
      src/MainWindow.cpp

@ -603,25 +603,46 @@ bool MainWindow::queryClose()
int result;
if (!processesRunning.isEmpty()) {
result = KMessageBox::warningYesNoCancelList(this,
i18ncp("@info",
"There is a process running in this window. "
"Do you still want to quit?",
"There are %1 processes running in this window. "
"Do you still want to quit?",
processesRunning.count()),
processesRunning,
i18nc("@title", "Confirm Close"),
KGuiItem(i18nc("@action:button",
"Close &Window"),
QStringLiteral("window-close")),
KGuiItem(i18nc("@action:button",
"Close Current &Tab"),
QStringLiteral("tab-close")),
KStandardGuiItem::cancel(),
// don't ask again name is wrong but I can't update.
// this is not about tabs anymore. it's about empty tabs *or* splits.
QStringLiteral("CloseAllTabs"));
if (openTabs == 1) {
result = KMessageBox::warningYesNoList(this,
i18ncp("@info",
"There is a process running in this window. "
"Do you still want to quit?",
"There are %1 processes running in this window. "
"Do you still want to quit?",
processesRunning.count()),
processesRunning,
i18nc("@title", "Confirm Close"),
KGuiItem(i18nc("@action:button",
"Close &Window"),
QStringLiteral("window-close")),
KStandardGuiItem::cancel(),
// don't ask again name is wrong but I can't update.
// this is not about tabs anymore. it's about empty tabs *or* splits.
QStringLiteral("CloseAllTabs"));
if (result == KMessageBox::No) // No is equal to cancel closing
result = KMessageBox::Cancel;
} else {
result = KMessageBox::warningYesNoCancelList(this,
i18ncp("@info",
"There is a process running in this window. "
"Do you still want to quit?",
"There are %1 processes running in this window. "
"Do you still want to quit?",
processesRunning.count()),
processesRunning,
i18nc("@title", "Confirm Close"),
KGuiItem(i18nc("@action:button",
"Close &Window"),
QStringLiteral("window-close")),
KGuiItem(i18nc("@action:button",
"Close Current &Tab"),
QStringLiteral("tab-close")),
KStandardGuiItem::cancel(),
// don't ask again name is wrong but I can't update.
// this is not about tabs anymore. it's about empty tabs *or* splits.
QStringLiteral("CloseAllTabs"));
}
} else {
result = KMessageBox::warningYesNoCancel(this,
i18nc("@info",

Loading…
Cancel
Save