Baloo

indexerconfig.h
1 /*
2  This file is part of the KDE Baloo Project
3  SPDX-FileCopyrightText: 2014 Vishesh Handa <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7 
8 #ifndef BALOO_INDEXERCONFIG_H
9 #define BALOO_INDEXERCONFIG_H
10 
11 #include <QObject>
12 #include "core_export.h"
13 
14 namespace Baloo {
15 
16 /**
17  * @class IndexerConfig indexerconfig.h <Baloo/IndexerConfig>
18  *
19  * This class allows it to access the current config, to
20  * read and modify it.
21  *
22  * It is not meant as a means to infer the current state of
23  * the Indexer or the DB. The DB is updated asynchronously,
24  * and changes of the config will not be reflected immediately.
25  */
26 class BALOO_CORE_EXPORT IndexerConfig
27 {
28 public:
29  IndexerConfig();
30  ~IndexerConfig();
31 
32  IndexerConfig(const IndexerConfig &) = delete;
33  IndexerConfig &operator=(const IndexerConfig &) = delete;
34 
35  bool fileIndexingEnabled() const;
36  void setFileIndexingEnabled(bool enabled) const;
37 
38  /**
39  * Check if the file or folder \p path should be indexed.
40  *
41  * If itself or its nearest explicitly included or excluded ancestor is
42  * excluded it is not indexed.
43  * Otherwise it is indexed according to the
44  * includeFolders and excludeFilters config.
45  *
46  * \return \c true if the file or folder at \p path should
47  * be indexed according to the configuration.
48  *
49  * TODO KF6: deprecate, not of any concern for ouside
50  * users. Use \c Baloo::File to know if a file has
51  * been indexed.
52  * \sa Baloo::File
53  */
54  bool shouldBeIndexed(const QString& path) const;
55 
56  /**
57  * Check if \p folder can be searched.
58  * \p folder can be searched if itself or one of its descendants is indexed.
59  *
60  * Example:
61  * if ~/foo is not indexed and ~/foo/bar is indexed
62  * then ~/foo can be searched.
63  *
64  * \return \c true if the \p folder can be searched.
65  */
66  bool canBeSearched(const QString& folder) const;
67 
68  /**
69  * Folders to search for files to index and analyze.
70  * \return list of paths.
71  */
72  QStringList includeFolders() const;
73 
74  /**
75  * Folders that are excluded from indexing.
76  * (Descendant folders of an excluded folder can be added
77  * and they will be indexed.)
78  * \return list of paths.
79  */
80  QStringList excludeFolders() const;
81  QStringList excludeFilters() const;
82  QStringList excludeMimetypes() const;
83 
84  void setIncludeFolders(const QStringList& includeFolders);
85  void setExcludeFolders(const QStringList& excludeFolders);
86  void setExcludeFilters(const QStringList& excludeFilters);
87  void setExcludeMimetypes(const QStringList& excludeMimetypes);
88 
89 #if BALOO_CORE_BUILD_DEPRECATED_SINCE(5, 69)
90  /**
91  * @deprecated Since 5.69. Do not use this function, firstRun is no longer
92  * exposed in the config, as it is an internal baloo state.
93  * \return \c false
94  */
95  BALOO_CORE_DEPRECATED_VERSION(5, 69, "Do not use. firstRun is a baloo internal state")
96  bool firstRun() const;
97  /**
98  * @deprecated Since 5.69. Do not use this function. Since 5.69, calling
99  * it no longer has any effect.
100  */
101  BALOO_CORE_DEPRECATED_VERSION(5, 69, "Do not use. firstRun is a baloo internal state")
102  void setFirstRun(bool firstRun) const;
103 #endif
104 
105  bool indexHidden() const;
106  void setIndexHidden(bool value) const;
107 
108  bool onlyBasicIndexing() const;
109  void setOnlyBasicIndexing(bool value);
110 
111  void refresh() const;
112 
113 private:
114  class Private;
115  Private* d;
116 };
117 }
118 
119 #endif // BALOO_INDEXERCONFIG_H
Implements storage for docIds without any associated data Instantiated for:
Definition: coding.cpp:11
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Dec 11 2023 03:53:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.