| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // Copyright (C) 2016 Intel Corporation. |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 4 | |
| 5 | // |
| 6 | // W A R N I N G |
| 7 | // ------------- |
| 8 | // |
| 9 | // This file is not part of the public API. This header file may |
| 10 | // change from version to version without notice, or even be |
| 11 | // removed. |
| 12 | // |
| 13 | // We mean it. |
| 14 | // |
| 15 | // |
| 16 | |
| 17 | #ifndef QDBUSABSTRACTINTERFACE_P_H |
| 18 | #define QDBUSABSTRACTINTERFACE_P_H |
| 19 | |
| 20 | #include <QtDBus/private/qtdbusglobal_p.h> |
| 21 | #include <qdbusabstractinterface.h> |
| 22 | #include <qdbusconnection.h> |
| 23 | #include <qdbuserror.h> |
| 24 | #include "qdbusconnection_p.h" |
| 25 | #include "private/qobject_p.h" |
| 26 | |
| 27 | #define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply" |
| 28 | |
| 29 | #ifndef QT_NO_DBUS |
| 30 | |
| 31 | QT_BEGIN_NAMESPACE |
| 32 | |
| 33 | class QDBusAbstractInterfacePrivate : public QObjectPrivate |
| 34 | { |
| 35 | public: |
| 36 | Q_DECLARE_PUBLIC(QDBusAbstractInterface) |
| 37 | |
| 38 | mutable QDBusConnection connection; // mutable because we want to make calls from const functions |
| 39 | QString service; |
| 40 | QString currentOwner; |
| 41 | QString path; |
| 42 | QString interface; |
| 43 | mutable QDBusError lastError; |
| 44 | int timeout; |
| 45 | bool interactiveAuthorizationAllowed; |
| 46 | |
| 47 | // this is set during creation and never changed |
| 48 | // it can't be const because QDBusInterfacePrivate has one more check |
| 49 | bool isValid; |
| 50 | |
| 51 | QDBusAbstractInterfacePrivate(const QString &serv, const QString &p, |
| 52 | const QString &iface, const QDBusConnection& con, bool dynamic); |
| 53 | virtual ~QDBusAbstractInterfacePrivate() { } |
| 54 | void initOwnerTracking(); |
| 55 | bool canMakeCalls() const; |
| 56 | |
| 57 | // these functions do not check if the property is valid |
| 58 | bool property(const QMetaProperty &mp, void *returnValuePtr) const; |
| 59 | bool setProperty(const QMetaProperty &mp, const QVariant &value); |
| 60 | |
| 61 | // return conn's d pointer |
| 62 | inline QDBusConnectionPrivate *connectionPrivate() const |
| 63 | { return QDBusConnectionPrivate::d(q: connection); } |
| 64 | |
| 65 | void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); |
| 66 | |
| 67 | static void finishDisconnectNotify(QDBusAbstractInterface *iface, int signalId); |
| 68 | }; |
| 69 | |
| 70 | QT_END_NAMESPACE |
| 71 | |
| 72 | #endif // QT_NO_DBUS |
| 73 | #endif |
| 74 | |