From kde-commits Tue Dec 06 19:03:24 2016 From: Kurt Hindenburg Date: Tue, 06 Dec 2016 19:03:24 +0000 To: kde-commits Subject: [konsole] src: Add default search options to Konsole settings Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=148105101210008 Git commit 2b6b9c579bb7e79ea7dffac75318dc89bef5bb35 by Kurt Hindenburg. Committed on 06/12/2016 at 18:59. Pushed by hindenburg into branch 'master'. Add default search options to Konsole settings Thanks to Ahmad Samir ahmadsamir3891 gmail com for patch. Todo: any changes to the settings should auto proprogate to all tabs' search bars. Review: 129376 Feature: 332601 M +3 -0 src/CMakeLists.txt M +25 -2 src/IncrementalSearchBar.cpp M +2 -0 src/IncrementalSearchBar.h M +2 -0 src/Session.cpp M +75 -1 src/settings/GeneralSettings.ui M +21 -0 src/settings/konsole.kcfg https://commits.kde.org/konsole/2b6b9c579bb7e79ea7dffac75318dc89bef5bb35 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index adfa0364..b64545a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -105,6 +105,9 @@ set(konsoleprivate_SRCS ${sessionadaptors_SRCS} WindowSystemInfo.cpp ${CMAKE_CURRENT_BINARY_DIR}/org.kde.konsole.Window= .xml ${CMAKE_CURRENT_BINARY_DIR}/org.kde.konsole.Sessio= n.xml) + +kconfig_add_kcfg_files(konsoleprivate_SRCS settings/KonsoleSettings.kcfgc) + set(konsole_LIBS KF5::XmlGui Qt5::PrintSupport diff --git a/src/IncrementalSearchBar.cpp b/src/IncrementalSearchBar.cpp index 17a14ca6..da4f88ca 100644 --- a/src/IncrementalSearchBar.cpp +++ b/src/IncrementalSearchBar.cpp @@ -32,6 +32,7 @@ #include #include #include +#include "KonsoleSettings.h" = using namespace Konsole; = @@ -128,15 +129,14 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget* a= Parent) _highlightMatches =3D optionsMenu->addAction(i18nc("@item:inmenu", "Hi= ghlight all matches")); _highlightMatches->setCheckable(true); _highlightMatches->setToolTip(i18nc("@info:tooltip", "Sets whether mat= ching text should be highlighted")); - _highlightMatches->setChecked(true); connect(_highlightMatches, &QAction::toggled, this, &Konsole::Incremen= talSearchBar::highlightMatchesToggled); = _reverseSearch =3D optionsMenu->addAction(i18n("Search backwards")); _reverseSearch->setCheckable(true); _reverseSearch->setToolTip(i18n("Sets whether search should start from= the bottom")); - _reverseSearch->setChecked(true); connect(_reverseSearch, &QAction::toggled, this, &Konsole::Incremental= SearchBar::updateButtonsAccordingToReverseSearchSetting); updateButtonsAccordingToReverseSearchSetting(); + setOptions(); = barLayout->addStretch(); = @@ -277,3 +277,26 @@ const QBitArray IncrementalSearchBar::optionsChecked() return options; } = +void IncrementalSearchBar::setOptions() +{ + if (KonsoleSettings::searchCaseSensitive()) { + _caseSensitive->setChecked(true); + } else { + _caseSensitive->setChecked(false); + } + if (KonsoleSettings::searchRegExpression()) { + _regExpression->setChecked(true); + } else { + _regExpression->setChecked(false); + } + if (KonsoleSettings::searchHighlightMatches()) { + _highlightMatches->setChecked(true); + } else { + _highlightMatches->setChecked(false); + } + if (KonsoleSettings::searchReverseSearch()) { + _reverseSearch->setChecked(true); + } else { + _reverseSearch->setChecked(false); + } +} diff --git a/src/IncrementalSearchBar.h b/src/IncrementalSearchBar.h index dea1232b..59d822eb 100644 --- a/src/IncrementalSearchBar.h +++ b/src/IncrementalSearchBar.h @@ -99,6 +99,8 @@ public: = void focusLineEdit(); = + void setOptions(); + // reimplemented virtual void setVisible(bool visible); signals: diff --git a/src/Session.cpp b/src/Session.cpp index d63c8a0c..a9052ec7 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -298,6 +298,8 @@ void Session::viewDestroyed(QObject* view) { // the received QObject has already been destroyed, so using // qobject_cast<> does not work here + // note: runtime error: downcast not an object of type 'TerminalDispla= y' + // note: object is of type 'QWidget' TerminalDisplay* display =3D static_cast(view); = Q_ASSERT(_views.contains(display)); diff --git a/src/settings/GeneralSettings.ui b/src/settings/GeneralSettings= .ui index 8d191017..6bc63641 100644 --- a/src/settings/GeneralSettings.ui +++ b/src/settings/GeneralSettings.ui @@ -131,7 +131,81 @@ - + + + QLayout::SetNoConstraint + + + + + Default Search Settings + + + + + + + 0 + 0 + + + + Search is case sensitive + + + Sets whether the search is case sensitive + + + + + + + + 0 + 0 + + + + Match using regular expressions + + + + + + + + 0 + 0 + + + + Highlight all search matches + + + + + + + + 0 + 0 + + + + Search backwards + + + Sets whether search should start from the bottom + + + + + + + + + + 0 diff --git a/src/settings/konsole.kcfg b/src/settings/konsole.kcfg index 075d2f7e..3c85f6c4 100644 --- a/src/settings/konsole.kcfg +++ b/src/settings/konsole.kcfg @@ -41,6 +41,27 @@ false + + + + Sets whether the search is case sensitive + false + + + + false + + + + Sets whether matching text should be highlighted + true + + + + Sets whether search should start from the bottom + true + +