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 | QT_BEGIN_NAMESPACE |
27 | |
28 | class QDBusServiceWatcher; |
29 | |
30 | class DBusConnection : public QObject |
31 | { |
32 | Q_OBJECT |
33 | |
34 | public: |
35 | DBusConnection(QObject *parent = nullptr); |
36 | QDBusConnection connection() const; |
37 | bool isEnabled() const { return m_enabled; } |
38 | |
39 | Q_SIGNALS: |
40 | // Emitted when the global accessibility status changes to enabled |
41 | void enabledChanged(bool enabled); |
42 | |
43 | private Q_SLOTS: |
44 | QString getAddressFromXCB(); |
45 | void serviceRegistered(); |
46 | void serviceUnregistered(); |
47 | void connectA11yBus(const QString &address); |
48 | |
49 | void dbusError(const QDBusError &error); |
50 | |
51 | private: |
52 | QString getAccessibilityBusAddress() const; |
53 | |
54 | QDBusServiceWatcher *dbusWatcher; |
55 | QDBusConnection m_a11yConnection; |
56 | bool m_enabled; |
57 | }; |
58 | |
59 | QT_END_NAMESPACE |
60 | |
61 | #endif // DBUSCONNECTION_H |
62 | |