Improve QDialogButtonBox::Yes override text

Summary:
We are asking the users whether they are sure they want to quit.

But the "Quit" button can be ambiguous (am I quitting dolphin or just
this dialog?). If we use a "Quit Dolphin" button instead, that clearly
shows what will happen after triggering the action.

Test Plan: Close dolphin while multiple tabs are open.

Reviewers: #dolphin

Differential Revision: https://phabricator.kde.org/D11892
This commit is contained in:
Elvis Angelaccio 2018-04-02 23:06:41 +02:00
parent 993c47f309
commit e9192259f6

View file

@ -48,6 +48,7 @@
#include <KActionMenu> #include <KActionMenu>
#include <KAuthorized> #include <KAuthorized>
#include <KConfig> #include <KConfig>
#include <KDesktopFile>
#include <KFileItemListProperties> #include <KFileItemListProperties>
#include <KFilePlacesModel> #include <KFilePlacesModel>
#include <KHelpMenu> #include <KHelpMenu>
@ -402,7 +403,8 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
dialog->setWindowTitle(i18nc("@title:window", "Confirmation")); dialog->setWindowTitle(i18nc("@title:window", "Confirmation"));
dialog->setModal(true); dialog->setModal(true);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel); QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel);
KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit()); KDesktopFile dolphinDesktopFile(QStringLiteral("%1.desktop").arg(QGuiApplication::desktopFileName()));
KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KGuiItem(i18nc("@action:button 'Quit Dolphin' button", "&Quit %1", dolphinDesktopFile.readName()), QIcon::fromTheme(QStringLiteral("application-exit"))));
KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("tab-close")))); KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("tab-close"))));
KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel()); KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
buttons->button(QDialogButtonBox::Yes)->setDefault(true); buttons->button(QDialogButtonBox::Yes)->setDefault(true);