diff options
author | Gleb Popov <arrowd@FreeBSD.org> | 2023-10-16 19:52:11 +0300 |
---|---|---|
committer | Gleb Popov <arrowd@FreeBSD.org> | 2023-11-07 19:49:34 +0000 |
commit | 295e56201da69a6e719e093291ffc488e5b8eff3 (patch) | |
tree | 3a8c2d81b6f60536e32d7579de206910e2b72112 /src/dbus/qdbusabstractinterface.cpp | |
parent | 889c3e2e5b262071420c0af5f0e1021a9d230320 (diff) |
Implement QDBusAbstractInterface::setInteractiveAuthorizationAllowed
Task-number: QTBUG-100458
Change-Id: I48d6f17943a554c1173d16a2320eb460c3d5c387
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusabstractinterface.cpp')
-rw-r--r-- | src/dbus/qdbusabstractinterface.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index b2971b9d5f..423aca7b82 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -79,6 +79,7 @@ QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv lastError(checkIfValid(serv, p, iface, isDynamic, (connectionPrivate() && connectionPrivate()->mode == QDBusConnectionPrivate::PeerMode))), timeout(-1), + interactiveAuthorizationAllowed(false), isValid(!lastError.isValid()) { if (!isValid) @@ -397,6 +398,30 @@ int QDBusAbstractInterface::timeout() const } /*! + When passed \a enable = \c true it causes all consecutive DBus calls made via + this interface to have the InteractiveAuthorizationAllowed flag set. Passing + false disables this behavior. + + \since 6.7 + \sa QDBusMessage::setInteractiveAuthorizationAllowed() +*/ +void QDBusAbstractInterface::setInteractiveAuthorizationAllowed(bool enable) +{ + d_func()->interactiveAuthorizationAllowed = enable; +} + +/*! + Returns the current value of the InteractiveAuthorizationAllowed flag. + + \since 6.7 + \sa QDBusMessage::setInteractiveAuthorizationAllowed() +*/ +bool QDBusAbstractInterface::isInteractiveAuthorizationAllowed() const +{ + return d_func()->interactiveAuthorizationAllowed; +} + +/*! Places a call to the remote method specified by \a method on this interface, using \a args as arguments. This function returns the message that was received as a reply, which can be a normal QDBusMessage::ReplyMessage (indicating success) or QDBusMessage::ErrorMessage (if the call @@ -488,6 +513,8 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method); QDBusMessagePrivate::setParametersValidated(msg, true); msg.setArguments(args); + if (d->interactiveAuthorizationAllowed) + msg.setInteractiveAuthorizationAllowed(true); return d->connection.asyncCall(msg, d->timeout); } |