From 94c9772a813ffe694881a17909e79a121ed7efce Mon Sep 17 00:00:00 2001 From: Tim Delaney Date: Sat, 12 Nov 2016 01:32:58 +1100 Subject: [PATCH] Ctrl+F search filter. Closes #5797. --HG-- branch : magao-dev --- src/gui/mainwindow.cpp | 11 +++++++++-- src/gui/mainwindow.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index b83b190a3..4ab37e629 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -634,6 +634,12 @@ void MainWindow::displaySearchTab(bool enable) } } +void MainWindow::focusSearchFilter() +{ + m_searchFilter->setFocus(); + m_searchFilter->selectAll(); +} + void MainWindow::updateNbTorrents() { m_tabs->setTabText(0, tr("Transfers (%1)").arg(m_transferListWidget->getSourceModel()->rowCount())); @@ -759,11 +765,12 @@ void MainWindow::createKeyboardShortcuts() connect(switchTransferShortcut, SIGNAL(activated()), this, SLOT(displayTransferTab())); QShortcut *switchSearchShortcut = new QShortcut(QKeySequence("Alt+2"), this); connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab())); - QShortcut *switchSearchShortcut2 = new QShortcut(QKeySequence::Find, this); - connect(switchSearchShortcut2, SIGNAL(activated()), this, SLOT(displaySearchTab())); QShortcut *switchRSSShortcut = new QShortcut(QKeySequence("Alt+3"), this); connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab())); + QShortcut *switchSearchFilterShortcut = new QShortcut(QKeySequence::Find, this); + connect(switchSearchFilterShortcut, SIGNAL(activated()), this, SLOT(focusSearchFilter())); + m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents); m_ui->actionOptions->setShortcut(QKeySequence("Alt+O")); m_ui->actionStart->setShortcut(QKeySequence("Ctrl+S")); diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 4d833e82d..c5aa633b2 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -126,6 +126,7 @@ private slots: void displayTransferTab() const; void displaySearchTab() const; void displayRSSTab() const; + void focusSearchFilter(); void updateGUI(); void loadPreferences(bool configureSession = true); void addUnauthenticatedTracker(const QPair &tracker);