summaryrefslogtreecommitdiff
blob: f348bf39b5d6e4ff2bca4c9064cd8ec46af8d252 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
From b23e8823d7c950b43259b8750f0d14c19fa5f31c Mon Sep 17 00:00:00 2001
From: Alexander Lohnau <alexander.lohnau@gmx.de>
Date: Sat, 22 May 2021 07:15:04 +0200
Subject: [PATCH] Clean up defunct KRegExpEditorInterface code

This code is deprecated, defunct and partly commented out for years.
---
 CMakeLists.txt     |  1 -
 src/CMakeLists.txt |  1 -
 src/kftabdlg.cpp   | 48 +---------------------------------------------
 src/kftabdlg.h     |  4 ----
 src/kquery.cpp     | 31 +++++++-----------------------
 src/kquery.h       |  3 +--
 6 files changed, 9 insertions(+), 79 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4587dd278..1c867f5b5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
     FileMetaData
     I18n
     KIO
-    TextWidgets
     WidgetsAddons
 )
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 97d81a963..d24b5f4b0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,7 +22,6 @@ KF5::CoreAddons
 KF5::FileMetaData
 KF5::I18n
 KF5::KIOWidgets
-KF5::TextWidgets
 KF5::WidgetsAddons
 KF5::XmlGui
 )
diff --git a/src/kftabdlg.cpp b/src/kftabdlg.cpp
index ddb9c7be0..f2c6cbf7a 100644
--- a/src/kftabdlg.cpp
+++ b/src/kftabdlg.cpp
@@ -29,8 +29,6 @@
 #include <KLineEdit>
 #include <KLocalizedString>
 #include <KMessageBox>
-#include <KRegExpEditorInterface>
-#include <KServiceTypeTrader>
 #include <KSharedConfig>
 #include <KShell>
 #include <KUrlComboBox>
@@ -55,7 +53,6 @@ struct MimeTypes
 
 KfindTabWidget::KfindTabWidget(QWidget *parent)
     : QTabWidget(parent)
-    , regExpDialog(nullptr)
 {
     // This validator will be used for all numeric edit fields
     //KDigitValidator *digitV = new KDigitValidator(this);
@@ -307,7 +304,6 @@ KfindTabWidget::KfindTabWidget(QWidget *parent)
 
     caseContextCb = new QCheckBox(i18n("Case s&ensitive"), pages[2]);
     binaryContextCb = new QCheckBox(i18n("Include &binary files"), pages[2]);
-    regexpContentCb = new QCheckBox(i18n("Regular e&xpression"), pages[2]);
 
     const QString binaryTooltip
         = i18n("<qt>This lets you search in any type of file, "
@@ -315,13 +311,6 @@ KfindTabWidget::KfindTabWidget(QWidget *parent)
                "program files and images).</qt>");
     binaryContextCb->setToolTip(binaryTooltip);
 
-    QPushButton *editRegExp = nullptr;
-    if (!KServiceTypeTrader::self()->query(QStringLiteral("KRegExpEditor/KRegExpEditor")).isEmpty()) {
-        // The editor is available, so lets use it.
-        editRegExp = new QPushButton(i18n("&Edit..."), pages[2]);
-        editRegExp->setObjectName(QStringLiteral("editRegExp"));
-    }
-
     metainfokeyEdit = new KLineEdit(pages[2]);
     metainfoEdit = new KLineEdit(pages[2]);
     QLabel *textMetaInfo = new QLabel(i18nc("as in search for", "fo&r:"), pages[2]);
@@ -387,15 +376,6 @@ KfindTabWidget::KfindTabWidget(QWidget *parent)
         watcher->deleteLater();
     });
 
-    if (editRegExp) {
-        // The editor was available, so lets use it.
-        connect(regexpContentCb, &QCheckBox::toggled, editRegExp, &QPushButton::setEnabled);
-        editRegExp->setEnabled(false);
-        connect(editRegExp, &QPushButton::clicked, this, &KfindTabWidget::slotEditRegExp);
-    } else {
-        regexpContentCb->hide();
-    }
-
     // Layout
     tmp = sizeEdit->fontMetrics().boundingRect(QStringLiteral(" 00000 ")).width();
     sizeEdit->setMinimumSize(tmp, sizeEdit->sizeHint().height());
@@ -405,7 +385,6 @@ KfindTabWidget::KfindTabWidget(QWidget *parent)
     grid2->addWidget(textL, 1, 0);
     grid2->addWidget(typeBox, 0, 1, 1, 3);
     grid2->addWidget(textEdit, 1, 1, 1, 3);
-    grid2->addWidget(regexpContentCb, 2, 2);
     grid2->addWidget(caseContextCb, 2, 1);
     grid2->addWidget(binaryContextCb, 3, 1);
 
@@ -416,11 +395,6 @@ KfindTabWidget::KfindTabWidget(QWidget *parent)
 
     metainfokeyEdit->setText(QStringLiteral("*"));
 
-    if (editRegExp) {
-        // The editor was available, so lets use it.
-        grid2->addWidget(editRegExp, 2, 3);
-    }
-
     addTab(pages[0], i18n("Name/&Location"));
     addTab(pages[2], i18nc("tab name: search by contents", "C&ontents"));
     addTab(pages[1], i18n("&Properties"));
@@ -532,25 +506,6 @@ void KfindTabWidget::loadHistory()
     }
 }
 
-void KfindTabWidget::slotEditRegExp()
-{
-#if 0
-    if (!regExpDialog) {
-        regExpDialog = KServiceTypeTrader::createInstanceFromQuery<QDialog>(QStringLiteral("KRegExpEditor/KRegExpEditor"), QString(), this);
-    }
-
-    KRegExpEditorInterface *iface = qobject_cast<KRegExpEditorInterface *>(regExpDialog);
-    if (!iface) {
-        return;
-    }
-
-    iface->setRegExp(textEdit->text());
-    if (regExpDialog->exec()) {
-        textEdit->setText(iface->regExp());
-    }
-#endif
-}
-
 void KfindTabWidget::setFocus()
 {
     nameBox->setFocus();
@@ -771,8 +726,7 @@ void KfindTabWidget::setQuery(KQuery *query)
 
     query->setShowHiddenFiles(hiddenFilesCb->isChecked());
 
-    query->setContext(textEdit->text(), caseContextCb->isChecked(),
-                      binaryContextCb->isChecked(), regexpContentCb->isChecked());
+    query->setContext(textEdit->text(), caseContextCb->isChecked(), binaryContextCb->isChecked());
 }
 
 void KfindTabWidget::getDirectory()
diff --git a/src/kftabdlg.h b/src/kftabdlg.h
index e2a4912d6..336835a06 100644
--- a/src/kftabdlg.h
+++ b/src/kftabdlg.h
@@ -23,7 +23,6 @@ class QString;
 class QDate;
 class QRegExp;
 class KDateComboBox;
-class QDialog;
 class KComboBox;
 class QSpinBox;
 class QLabel;
@@ -60,7 +59,6 @@ private Q_SLOTS:
     void getDirectory();
     void fixLayout();
     void slotSizeBoxChanged(int);
-    void slotEditRegExp();
 
 Q_SIGNALS:
     void startSearch();
@@ -112,8 +110,6 @@ private:
     QSpinBox *sizeEdit;
     QCheckBox *caseContextCb;
     QCheckBox *binaryContextCb;
-    QCheckBox *regexpContentCb;
-    QDialog *regExpDialog;
 
     QUrl m_url;
 
diff --git a/src/kquery.cpp b/src/kquery.cpp
index 91e45ed07..c6c7327bf 100644
--- a/src/kquery.cpp
+++ b/src/kquery.cpp
@@ -35,7 +35,6 @@ KQuery::KQuery(QObject *parent)
     , m_recursive(false)
     , m_casesensitive(false)
     , m_search_binary(false)
-    , m_regexpForContent(false)
     , m_useLocate(false)
     , m_showHiddenFiles(false)
     , job(nullptr)
@@ -458,19 +457,11 @@ void KQuery::processQuery(const KFileItem &file)
                 str.remove(xmlTags);
             }
 
-            if (m_regexpForContent) {
-                if (m_regexp.indexIn(str) >= 0) {
-                    matchingLine = QString::number(matchingLineNumber)+QStringLiteral(": ")+str.trimmed();
-                    found = true;
-                    break;
-                }
-            } else {
-                if (str.indexOf(m_context, 0, m_casesensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) != -1) {
-                    matchingLine = QString::number(matchingLineNumber)+QStringLiteral(": ")+str.trimmed();
-                    found = true;
-                    break;
-                }
-            }
+	if (str.indexOf(m_context, 0, m_casesensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) != -1) {
+	    matchingLine = QString::number(matchingLineNumber)+QStringLiteral(": ")+str.trimmed();
+	    found = true;
+	    break;
+	}
             qApp->processEvents();
         }
 
@@ -484,25 +475,17 @@ void KQuery::processQuery(const KFileItem &file)
     m_foundFilesList.append(QPair<KFileItem, QString>(file, matchingLine));
 }
 
-void KQuery::setContext(const QString &context, bool casesensitive, bool search_binary, bool useRegexp)
+void KQuery::setContext(const QString &context, bool casesensitive, bool search_binary)
 {
     m_context = context;
     m_casesensitive = casesensitive;
     m_search_binary = search_binary;
-    m_regexpForContent = useRegexp;
-    if (!m_regexpForContent) {
-        m_regexp.setPatternSyntax(QRegExp::Wildcard);
-    } else {
-        m_regexp.setPatternSyntax(QRegExp::RegExp);
-    }
+    m_regexp.setPatternSyntax(QRegExp::Wildcard);
     if (casesensitive) {
         m_regexp.setCaseSensitivity(Qt::CaseSensitive);
     } else {
         m_regexp.setCaseSensitivity(Qt::CaseInsensitive);
     }
-    if (m_regexpForContent) {
-        m_regexp.setPattern(m_context);
-    }
 }
 
 void KQuery::setMetaInfo(const QString &metainfo, const QString &metainfokey)
diff --git a/src/kquery.h b/src/kquery.h
index 285b37214..2e581765c 100644
--- a/src/kquery.h
+++ b/src/kquery.h
@@ -38,7 +38,7 @@ public:
     void setPath(const QUrl &url);
     void setFileType(int filetype);
     void setMimeType(const QStringList &mimetype);
-    void setContext(const QString &context, bool casesensitive, bool search_binary, bool useRegexp);
+    void setContext(const QString &context, bool casesensitive, bool search_binary);
     void setUsername(const QString &username);
     void setGroupname(const QString &groupname);
     void setMetaInfo(const QString &metainfo, const QString &metainfokey);
@@ -93,7 +93,6 @@ private:
     QString m_metainfokey;
     bool m_casesensitive;
     bool m_search_binary;
-    bool m_regexpForContent;
     bool m_useLocate;
     bool m_showHiddenFiles;
     QByteArray bufferLocate;
-- 
GitLab