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
wilder
Fushan Wen 5 years ago
parent 9fd65c9b62
commit 49ccf099c1
  1. 13
      src/session/SessionController.cpp
  2. 1
      src/session/SessionController.h
  3. 1
      src/widgets/IncrementalSearchBar.cpp
  4. 5
      src/widgets/IncrementalSearchBar.h

@ -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

Loading…
Cancel
Save