#ifndef FILENAMESEARCHPROTOCOL_H
#define FILENAMESEARCHPROTOCOL_H
-
+
#include <kio/slavebase.h>
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.
- * Example: The URL filenamesearch:///home/peter?search=hello lists
- * recursively all files inside the directory home/peter, that contain
- * the "hello" as part of their filename.
+ * 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);
+
+ virtual void listDir(const QUrl& url) Q_DECL_OVERRIDE;
private:
void searchDirectory(const KUrl& directory);
* @return True, if the pattern m_searchPattern is part of
* the file \a fileName.
*/
- bool containsPattern(const KUrl& fileName) const;
+ bool contentContainsPattern(const KUrl& fileName) const;
+
+ void cleanup();
bool m_checkContent;
- QString m_searchPattern;
+ QRegExp* m_regExp;
+ QSet<QString> m_iteratedDirs;
};
-
+
#endif