Konsole confirmation dialog - non-compliant behavior

Tomaz Canabrava tomaz.canabrava at gmail.com
Sat Dec 13 20:08:57 GMT 2025


On Sat, 13 Dec 2025 at 20:15 Cristian S <cristian_s at gmx.com> wrote:

> I'm trying to figure out where this bug is coming from.
> I'm discussing these particular versions of Konsole and KWidgetsAddons as
> published on Debian Snapshots:
>
> #    konsole 20.12.1-1 (sources at
> http://snapshot.debian.org/package/konsole/4%3A20.12.1-1/#konsole_4:3a:20.12.1-1
> )
> #    kwidgetsaddons 5.78.0-2 (sources at
> http://snapshot.debian.org/package/kwidgetsaddons/5.78.0-2/#libkf5widgetsaddons5_5.78.0-2
> )
>

this is from 5 years ago, any chance you can update?


> The issue I'm trying to fix is with the confirmation dialogs shown for
> example by Konsole when trying to close a Konsole window containing a
> process or more  can updstill running in it.
>
> This confirmation dialog uses the KMessageBox widget from KWidgetsAddons.
> Looking in kwidgetsaddons-5.78.0/src/kmessagebox.h,  at line 409, I see
> this:
>
> ====================================
> /**
>  * Display a Yes/No/Cancel "warning" dialog with a listbox to show
> information
>  * to the user.
>  *
>  * @param parent  Parent widget.
>  * @param text    Message string.
>  * @param strlist List of strings to be written in the listbox. If the
>  *                list is empty, it doesn't show any listbox, working
>  *                as warningYesNoCancel.
>  * @param caption Message box title. The application name is added to
>  *                the title. The default title is i18n("Warning").
>  * @param buttonYes The text for the first button.
>  *                  The default is KStandardGuiItem::yes().
>  * @param buttonNo  The text for the second button.
>  *                  The default is KStandardGuiItem::no().
>  * @param buttonCancel  The text for the third button.
>  *                  The default is KStandardGuiItem::cancel().
>  * @param dontAskAgainName If provided, a checkbox is added with which
>  *                further questions can be turned off. If turned off
>  *                all questions will be automatically answered with the
>  *                last answer (either Yes or No).
>  *                The string is used to lookup and store the setting
>  *                in the applications config file.
>  *                The setting is stored in the "Notification Messages"
> group.
>  *                If @p dontAskAgainName starts with a ':' then the setting
>  *                is stored in the global config file.
>  * @param options  see Options
>  *
>  * @return  @p Yes is returned if the Yes-button is pressed. @p No is
> returned
>  *          if the No-button is pressed. @p Cancel is retunred if the
> Cancel-
>  *          button is pressed.
>  *
>  * To be used for questions "Do you want to save your changes?"
>  * The text should explain the implication of choosing 'No'.
>  *
>  * The default button is "Yes". Pressing "Esc" selects "Cancel"
>  */
> KWIDGETSADDONS_EXPORT ButtonCode warningYesNoCancelList(QWidget *parent,
>         const QString &text,
>         const QStringList &strlist,
>         const QString &caption = QString(),
>         const KGuiItem &buttonYes = KStandardGuiItem::yes(),
>         const KGuiItem &buttonNo = KStandardGuiItem::no(),
>         const KGuiItem &buttonCancel = KStandardGuiItem::cancel(),
>         const QString &dontAskAgainName = QString(),
>         Options options = Notify);
> ====================================
>
> So the description in the comment clearly says the default button is "Yes".
> I take this to mean "the leftmost button having the initial focus".
> Also note the order of these buttons is 1="Yes", 2="No", 3="Cancel".
>
> Now looking in konsole-20.12.1/src/MainWindow.cpp,  at line 620, I see
> this:
>
> ====================================
> 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"));
> ====================================
>
> So here, the first button is "Close Window" as "Yes", the second is "Close
> Current Tab" as "No" and the third is "Cancel" as "Cancel".
> So absolutely correct.
>
> Therefore "Close Window" should be shown as the leftmost button and having
> the initial focus.
>
> Yet, when actually running Konsole, the first (leftmost) button with
> initial focus is "Cancel", and "Close Window" is the rightmost button,
> which is exactly backwards from the stated behavior of KMessageBox.
>
> Now my opinion is that this is a bug from KWidgets/KMessageBox and not
> from Konsole, and I base this opinion on the fact that this behavior is
> common to other KDE programs, for instance Konqueror or KWrite.
> I attached to this message screenshots of these confirmation dialogs from
> Konsole and Konqueror for reference.
>
> My question for the readers of this message is: did any of the Konsole
> developers notice this backward behavior of the buttons in KMessageBox?
>
> Has anybody tried to figure out a way to fix this, and, if so, can they
> share their findings here?
>
> I just want to figure out how to get the buttons back in the correct order
> with the focus on the first.
> Maybe someone can suggest how to do this?
> Maybe reverse the order of the buttons in the warningYesNoCancelList()
> function call in konsole-20.12.1/src/MainWindow.cpp ?  Would that do it?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20251213/1c708c21/attachment.htm>


More information about the konsole-devel mailing list