Baloo

indexerconfig.cpp
1 /*
2  This file is part of the KDE Baloo Project
3  SPDX-FileCopyrightText: 2014 Vishesh Handa <[email protected]>
4  SPDX-FileCopyrightText: 2020 Benjamin Port <[email protected]>
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 
18 using namespace Baloo;
19 
20 class BALOO_CORE_NO_EXPORT IndexerConfig::Private {
21 public:
22  FileIndexerConfig m_config;
23  BalooSettings m_settings;
24 };
25 
26 IndexerConfig::IndexerConfig()
27  : d(new Private)
28 {
29 }
30 
31 IndexerConfig::~IndexerConfig()
32 {
33  d->m_settings.save();
34  delete d;
35 }
36 
37 bool IndexerConfig::fileIndexingEnabled() const
38 {
39  return d->m_settings.indexingEnabled();
40 }
41 
42 void IndexerConfig::setFileIndexingEnabled(bool enabled) const
43 {
44  d->m_settings.setIndexingEnabled(enabled);
45 }
46 
47 bool IndexerConfig::shouldBeIndexed(const QString& path) const
48 {
49  return d->m_config.shouldBeIndexed(path);
50 }
51 
52 bool IndexerConfig::canBeSearched(const QString& folder) const
53 {
54  return d->m_config.canBeSearched(folder);
55 }
56 
58 {
59  return d->m_config.excludeFolders();
60 }
61 
63 {
64  return d->m_config.includeFolders();
65 }
66 
67 QStringList IndexerConfig::excludeFilters() const
68 {
69  return d->m_config.excludeFilters();
70 }
71 
72 QStringList IndexerConfig::excludeMimetypes() const
73 {
74  return d->m_config.excludeMimetypes();
75 }
76 
77 void IndexerConfig::setExcludeFolders(const QStringList& excludeFolders)
78 {
79  d->m_settings.setExcludedFolders(excludeFolders);
80 }
81 
82 void IndexerConfig::setIncludeFolders(const QStringList& includeFolders)
83 {
84  d->m_settings.setFolders(includeFolders);
85 }
86 
87 void IndexerConfig::setExcludeFilters(const QStringList& excludeFilters)
88 {
89  d->m_settings.setExcludedFilters(excludeFilters);
90 }
91 
92 void IndexerConfig::setExcludeMimetypes(const QStringList& excludeMimetypes)
93 {
94  d->m_settings.setExcludedMimetypes(excludeMimetypes);
95 }
96 
97 #if BALOO_CORE_BUILD_DEPRECATED_SINCE(5, 69)
98 bool IndexerConfig::firstRun() const
99 {
100  return false;
101 }
102 
103 void IndexerConfig::setFirstRun(bool) const
104 {
105 }
106 #endif
107 
108 bool IndexerConfig::indexHidden() const
109 {
110  return d->m_settings.indexHiddenFolders();
111 }
112 
113 void IndexerConfig::setIndexHidden(bool value) const
114 {
115  d->m_settings.setIndexHiddenFolders(value);
116 }
117 
118 bool IndexerConfig::onlyBasicIndexing() const
119 {
120  return d->m_settings.onlyBasicIndexing();
121 }
122 
123 void IndexerConfig::setOnlyBasicIndexing(bool value)
124 {
125  d->m_settings.setOnlyBasicIndexing(value);
126 }
127 
128 void IndexerConfig::refresh() const
129 {
130  org::kde::baloo::main mainInterface(QStringLiteral("org.kde.baloo"),
131  QStringLiteral("/"),
133  mainInterface.updateConfig();
134 }
bool shouldBeIndexed(const QString &path) const
Check if the file or folder path should be indexed.
QDBusConnection sessionBus()
Implements storage for docIds without any associated data Instantiated for:
Definition: coding.cpp:11
Active config class which emits signals if the config was changed, for example if the KCM saved the c...
QStringList excludeFolders() const
Folders that are excluded from indexing.
QStringList includeFolders() const
Folders to search for files to index and analyze.
bool canBeSearched(const QString &folder) const
Check if folder can be searched.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Nov 29 2023 03:56:26 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.