Commit 4a82adba authored by Nate Graham's avatar Nate Graham 💤
Browse files

Fix Ctrl+F shortcut conflict

The base app was always setting Ctrl+F as a search shortcut, even when the toolbar upon
which the search field lives was not visible. This caused the dreaded "ambiguous shortcut"
dialog to appear. The patch fixes the issue by setting the shortcut only when the toolbar
contains a search field, and unsetting it when the toolbar is hidden.

BUG: 405030
FIXED-IN: 5.18

Test Plan:
Hit {key Ctrl F} in both sidebar and icons view. In both cases, it focuses the search

Reviewers: #plasma, GB_2, apol

Reviewed By: apol

Subscribers: apol, plasma-devel

Tags: #plasma

Differential Revision:
parent a1695cb9
......@@ -152,7 +152,6 @@ void SettingsBase::initToolBar()
// Finally the search line-edit
searchAction = new QWidgetAction( this );
actionCollection()->setDefaultShortcut(searchAction, QKeySequence(Qt::CTRL + Qt::Key_F));
connect( searchAction, SIGNAL(triggered(bool)), searchText, SLOT(setFocus()));
actionCollection()->addAction( QStringLiteral("searchText"), searchAction );
// Initialise the Window
......@@ -388,6 +387,7 @@ void SettingsBase::changeToolBar( BaseMode::ToolBarItems toolbar )
QList<QAction*> searchBarActions;
searchBarActions << spacerAction << searchAction;
guiFactory()->plugActionList( this, QStringLiteral("search"), searchBarActions );
actionCollection()->setDefaultShortcut(searchAction, QKeySequence(Qt::CTRL + Qt::Key_F));
if ( BaseMode::Configure & toolbar ) {
QList<QAction*> configureBarActions;
......@@ -399,6 +399,12 @@ void SettingsBase::changeToolBar( BaseMode::ToolBarItems toolbar )
quitBarActions << quitAction;
guiFactory()->plugActionList( this, QStringLiteral("quit"), quitBarActions );
if (BaseMode::NoItems & toolbar) {
// Remove search shortcut when there's no toolbar so it doesn't
// interfere with the built-in shortcut for the search field in the QML
// sidebar view
actionCollection()->setDefaultShortcut(searchAction, QKeySequence());
toolBar()->setVisible(toolbar != BaseMode::NoItems || (activeView && activeView->actionsList().count() > 0));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment