From 10dc4f93f432ca066a02de98470536cc10a917b3 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 13 Feb 2023 20:57:13 +0200 Subject: [PATCH] VCS: Recover clearer actions when closing commit editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends commit d63bfa4a2975541b51fc8173fdb06933bb9dd40d, and recovers the actions that were introduced in 15b176e30c0a3a6e6effe0043a5133241caa9d2f (relates to QTCREATORBUG-18799). I keep being confused by these Yes/No myself :) Change-Id: I0429ef9c25231b96bd595a1bfb6808b621db54e5 Reviewed-by: Leena Miettinen Reviewed-by: André Hartmann --- src/plugins/vcsbase/vcsbasesubmiteditor.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 00c46fbce16..eaa825adb10 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -481,10 +481,18 @@ bool VcsBaseSubmitEditor::promptSubmit(VcsBasePluginPrivate *plugin) return true; const QString commitName = plugin->commitDisplayName(); - return QMessageBox::question(Core::ICore::dialogParent(), - Tr::tr("Close %1 %2 Editor").arg(plugin->displayName(), commitName), - Tr::tr("Closing this editor will abort the %1. Are you sure?") - .arg(commitName.toLower())) == QMessageBox::Yes; + QMessageBox mb(Core::ICore::dialogParent()); + mb.setWindowTitle(Tr::tr("Close %1 %2 Editor").arg(plugin->displayName(), commitName)); + mb.setIcon(QMessageBox::Warning); + mb.setText(Tr::tr("Closing this editor will abort the %1.") + .arg(commitName.toLower())); + mb.setStandardButtons(QMessageBox::Close | QMessageBox::Cancel); + // On Windows there is no mnemonic for Close. Set it explicitly. + mb.button(QMessageBox::Close)->setText(Tr::tr("&Close")); + mb.button(QMessageBox::Cancel)->setText(Tr::tr("&Keep Editing")); + mb.setDefaultButton(QMessageBox::Cancel); + mb.exec(); + return mb.result() == QMessageBox::Close; } QString VcsBaseSubmitEditor::promptForNickName()