Baloo

indexerconfig.cpp
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
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
57{
58 return d->m_config.excludeFolders();
59}
60
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("/"),
121 mainInterface.updateConfig();
122}
Active config class which emits signals if the config was changed, for example if the KCM saved the c...
This class allows it to access the current config, to read and modify it.
bool canBeSearched(const QString &folder) const
Check if folder can be searched.
QStringList includeFolders() const
Folders to search for files to index and analyze.
bool shouldBeIndexed(const QString &path) const
Check if the file or folder path should be indexed.
QStringList excludeFolders() const
Folders that are excluded from indexing.
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
QDBusConnection sessionBus()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:52:28 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.