1/*
2 This file is part of the KDE Baloo Project
3 SPDX-FileCopyrightText: 2015 Pinak Ahuja <pinak.ahuja@gmail.com>
4 SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#ifndef MONITOR_H
10#define MONITOR_H
11
12#include "command.h"
13#include "fileindexerinterface.h"
14#include "schedulerinterface.h"
15#include <QObject>
16#include <QTextStream>
17#include <KLocalizedString>
18
19namespace Baloo {
20
21class MonitorCommand : public QObject, public Command
22{
23 Q_OBJECT
24public:
25 explicit MonitorCommand(QObject* parent = nullptr);
26
27 QString command() override {
28 return QStringLiteral("monitor");
29 }
30
31 QString description() override {
32 return i18n("CLI interface for monitoring Baloo");
33 }
34
35 int exec(const QCommandLineParser& parser) override;
36
37private Q_SLOTS:
38 void startedIndexingFile(const QString& filePath);
39 void finishedIndexingFile(const QString& filePath);
40 void stateChanged(int state);
41 void balooIsAvailable();
42 void balooIsNotAvailable();
43
44private:
45 QTextStream m_out;
46 QTextStream m_err;
47 org::kde::baloo::fileindexer* m_indexerDBusInterface;
48 org::kde::baloo::scheduler* m_schedulerDBusInterface;
49 QString m_currentFile;
50 QDBusServiceWatcher* m_dbusServiceWatcher;
51};
52}
53#endif // MONITOR_H
54

source code of baloo/src/tools/balooctl/monitorcommand.h