Changeset View
Changeset View
Standalone View
Standalone View
krusader/FileSystem/krquery.h
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 45 | public: | |||
---|---|---|---|---|---|
69 | // sets the text for name filtering | 69 | // sets the text for name filtering | ||
70 | void setNameFilter(const QString &text, bool cs = true); | 70 | void setNameFilter(const QString &text, bool cs = true); | ||
71 | // returns the current filter mask | 71 | // returns the current filter mask | ||
72 | const QString &nameFilter() const { return origFilter; } | 72 | const QString &nameFilter() const { return origFilter; } | ||
73 | // returns whether the filter is case sensitive | 73 | // returns whether the filter is case sensitive | ||
74 | bool isCaseSensitive() { return matchesCaseSensitive; } | 74 | bool isCaseSensitive() { return matchesCaseSensitive; } | ||
75 | 75 | | |||
76 | // returns if the filter is null (was cancelled) | 76 | // returns if the filter is null (was cancelled) | ||
77 | bool isNull() { return bNull; } | 77 | bool isNull() const { return bNull; } | ||
78 | 78 | | |||
79 | // sets the content part of the query | 79 | // sets the content part of the query | ||
80 | void setContent(const QString &content, bool cs = true, bool wholeWord = false, | 80 | void setContent(const QString &content, bool cs = true, bool wholeWord = false, | ||
81 | QString encoding = QString(), bool regExp = false); | 81 | QString encoding = QString(), bool regExp = false); | ||
82 | const QString content() { return contain; } | 82 | const QString content() const { return contain; } | ||
83 | 83 | | |||
84 | // sets the minimum file size limit | 84 | // sets the minimum file size limit | ||
85 | void setMinimumFileSize(KIO::filesize_t); | 85 | void setMinimumFileSize(KIO::filesize_t); | ||
86 | // sets the maximum file size limit | 86 | // sets the maximum file size limit | ||
87 | void setMaximumFileSize(KIO::filesize_t); | 87 | void setMaximumFileSize(KIO::filesize_t); | ||
88 | 88 | | |||
89 | // sets the time the file newer than | 89 | // sets the time the file newer than | ||
90 | void setNewerThan(time_t time); | 90 | void setNewerThan(time_t time); | ||
Show All 11 Lines | |||||
102 | // type, must be one of the following: | 102 | // type, must be one of the following: | ||
103 | // 1. a valid mime type name | 103 | // 1. a valid mime type name | ||
104 | // 2. one of: i18n("Archives"), i18n("Folders"), i18n("Image Files") | 104 | // 2. one of: i18n("Archives"), i18n("Folders"), i18n("Image Files") | ||
105 | // i18n("Text Files"), i18n("Video Files"), i18n("Audio Files") | 105 | // i18n("Text Files"), i18n("Video Files"), i18n("Audio Files") | ||
106 | // 3. i18n("Custom") in which case you must supply a list of valid mime-types | 106 | // 3. i18n("Custom") in which case you must supply a list of valid mime-types | ||
107 | // in the member QStringList customType | 107 | // in the member QStringList customType | ||
108 | void setMimeType(const QString &typeIn, QStringList customList = QStringList()); | 108 | void setMimeType(const QString &typeIn, QStringList customList = QStringList()); | ||
109 | // true if setMimeType was called | 109 | // true if setMimeType was called | ||
110 | bool hasMimeType() { return type.isEmpty(); } | 110 | bool hasMimeType() const { return type.isEmpty(); } | ||
111 | 111 | | |||
112 | // sets the search in archive flag | 112 | // sets the search in archive flag | ||
113 | void setSearchInArchives(bool flag) { inArchive = flag; } | 113 | void setSearchInArchives(bool flag) { m_inArchive = flag; } | ||
114 | // gets the search in archive flag | 114 | // gets the search in archive flag | ||
115 | bool searchInArchives() { return inArchive; } | 115 | bool searchInArchives() const { return m_inArchive; } | ||
116 | // sets the recursive flag | 116 | // sets the recursive flag | ||
117 | void setRecursive(bool flag) { recurse = flag; } | 117 | void setRecursive(bool flag) { m_recurse = flag; } | ||
118 | // gets the recursive flag | 118 | // gets the recursive flag | ||
119 | bool isRecursive() { return recurse; } | 119 | bool isRecursive() const { return m_recurse; } | ||
120 | // sets whether to follow symbolic links | 120 | // sets whether to follow symbolic links | ||
121 | void setFollowLinks(bool flag) { followLinksP = flag; } | 121 | void setFollowLinks(bool flag) { m_followLinks = flag; } | ||
122 | // gets whether to follow symbolic links | 122 | // gets whether to follow symbolic links | ||
123 | bool followLinks() { return followLinksP; } | 123 | bool followLinks() const { return m_followLinks; } | ||
124 | // sets whether to ignore hidden files/folders | ||||
125 | void setIgnoreHidden(bool flag) { m_ignoreHidden = flag; } | ||||
126 | // gets whether to ignore hidden files/folders | ||||
127 | bool ignoreHidden() const { return m_ignoreHidden; } | ||||
124 | 128 | | |||
125 | // sets the folder names which the searcher will exclude from traversing | 129 | // sets the folder names which the searcher will exclude from traversing | ||
126 | void setExcludeFolderNames(const QStringList &urls); | 130 | void setExcludeFolderNames(const QStringList &urls); | ||
127 | // gets the folder names which the searcher excludes | 131 | // gets the folder names which the searcher excludes | ||
128 | const QStringList excludeFolderNames() { return excludedFolderNames; } | 132 | const QStringList excludeFolderNames() { return excludedFolderNames; } | ||
129 | // sets the folders where the searcher will search | 133 | // sets the folders where the searcher will search | ||
130 | void setSearchInDirs(const QList<QUrl> &urls); | 134 | void setSearchInDirs(const QList<QUrl> &urls); | ||
131 | // gets the folders where the searcher searches | 135 | // gets the folders where the searcher searches | ||
132 | const QList<QUrl> &searchInDirs() { return whereToSearch; } | 136 | const QList<QUrl> &searchInDirs() const { return m_whereToSearch; } | ||
133 | // sets the folders where search is not permitted | 137 | // sets the folders where search is not permitted | ||
134 | void setDontSearchInDirs(const QList<QUrl> &urls); | 138 | void setDontSearchInDirs(const QList<QUrl> &urls); | ||
135 | // gets the folders where search is not permitted | 139 | // gets the folders where search is not permitted | ||
136 | const QList<QUrl> &dontSearchInDirs() { return whereNotToSearch; } | 140 | const QList<QUrl> &dontSearchInDirs() const { return m_whereNotToSearch; } | ||
137 | // checks if a URL is excluded | 141 | // checks if a URL is excluded | ||
138 | bool isExcluded(const QUrl &url); | 142 | bool isExcluded(const QUrl &url) const ; | ||
139 | // gives whether we search for content | 143 | // gives whether we search for content | ||
140 | bool isContentSearched() const { return !contain.isEmpty(); } | 144 | bool isContentSearched() const { return !contain.isEmpty(); } | ||
141 | 145 | | |||
142 | bool checkLine(const QString &line, bool backwards = false) const; | 146 | bool checkLine(const QString &line, bool backwards = false) const; | ||
143 | const QString &foundText() const { return lastSuccessfulGrep; } | 147 | const QString &foundText() const { return lastSuccessfulGrep; } | ||
144 | int matchIndex() const { return lastSuccessfulGrepMatchIndex; } | 148 | int matchIndex() const { return lastSuccessfulGrepMatchIndex; } | ||
145 | int matchLength() const { return lastSuccessfulGrepMatchLength; } | 149 | int matchLength() const { return lastSuccessfulGrepMatchLength; } | ||
146 | 150 | | |||
Show All 25 Lines | 157 | protected: | |||
172 | 176 | | |||
173 | QString owner; | 177 | QString owner; | ||
174 | QString group; | 178 | QString group; | ||
175 | QString perm; | 179 | QString perm; | ||
176 | 180 | | |||
177 | QString type; | 181 | QString type; | ||
178 | QStringList customType; | 182 | QStringList customType; | ||
179 | 183 | | |||
180 | bool inArchive; // if true- search in archive. | 184 | bool m_inArchive; // if true- search in archive. | ||
181 | bool recurse; // if true recurse ob sub-dirs... | 185 | bool m_recurse; // if true recurse ob sub-dirs... | ||
182 | bool followLinksP; | 186 | bool m_followLinks; | ||
187 | bool m_ignoreHidden; | ||||
183 | 188 | | |||
184 | QStringList excludedFolderNames; // substrings of paths where not to search | 189 | QStringList excludedFolderNames; // substrings of paths where not to search | ||
185 | QList<QUrl> whereToSearch; // directories to search | 190 | QList<QUrl> m_whereToSearch; // directories to search | ||
186 | QList<QUrl> whereNotToSearch; // directories NOT to search | 191 | QList<QUrl> m_whereNotToSearch; // directories NOT to search | ||
187 | 192 | | |||
188 | signals: | 193 | signals: | ||
189 | void status(const QString &name); | 194 | void status(const QString &name); | ||
190 | void processEvents(bool &stopped); | 195 | void processEvents(bool &stopped); | ||
191 | 196 | | |||
192 | private: | 197 | private: | ||
193 | bool matchCommon(const QString &, const QStringList &, const QStringList &) const; | 198 | bool matchCommon(const QString &, const QStringList &, const QStringList &) const; | ||
194 | bool checkPerm(QString perm) const; | 199 | bool checkPerm(QString perm) const; | ||
195 | bool checkType(QString mime) const; | 200 | bool checkType(QString mime) const; | ||
196 | bool containsContent(QString file) const; | 201 | bool containsContent(QString file) const; | ||
197 | bool containsContent(QUrl url) const; | 202 | bool containsContent(QUrl url) const; | ||
198 | bool checkBuffer(const char *data, int len) const; | 203 | bool checkBuffer(const char *data, int len) const; | ||
199 | bool checkTimer() const; | 204 | bool checkTimer() const; | ||
200 | QStringList split(QString); | 205 | QStringList split(QString); | ||
206 | static QString getFileName(const QString &name); | ||||
201 | 207 | | |||
202 | private slots: | 208 | private slots: | ||
203 | void containsContentData(KIO::Job *, const QByteArray &); | 209 | void containsContentData(KIO::Job *, const QByteArray &); | ||
204 | void containsContentFinished(KJob *); | 210 | void containsContentFinished(KJob *); | ||
205 | 211 | | |||
206 | private: | 212 | private: | ||
207 | QString origFilter; | 213 | QString origFilter; | ||
208 | mutable bool busy; | 214 | mutable bool busy; | ||
Show All 20 Lines |