mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Dolphin Search: Do not use Nepomuk for hidden folders
Nepomuk does not index hidden folders BUG: 318442 REVIEW: 110697 FIXED-IN: 4.11.0
This commit is contained in:
parent
b1aebb44d6
commit
85ea7bda39
1 changed files with 25 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue