Qt Accessibility Client

registry.cpp
1 /*
2  SPDX-FileCopyrightText: 2012 Frederik Gladhorn <[email protected]>
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 
12 using namespace QAccessibleClient;
13 
15  : QObject(parent), d(new RegistryPrivate(this))
16 {
17  registerDBusTypes();
18 }
19 
21 {
22  delete d;
23 }
24 
25 bool Registry::isEnabled() const
26 {
27  return d->isEnabled();
28 }
29 
30 void 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 
65 Registry::CacheType Registry::cacheType() const
66 {
67  if (dynamic_cast<CacheWeakStrategy*>(d->m_cache))
68  return WeakCache;
69  return NoCache;
70 }
71 
72 void 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 
86 AccessibleObject 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 
96 QStringList Registry::clientCacheObjects() const
97 {
98  QStringList result;
99  if (d->m_cache)
100  return d->m_cache->ids();
101  return QStringList();
102 }
103 
104 void Registry::clearClientCache()
105 {
106  if (d->m_cache)
107  d->m_cache->clear();
108 }
109 
110 #include "moc_registry.cpp"
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
void setEnabled(bool enable)
Activates accessibility when enabled and tells toolkits to provide updates such as focus changes.
Definition: registry.cpp:30
~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
QList< AccessibleObject > applications() const
List of all currently running applications that expose an accessibility interface.
Definition: registry.cpp:55
This class represents an accessible object.
void setScreenReaderEnabled(bool enable)
Tells the system that a screen reader is enabled.
Definition: registry.cpp:40
EventListeners subscribedEventListeners() const
Returns the active event listeners.
Definition: registry.cpp:50
bool isEnabled() const
Returns true if the accessibility stack is enabled.
Definition: registry.cpp:25
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
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Nov 29 2023 04:07:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.