From 2b2bc11d7d9753d5051f7ba364e786f3754b0f68 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 24 May 2015 15:11:37 +0800 Subject: [PATCH 1/3] Set default focus to cancel button in delete confirm dlg, closes #3085 --- src/gui/deletionconfirmationdlg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/deletionconfirmationdlg.h b/src/gui/deletionconfirmationdlg.h index 7756ad5ae..4b778d28b 100644 --- a/src/gui/deletionconfirmationdlg.h +++ b/src/gui/deletionconfirmationdlg.h @@ -32,6 +32,7 @@ #define DELETIONCONFIRMATIONDLG_H #include +#include #include "ui_confirmdeletiondlg.h" #include "preferences.h" #include "iconprovider.h" @@ -55,7 +56,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { move(misc::screenCenter(this)); checkPermDelete->setChecked(Preferences::instance()->deleteTorrentFilesAsDefault()); connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState())); - buttonBox->setFocus(); + buttonBox->button(QDialogButtonBox::Cancel)->setFocus(); } bool shouldDeleteLocalFiles() const { From a29f2dcfaa411e3781707e3f9fd5c9ee560664ee Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 24 May 2015 15:12:07 +0800 Subject: [PATCH 2/3] Set default focus to ok button in add new torrent dlg --- src/gui/addnewtorrentdialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index e480ae38b..2bd8d633b 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -87,6 +87,8 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent) editHotkey = new QShortcut(QKeySequence("F2"), ui->content_tree, 0, 0, Qt::WidgetShortcut); connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedFile())); connect(ui->content_tree, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedFile())); + + ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus(); } AddNewTorrentDialog::~AddNewTorrentDialog() From e75de01809d5a4ea05672d70a50681d48ed4ee68 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 26 May 2015 13:25:12 +0800 Subject: [PATCH 3/3] Set default focus to no button in exit confirm box --- src/gui/mainwindow.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 4c4e0d18a..49091e4f0 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -911,10 +911,10 @@ void MainWindow::closeEvent(QCloseEvent *e) QMessageBox confirmBox(QMessageBox::Question, tr("Exiting qBittorrent"), tr("Some files are currently transferring.\nAre you sure you want to quit qBittorrent?"), QMessageBox::NoButton, this); - QPushButton *noBtn = confirmBox.addButton(tr("No"), QMessageBox::NoRole); - QPushButton *yesBtn = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole); - QPushButton *alwaysBtn = confirmBox.addButton(tr("Always"), QMessageBox::YesRole); - confirmBox.setDefaultButton(yesBtn); + QPushButton *noBtn = confirmBox.addButton(tr("&No"), QMessageBox::NoRole); + QPushButton *yesBtn = confirmBox.addButton(tr("&Yes"), QMessageBox::YesRole); + QPushButton *alwaysBtn = confirmBox.addButton(tr("&Always Yes"), QMessageBox::YesRole); + confirmBox.setDefaultButton(noBtn); confirmBox.exec(); if (!confirmBox.clickedButton() || confirmBox.clickedButton() == noBtn) { // Cancel exit @@ -922,9 +922,10 @@ void MainWindow::closeEvent(QCloseEvent *e) force_exit = false; return; } - if (confirmBox.clickedButton() == alwaysBtn) + if (confirmBox.clickedButton() == alwaysBtn) { // Remember choice Preferences::instance()->setConfirmOnExit(false); + } } }