8#include "polkitqt1-agent-listener.h"
12#include "polkitqtlistener_p.h"
14#include "polkitqt1-authority.h"
15#include "polkitqt1-subject.h"
16#include "polkitqt1-identity.h"
17#include "polkitqt1-details.h"
28 PolkitAgentListener *listener;
29#ifndef POLKIT_QT_1_COMPATIBILITY_MODE
30 void *registeredHandle;
35 :
QObject(parent), d(new ListenerPrivate)
37 d->listener = polkit_qt_listener_new();
39 qDebug() <<
"New PolkitAgentListener " << d->listener;
41 ListenerAdapter::instance()->addListener(
this);
45 :
QObject(parent), d(new ListenerPrivate)
49 if (d->listener !=
nullptr) {
50 g_object_ref(d->listener);
56 qDebug(
"Destroying listener");
58 ListenerAdapter::instance()->removeListener(
this);
59#ifndef POLKIT_QT_1_COMPATIBILITY_MODE
60 if (d->registeredHandle) {
61 polkit_agent_listener_unregister(d->registeredHandle);
64 if (d->listener !=
nullptr) {
65 g_object_unref(d->listener);
71 GError *error =
nullptr;
73#ifndef POLKIT_QT_1_COMPATIBILITY_MODE
74 d->registeredHandle = polkit_agent_listener_register(d->listener,
75 POLKIT_AGENT_REGISTER_FLAGS_NONE,
77 bool r = polkit_agent_register_listener(d->listener,
81#ifndef POLKIT_QT_1_COMPATIBILITY_MODE
86 if (error !=
nullptr) {
87 qWarning() <<
QString(
"Cannot register authentication agent: %1").
arg(error->message);
91#ifndef POLKIT_QT_1_COMPATIBILITY_MODE
92 if (d->registeredHandle ==
nullptr) {
93 qWarning() << QString(
"Cannot register authentication agent!");
const PolkitAgentListener * listener()
Returns pointer to the PolkitAgentListener.
bool registerListener(const PolkitQt1::Subject &subject, const QString &objectPath)
Registers listener with polkit daemon as an authentication agent for subject.
Listener(QObject *parent=nullptr)
Constructor of Listener class.
This class represents PolicyKit subjects.
PolkitSubject * subject() const
Gets PolkitSubject object.
QString arg(Args &&... args) const const
QByteArray toLatin1() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 15 2024 11:56:27 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.