Fix consistency of default button in messageboxes between Qt and KDE builds.

This commit is contained in:
craig.p.drummond
2013-05-10 19:02:29 +00:00
parent 08fbc4d294
commit 7c085c1913
2 changed files with 6 additions and 3 deletions

View File

@@ -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
-------

View File

@@ -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);