From 7c085c19134591d9ba08b0232a743a5cdcb4d8eb Mon Sep 17 00:00:00 2001 From: "craig.p.drummond" Date: Fri, 10 May 2013 19:02:29 +0000 Subject: [PATCH] Fix consistency of default button in messageboxes between Qt and KDE builds. --- ChangeLog | 1 + support/messagebox.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99149060a..349e42a79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ 1. Dont display codec settings in copy dialog unless we are copying to a device, or from an AudioCD. 2. Save size of Track Organiser, Tag Editor, and ReplayGain dialogs. +3. Fix consistency of default button in messageboxes between Qt and KDE builds. 1.0.2.1 ------- diff --git a/support/messagebox.cpp b/support/messagebox.cpp index 58b44efdc..aa39ee8ae 100644 --- a/support/messagebox.cpp +++ b/support/messagebox.cpp @@ -48,15 +48,17 @@ MessageBox::ButtonCode MessageBox::questionYesNoCancel(QWidget *parent, const QS if (yesText.text.isEmpty() && noText.text.isEmpty()) { return map(isWarning ? QMessageBox::warning(parent, title.isEmpty() ? i18n("Warning") : title, message, - QMessageBox::Yes|QMessageBox::No|(showCancel ? QMessageBox::Cancel : QMessageBox::NoButton)) + QMessageBox::Yes|QMessageBox::No|(showCancel ? QMessageBox::Cancel : QMessageBox::NoButton), + showCancel ? QMessageBox::Yes : QMessageBox::No) : QMessageBox::question(parent, title.isEmpty() ? i18n("Question") : title, message, - QMessageBox::Yes|QMessageBox::No|(showCancel ? QMessageBox::Cancel : QMessageBox::NoButton)) + QMessageBox::Yes|QMessageBox::No|(showCancel ? QMessageBox::Cancel : QMessageBox::NoButton), + QMessageBox::Yes) ); } else { QMessageBox box(isWarning ? QMessageBox::Warning : QMessageBox::Question, title.isEmpty() ? (isWarning ? i18n("Warning") : i18n("Question")) : title, message, QMessageBox::Yes|QMessageBox::No|(showCancel ? QMessageBox::Cancel : QMessageBox::NoButton), parent); - box.setDefaultButton(QMessageBox::Yes); + box.setDefaultButton(isWarning && !showCancel ? QMessageBox::No : QMessageBox::Yes); if (!yesText.text.isEmpty()) { QAbstractButton *btn=box.button(QMessageBox::Yes); btn->setText(yesText.text);