File indexing completed on 2024-04-28 15:17:40
0001 /* 0002 This file is part of the KDE Baloo Project 0003 SPDX-FileCopyrightText: 2014 Vishesh Handa <vhanda@kde.org> 0004 SPDX-FileCopyrightText: 2020 Benjamin Port <benjamin.port@enioka.com> 0005 0006 SPDX-License-Identifier: LGPL-2.1-or-later 0007 */ 0008 0009 #include "indexerconfig.h" 0010 #include "../file/fileindexerconfig.h" 0011 #include "../file/fileexcludefilters.h" 0012 #include "../file/regexpcache.h" 0013 0014 #include <QDBusConnection> 0015 #include "maininterface.h" 0016 #include "baloosettings.h" 0017 0018 using namespace Baloo; 0019 0020 class BALOO_CORE_NO_EXPORT IndexerConfig::Private { 0021 public: 0022 FileIndexerConfig m_config; 0023 BalooSettings m_settings; 0024 }; 0025 0026 IndexerConfig::IndexerConfig() 0027 : d(new Private) 0028 { 0029 } 0030 0031 IndexerConfig::~IndexerConfig() 0032 { 0033 d->m_settings.save(); 0034 delete d; 0035 } 0036 0037 bool IndexerConfig::fileIndexingEnabled() const 0038 { 0039 return d->m_settings.indexingEnabled(); 0040 } 0041 0042 void IndexerConfig::setFileIndexingEnabled(bool enabled) const 0043 { 0044 d->m_settings.setIndexingEnabled(enabled); 0045 } 0046 0047 bool IndexerConfig::shouldBeIndexed(const QString& path) const 0048 { 0049 return d->m_config.shouldBeIndexed(path); 0050 } 0051 0052 bool IndexerConfig::canBeSearched(const QString& folder) const 0053 { 0054 return d->m_config.canBeSearched(folder); 0055 } 0056 0057 QStringList IndexerConfig::excludeFolders() const 0058 { 0059 return d->m_config.excludeFolders(); 0060 } 0061 0062 QStringList IndexerConfig::includeFolders() const 0063 { 0064 return d->m_config.includeFolders(); 0065 } 0066 0067 QStringList IndexerConfig::excludeFilters() const 0068 { 0069 return d->m_config.excludeFilters(); 0070 } 0071 0072 QStringList IndexerConfig::excludeMimetypes() const 0073 { 0074 return d->m_config.excludeMimetypes(); 0075 } 0076 0077 void IndexerConfig::setExcludeFolders(const QStringList& excludeFolders) 0078 { 0079 d->m_settings.setExcludedFolders(excludeFolders); 0080 } 0081 0082 void IndexerConfig::setIncludeFolders(const QStringList& includeFolders) 0083 { 0084 d->m_settings.setFolders(includeFolders); 0085 } 0086 0087 void IndexerConfig::setExcludeFilters(const QStringList& excludeFilters) 0088 { 0089 d->m_settings.setExcludedFilters(excludeFilters); 0090 } 0091 0092 void IndexerConfig::setExcludeMimetypes(const QStringList& excludeMimetypes) 0093 { 0094 d->m_settings.setExcludedMimetypes(excludeMimetypes); 0095 } 0096 0097 #if BALOO_CORE_BUILD_DEPRECATED_SINCE(5, 69) 0098 bool IndexerConfig::firstRun() const 0099 { 0100 return false; 0101 } 0102 0103 void IndexerConfig::setFirstRun(bool) const 0104 { 0105 } 0106 #endif 0107 0108 bool IndexerConfig::indexHidden() const 0109 { 0110 return d->m_settings.indexHiddenFolders(); 0111 } 0112 0113 void IndexerConfig::setIndexHidden(bool value) const 0114 { 0115 d->m_settings.setIndexHiddenFolders(value); 0116 } 0117 0118 bool IndexerConfig::onlyBasicIndexing() const 0119 { 0120 return d->m_settings.onlyBasicIndexing(); 0121 } 0122 0123 void IndexerConfig::setOnlyBasicIndexing(bool value) 0124 { 0125 d->m_settings.setOnlyBasicIndexing(value); 0126 } 0127 0128 void IndexerConfig::refresh() const 0129 { 0130 org::kde::baloo::main mainInterface(QStringLiteral("org.kde.baloo"), 0131 QStringLiteral("/"), 0132 QDBusConnection::sessionBus()); 0133 mainInterface.updateConfig(); 0134 }