Changeset View
Changeset View
Standalone View
Standalone View
src/file/fileindexerconfig.cpp
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | |||||
133 | } | 133 | } | ||
134 | 134 | | |||
135 | bool FileIndexerConfig::isInitialRun() const | 135 | bool FileIndexerConfig::isInitialRun() const | ||
136 | { | 136 | { | ||
137 | return m_config.group("General").readEntry("first run", true); | 137 | return m_config.group("General").readEntry("first run", true); | ||
138 | } | 138 | } | ||
139 | 139 | | |||
140 | 140 | | |||
141 | bool FileIndexerConfig::canBeSearched(const QString& folder) const | ||||
142 | { | ||||
143 | QFileInfo fi(folder); | ||||
144 | QString path = fi.absolutePath(); | ||||
145 | if (!fi.isDir()) { | ||||
146 | return false; | ||||
147 | } else if (shouldFolderBeIndexed(path)) { | ||||
148 | return true; | ||||
149 | } | ||||
150 | | ||||
151 | // Look for included descendants | ||||
152 | for (const QPair<QString, bool>& fld: m_folderCache) { | ||||
153 | if (fld.second && fld.first.startsWith(path)) { | ||||
154 | return true; | ||||
155 | } | ||||
156 | } | ||||
157 | | ||||
158 | return false; | ||||
159 | } | ||||
160 | | ||||
141 | bool FileIndexerConfig::shouldBeIndexed(const QString& path) const | 161 | bool FileIndexerConfig::shouldBeIndexed(const QString& path) const | ||
142 | { | 162 | { | ||
143 | QFileInfo fi(path); | 163 | QFileInfo fi(path); | ||
144 | if (fi.isDir()) { | 164 | if (fi.isDir()) { | ||
145 | return shouldFolderBeIndexed(path); | 165 | return shouldFolderBeIndexed(path); | ||
146 | } else { | 166 | } else { | ||
147 | return (shouldFolderBeIndexed(fi.absolutePath()) && | 167 | return (shouldFolderBeIndexed(fi.absolutePath()) && | ||
148 | (!fi.isHidden() || indexHiddenFilesAndFolders()) && | 168 | (!fi.isHidden() || indexHiddenFilesAndFolders()) && | ||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |