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 <QDBusUnixFileDescriptor>
18#include <QVariant>
19
20namespace KAuth
21{
22class DBusHelperProxy : public HelperProxy, protected QDBusContext
23{
25 Q_PLUGIN_METADATA(IID "org.kde.DBusHelperProxy")
26 Q_INTERFACES(KAuth::HelperProxy)
27
28 QObject *responder;
29 QString m_name;
30 QString m_currentAction;
31 bool m_stopRequest;
32 QList<QString> m_actionsInProgress;
33 QDBusConnection m_busConnection;
34
35 enum SignalType {
36 ActionStarted, // The blob argument is empty
37 ActionPerformed, // The blob argument contains the ActionReply
38 DebugMessage, // The blob argument contains the debug level and the message (in this order)
39 ProgressStepIndicator, // The blob argument contains the step indicator
40 ProgressStepData, // The blob argument contains the QVariantMap
41 };
42
43public:
44 DBusHelperProxy();
45 DBusHelperProxy(const QDBusConnection &busConnection);
46
47 ~DBusHelperProxy() override;
48
49 virtual void
50 executeAction(const QString &action, const QString &helperID, const DetailsMap &details, const QVariantMap &arguments, int timeout = -1) override;
51 void stopAction(const QString &action, const QString &helperID) override;
52
53 bool initHelper(const QString &name) override;
54 void setHelperResponder(QObject *o) override;
55 bool hasToStopAction() override;
56 void sendDebugMessage(int level, const char *msg) override;
57 void sendProgressStep(int step) override;
58 void sendProgressStepData(const QVariantMap &data) override;
59
60 int callerUid() const override;
61
62public Q_SLOTS:
63 void stopAction(const QString &action);
64 QByteArray performAction(const QString &action,
65 const QByteArray &callerID,
66 const QVariantMap &details,
67 QByteArray arguments,
69
71 void remoteSignal(int type, const QString &action, const QByteArray &blob); // This signal is sent from the helper to the app
72
73private Q_SLOTS:
74 void remoteSignalReceived(int type, const QString &action, QByteArray blob);
75
76private:
77 bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details);
78};
79
80} // namespace Auth
81
82#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 Fri Oct 11 2024 12:15:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.