]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/search/filenamesearchprotocol.h
Increase version
[dolphin.git] / src / search / filenamesearchprotocol.h
index 70d3e631c406d37c3b5aa3459b6d8a7b9e69be29..732aef942f33ffa2fef7ba04322c9327740bfc6c 100644 (file)
 
 #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);
@@ -46,10 +47,13 @@ private:
      * @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