diff --git a/src/file/fileindexerconfig.h b/src/file/fileindexerconfig.h --- a/src/file/fileindexerconfig.h +++ b/src/file/fileindexerconfig.h @@ -27,6 +27,7 @@ #include #include "regexpcache.h" +#include "storagedevices.h" namespace Baloo { @@ -164,6 +165,8 @@ */ uint maxUncomittedFiles(); + StorageDevices* storageDevices(); + public Q_SLOTS: /** * Reread the config from disk and update the configuration cache. diff --git a/src/file/fileindexerconfig.cpp b/src/file/fileindexerconfig.cpp --- a/src/file/fileindexerconfig.cpp +++ b/src/file/fileindexerconfig.cpp @@ -312,18 +312,13 @@ return; } - if (!m_devices) { - m_devices = new StorageDevices(this); - } - KConfigGroup group = m_config.group("General"); QStringList includeFoldersPlain = group.readPathEntry("folders", QStringList() << QDir::homePath()); QStringList excludeFoldersPlain = group.readPathEntry("exclude folders", QStringList()); // Add all removable media and network shares as ignored unless they have // been explicitly added in the include list - const auto allMedia = m_devices->allMedia(); - for (const auto& device: allMedia) { + for (const auto& device: storageDevices()->allMedia()) { const QString mountPath = device.mountPath(); if (!device.isUsable() && !mountPath.isEmpty()) { if (!includeFoldersPlain.contains(mountPath)) { @@ -397,3 +392,11 @@ return m_maxUncomittedFiles; } +StorageDevices* FileIndexerConfig::storageDevices() +{ + if (!m_devices) { + m_devices = new StorageDevices(this); + } + + return m_devices; +}