diff options
author | Kai Uwe Broulik <kde@privat.broulik.de> | 2018-04-04 15:48:53 +0200 |
---|---|---|
committer | Kai Uwe Broulik <kde@privat.broulik.de> | 2018-07-10 19:46:40 +0000 |
commit | d743df975db3403ec83d67bd376d8a6bfea3dfb0 (patch) | |
tree | 647560847f9ae5d4bd6ddffc5d64d40a030a2f3d /src/dbus/qdbus_symbols_p.h | |
parent | 5c5af7155ae989664919de1f10ac17121fa12a36 (diff) | |
download | qtbase-d743df975db3403ec83d67bd376d8a6bfea3dfb0.tar.gz |
Support interactive authorization flag in DBusMessage
This flag was introduced to serve as a replacement for a dedicated "interactive" boolean
argument in method calls guarded by Polkit.
Change-Id: Ida91c9872e70f8ca6672563d0ca6642f38c498ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbus_symbols_p.h')
-rw-r--r-- | src/dbus/qdbus_symbols_p.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index 9eaebe6d7e..7cce0d71aa 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -161,6 +161,19 @@ template <> struct TraceReturn<void> { typedef void Type; }; funcret DEBUGRET(ret) ptr argcall; \ } +# define DEFINEFUNC_CONDITIONALLY(ret, func, args, argcall, funcret, failret) \ + typedef ret (* _q_PTR_##func) args; \ + static inline ret q_##func args \ + { \ + static _q_PTR_##func ptr; \ + DEBUGCALL(#func, argcall); \ + if (!ptr) \ + ptr = (_q_PTR_##func) qdbus_resolve_conditionally(#func); \ + if (!ptr) \ + failret; \ + funcret DEBUGRET(ret) ptr argcall; \ + } + #else // defined QT_LINKED_LIBDBUS inline bool qdbus_loadLibDBus() { return true; } @@ -300,6 +313,26 @@ DEFINEFUNC(const char* , dbus_message_get_signature, (DBusMessage *message), (message), return) DEFINEFUNC(int , dbus_message_get_type, (DBusMessage *message), (message), return) + +#if !defined QT_LINKED_LIBDBUS + +DEFINEFUNC_CONDITIONALLY(dbus_bool_t , dbus_message_get_allow_interactive_authorization, (DBusMessage *message), + (message), return, return false) + +#else // defined QT_LINKED_LIBDBUS + +static inline dbus_bool_t q_dbus_message_get_allow_interactive_authorization(DBusMessage *message) +{ +#ifdef DBUS_HEADER_FLAG_ALLOW_INTERACTIVE_AUTHORIZATION + return dbus_message_get_allow_interactive_authorization(message); +#else + Q_UNUSED(message); + return false; +#endif +} + +#endif // defined QT_LINKED_LIBDBUS + DEFINEFUNC(dbus_bool_t , dbus_message_iter_append_basic, (DBusMessageIter *iter, int type, const void *value), @@ -378,9 +411,33 @@ DEFINEFUNC(dbus_bool_t , dbus_message_set_sender, (DBusMessage *message, DEFINEFUNC(void , dbus_message_unref, (DBusMessage *message), (message), ) +#if !defined QT_LINKED_LIBDBUS + +DEFINEFUNC_CONDITIONALLY(void, dbus_message_set_allow_interactive_authorization, + (DBusMessage *message, dbus_bool_t allow), (message, allow), return, return) + + +#else // defined QT_LINKED_LIBDBUS + +static inline void q_dbus_message_set_allow_interactive_authorization(DBusMessage *message, dbus_bool_t allow) +{ +#ifdef DBUS_HEADER_FLAG_ALLOW_INTERACTIVE_AUTHORIZATION + dbus_message_set_allow_interactive_authorization(message, allow); +#else + Q_UNUSED(message); + Q_UNUSED(allow); +#endif +} + +#endif // defined QT_LINKED_LIBDBUS + /* dbus-misc.h */ DEFINEFUNC(char* , dbus_get_local_machine_id , (void), (), return) +DEFINEFUNC(void , dbus_get_version , (int *major_version, int *minor_version, int *micro_version) + , (major_version, minor_version, micro_version) + , return) + /* dbus-pending-call.h */ DEFINEFUNC(dbus_bool_t , dbus_pending_call_set_notify, (DBusPendingCall *pending, |