KAuth

DBusHelperProxy.h
1/*
2 SPDX-FileCopyrightText: 2008 Nicola Gigante <nicola.gigante@gmail.com>
3 SPDX-FileCopyrightText: 2009 Dario Freddi <drf@kde.org>
4 SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#ifndef DBUS_HELPER_PROXY_H
10#define DBUS_HELPER_PROXY_H
11
12#include "HelperProxy.h"
13#include "actionreply.h"
14
15#include <QDBusConnection>
16#include <QDBusContext>
17#include <QVariant>
18
19namespace KAuth
20{
21class DBusHelperProxy : public HelperProxy, protected QDBusContext
22{
24 Q_PLUGIN_METADATA(IID "org.kde.DBusHelperProxy")
25 Q_INTERFACES(KAuth::HelperProxy)
26
27 QObject *responder;
28 QString m_name;
29 QString m_currentAction;
30 bool m_stopRequest;
31 QList<QString> m_actionsInProgress;
32 QDBusConnection m_busConnection;
33
34 enum SignalType {
35 ActionStarted, // The blob argument is empty
36 ActionPerformed, // The blob argument contains the ActionReply
37 DebugMessage, // The blob argument contains the debug level and the message (in this order)
38 ProgressStepIndicator, // The blob argument contains the step indicator
39 ProgressStepData, // The blob argument contains the QVariantMap
40 };
41
42public:
43 DBusHelperProxy();
44 DBusHelperProxy(const QDBusConnection &busConnection);
45
46 ~DBusHelperProxy() override;
47
48 virtual void
49 executeAction(const QString &action, const QString &helperID, const DetailsMap &details, const QVariantMap &arguments, int timeout = -1) override;
50 void stopAction(const QString &action, const QString &helperID) override;
51
52 bool initHelper(const QString &name) override;
53 void setHelperResponder(QObject *o) override;
54 bool hasToStopAction() override;
55 void sendDebugMessage(int level, const char *msg) override;
56 void sendProgressStep(int step) override;
57 void sendProgressStepData(const QVariantMap &data) override;
58
59 int callerUid() const override;
60
61public Q_SLOTS:
62 void stopAction(const QString &action);
63 QByteArray performAction(const QString &action, const QByteArray &callerID, const QVariantMap &details, QByteArray arguments);
64
66 void remoteSignal(int type, const QString &action, const QByteArray &blob); // This signal is sent from the helper to the app
67
68private Q_SLOTS:
69 void remoteSignalReceived(int type, const QString &action, QByteArray blob);
70
71private:
72 bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details);
73};
74
75} // namespace Auth
76
77#endif
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:10 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.