Browse Source

Set default focus to no button in exit confirm box

adaptive-webui-19844
Chocobo1 10 years ago
parent
commit
e75de01809
  1. 11
      src/gui/mainwindow.cpp

11
src/gui/mainwindow.cpp

@ -911,10 +911,10 @@ void MainWindow::closeEvent(QCloseEvent *e)
QMessageBox confirmBox(QMessageBox::Question, tr("Exiting qBittorrent"), QMessageBox confirmBox(QMessageBox::Question, tr("Exiting qBittorrent"),
tr("Some files are currently transferring.\nAre you sure you want to quit qBittorrent?"), tr("Some files are currently transferring.\nAre you sure you want to quit qBittorrent?"),
QMessageBox::NoButton, this); QMessageBox::NoButton, this);
QPushButton *noBtn = confirmBox.addButton(tr("No"), QMessageBox::NoRole); QPushButton *noBtn = confirmBox.addButton(tr("&No"), QMessageBox::NoRole);
QPushButton *yesBtn = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole); QPushButton *yesBtn = confirmBox.addButton(tr("&Yes"), QMessageBox::YesRole);
QPushButton *alwaysBtn = confirmBox.addButton(tr("Always"), QMessageBox::YesRole); QPushButton *alwaysBtn = confirmBox.addButton(tr("&Always Yes"), QMessageBox::YesRole);
confirmBox.setDefaultButton(yesBtn); confirmBox.setDefaultButton(noBtn);
confirmBox.exec(); confirmBox.exec();
if (!confirmBox.clickedButton() || confirmBox.clickedButton() == noBtn) { if (!confirmBox.clickedButton() || confirmBox.clickedButton() == noBtn) {
// Cancel exit // Cancel exit
@ -922,9 +922,10 @@ void MainWindow::closeEvent(QCloseEvent *e)
force_exit = false; force_exit = false;
return; return;
} }
if (confirmBox.clickedButton() == alwaysBtn) if (confirmBox.clickedButton() == alwaysBtn) {
// Remember choice // Remember choice
Preferences::instance()->setConfirmOnExit(false); Preferences::instance()->setConfirmOnExit(false);
}
} }
} }

Loading…
Cancel
Save