1/*
2 This file is part of the KDE Baloo Project
3 SPDX-FileCopyrightText: 2014 Vishesh Handa <vhanda@kde.org>
4 SPDX-FileCopyrightText: 2020 Benjamin Port <benjamin.port@enioka.com>
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#include "indexerconfig.h"
10#include "../file/fileindexerconfig.h"
11#include "../file/fileexcludefilters.h"
12#include "../file/regexpcache.h"
13
14#include <QDBusConnection>
15#include "maininterface.h"
16#include "baloosettings.h"
17
18using namespace Baloo;
19
20class BALOO_CORE_NO_EXPORT IndexerConfig::Private {
21public:
22 FileIndexerConfig m_config;
23 BalooSettings m_settings;
24};
25
26IndexerConfig::IndexerConfig()
27 : d(new Private)
28{
29}
30
31IndexerConfig::~IndexerConfig()
32{
33 d->m_settings.save();
34}
35
36bool IndexerConfig::fileIndexingEnabled() const
37{
38 return d->m_settings.indexingEnabled();
39}
40
41void IndexerConfig::setFileIndexingEnabled(bool enabled) const
42{
43 d->m_settings.setIndexingEnabled(enabled);
44}
45
46bool IndexerConfig::shouldBeIndexed(const QString& path) const
47{
48 return d->m_config.shouldBeIndexed(path);
49}
50
51bool IndexerConfig::canBeSearched(const QString& folder) const
52{
53 return d->m_config.canBeSearched(folder);
54}
55
56QStringList IndexerConfig::excludeFolders() const
57{
58 return d->m_config.excludeFolders();
59}
60
61QStringList IndexerConfig::includeFolders() const
62{
63 return d->m_config.includeFolders();
64}
65
66QStringList IndexerConfig::excludeFilters() const
67{
68 return d->m_config.excludeFilters();
69}
70
71QStringList IndexerConfig::excludeMimetypes() const
72{
73 return d->m_config.excludeMimetypes();
74}
75
76void IndexerConfig::setExcludeFolders(const QStringList& excludeFolders)
77{
78 d->m_settings.setExcludedFolders(excludeFolders);
79}
80
81void IndexerConfig::setIncludeFolders(const QStringList& includeFolders)
82{
83 d->m_settings.setFolders(includeFolders);
84}
85
86void IndexerConfig::setExcludeFilters(const QStringList& excludeFilters)
87{
88 d->m_settings.setExcludedFilters(excludeFilters);
89}
90
91void IndexerConfig::setExcludeMimetypes(const QStringList& excludeMimetypes)
92{
93 d->m_settings.setExcludedMimetypes(excludeMimetypes);
94}
95
96bool IndexerConfig::indexHidden() const
97{
98 return d->m_settings.indexHiddenFolders();
99}
100
101void IndexerConfig::setIndexHidden(bool value) const
102{
103 d->m_settings.setIndexHiddenFolders(value);
104}
105
106bool IndexerConfig::onlyBasicIndexing() const
107{
108 return d->m_settings.onlyBasicIndexing();
109}
110
111void IndexerConfig::setOnlyBasicIndexing(bool value)
112{
113 d->m_settings.setOnlyBasicIndexing(value);
114}
115
116void IndexerConfig::refresh() const
117{
118 org::kde::baloo::main mainInterface(QStringLiteral("org.kde.baloo"),
119 QStringLiteral("/"),
120 QDBusConnection::sessionBus());
121 mainInterface.updateConfig();
122}
123

source code of baloo/src/lib/indexerconfig.cpp