Commit 49ccf099 authored by Fushan Wen's avatar Fushan Wen
Browse files

Make "Find Next/Previous" icons in Edit menu consistent with those in the search bar

There is an inconsistence in "Find Next/Previous" icons in Edit menu and
the search bar. Make sure they are consistent whenever "Search backwards"
is checked or not.

BUG: 443244
parent 9fd65c9b
Pipeline #86814 passed with stage
in 1 minute and 49 seconds
......@@ -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);
......
......@@ -233,6 +233,7 @@ private Q_SLOTS:
void searchFrom();
void findNextInHistory();
void findPreviousInHistory();
void updateMenuIconsAccordingToReverseSearchSetting();
void changeSearchMatch();
void saveHistory();
void showHistoryOptions();
......
......@@ -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();
......
......@@ -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
......
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