Changeset View
Changeset View
Standalone View
Standalone View
src/file/fileindexerconfig.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | 55 | | |||
56 | using namespace Baloo; | 56 | using namespace Baloo; | ||
57 | 57 | | |||
58 | FileIndexerConfig::FileIndexerConfig(QObject* parent) | 58 | FileIndexerConfig::FileIndexerConfig(QObject* parent) | ||
59 | : QObject(parent) | 59 | : QObject(parent) | ||
60 | , m_config(QStringLiteral("baloofilerc")) | 60 | , m_config(QStringLiteral("baloofilerc")) | ||
61 | , m_folderCacheDirty(true) | 61 | , m_folderCacheDirty(true) | ||
62 | , m_indexHidden(false) | 62 | , m_indexHidden(false) | ||
63 | , m_devices(nullptr) | 63 | , m_devices(nullptr) | ||
michaelh: Looks like you're reverting https://cgit.kde.org/baloo.git/commit/? | |||||
smithjd: No, making the StorageDevices object static so it can be exported. | |||||
Please create the StorageDevices object on demand, otherwise this penalizes all users of that class that just want to know whether Baloo itself is enabled, which was the main reason for doing D11279 broulik: Please create the `StorageDevices` object on demand, otherwise this penalizes all users of that… | |||||
I had presumed that the optimization came from re-using the already existing cache instead of recreating it, rather than creating the SolidDevices object on demand. smithjd: I had presumed that the optimization came from re-using the already existing cache instead of… | |||||
64 | , m_maxUncomittedFiles(40) | 64 | , m_maxUncomittedFiles(40) | ||
65 | { | 65 | { | ||
66 | forceConfigUpdate(); | 66 | forceConfigUpdate(); | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | 69 | | |||
70 | FileIndexerConfig::~FileIndexerConfig() | 70 | FileIndexerConfig::~FileIndexerConfig() | ||
71 | { | 71 | { | ||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Line(s) | |||||
308 | } | 308 | } | ||
309 | 309 | | |||
310 | void FileIndexerConfig::buildFolderCache() | 310 | void FileIndexerConfig::buildFolderCache() | ||
311 | { | 311 | { | ||
312 | if (!m_folderCacheDirty) { | 312 | if (!m_folderCacheDirty) { | ||
313 | return; | 313 | return; | ||
314 | } | 314 | } | ||
315 | 315 | | |||
316 | if (!m_devices) { | | |||
317 | m_devices = new StorageDevices(this); | | |||
318 | } | | |||
319 | | ||||
320 | KConfigGroup group = m_config.group("General"); | 316 | KConfigGroup group = m_config.group("General"); | ||
321 | QStringList includeFoldersPlain = group.readPathEntry("folders", QStringList() << QDir::homePath()); | 317 | QStringList includeFoldersPlain = group.readPathEntry("folders", QStringList() << QDir::homePath()); | ||
322 | QStringList excludeFoldersPlain = group.readPathEntry("exclude folders", QStringList()); | 318 | QStringList excludeFoldersPlain = group.readPathEntry("exclude folders", QStringList()); | ||
323 | 319 | | |||
324 | // Add all removable media and network shares as ignored unless they have | 320 | // Add all removable media and network shares as ignored unless they have | ||
325 | // been explicitly added in the include list | 321 | // been explicitly added in the include list | ||
326 | for (const auto& device: m_devices->allMedia()) { | 322 | for (const auto& device: storageDevices()->allMedia()) { | ||
327 | const QString mountPath = device.mountPath(); | 323 | const QString mountPath = device.mountPath(); | ||
328 | if (!device.isUsable() && !mountPath.isEmpty()) { | 324 | if (!device.isUsable() && !mountPath.isEmpty()) { | ||
329 | if (!includeFoldersPlain.contains(mountPath)) { | 325 | if (!includeFoldersPlain.contains(mountPath)) { | ||
330 | excludeFoldersPlain << mountPath; | 326 | excludeFoldersPlain << mountPath; | ||
331 | } | 327 | } | ||
332 | } | 328 | } | ||
333 | } | 329 | } | ||
334 | 330 | | |||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 387 | { | |||
392 | return m_config.group("Basic Settings").readEntry("Indexing-Enabled", true); | 388 | return m_config.group("Basic Settings").readEntry("Indexing-Enabled", true); | ||
393 | } | 389 | } | ||
394 | 390 | | |||
395 | uint FileIndexerConfig::maxUncomittedFiles() | 391 | uint FileIndexerConfig::maxUncomittedFiles() | ||
396 | { | 392 | { | ||
397 | return m_maxUncomittedFiles; | 393 | return m_maxUncomittedFiles; | ||
398 | } | 394 | } | ||
399 | 395 | | |||
396 | StorageDevices* FileIndexerConfig::storageDevices() | ||||
397 | { | ||||
398 | if (!m_devices) { | ||||
399 | m_devices = new StorageDevices(this); | ||||
400 | } | ||||
401 | | ||||
402 | return m_devices; | ||||
403 | } |
Looks like you're reverting https://cgit.kde.org/baloo.git/commit/?id=76c207a141423102ab0c5fba43fdafe3e205cca5 with this