[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [konsole] src: Add default search options to Konsole settings
From: Kurt Hindenburg <kurt.hindenburg () gmail ! com>
Date: 2016-12-06 19:03:24
Message-ID: E1cEL1Q-0007i3-4U () code ! kde ! org
[Download RAW message or body]
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.Session.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 <KColorScheme>
#include <QLineEdit>
#include <KLocalizedString>
+#include "KonsoleSettings.h"
using namespace Konsole;
@@ -128,15 +129,14 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent)
_highlightMatches = optionsMenu->addAction(i18nc("@item:inmenu", "Highlight all \
matches")); _highlightMatches->setCheckable(true);
_highlightMatches->setToolTip(i18nc("@info:tooltip", "Sets whether matching text \
should be highlighted"));
- _highlightMatches->setChecked(true);
connect(_highlightMatches, &QAction::toggled, this, \
&Konsole::IncrementalSearchBar::highlightMatchesToggled);
_reverseSearch = 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::IncrementalSearchBar::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 'TerminalDisplay'
+ // note: object is of type 'QWidget'
TerminalDisplay* display = static_cast<TerminalDisplay*>(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 @@
</layout>
</item>
<item>
- <widget class="QGroupBox" name="groupBox_2">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Default Search Settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="kcfg_SearchCaseSensitive">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Search is case sensitive</string>
+ </property>
+ <property name="toolTip">
+ <string>Sets whether the search is case sensitive</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="kcfg_SearchRegExpression">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Match using regular expressions</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="kcfg_SearchHighlightMatches">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Highlight all search matches</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="kcfg_SearchReverseSearch">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Search backwards</string>
+ </property>
+ <property name="toolTip">
+ <string>Sets whether search should start from the bottom</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
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 @@
<default>false</default>
</entry>
</group>
+ <group name="SearchSettings">
+ <entry name="SearchCaseSensitive" type="Bool">
+ <label>Search is case sensitive</label>
+ <tooltip>Sets whether the search is case sensitive</tooltip>
+ <default>false</default>
+ </entry>
+ <entry name="SearchRegExpression" type="Bool">
+ <label>Match using regular expressions</label>
+ <default>false</default>
+ </entry>
+ <entry name="SearchHighlightMatches" type="Bool">
+ <label>Highlight all search matches</label>
+ <tooltip>Sets whether matching text should be highlighted</tooltip>
+ <default>true</default>
+ </entry>
+ <entry name="SearchReverseSearch" type="Bool">
+ <label>Search backwards</label>
+ <tooltip>Sets whether search should start from the bottom</tooltip>
+ <default>true</default>
+ </entry>
+ </group>
<group name="TabBar">
<entry name="TabBarVisibility" type="Enum">
<label>Control the visibility of the whole tab bar</label>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic