1 | // Copyright (C) 2016 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 | #include "qspidbuscache_p.h" |
6 | #include "qspiaccessiblebridge_p.h" |
7 | |
8 | #if QT_CONFIG(accessibility) |
9 | #include "cache_adaptor.h" |
10 | |
11 | #define QSPI_OBJECT_PATH_CACHE "/org/a11y/atspi/cache" |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | using namespace Qt::StringLiterals; |
16 | |
17 | /*! |
18 | \class QSpiDBusCache |
19 | \internal |
20 | \brief This class is responsible for the AT-SPI cache interface. |
21 | |
22 | The idea behind the cache is that starting an application would |
23 | result in many dbus calls. The way GTK/Gail/ATK work is that |
24 | they create accessibles for all objects on startup. |
25 | In order to avoid querying all the objects individually via DBus |
26 | they get sent by using the GetItems call of the cache. |
27 | |
28 | Additionally the AddAccessible and RemoveAccessible signals |
29 | are responsible for adding/removing objects from the cache. |
30 | |
31 | Currently the Qt bridge chooses to ignore these. |
32 | */ |
33 | |
34 | QSpiDBusCache::QSpiDBusCache(QDBusConnection c, QObject* parent) |
35 | : QObject(parent) |
36 | { |
37 | new CacheAdaptor(this); |
38 | c.registerObject(QSPI_OBJECT_PATH_CACHE ""_L1, object: this, options: QDBusConnection::ExportAdaptors); |
39 | } |
40 | |
41 | void QSpiDBusCache::emitAddAccessible(const QSpiAccessibleCacheItem& item) |
42 | { |
43 | emit AddAccessible(nodeAdded: item); |
44 | } |
45 | |
46 | void QSpiDBusCache::emitRemoveAccessible(const QSpiObjectReference& item) |
47 | { |
48 | emit RemoveAccessible(nodeRemoved: item); |
49 | } |
50 | |
51 | QSpiAccessibleCacheArray QSpiDBusCache::GetItems() |
52 | { |
53 | return QSpiAccessibleCacheArray(); |
54 | } |
55 | |
56 | QT_END_NAMESPACE |
57 | |
58 | #include "moc_qspidbuscache_p.cpp" |
59 | #endif // QT_CONFIG(accessibility) |
60 |