From 2c8447853ba0855d32af7708670acd771b715591 Mon Sep 17 00:00:00 2001 From: Aleksandr Cupacenko Date: Wed, 2 Mar 2022 07:27:22 +0200 Subject: [PATCH] Focus save path when Manual mode is selected initially Closes #15972. PR #16536. --- src/gui/addnewtorrentdialog.cpp | 6 +++++- src/gui/fspathedit.cpp | 1 + src/gui/watchedfolderoptionsdialog.cpp | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 61a1fb1bf..ad03f89ab 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -249,7 +249,11 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP connect(editHotkey, &QShortcut::activated, this, &AddNewTorrentDialog::renameSelectedFile); connect(m_ui->contentTreeView, &QAbstractItemView::doubleClicked, this, &AddNewTorrentDialog::renameSelectedFile); - m_ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus(); + // Default focus + if (m_ui->comboTTM->currentIndex() == 0) // 0 is Manual mode + m_ui->savePath->setFocus(); + else + m_ui->categoryComboBox->setFocus(); } AddNewTorrentDialog::~AddNewTorrentDialog() diff --git a/src/gui/fspathedit.cpp b/src/gui/fspathedit.cpp index 25d79bf24..b6ad496ee 100644 --- a/src/gui/fspathedit.cpp +++ b/src/gui/fspathedit.cpp @@ -189,6 +189,7 @@ FileSystemPathEdit::FileSystemPathEdit(Private::FileEditorWithCompletion *editor { Q_D(FileSystemPathEdit); editor->widget()->setParent(this); + setFocusProxy(editor->widget()); auto *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); diff --git a/src/gui/watchedfolderoptionsdialog.cpp b/src/gui/watchedfolderoptionsdialog.cpp index 6949104b6..fe949174d 100644 --- a/src/gui/watchedfolderoptionsdialog.cpp +++ b/src/gui/watchedfolderoptionsdialog.cpp @@ -87,7 +87,11 @@ WatchedFolderOptionsDialog::WatchedFolderOptionsDialog( loadState(); - m_ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus(); + // Default focus + if (m_ui->comboTTM->currentIndex() == 0) // 0 is Manual mode + m_ui->savePath->setFocus(); + else + m_ui->categoryComboBox->setFocus(); } WatchedFolderOptionsDialog::~WatchedFolderOptionsDialog()