| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | |
| 5 | #ifndef DBUSCONNECTION_H |
| 6 | #define DBUSCONNECTION_H |
| 7 | |
| 8 | // |
| 9 | // W A R N I N G |
| 10 | // ------------- |
| 11 | // |
| 12 | // This file is not part of the Qt API. It exists purely as an |
| 13 | // implementation detail. This header file may change from version to |
| 14 | // version without notice, or even be removed. |
| 15 | // |
| 16 | // We mean it. |
| 17 | // |
| 18 | |
| 19 | #include <QtCore/QObject> |
| 20 | #include <QtCore/QString> |
| 21 | #include <QtDBus/QDBusConnection> |
| 22 | #include <QtDBus/QDBusVariant> |
| 23 | #include <QtCore/private/qglobal_p.h> |
| 24 | Q_MOC_INCLUDE(<QtDBus/QDBusError>) |
| 25 | |
| 26 | #include "bus_interface.h" |
| 27 | #include "properties_interface.h" |
| 28 | |
| 29 | QT_BEGIN_NAMESPACE |
| 30 | |
| 31 | class QDBusServiceWatcher; |
| 32 | |
| 33 | class QAtSpiDBusConnection : public QObject |
| 34 | { |
| 35 | Q_OBJECT |
| 36 | |
| 37 | public: |
| 38 | QAtSpiDBusConnection(QObject *parent = nullptr); |
| 39 | QDBusConnection connection() const; |
| 40 | bool isEnabled() const { return m_enabled; } |
| 41 | |
| 42 | Q_SIGNALS: |
| 43 | // Emitted when the global accessibility status changes to enabled |
| 44 | void enabledChanged(bool enabled); |
| 45 | |
| 46 | private Q_SLOTS: |
| 47 | QString getAddressFromXCB(); |
| 48 | void checkEnabledState(); |
| 49 | void serviceUnregistered(); |
| 50 | void connectA11yBus(const QString &address); |
| 51 | |
| 52 | void dbusError(const QDBusError &error); |
| 53 | |
| 54 | private: |
| 55 | QString getAccessibilityBusAddress() const; |
| 56 | |
| 57 | QDBusServiceWatcher *dbusWatcher; |
| 58 | OrgFreedesktopDBusPropertiesInterface *m_dbusProperties; |
| 59 | OrgA11yStatusInterface *m_a11yStatus; |
| 60 | QDBusConnection m_a11yConnection; |
| 61 | bool m_enabled; |
| 62 | }; |
| 63 | |
| 64 | QT_END_NAMESPACE |
| 65 | |
| 66 | #endif // DBUSCONNECTION_H |
| 67 | |