diff --git a/src/session/SessionController.cpp b/src/session/SessionController.cpp index 8a825bd4..552176af 100644 --- a/src/session/SessionController.cpp +++ b/src/session/SessionController.cpp @@ -578,9 +578,12 @@ void SessionController::setupSearchBar() connect(_searchBar, &Konsole::IncrementalSearchBar::searchFromClicked, this, &Konsole::SessionController::searchFrom); connect(_searchBar, &Konsole::IncrementalSearchBar::findNextClicked, this, &Konsole::SessionController::findNextInHistory); connect(_searchBar, &Konsole::IncrementalSearchBar::findPreviousClicked, this, &Konsole::SessionController::findPreviousInHistory); + connect(_searchBar, &Konsole::IncrementalSearchBar::reverseSearchToggled, this, &Konsole::SessionController::updateMenuIconsAccordingToReverseSearchSetting); connect(_searchBar, &Konsole::IncrementalSearchBar::highlightMatchesToggled, this, &Konsole::SessionController::highlightMatches); connect(_searchBar, &Konsole::IncrementalSearchBar::matchCaseToggled, this, &Konsole::SessionController::changeSearchMatch); connect(_searchBar, &Konsole::IncrementalSearchBar::matchRegExpToggled, this, &Konsole::SessionController::changeSearchMatch); + + updateMenuIconsAccordingToReverseSearchSetting(); } void SessionController::setShowMenuAction(QAction *action) @@ -1545,6 +1548,16 @@ void SessionController::findPreviousInHistory() beginSearch(_searchBar->searchText(), reverseSearchChecked() ? Enum::ForwardsSearch : Enum::BackwardsSearch); } +void SessionController::updateMenuIconsAccordingToReverseSearchSetting() +{ + if (reverseSearchChecked()) { + _findNextAction->setIcon(QIcon::fromTheme(QStringLiteral("go-up"))); + _findPreviousAction->setIcon(QIcon::fromTheme(QStringLiteral("go-down"))); + } else { + _findNextAction->setIcon(QIcon::fromTheme(QStringLiteral("go-down"))); + _findPreviousAction->setIcon(QIcon::fromTheme(QStringLiteral("go-up"))); + } +} void SessionController::changeSearchMatch() { Q_ASSERT(_searchBar); diff --git a/src/session/SessionController.h b/src/session/SessionController.h index a1e9634c..2aef317f 100644 --- a/src/session/SessionController.h +++ b/src/session/SessionController.h @@ -233,6 +233,7 @@ private Q_SLOTS: void searchFrom(); void findNextInHistory(); void findPreviousInHistory(); + void updateMenuIconsAccordingToReverseSearchSetting(); void changeSearchMatch(); void saveHistory(); void showHistoryOptions(); diff --git a/src/widgets/IncrementalSearchBar.cpp b/src/widgets/IncrementalSearchBar.cpp index 4037ce35..a35bb410 100644 --- a/src/widgets/IncrementalSearchBar.cpp +++ b/src/widgets/IncrementalSearchBar.cpp @@ -132,6 +132,7 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget *parent) _reverseSearch->setCheckable(true); _reverseSearch->setToolTip(i18nc("@info:tooltip", "Sets whether search should start from the bottom")); connect(_reverseSearch, &QAction::toggled, this, &Konsole::IncrementalSearchBar::updateButtonsAccordingToReverseSearchSetting); + connect(_reverseSearch, &QAction::toggled, this, &Konsole::IncrementalSearchBar::reverseSearchToggled); updateButtonsAccordingToReverseSearchSetting(); setOptions(); diff --git a/src/widgets/IncrementalSearchBar.h b/src/widgets/IncrementalSearchBar.h index 592a44e5..5ce02425 100644 --- a/src/widgets/IncrementalSearchBar.h +++ b/src/widgets/IncrementalSearchBar.h @@ -104,6 +104,11 @@ Q_SIGNALS: * matches for the search text should be highlighted */ void highlightMatchesToggled(bool); + /** + * Emitted when the user toggles the checkbox to indicate whether + * the search direction should be reversed. + */ + void reverseSearchToggled(bool); /** * Emitted when the user toggles the checkbox to indicate whether * matching for the search text should be case sensitive