Commit e9ce8140 authored by Francesco Cecconi's avatar Francesco Cecconi
Browse files

Make 'Find' action consistent with other KDE applications

When search bar is visible, pressing the shortcut/menu item for the second
time give focus to the search lineEdit. This patch remove toggleable property
from the action.

BUG: 271668
REVIEW: 105723
FIXED-IN: 4.10.0
parent 6b878d16
......@@ -93,7 +93,7 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
, _viewUrlFilter(0)
, _searchFilter(0)
, _copyInputToAllTabsAction(0)
, _searchToggleAction(0)
, _findAction(0)
, _findNextAction(0)
, _findPreviousAction(0)
, _urlFilterUpdateRequired(false)
......@@ -104,6 +104,7 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
, _listenForScreenWindowUpdates(false)
, _preventClose(false)
, _keepIconUntilInteraction(false)
, _isSearchBarEnabled(false)
{
Q_ASSERT(session);
Q_ASSERT(view);
......@@ -508,7 +509,7 @@ void SessionController::setSearchBar(IncrementalSearchBar* searchBar)
// if the search bar was previously active
// then re-enter search mode
enableSearchBar(_searchToggleAction->isChecked());
enableSearchBar(_isSearchBarEnabled);
}
}
IncrementalSearchBar* SessionController::searchBar() const
......@@ -589,10 +590,8 @@ void SessionController::setupCommonActions()
connect(_switchProfileMenu->menu(), SIGNAL(aboutToShow()), this, SLOT(prepareSwitchProfileMenu()));
// History
_searchToggleAction = KStandardAction::find(this, 0, collection);
_searchToggleAction->setShortcut(QKeySequence());
_searchToggleAction->setCheckable(true);
connect(_searchToggleAction, SIGNAL(toggled(bool)), this, SLOT(searchHistory(bool)));
_findAction = KStandardAction::find(this, SLOT(searchBarEvent()), collection);
_findAction->setShortcut(QKeySequence());
_findNextAction = KStandardAction::findNext(this, SLOT(findNextInHistory()), collection);
_findNextAction->setShortcut(QKeySequence());
......@@ -681,7 +680,7 @@ void SessionController::setupExtraActions()
action->setIcon(KIcon("format-font-size-less"));
action->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Minus));
_searchToggleAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F));
_findAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F));
_findNextAction->setShortcut(QKeySequence(Qt::Key_F3));
_findPreviousAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3));
}
......@@ -985,7 +984,8 @@ void SessionController::copyInputToNone()
void SessionController::searchClosed()
{
_searchToggleAction->toggle();
_isSearchBarEnabled = false;
searchHistory(false);
}
void SessionController::listenForScreenWindowUpdates()
......@@ -1008,6 +1008,20 @@ void SessionController::updateSearchFilter()
}
}
void SessionController::searchBarEvent()
{
if (_searchBar->isVisible())
{
// refresh focus
_searchBar->setVisible(true);
}
else
{
searchHistory(true);
_isSearchBarEnabled = true;
}
}
void SessionController::enableSearchBar(bool showSearchBar)
{
if (!_searchBar)
......
......@@ -224,6 +224,7 @@ private slots:
void changeCodec(QTextCodec* codec);
void enableSearchBar(bool showSearchBar);
void searchHistory(bool showSearchBar);
void searchBarEvent();
void findNextInHistory();
void findPreviousInHistory();
void changeSearchMatch();
......@@ -304,7 +305,7 @@ private:
KAction* _copyInputToAllTabsAction;
KAction* _searchToggleAction;
KAction* _findAction;
KAction* _findNextAction;
KAction* _findPreviousAction;
......@@ -333,6 +334,8 @@ private:
static const KIcon _broadcastIcon;
QStringList _bookmarkValidProgramsToClear;
bool _isSearchBarEnabled;
};
inline bool SessionController::isValid() const
{
......
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