7#ifndef BALOO_FILEINDEXSCHEDULER_H
8#define BALOO_FILEINDEXSCHEDULER_H
15#include "filecontentindexerprovider.h"
16#include "powerstatemonitor.h"
17#include "indexerstate.h"
18#include "timeestimator.h"
23class FileIndexerConfig;
24class FileContentIndexer;
26class FileIndexScheduler :
public QObject
29 Q_CLASSINFO(
"D-Bus Interface",
"org.kde.baloo.scheduler")
31 Q_PROPERTY(
int state READ state NOTIFY stateChanged)
33 FileIndexScheduler(Database* db, FileIndexerConfig* config,
bool firstRun,
QObject*
parent =
nullptr);
34 ~FileIndexScheduler() override;
35 int state()
const {
return m_indexerState; }
38 Q_SCRIPTABLE
void stateChanged(
int state);
41 void indexNewFile(
const QString& file) {
44 if (isIndexerIdle()) {
50 void indexModifiedFile(
const QString& file) {
51 if (!m_modifiedFiles.
contains(file)) {
52 m_modifiedFiles << file;
53 if (isIndexerIdle()) {
59 void indexXAttrFile(
const QString& file) {
62 if (isIndexerIdle()) {
68 void runnerFinished() {
73 void handleFileRemoved(
const QString& file);
76 void scheduleIndexing();
77 void scheduleCheckUnindexedFiles();
78 void scheduleCheckStaleIndexEntries();
79 void startupFinished();
81 Q_SCRIPTABLE
void suspend() { setSuspend(
true); }
82 Q_SCRIPTABLE
void resume() { setSuspend(
false); }
83 Q_SCRIPTABLE uint getRemainingTime();
84 Q_SCRIPTABLE
void checkUnindexedFiles();
85 Q_SCRIPTABLE
void checkStaleIndexEntries();
86 Q_SCRIPTABLE uint getBatchSize();
89 void powerManagementStatusChanged(
bool isOnBattery);
92 void setSuspend(
bool suspend);
93 bool isIndexerIdle() {
94 return m_isGoingIdle ||
95 (m_indexerState == Suspended) ||
96 (m_indexerState == Startup) ||
97 (m_indexerState == Idle) ||
98 (m_indexerState == LowPowerIdle);
102 FileIndexerConfig* m_config;
110 FileContentIndexerProvider m_provider;
111 FileContentIndexer* m_contentIndexer;
113 PowerStateMonitor m_powerMonitor;
115 IndexerState m_indexerState;
116 TimeEstimator m_timeEstimator;
117 uint m_indexPendingFiles = 0;
118 uint m_indexFinishedFiles = 0;
120 bool m_checkUnindexedFiles;
121 bool m_checkStaleIndexEntries;
Implements storage for docIds without any associated data Instantiated for:
QObject * parent() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const