┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search
diff options
context:
space:
mode:
Diffstat (limited to 'src/search')
-rw-r--r--src/search/dolphinfacetswidget.cpp5
-rw-r--r--src/search/dolphinfacetswidget.h3
-rw-r--r--src/search/dolphinsearchbox.cpp127
-rw-r--r--src/search/dolphinsearchbox.h34
-rw-r--r--src/search/filenamesearch.protocol17
-rw-r--r--src/search/filenamesearchprotocol.cpp191
-rw-r--r--src/search/filenamesearchprotocol.h60
7 files changed, 101 insertions, 336 deletions
diff --git a/src/search/dolphinfacetswidget.cpp b/src/search/dolphinfacetswidget.cpp
index f20ae68d5..b183eb8a1 100644
--- a/src/search/dolphinfacetswidget.cpp
+++ b/src/search/dolphinfacetswidget.cpp
@@ -19,7 +19,7 @@
#include "dolphinfacetswidget.h"
-#include <KLocale>
+#include <KLocalizedString>
#include <QButtonGroup>
#include <QCheckBox>
#include <QDate>
@@ -295,9 +295,8 @@ QRadioButton* DolphinFacetsWidget::createRadioButton(const QString& text,
QButtonGroup* group)
{
QRadioButton* button = new QRadioButton(text);
- connect(button, SIGNAL(clicked()), this, SIGNAL(facetChanged()));
+ connect(button, &QRadioButton::clicked, this, &DolphinFacetsWidget::facetChanged);
group->addButton(button);
return button;
}
-#include "dolphinfacetswidget.moc"
diff --git a/src/search/dolphinfacetswidget.h b/src/search/dolphinfacetswidget.h
index 757dcd482..03fb1279d 100644
--- a/src/search/dolphinfacetswidget.h
+++ b/src/search/dolphinfacetswidget.h
@@ -24,11 +24,10 @@
#include <config-baloo.h>
#ifdef HAVE_BALOO
- #include <baloo/term.h>
+ #include <Baloo/Term>
#endif
class QButtonGroup;
-class QCheckBox;
class QDate;
class QRadioButton;
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index 46ca01a4c..65d35539c 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -22,15 +22,14 @@
#include "dolphin_searchsettings.h"
#include "dolphinfacetswidget.h"
-#include <KIcon>
+#include <QIcon>
#include <KLineEdit>
-#include <KLocale>
+#include <KLocalizedString>
#include <KSeparator>
#include <QButtonGroup>
#include <QDir>
#include <QEvent>
-#include <QFormLayout>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QLabel>
@@ -39,12 +38,14 @@
#include <QToolButton>
#include <QVBoxLayout>
-#include <config-baloo.h>
#ifdef HAVE_BALOO
- #include <baloo/query.h>
- #include <baloo/term.h>
- #include <baloo/indexerconfig.h>
+ #include <Baloo/NaturalFileQueryParser>
+ #include <Baloo/QueryBuilder>
+ #include <Baloo/Query>
+ #include <Baloo/Term>
+ #include <Baloo/IndexerConfig>
#endif
+#include <QFontDatabase>
DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
QWidget(parent),
@@ -81,7 +82,7 @@ QString DolphinSearchBox::text() const
return m_searchInput->text();
}
-void DolphinSearchBox::setSearchPath(const KUrl& url)
+void DolphinSearchBox::setSearchPath(const QUrl& url)
{
m_searchPath = url;
@@ -93,7 +94,7 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
if (url.isLocalFile()) {
location = QLatin1String("/");
} else {
- location = url.protocol() + QLatin1String(" - ") + url.host();
+ location = url.scheme() + QLatin1String(" - ") + url.host();
}
}
@@ -113,14 +114,14 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
m_facetsWidget->setEnabled(hasFacetsSupport);
}
-KUrl DolphinSearchBox::searchPath() const
+QUrl DolphinSearchBox::searchPath() const
{
return m_searchPath;
}
-KUrl DolphinSearchBox::urlForSearching() const
+QUrl DolphinSearchBox::urlForSearching() const
{
- KUrl url;
+ QUrl url;
bool useBalooSearch = false;
#ifdef HAVE_BALOO
const Baloo::IndexerConfig searchInfo;
@@ -129,7 +130,7 @@ KUrl DolphinSearchBox::urlForSearching() const
if (useBalooSearch) {
url = balooUrlForSearching();
} else {
- url.setProtocol("filenamesearch");
+ url.setScheme("filenamesearch");
url.addQueryItem("search", m_searchInput->text());
if (m_contentButton->isChecked()) {
url.addQueryItem("checkContent", "yes");
@@ -150,15 +151,14 @@ KUrl DolphinSearchBox::urlForSearching() const
return url;
}
-void DolphinSearchBox::fromSearchUrl(const KUrl& url)
+void DolphinSearchBox::fromSearchUrl(const QUrl& url)
{
- if (url.protocol() == "baloosearch") {
+ if (url.scheme() == "baloosearch") {
fromBalooSearchUrl(url);
- } else if (url.protocol() == "filenamesearch") {
- const QMap<QString, QString>& queryItems = url.queryItems();
- setText(queryItems.value("search"));
- setSearchPath(queryItems.value("url"));
- m_contentButton->setChecked(queryItems.value("checkContent") == "yes");
+ } else if (url.scheme() == "filenamesearch") {
+ setText(url.queryItemValue("search"));
+ setSearchPath(url.queryItemValue("url"));
+ m_contentButton->setChecked(url.queryItemValue("checkContent") == "yes");
} else {
setText(QString());
setSearchPath(url);
@@ -251,8 +251,10 @@ void DolphinSearchBox::slotConfigurationChanged()
}
}
-void DolphinSearchBox::slotSearchTextChanged(const QString& text)
+void DolphinSearchBox::slotSearchTextChanged()
{
+ const QString text = m_searchInput->text();
+
if (text.isEmpty()) {
m_startSearchTimer->stop();
} else {
@@ -261,10 +263,17 @@ void DolphinSearchBox::slotSearchTextChanged(const QString& text)
emit searchTextChanged(text);
}
-void DolphinSearchBox::slotReturnPressed(const QString& text)
+void DolphinSearchBox::slotReturnPressed()
{
emitSearchRequest();
- emit returnPressed(text);
+ emit returnPressed(m_searchInput->text());
+}
+
+void DolphinSearchBox::updateSearchInputParsing()
+{
+#ifdef HAVE_BALOO
+ m_searchInput->setParsingEnabled(m_contentButton->isChecked());
+#endif
}
void DolphinSearchBox::slotFacetsButtonToggled()
@@ -287,7 +296,7 @@ void DolphinSearchBox::initButton(QToolButton* button)
button->setAutoExclusive(true);
button->setAutoRaise(true);
button->setCheckable(true);
- connect(button, SIGNAL(clicked(bool)), this, SLOT(slotConfigurationChanged()));
+ connect(button, &QToolButton::clicked, this, &DolphinSearchBox::slotConfigurationChanged);
}
void DolphinSearchBox::loadSettings()
@@ -305,6 +314,7 @@ void DolphinSearchBox::loadSettings()
}
m_facetsWidget->setVisible(SearchSettings::showFacetsWidget());
+ updateSearchInputParsing();
}
void DolphinSearchBox::saveSettings()
@@ -312,7 +322,7 @@ void DolphinSearchBox::saveSettings()
SearchSettings::setLocation(m_fromHereButton->isChecked() ? "FromHere" : "Everywhere");
SearchSettings::setWhat(m_fileNameButton->isChecked() ? "FileName" : "Content");
SearchSettings::setShowFacetsWidget(m_facetsToggleButton->isChecked());
- SearchSettings::self()->writeConfig();
+ SearchSettings::self()->save();
}
void DolphinSearchBox::init()
@@ -320,23 +330,32 @@ void DolphinSearchBox::init()
// Create close button
QToolButton* closeButton = new QToolButton(this);
closeButton->setAutoRaise(true);
- closeButton->setIcon(KIcon("dialog-close"));
+ closeButton->setIcon(QIcon::fromTheme("dialog-close"));
closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching"));
- connect(closeButton, SIGNAL(clicked()), this, SLOT(emitCloseRequest()));
+ connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest);
// Create search label
m_searchLabel = new QLabel(this);
// Create search box
+#ifdef HAVE_BALOO
+ m_queryParser.reset(new Baloo::NaturalFileQueryParser);
+ m_searchInput = new Baloo::QueryBuilder(m_queryParser.data(), this);
+ connect(m_searchInput, &Baloo::QueryBuilder::editingFinished,
+ this, &DolphinSearchBox::slotReturnPressed);
+ connect(m_searchInput, &Baloo::QueryBuilder::textChanged,
+ this, &DolphinSearchBox::slotSearchTextChanged);
+#else
m_searchInput = new KLineEdit(this);
m_searchInput->installEventFilter(this);
m_searchInput->setClearButtonShown(true);
- m_searchInput->setFont(KGlobalSettings::generalFont());
+ m_searchInput->setFont(QFontDatabase::systemFont(QFontDatabase::GeneralFont));
+ connect(m_searchInput, &KLineEdit::returnPressed,
+ this, &DolphinSearchBox::slotReturnPressed);
+ connect(m_searchInput, &KLineEdit::textChanged,
+ this, &DolphinSearchBox::slotSearchTextChanged);
+#endif
setFocusProxy(m_searchInput);
- connect(m_searchInput, SIGNAL(returnPressed(QString)),
- this, SLOT(slotReturnPressed(QString)));
- connect(m_searchInput, SIGNAL(textChanged(QString)),
- this, SLOT(slotSearchTextChanged(QString)));
// Apply layout for the search input
QHBoxLayout* searchInputLayout = new QHBoxLayout();
@@ -357,6 +376,8 @@ void DolphinSearchBox::init()
QButtonGroup* searchWhatGroup = new QButtonGroup(this);
searchWhatGroup->addButton(m_fileNameButton);
searchWhatGroup->addButton(m_contentButton);
+ connect(searchWhatGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
+ this, &DolphinSearchBox::updateSearchInputParsing);
m_separator = new KSeparator(Qt::Vertical, this);
@@ -377,12 +398,12 @@ void DolphinSearchBox::init()
m_facetsToggleButton = new QToolButton(this);
m_facetsToggleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
initButton(m_facetsToggleButton);
- connect(m_facetsToggleButton, SIGNAL(clicked()), this, SLOT(slotFacetsButtonToggled()));
+ connect(m_facetsToggleButton, &QToolButton::clicked, this, &DolphinSearchBox::slotFacetsButtonToggled);
m_facetsWidget = new DolphinFacetsWidget(this);
m_facetsWidget->installEventFilter(this);
m_facetsWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
- connect(m_facetsWidget, SIGNAL(facetChanged()), this, SLOT(slotFacetChanged()));
+ connect(m_facetsWidget, &DolphinFacetsWidget::facetChanged, this, &DolphinSearchBox::slotFacetChanged);
// Apply layout for the options
QHBoxLayout* optionsLayout = new QHBoxLayout();
@@ -422,47 +443,50 @@ void DolphinSearchBox::init()
m_startSearchTimer = new QTimer(this);
m_startSearchTimer->setSingleShot(true);
m_startSearchTimer->setInterval(1000);
- connect(m_startSearchTimer, SIGNAL(timeout()), this, SLOT(emitSearchRequest()));
+ connect(m_startSearchTimer, &QTimer::timeout, this, &DolphinSearchBox::emitSearchRequest);
updateFacetsToggleButton();
}
-KUrl DolphinSearchBox::balooUrlForSearching() const
+QUrl DolphinSearchBox::balooUrlForSearching() const
{
#ifdef HAVE_BALOO
const QString text = m_searchInput->text();
Baloo::Query query;
+
+ if (m_contentButton->isChecked()) {
+ query = m_queryParser->parse(text, Baloo::NaturalQueryParser::DetectFilenamePattern);
+ } else {
+ query.setTerm(Baloo::Term(QLatin1String("filename"), text));
+ }
+
+ // Configure the query so that it returns files and takes the rating into account
query.addType("File");
query.addType(m_facetsWidget->facetType());
Baloo::Term term(Baloo::Term::And);
-
Baloo::Term ratingTerm = m_facetsWidget->ratingTerm();
+
if (ratingTerm.isValid()) {
+ term.addSubTerm(query.term());
term.addSubTerm(ratingTerm);
- }
- if (m_contentButton->isChecked()) {
- query.setSearchString(text);
- } else if (!text.isEmpty()) {
- term.addSubTerm(Baloo::Term(QLatin1String("filename"), text));
+ query.setTerm(term);
}
if (m_fromHereButton->isChecked()) {
- query.addCustomOption("includeFolder", m_searchPath.toLocalFile());
+ query.setIncludeFolder(m_searchPath.toLocalFile());
}
- query.setTerm(term);
-
return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.",
"Query Results from '%1'", text));
#else
- return KUrl();
+ return QUrl();
#endif
}
-void DolphinSearchBox::fromBalooSearchUrl(const KUrl& url)
+void DolphinSearchBox::fromBalooSearchUrl(const QUrl& url)
{
#ifdef HAVE_BALOO
const Baloo::Query query = Baloo::Query::fromSearchUrl(url);
@@ -472,9 +496,9 @@ void DolphinSearchBox::fromBalooSearchUrl(const KUrl& url)
// while we adjust the search text and the facet widget.
blockSignals(true);
- const QVariantHash customOptions = query.customOptions();
- if (customOptions.contains("includeFolder")) {
- setSearchPath(customOptions.value("includeFolder").toString());
+ const QString customDir = query.includeFolder();
+ if (!customDir.isEmpty()) {
+ setSearchPath(customDir);
} else {
setSearchPath(QDir::homePath());
}
@@ -508,8 +532,7 @@ void DolphinSearchBox::updateFacetsToggleButton()
{
const bool facetsIsVisible = SearchSettings::showFacetsWidget();
m_facetsToggleButton->setChecked(facetsIsVisible ? true : false);
- m_facetsToggleButton->setIcon(KIcon(facetsIsVisible ? "arrow-up-double" : "arrow-down-double"));
+ m_facetsToggleButton->setIcon(QIcon::fromTheme(facetsIsVisible ? "arrow-up-double" : "arrow-down-double"));
m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options"));
}
-#include "dolphinsearchbox.moc"
diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h
index 53b12ffab..2de4c457c 100644
--- a/src/search/dolphinsearchbox.h
+++ b/src/search/dolphinsearchbox.h
@@ -20,10 +20,11 @@
#ifndef DOLPHINSEARCHBOX_H
#define DOLPHINSEARCHBOX_H
-#include <KUrl>
-#include <QList>
+#include <QUrl>
#include <QWidget>
+#include <config-baloo.h>
+
class DolphinFacetsWidget;
class KLineEdit;
class KSeparator;
@@ -32,6 +33,11 @@ class QScrollArea;
class QLabel;
class QVBoxLayout;
+namespace Baloo {
+ class QueryBuilder;
+ class NaturalQueryParser;
+}
+
/**
* @brief Input box for searching files with or without Baloo.
*
@@ -65,17 +71,17 @@ public:
* Sets the current path that is used as root for
* searching files, if "From Here" has been selected.
*/
- void setSearchPath(const KUrl& url);
- KUrl searchPath() const;
+ void setSearchPath(const QUrl& url);
+ QUrl searchPath() const;
/** @return URL that will start the searching of files. */
- KUrl urlForSearching() const;
+ QUrl urlForSearching() const;
/**
* Extracts information from the given search \a url to
* initialize the search box properly.
*/
- void fromSearchUrl(const KUrl& url);
+ void fromSearchUrl(const QUrl& url);
/**
* Selects the whole text of the search box.
@@ -134,10 +140,11 @@ private slots:
void emitSearchRequest();
void emitCloseRequest();
void slotConfigurationChanged();
- void slotSearchTextChanged(const QString& text);
- void slotReturnPressed(const QString& text);
+ void slotSearchTextChanged();
+ void slotReturnPressed();
void slotFacetsButtonToggled();
void slotFacetChanged();
+ void updateSearchInputParsing();
private:
void initButton(QToolButton* button);
@@ -148,13 +155,13 @@ private:
/**
* @return URL that represents the Baloo query for starting the search.
*/
- KUrl balooUrlForSearching() const;
+ QUrl balooUrlForSearching() const;
/**
* Extracts information from the given Baloo search \a url to
* initialize the search box properly.
*/
- void fromBalooSearchUrl(const KUrl& url);
+ void fromBalooSearchUrl(const QUrl& url);
void updateFacetsToggleButton();
private:
@@ -164,7 +171,12 @@ private:
QVBoxLayout* m_topLayout;
QLabel* m_searchLabel;
+#ifdef HAVE_BALOO
+ Baloo::QueryBuilder* m_searchInput;
+ QScopedPointer<Baloo::NaturalQueryParser> m_queryParser;
+#else
KLineEdit* m_searchInput;
+#endif
QScrollArea* m_optionsScrollArea;
QToolButton* m_fileNameButton;
QToolButton* m_contentButton;
@@ -174,7 +186,7 @@ private:
QToolButton* m_facetsToggleButton;
DolphinFacetsWidget* m_facetsWidget;
- KUrl m_searchPath;
+ QUrl m_searchPath;
QTimer* m_startSearchTimer;
};
diff --git a/src/search/filenamesearch.protocol b/src/search/filenamesearch.protocol
deleted file mode 100644
index 06aec0e6b..000000000
--- a/src/search/filenamesearch.protocol
+++ /dev/null
@@ -1,17 +0,0 @@
-[Protocol]
-exec=kio_filenamesearch
-protocol=filenamesearch
-input=none
-output=filesystem
-reading=true
-writing=false
-deleting=true
-linking=false
-makedir=false
-moving=false
-listing=Name,Type,Size,Date,AccessDate,Access,Owner,Group,Link
-source=false
-Icon=edit-find
-Class=:local
-determineMimetypeFromExtension=false
-maxInstances=10
diff --git a/src/search/filenamesearchprotocol.cpp b/src/search/filenamesearchprotocol.cpp
deleted file mode 100644
index 38dd26b23..000000000
--- a/src/search/filenamesearchprotocol.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2010 by Peter Penz <[email protected]> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-#include "filenamesearchprotocol.h"
-
-#include <KComponentData>
-#include <KDirLister>
-#include <KFileItem>
-#include <KIO/NetAccess>
-#include <KIO/Job>
-#include <KUrl>
-#include <ktemporaryfile.h>
-
-#include <QCoreApplication>
-#include <QEventLoop>
-#include <QRegExp>
-
-FileNameSearchProtocol::FileNameSearchProtocol( const QByteArray &pool, const QByteArray &app ) :
- SlaveBase("search", pool, app),
- m_checkContent(false),
- m_regExp(0),
- m_iteratedDirs()
-{
-}
-
-FileNameSearchProtocol::~FileNameSearchProtocol()
-{
- cleanup();
-}
-
-void FileNameSearchProtocol::listDir(const KUrl& url)
-{
- cleanup();
-
- const QString search = url.queryItem("search");
- if (!search.isEmpty()) {
- m_regExp = new QRegExp(search, Qt::CaseInsensitive, QRegExp::Wildcard);
- }
-
- m_checkContent = false;
- const QString checkContent = url.queryItem("checkContent");
- if (checkContent == QLatin1String("yes")) {
- m_checkContent = true;
- }
-
- const QString urlString = url.queryItem("url");
- searchDirectory(KUrl(urlString));
-
- cleanup();
- finished();
-}
-
-void FileNameSearchProtocol::searchDirectory(const KUrl& directory)
-{
- if (directory.path() == QLatin1String("/proc")) {
- // Don't try to iterate the /proc directory of Linux
- return;
- }
-
- // Get all items of the directory
- KDirLister *dirLister = new KDirLister();
- dirLister->setDelayedMimeTypes(false);
- dirLister->setAutoErrorHandlingEnabled(false, 0);
- dirLister->openUrl(directory);
-
- QEventLoop eventLoop;
- QObject::connect(dirLister, SIGNAL(canceled()), &eventLoop, SLOT(quit()));
- QObject::connect(dirLister, SIGNAL(completed()), &eventLoop, SLOT(quit()));
- eventLoop.exec();
-
- // Visualize all items that match the search pattern
- QList<KUrl> pendingDirs;
- const KFileItemList items = dirLister->items();
- foreach (const KFileItem& item, items) {
- bool addItem = false;
- if (!m_regExp || item.name().contains(*m_regExp)) {
- addItem = true;
- } else if (m_checkContent && item.determineMimeType()->is(QLatin1String("text/plain"))) {
- addItem = contentContainsPattern(item.url());
- }
-
- if (addItem) {
- KIO::UDSEntry entry = item.entry();
- entry.insert(KIO::UDSEntry::UDS_URL, item.url().url() );
- listEntry(entry,false);
- }
-
- if (item.isDir()) {
- if (item.isLink()) {
- // Assure that no endless searching is done in directories that
- // have already been iterated.
- const KUrl linkDest(item.url(), item.linkDest());
- if (!m_iteratedDirs.contains(linkDest.path())) {
- pendingDirs.append(linkDest);
- }
- } else {
- pendingDirs.append(item.url());
- }
- }
- }
- listEntry(KIO::UDSEntry(), true);
-
- m_iteratedDirs.insert(directory.path());
-
- delete dirLister;
- dirLister = 0;
-
- // Recursively iterate all sub directories
- foreach (const KUrl& pendingDir, pendingDirs) {
- searchDirectory(pendingDir);
- }
-}
-
-bool FileNameSearchProtocol::contentContainsPattern(const KUrl& fileName) const
-{
- Q_ASSERT(m_regExp);
-
- QString path;
- KTemporaryFile tempFile;
-
- if (fileName.isLocalFile()) {
- path = fileName.path();
- } else if (tempFile.open()) {
- KIO::Job* getJob = KIO::file_copy(fileName,
- tempFile.fileName(),
- -1,
- KIO::Overwrite | KIO::HideProgressInfo);
- if (!KIO::NetAccess::synchronousRun(getJob, 0)) {
- // The non-local file could not be downloaded
- return false;
- }
- path = tempFile.fileName();
- } else {
- // No temporary file could be created for downloading non-local files
- return false;
- }
-
- QFile file(path);
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- return false;
- }
-
- QTextStream in(&file);
- while (!in.atEnd()) {
- const QString line = in.readLine();
- if (line.contains(*m_regExp)) {
- return true;
- }
- }
-
- return false;
-}
-
-void FileNameSearchProtocol::cleanup()
-{
- delete m_regExp;
- m_regExp = 0;
- m_iteratedDirs.clear();
-}
-
-extern "C" int KDE_EXPORT kdemain( int argc, char **argv )
-{
- KComponentData instance("kio_search");
- QCoreApplication app(argc, argv);
-
- if (argc != 4) {
- fprintf(stderr, "Usage: kio_filenamesearch protocol domain-socket1 domain-socket2\n");
- exit(-1);
- }
-
- FileNameSearchProtocol slave(argv[2], argv[3]);
- slave.dispatchLoop();
-
- return 0;
-}
diff --git a/src/search/filenamesearchprotocol.h b/src/search/filenamesearchprotocol.h
deleted file mode 100644
index 4a854d729..000000000
--- a/src/search/filenamesearchprotocol.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2010 by Peter Penz <[email protected]> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-#ifndef FILENAMESEARCHPROTOCOL_H
-#define FILENAMESEARCHPROTOCOL_H
-
-#include <kio/slavebase.h>
-
-class KFileItem;
-class KUrl;
-class QRegExp;
-
-/**
- * @brief Lists files where the filename matches do a given query.
- *
- * The query is defined as part of the "search" query item of the URL.
- * The directory where the searching is started is defined in the "url" query
- * item. If the query item "checkContent" is set to "yes", all files with
- * a text MIME type will be checked for the content.
- */
-class FileNameSearchProtocol : public KIO::SlaveBase {
-public:
- FileNameSearchProtocol(const QByteArray& pool, const QByteArray& app);
- virtual ~FileNameSearchProtocol();
-
- virtual void listDir(const KUrl& url);
-
-private:
- void searchDirectory(const KUrl& directory);
-
- /**
- * @return True, if the pattern m_searchPattern is part of
- * the file \a fileName.
- */
- bool contentContainsPattern(const KUrl& fileName) const;
-
- void cleanup();
-
- bool m_checkContent;
- QRegExp* m_regExp;
- QSet<QString> m_iteratedDirs;
-};
-
-#endif