File indexing completed on 2024-05-19 15:07:33

0001 /*
0002     SPDX-FileCopyrightText: 2008 Nicola Gigante <nicola.gigante@gmail.com>
0003     SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-or-later
0006 */
0007 
0008 #ifndef KAUTH_HELPER_PROXY_H
0009 #define KAUTH_HELPER_PROXY_H
0010 
0011 #include <QMap>
0012 #include <QObject>
0013 #include <QString>
0014 #include <QVariant>
0015 
0016 #include "action.h"
0017 #include "actionreply.h"
0018 
0019 namespace KAuth
0020 {
0021 typedef Action::DetailsMap DetailsMap;
0022 
0023 class HelperProxy : public QObject
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     ~HelperProxy() override;
0029 
0030     // Application-side methods
0031     virtual void executeAction(const QString &action, const QString &helperID, const DetailsMap &details, const QVariantMap &arguments, int timeout) = 0;
0032     virtual void stopAction(const QString &action, const QString &helperID) = 0;
0033 
0034     // Helper-side methods
0035     virtual bool initHelper(const QString &name) = 0;
0036     virtual void setHelperResponder(QObject *o) = 0;
0037     virtual bool hasToStopAction() = 0;
0038     virtual void sendDebugMessage(int level, const char *msg) = 0;
0039     virtual void sendProgressStep(int step) = 0;
0040     virtual void sendProgressStepData(const QVariantMap &step) = 0;
0041     // Attempts to resolve the UID of the unprivileged remote process.
0042     virtual int callerUid() const = 0;
0043 
0044 Q_SIGNALS:
0045     void actionStarted(const QString &action);
0046     void actionPerformed(const QString &action, const KAuth::ActionReply &reply);
0047     void progressStep(const QString &action, int progress);
0048     void progressStepData(const QString &action, const QVariantMap &data);
0049 };
0050 
0051 } // namespace KAuth
0052 
0053 Q_DECLARE_INTERFACE(KAuth::HelperProxy, "org.kde.kf5auth.HelperProxy/0.1")
0054 
0055 #endif