┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishesh Handa <[email protected]>2013-05-28 22:03:36 +0530
committerVishesh Handa <[email protected]>2013-05-29 20:13:10 +0530
commit780327f7d3652d4964933533ff6a856bb8aaea22 (patch)
treec59152f72cf2b95f75a5e94a30f4dd04a9d0ef7b
parentae415dcebdf61430ee54a5afc1dc4e6517f34234 (diff)
Dolphin Search: Do not use Nepomuk for hidden folders
Nepomuk does not index hidden folders BUG: 318442 REVIEW: 110697 FIXED-IN: 4.11.0
-rw-r--r--src/search/dolphinsearchinformation.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/search/dolphinsearchinformation.cpp b/src/search/dolphinsearchinformation.cpp
index 31f6fcc7b..b723f1ec0 100644
--- a/src/search/dolphinsearchinformation.cpp
+++ b/src/search/dolphinsearchinformation.cpp
@@ -28,6 +28,8 @@
#include <KGlobal>
#include <KUrl>
+#include <QFileInfo>
+#include <QDir>
struct DolphinSearchInformationSingleton
{
@@ -50,12 +52,35 @@ bool DolphinSearchInformation::isIndexingEnabled() const
return m_indexingEnabled;
}
+namespace {
+ /// recursively check if a folder is hidden
+ bool isDirHidden( QDir& dir ) {
+ if (QFileInfo(dir.path()).isHidden()) {
+ return true;
+ } else if (dir.cdUp()) {
+ return isDirHidden(dir);
+ } else {
+ return false;
+ }
+ }
+
+ bool isDirHidden(const QString& path) {
+ QDir dir(path);
+ return isDirHidden(dir);
+ }
+}
+
bool DolphinSearchInformation::isPathIndexed(const KUrl& url) const
{
#ifdef HAVE_NEPOMUK
const KConfig strigiConfig("nepomukstrigirc");
const QStringList indexedFolders = strigiConfig.group("General").readPathEntry("folders", QStringList());
+ // Nepomuk does not index hidden folders
+ if (isDirHidden(url.toLocalFile())) {
+ return false;
+ }
+
// Check whether the path is part of an indexed folder
bool isIndexed = false;
foreach (const QString& indexedFolder, indexedFolders) {