Qt Accessibility Client

registry.cpp
1/*
2 SPDX-FileCopyrightText: 2012 Frederik Gladhorn <gladhorn@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "registry.h"
8#include "registry_p.h"
9
10#include <qurl.h>
11
12using namespace QAccessibleClient;
13
15 : QObject(parent), d(new RegistryPrivate(this))
16{
17 registerDBusTypes();
18}
19
21{
22 delete d;
23}
24
26{
27 return d->isEnabled();
28}
29
30void Registry::setEnabled(bool enable)
31{
32 d->setEnabled(enable);
33}
34
36{
37 return d->isScreenReaderEnabled();
38}
39
41{
42 d->setScreenReaderEnabled(enable);
43}
44
46{
47 d->subscribeEventListeners(listeners);
48}
49
51{
52 return d->eventListeners();
53}
54
56{
57 return d->topLevelAccessibles();
58}
59
61{
62 return d->fromUrl(url);
63}
64
65Registry::CacheType Registry::cacheType() const
66{
67 if (dynamic_cast<CacheWeakStrategy*>(d->m_cache))
68 return WeakCache;
69 return NoCache;
70}
71
72void Registry::setCacheType(Registry::CacheType type)
73{
74 //if (cacheType() == type) return;
75 delete d->m_cache;
76 d->m_cache = nullptr;
77 switch (type) {
78 case NoCache:
79 break;
80 case WeakCache:
81 d->m_cache = new CacheWeakStrategy();
82 break;
83 }
84}
85
86AccessibleObject Registry::clientCacheObject(const QString &id) const
87{
88 if (d->m_cache) {
89 QSharedPointer<AccessibleObjectPrivate> p = d->m_cache->get(id);
90 if (p)
91 return AccessibleObject(p);
92 }
93 return AccessibleObject();
94}
95
96QStringList Registry::clientCacheObjects() const
97{
98 QStringList result;
99 if (d->m_cache)
100 return d->m_cache->ids();
101 return QStringList();
102}
103
104void Registry::clearClientCache()
105{
106 if (d->m_cache)
107 d->m_cache->clear();
108}
109
110#include "moc_registry.cpp"
This class represents an accessible object.
void setEnabled(bool enable)
Activates accessibility when enabled and tells toolkits to provide updates such as focus changes.
Definition registry.cpp:30
void subscribeEventListeners(const EventListeners &listeners) const
In order to get notified of changes in accessible applications it is neccessary to subscribe to the l...
Definition registry.cpp:45
~Registry() override
Destroys this Registry.
Definition registry.cpp:20
Registry(QObject *parent=nullptr)
Construct a Registry object with parent as QObject parent.
Definition registry.cpp:14
void setScreenReaderEnabled(bool enable)
Tells the system that a screen reader is enabled.
Definition registry.cpp:40
QList< AccessibleObject > applications() const
List of all currently running applications that expose an accessibility interface.
Definition registry.cpp:55
bool isEnabled() const
Returns true if the accessibility stack is enabled.
Definition registry.cpp:25
EventListeners subscribedEventListeners() const
Returns the active event listeners.
Definition registry.cpp:50
AccessibleObject accessibleFromUrl(const QUrl &url) const
Creates the AccessibleObject for the url.
Definition registry.cpp:60
bool isScreenReaderEnabled() const
Returns true if the screen reader is enabled.
Definition registry.cpp:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:15:32 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.