| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/linuxaccessibility/atspiadaptor.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | #include "atspiadaptor_p.h" | - | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | #include <QtGui/qwindow.h> | - | ||||||||||||||||||||||||
| 37 | #include <QtGui/qguiapplication.h> | - | ||||||||||||||||||||||||
| 38 | #include <qdbusmessage.h> | - | ||||||||||||||||||||||||
| 39 | #include <qdbusreply.h> | - | ||||||||||||||||||||||||
| 40 | #include <qclipboard.h> | - | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | #include <qdebug.h> | - | ||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | #ifndef QT_NO_ACCESSIBILITY | - | ||||||||||||||||||||||||
| 45 | #include "socket_interface.h" | - | ||||||||||||||||||||||||
| 46 | #include "constant_mappings_p.h" | - | ||||||||||||||||||||||||
| 47 | #include "../accessibility/qaccessiblebridgeutils_p.h" | - | ||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | #include "application_p.h" | - | ||||||||||||||||||||||||
| 50 | /*! | - | ||||||||||||||||||||||||
| 51 | \class AtSpiAdaptor | - | ||||||||||||||||||||||||
| 52 | \internal | - | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | \brief AtSpiAdaptor is the main class to forward between QAccessibleInterface and AT-SPI DBus | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | AtSpiAdaptor implements the functions specified in all at-spi interfaces. | - | ||||||||||||||||||||||||
| 57 | It sends notifications coming from Qt via dbus and listens to incoming dbus requests. | - | ||||||||||||||||||||||||
| 58 | */ | - | ||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | static bool isDebugging = false; | - | ||||||||||||||||||||||||
| 63 | #define qAtspiDebug if (!::isDebugging); else qDebug | - | ||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | AtSpiAdaptor::AtSpiAdaptor(DBusConnection *connection, QObject *parent) | - | ||||||||||||||||||||||||
| 66 | : QDBusVirtualObject(parent), m_dbus(connection) | - | ||||||||||||||||||||||||
| 67 | , sendFocus(0) | - | ||||||||||||||||||||||||
| 68 | , sendObject(0) | - | ||||||||||||||||||||||||
| 69 | , sendObject_active_descendant_changed(0) | - | ||||||||||||||||||||||||
| 70 | , sendObject_attributes_changed(0) | - | ||||||||||||||||||||||||
| 71 | , sendObject_bounds_changed(0) | - | ||||||||||||||||||||||||
| 72 | , sendObject_children_changed(0) | - | ||||||||||||||||||||||||
| 73 | // , sendObject_children_changed_add(0) | - | ||||||||||||||||||||||||
| 74 | // , sendObject_children_changed_remove(0) | - | ||||||||||||||||||||||||
| 75 | , sendObject_column_deleted(0) | - | ||||||||||||||||||||||||
| 76 | , sendObject_column_inserted(0) | - | ||||||||||||||||||||||||
| 77 | , sendObject_column_reordered(0) | - | ||||||||||||||||||||||||
| 78 | , sendObject_link_selected(0) | - | ||||||||||||||||||||||||
| 79 | , sendObject_model_changed(0) | - | ||||||||||||||||||||||||
| 80 | , sendObject_property_change(0) | - | ||||||||||||||||||||||||
| 81 | , sendObject_property_change_accessible_description(0) | - | ||||||||||||||||||||||||
| 82 | , sendObject_property_change_accessible_name(0) | - | ||||||||||||||||||||||||
| 83 | , sendObject_property_change_accessible_parent(0) | - | ||||||||||||||||||||||||
| 84 | , sendObject_property_change_accessible_role(0) | - | ||||||||||||||||||||||||
| 85 | , sendObject_property_change_accessible_table_caption(0) | - | ||||||||||||||||||||||||
| 86 | , sendObject_property_change_accessible_table_column_description(0) | - | ||||||||||||||||||||||||
| 87 | , sendObject_property_change_accessible_table_column_header(0) | - | ||||||||||||||||||||||||
| 88 | , sendObject_property_change_accessible_table_row_description(0) | - | ||||||||||||||||||||||||
| 89 | , sendObject_property_change_accessible_table_row_header(0) | - | ||||||||||||||||||||||||
| 90 | , sendObject_property_change_accessible_table_summary(0) | - | ||||||||||||||||||||||||
| 91 | , sendObject_property_change_accessible_value(0) | - | ||||||||||||||||||||||||
| 92 | , sendObject_row_deleted(0) | - | ||||||||||||||||||||||||
| 93 | , sendObject_row_inserted(0) | - | ||||||||||||||||||||||||
| 94 | , sendObject_row_reordered(0) | - | ||||||||||||||||||||||||
| 95 | , sendObject_selection_changed(0) | - | ||||||||||||||||||||||||
| 96 | , sendObject_state_changed(0) | - | ||||||||||||||||||||||||
| 97 | , sendObject_text_attributes_changed(0) | - | ||||||||||||||||||||||||
| 98 | , sendObject_text_bounds_changed(0) | - | ||||||||||||||||||||||||
| 99 | , sendObject_text_caret_moved(0) | - | ||||||||||||||||||||||||
| 100 | , sendObject_text_changed(0) | - | ||||||||||||||||||||||||
| 101 | // , sendObject_text_changed_delete(0) | - | ||||||||||||||||||||||||
| 102 | // , sendObject_text_changed_insert(0) | - | ||||||||||||||||||||||||
| 103 | , sendObject_text_selection_changed(0) | - | ||||||||||||||||||||||||
| 104 | , sendObject_value_changed(0) | - | ||||||||||||||||||||||||
| 105 | , sendObject_visible_data_changed(0) | - | ||||||||||||||||||||||||
| 106 | , sendWindow(0) | - | ||||||||||||||||||||||||
| 107 | , sendWindow_activate(0) | - | ||||||||||||||||||||||||
| 108 | , sendWindow_close(0) | - | ||||||||||||||||||||||||
| 109 | , sendWindow_create(0) | - | ||||||||||||||||||||||||
| 110 | , sendWindow_deactivate(0) | - | ||||||||||||||||||||||||
| 111 | // , sendWindow_desktop_create(0) | - | ||||||||||||||||||||||||
| 112 | // , sendWindow_desktop_destroy(0) | - | ||||||||||||||||||||||||
| 113 | , sendWindow_lower(0) | - | ||||||||||||||||||||||||
| 114 | , sendWindow_maximize(0) | - | ||||||||||||||||||||||||
| 115 | , sendWindow_minimize(0) | - | ||||||||||||||||||||||||
| 116 | , sendWindow_move(0) | - | ||||||||||||||||||||||||
| 117 | , sendWindow_raise(0) | - | ||||||||||||||||||||||||
| 118 | , sendWindow_reparent(0) | - | ||||||||||||||||||||||||
| 119 | , sendWindow_resize(0) | - | ||||||||||||||||||||||||
| 120 | , sendWindow_restore(0) | - | ||||||||||||||||||||||||
| 121 | , sendWindow_restyle(0) | - | ||||||||||||||||||||||||
| 122 | , sendWindow_shade(0) | - | ||||||||||||||||||||||||
| 123 | , sendWindow_unshade(0) | - | ||||||||||||||||||||||||
| 124 | { | - | ||||||||||||||||||||||||
| 125 | ::isDebugging = qEnvironmentVariableIsSet("QT_DEBUG_ACCESSIBILITY"); | - | ||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | m_applicationAdaptor = new QSpiApplicationAdaptor(m_dbus->connection(), this); | - | ||||||||||||||||||||||||
| 128 | connect(m_applicationAdaptor, SIGNAL(windowActivated(QObject*,bool)), this, SLOT(windowActivated(QObject*,bool))); | - | ||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||
| 130 | updateEventListeners(); | - | ||||||||||||||||||||||||
| 131 | bool success = m_dbus->connection().connect(QLatin1String("org.a11y.atspi.Registry"), QLatin1String("/org/a11y/atspi/registry"), | - | ||||||||||||||||||||||||
| 132 | QLatin1String("org.a11y.atspi.Registry"), QLatin1String("EventListenerRegistered"), this, | - | ||||||||||||||||||||||||
| 133 | SLOT(eventListenerRegistered(QString,QString))); | - | ||||||||||||||||||||||||
| 134 | success = success && m_dbus->connection().connect(QLatin1String("org.a11y.atspi.Registry"), QLatin1String("/org/a11y/atspi/registry"),
| 0 | ||||||||||||||||||||||||
| 135 | QLatin1String("org.a11y.atspi.Registry"), QLatin1String("EventListenerDeregistered"), this,
| 0 | ||||||||||||||||||||||||
| 136 | SLOT(eventListenerDeregistered(QString,QString)));
| 0 | ||||||||||||||||||||||||
| 137 | #ifdef QT_ATSPI_DEBUG | - | ||||||||||||||||||||||||
| 138 | qAtspiDebug() << "Registered event listener change listener: " << success; | - | ||||||||||||||||||||||||
| 139 | #endif | - | ||||||||||||||||||||||||
| 140 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | AtSpiAdaptor::~AtSpiAdaptor() | - | ||||||||||||||||||||||||
| 143 | { | - | ||||||||||||||||||||||||
| 144 | } | - | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | /*! | - | ||||||||||||||||||||||||
| 147 | Provide DBus introspection. | - | ||||||||||||||||||||||||
| 148 | */ | - | ||||||||||||||||||||||||
| 149 | QString AtSpiAdaptor::introspect(const QString &path) const | - | ||||||||||||||||||||||||
| 150 | { | - | ||||||||||||||||||||||||
| 151 | static const QLatin1String accessibleIntrospection( | - | ||||||||||||||||||||||||
| 152 | " <interface name=\"org.a11y.atspi.Accessible\">\n" | - | ||||||||||||||||||||||||
| 153 | " <property access=\"read\" type=\"s\" name=\"Name\"/>\n" | - | ||||||||||||||||||||||||
| 154 | " <property access=\"read\" type=\"s\" name=\"Description\"/>\n" | - | ||||||||||||||||||||||||
| 155 | " <property access=\"read\" type=\"(so)\" name=\"Parent\">\n" | - | ||||||||||||||||||||||||
| 156 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n" | - | ||||||||||||||||||||||||
| 157 | " </property>\n" | - | ||||||||||||||||||||||||
| 158 | " <property access=\"read\" type=\"i\" name=\"ChildCount\"/>\n" | - | ||||||||||||||||||||||||
| 159 | " <method name=\"GetChildAtIndex\">\n" | - | ||||||||||||||||||||||||
| 160 | " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 161 | " <arg direction=\"out\" type=\"(so)\"/>\n" | - | ||||||||||||||||||||||||
| 162 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 163 | " </method>\n" | - | ||||||||||||||||||||||||
| 164 | " <method name=\"GetChildren\">\n" | - | ||||||||||||||||||||||||
| 165 | " <arg direction=\"out\" type=\"a(so)\"/>\n" | - | ||||||||||||||||||||||||
| 166 | " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 167 | " </method>\n" | - | ||||||||||||||||||||||||
| 168 | " <method name=\"GetIndexInParent\">\n" | - | ||||||||||||||||||||||||
| 169 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 170 | " </method>\n" | - | ||||||||||||||||||||||||
| 171 | " <method name=\"GetRelationSet\">\n" | - | ||||||||||||||||||||||||
| 172 | " <arg direction=\"out\" type=\"a(ua(so))\"/>\n" | - | ||||||||||||||||||||||||
| 173 | " <annotation value=\"QSpiRelationArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 174 | " </method>\n" | - | ||||||||||||||||||||||||
| 175 | " <method name=\"GetRole\">\n" | - | ||||||||||||||||||||||||
| 176 | " <arg direction=\"out\" type=\"u\"/>\n" | - | ||||||||||||||||||||||||
| 177 | " </method>\n" | - | ||||||||||||||||||||||||
| 178 | " <method name=\"GetRoleName\">\n" | - | ||||||||||||||||||||||||
| 179 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 180 | " </method>\n" | - | ||||||||||||||||||||||||
| 181 | " <method name=\"GetLocalizedRoleName\">\n" | - | ||||||||||||||||||||||||
| 182 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 183 | " </method>\n" | - | ||||||||||||||||||||||||
| 184 | " <method name=\"GetState\">\n" | - | ||||||||||||||||||||||||
| 185 | " <arg direction=\"out\" type=\"au\"/>\n" | - | ||||||||||||||||||||||||
| 186 | " <annotation value=\"QSpiUIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 187 | " </method>\n" | - | ||||||||||||||||||||||||
| 188 | " <method name=\"GetAttributes\">\n" | - | ||||||||||||||||||||||||
| 189 | " <arg direction=\"out\" type=\"a{ss}\"/>\n" | - | ||||||||||||||||||||||||
| 190 | " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 191 | " </method>\n" | - | ||||||||||||||||||||||||
| 192 | " <method name=\"GetApplication\">\n" | - | ||||||||||||||||||||||||
| 193 | " <arg direction=\"out\" type=\"(so)\"/>\n" | - | ||||||||||||||||||||||||
| 194 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 195 | " </method>\n" | - | ||||||||||||||||||||||||
| 196 | " </interface>\n" | - | ||||||||||||||||||||||||
| 197 | ); | - | ||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | static const QLatin1String actionIntrospection( | - | ||||||||||||||||||||||||
| 200 | " <interface name=\"org.a11y.atspi.Action\">\n" | - | ||||||||||||||||||||||||
| 201 | " <property access=\"read\" type=\"i\" name=\"NActions\"/>\n" | - | ||||||||||||||||||||||||
| 202 | " <method name=\"GetDescription\">\n" | - | ||||||||||||||||||||||||
| 203 | " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 204 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 205 | " </method>\n" | - | ||||||||||||||||||||||||
| 206 | " <method name=\"GetName\">\n" | - | ||||||||||||||||||||||||
| 207 | " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 208 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 209 | " </method>\n" | - | ||||||||||||||||||||||||
| 210 | " <method name=\"GetKeyBinding\">\n" | - | ||||||||||||||||||||||||
| 211 | " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 212 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 213 | " </method>\n" | - | ||||||||||||||||||||||||
| 214 | " <method name=\"GetActions\">\n" | - | ||||||||||||||||||||||||
| 215 | " <arg direction=\"out\" type=\"a(sss)\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 216 | " <annotation value=\"QSpiActionArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 217 | " </method>\n" | - | ||||||||||||||||||||||||
| 218 | " <method name=\"DoAction\">\n" | - | ||||||||||||||||||||||||
| 219 | " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 220 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 221 | " </method>\n" | - | ||||||||||||||||||||||||
| 222 | " </interface>\n" | - | ||||||||||||||||||||||||
| 223 | ); | - | ||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | static const QLatin1String applicationIntrospection( | - | ||||||||||||||||||||||||
| 226 | " <interface name=\"org.a11y.atspi.Application\">\n" | - | ||||||||||||||||||||||||
| 227 | " <property access=\"read\" type=\"s\" name=\"ToolkitName\"/>\n" | - | ||||||||||||||||||||||||
| 228 | " <property access=\"read\" type=\"s\" name=\"Version\"/>\n" | - | ||||||||||||||||||||||||
| 229 | " <property access=\"readwrite\" type=\"i\" name=\"Id\"/>\n" | - | ||||||||||||||||||||||||
| 230 | " <method name=\"GetLocale\">\n" | - | ||||||||||||||||||||||||
| 231 | " <arg direction=\"in\" type=\"u\" name=\"lctype\"/>\n" | - | ||||||||||||||||||||||||
| 232 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 233 | " </method>\n" | - | ||||||||||||||||||||||||
| 234 | " <method name=\"GetApplicationBusAddress\">\n" | - | ||||||||||||||||||||||||
| 235 | " <arg direction=\"out\" type=\"s\" name=\"address\"/>\n" | - | ||||||||||||||||||||||||
| 236 | " </method>\n" | - | ||||||||||||||||||||||||
| 237 | " </interface>\n" | - | ||||||||||||||||||||||||
| 238 | ); | - | ||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | static const QLatin1String componentIntrospection( | - | ||||||||||||||||||||||||
| 241 | " <interface name=\"org.a11y.atspi.Component\">\n" | - | ||||||||||||||||||||||||
| 242 | " <method name=\"Contains\">\n" | - | ||||||||||||||||||||||||
| 243 | " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 244 | " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 245 | " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n" | - | ||||||||||||||||||||||||
| 246 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 247 | " </method>\n" | - | ||||||||||||||||||||||||
| 248 | " <method name=\"GetAccessibleAtPoint\">\n" | - | ||||||||||||||||||||||||
| 249 | " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 250 | " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 251 | " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n" | - | ||||||||||||||||||||||||
| 252 | " <arg direction=\"out\" type=\"(so)\"/>\n" | - | ||||||||||||||||||||||||
| 253 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 254 | " </method>\n" | - | ||||||||||||||||||||||||
| 255 | " <method name=\"GetExtents\">\n" | - | ||||||||||||||||||||||||
| 256 | " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n" | - | ||||||||||||||||||||||||
| 257 | " <arg direction=\"out\" type=\"(iiii)\"/>\n" | - | ||||||||||||||||||||||||
| 258 | " <annotation value=\"QSpiRect\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 259 | " </method>\n" | - | ||||||||||||||||||||||||
| 260 | " <method name=\"GetPosition\">\n" | - | ||||||||||||||||||||||||
| 261 | " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n" | - | ||||||||||||||||||||||||
| 262 | " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 263 | " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 264 | " </method>\n" | - | ||||||||||||||||||||||||
| 265 | " <method name=\"GetSize\">\n" | - | ||||||||||||||||||||||||
| 266 | " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n" | - | ||||||||||||||||||||||||
| 267 | " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n" | - | ||||||||||||||||||||||||
| 268 | " </method>\n" | - | ||||||||||||||||||||||||
| 269 | " <method name=\"GetLayer\">\n" | - | ||||||||||||||||||||||||
| 270 | " <arg direction=\"out\" type=\"u\"/>\n" | - | ||||||||||||||||||||||||
| 271 | " </method>\n" | - | ||||||||||||||||||||||||
| 272 | " <method name=\"GetMDIZOrder\">\n" | - | ||||||||||||||||||||||||
| 273 | " <arg direction=\"out\" type=\"n\"/>\n" | - | ||||||||||||||||||||||||
| 274 | " </method>\n" | - | ||||||||||||||||||||||||
| 275 | " <method name=\"GrabFocus\">\n" | - | ||||||||||||||||||||||||
| 276 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 277 | " </method>\n" | - | ||||||||||||||||||||||||
| 278 | " <method name=\"GetAlpha\">\n" | - | ||||||||||||||||||||||||
| 279 | " <arg direction=\"out\" type=\"d\"/>\n" | - | ||||||||||||||||||||||||
| 280 | " </method>\n" | - | ||||||||||||||||||||||||
| 281 | " <method name=\"SetExtents\">\n" | - | ||||||||||||||||||||||||
| 282 | " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 283 | " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 284 | " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n" | - | ||||||||||||||||||||||||
| 285 | " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n" | - | ||||||||||||||||||||||||
| 286 | " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n" | - | ||||||||||||||||||||||||
| 287 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 288 | " </method>\n" | - | ||||||||||||||||||||||||
| 289 | " <method name=\"SetPosition\">\n" | - | ||||||||||||||||||||||||
| 290 | " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 291 | " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 292 | " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n" | - | ||||||||||||||||||||||||
| 293 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 294 | " </method>\n" | - | ||||||||||||||||||||||||
| 295 | " <method name=\"SetSize\">\n" | - | ||||||||||||||||||||||||
| 296 | " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n" | - | ||||||||||||||||||||||||
| 297 | " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n" | - | ||||||||||||||||||||||||
| 298 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 299 | " </method>\n" | - | ||||||||||||||||||||||||
| 300 | " </interface>\n" | - | ||||||||||||||||||||||||
| 301 | ); | - | ||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||
| 303 | static const QLatin1String editableTextIntrospection( | - | ||||||||||||||||||||||||
| 304 | " <interface name=\"org.a11y.atspi.EditableText\">\n" | - | ||||||||||||||||||||||||
| 305 | " <method name=\"SetTextContents\">\n" | - | ||||||||||||||||||||||||
| 306 | " <arg direction=\"in\" type=\"s\" name=\"newContents\"/>\n" | - | ||||||||||||||||||||||||
| 307 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 308 | " </method>\n" | - | ||||||||||||||||||||||||
| 309 | " <method name=\"InsertText\">\n" | - | ||||||||||||||||||||||||
| 310 | " <arg direction=\"in\" type=\"i\" name=\"position\"/>\n" | - | ||||||||||||||||||||||||
| 311 | " <arg direction=\"in\" type=\"s\" name=\"text\"/>\n" | - | ||||||||||||||||||||||||
| 312 | " <arg direction=\"in\" type=\"i\" name=\"length\"/>\n" | - | ||||||||||||||||||||||||
| 313 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 314 | " </method>\n" | - | ||||||||||||||||||||||||
| 315 | " <method name=\"CopyText\">\n" | - | ||||||||||||||||||||||||
| 316 | " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n" | - | ||||||||||||||||||||||||
| 317 | " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n" | - | ||||||||||||||||||||||||
| 318 | " </method>\n" | - | ||||||||||||||||||||||||
| 319 | " <method name=\"CutText\">\n" | - | ||||||||||||||||||||||||
| 320 | " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n" | - | ||||||||||||||||||||||||
| 321 | " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n" | - | ||||||||||||||||||||||||
| 322 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 323 | " </method>\n" | - | ||||||||||||||||||||||||
| 324 | " <method name=\"DeleteText\">\n" | - | ||||||||||||||||||||||||
| 325 | " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n" | - | ||||||||||||||||||||||||
| 326 | " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n" | - | ||||||||||||||||||||||||
| 327 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 328 | " </method>\n" | - | ||||||||||||||||||||||||
| 329 | " <method name=\"PasteText\">\n" | - | ||||||||||||||||||||||||
| 330 | " <arg direction=\"in\" type=\"i\" name=\"position\"/>\n" | - | ||||||||||||||||||||||||
| 331 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 332 | " </method>\n" | - | ||||||||||||||||||||||||
| 333 | " </interface>\n" | - | ||||||||||||||||||||||||
| 334 | ); | - | ||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | static const QLatin1String tableIntrospection( | - | ||||||||||||||||||||||||
| 337 | " <interface name=\"org.a11y.atspi.Table\">\n" | - | ||||||||||||||||||||||||
| 338 | " <property access=\"read\" type=\"i\" name=\"NRows\"/>\n" | - | ||||||||||||||||||||||||
| 339 | " <property access=\"read\" type=\"i\" name=\"NColumns\"/>\n" | - | ||||||||||||||||||||||||
| 340 | " <property access=\"read\" type=\"(so)\" name=\"Caption\">\n" | - | ||||||||||||||||||||||||
| 341 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n" | - | ||||||||||||||||||||||||
| 342 | " </property>\n" | - | ||||||||||||||||||||||||
| 343 | " <property access=\"read\" type=\"(so)\" name=\"Summary\">\n" | - | ||||||||||||||||||||||||
| 344 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n" | - | ||||||||||||||||||||||||
| 345 | " </property>\n" | - | ||||||||||||||||||||||||
| 346 | " <property access=\"read\" type=\"i\" name=\"NSelectedRows\"/>\n" | - | ||||||||||||||||||||||||
| 347 | " <property access=\"read\" type=\"i\" name=\"NSelectedColumns\"/>\n" | - | ||||||||||||||||||||||||
| 348 | " <method name=\"GetAccessibleAt\">\n" | - | ||||||||||||||||||||||||
| 349 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 350 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 351 | " <arg direction=\"out\" type=\"(so)\"/>\n" | - | ||||||||||||||||||||||||
| 352 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 353 | " </method>\n" | - | ||||||||||||||||||||||||
| 354 | " <method name=\"GetIndexAt\">\n" | - | ||||||||||||||||||||||||
| 355 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 356 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 357 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 358 | " </method>\n" | - | ||||||||||||||||||||||||
| 359 | " <method name=\"GetRowAtIndex\">\n" | - | ||||||||||||||||||||||||
| 360 | " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 361 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 362 | " </method>\n" | - | ||||||||||||||||||||||||
| 363 | " <method name=\"GetColumnAtIndex\">\n" | - | ||||||||||||||||||||||||
| 364 | " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 365 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 366 | " </method>\n" | - | ||||||||||||||||||||||||
| 367 | " <method name=\"GetRowDescription\">\n" | - | ||||||||||||||||||||||||
| 368 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 369 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 370 | " </method>\n" | - | ||||||||||||||||||||||||
| 371 | " <method name=\"GetColumnDescription\">\n" | - | ||||||||||||||||||||||||
| 372 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 373 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 374 | " </method>\n" | - | ||||||||||||||||||||||||
| 375 | " <method name=\"GetRowExtentAt\">\n" | - | ||||||||||||||||||||||||
| 376 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 377 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 378 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 379 | " </method>\n" | - | ||||||||||||||||||||||||
| 380 | " <method name=\"GetColumnExtentAt\">\n" | - | ||||||||||||||||||||||||
| 381 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 382 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 383 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 384 | " </method>\n" | - | ||||||||||||||||||||||||
| 385 | " <method name=\"GetRowHeader\">\n" | - | ||||||||||||||||||||||||
| 386 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 387 | " <arg direction=\"out\" type=\"(so)\"/>\n" | - | ||||||||||||||||||||||||
| 388 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 389 | " </method>\n" | - | ||||||||||||||||||||||||
| 390 | " <method name=\"GetColumnHeader\">\n" | - | ||||||||||||||||||||||||
| 391 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 392 | " <arg direction=\"out\" type=\"(so)\"/>\n" | - | ||||||||||||||||||||||||
| 393 | " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 394 | " </method>\n" | - | ||||||||||||||||||||||||
| 395 | " <method name=\"GetSelectedRows\">\n" | - | ||||||||||||||||||||||||
| 396 | " <arg direction=\"out\" type=\"ai\"/>\n" | - | ||||||||||||||||||||||||
| 397 | " <annotation value=\"QSpiIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 398 | " </method>\n" | - | ||||||||||||||||||||||||
| 399 | " <method name=\"GetSelectedColumns\">\n" | - | ||||||||||||||||||||||||
| 400 | " <arg direction=\"out\" type=\"ai\"/>\n" | - | ||||||||||||||||||||||||
| 401 | " <annotation value=\"QSpiIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 402 | " </method>\n" | - | ||||||||||||||||||||||||
| 403 | " <method name=\"IsRowSelected\">\n" | - | ||||||||||||||||||||||||
| 404 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 405 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 406 | " </method>\n" | - | ||||||||||||||||||||||||
| 407 | " <method name=\"IsColumnSelected\">\n" | - | ||||||||||||||||||||||||
| 408 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 409 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 410 | " </method>\n" | - | ||||||||||||||||||||||||
| 411 | " <method name=\"IsSelected\">\n" | - | ||||||||||||||||||||||||
| 412 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 413 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 414 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 415 | " </method>\n" | - | ||||||||||||||||||||||||
| 416 | " <method name=\"AddRowSelection\">\n" | - | ||||||||||||||||||||||||
| 417 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 418 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 419 | " </method>\n" | - | ||||||||||||||||||||||||
| 420 | " <method name=\"AddColumnSelection\">\n" | - | ||||||||||||||||||||||||
| 421 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 422 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 423 | " </method>\n" | - | ||||||||||||||||||||||||
| 424 | " <method name=\"RemoveRowSelection\">\n" | - | ||||||||||||||||||||||||
| 425 | " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 426 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 427 | " </method>\n" | - | ||||||||||||||||||||||||
| 428 | " <method name=\"RemoveColumnSelection\">\n" | - | ||||||||||||||||||||||||
| 429 | " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n" | - | ||||||||||||||||||||||||
| 430 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 431 | " </method>\n" | - | ||||||||||||||||||||||||
| 432 | " <method name=\"GetRowColumnExtentsAtIndex\">\n" | - | ||||||||||||||||||||||||
| 433 | " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n" | - | ||||||||||||||||||||||||
| 434 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 435 | " <arg direction=\"out\" type=\"i\" name=\"row\"/>\n" | - | ||||||||||||||||||||||||
| 436 | " <arg direction=\"out\" type=\"i\" name=\"col\"/>\n" | - | ||||||||||||||||||||||||
| 437 | " <arg direction=\"out\" type=\"i\" name=\"row_extents\"/>\n" | - | ||||||||||||||||||||||||
| 438 | " <arg direction=\"out\" type=\"i\" name=\"col_extents\"/>\n" | - | ||||||||||||||||||||||||
| 439 | " <arg direction=\"out\" type=\"b\" name=\"is_selected\"/>\n" | - | ||||||||||||||||||||||||
| 440 | " </method>\n" | - | ||||||||||||||||||||||||
| 441 | " </interface>\n" | - | ||||||||||||||||||||||||
| 442 | ); | - | ||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | static const QLatin1String textIntrospection( | - | ||||||||||||||||||||||||
| 445 | " <interface name=\"org.a11y.atspi.Text\">\n" | - | ||||||||||||||||||||||||
| 446 | " <property access=\"read\" type=\"i\" name=\"CharacterCount\"/>\n" | - | ||||||||||||||||||||||||
| 447 | " <property access=\"read\" type=\"i\" name=\"CaretOffset\"/>\n" | - | ||||||||||||||||||||||||
| 448 | " <method name=\"GetText\">\n" | - | ||||||||||||||||||||||||
| 449 | " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 450 | " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 451 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 452 | " </method>\n" | - | ||||||||||||||||||||||||
| 453 | " <method name=\"SetCaretOffset\">\n" | - | ||||||||||||||||||||||||
| 454 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 455 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 456 | " </method>\n" | - | ||||||||||||||||||||||||
| 457 | " <method name=\"GetTextBeforeOffset\">\n" | - | ||||||||||||||||||||||||
| 458 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 459 | " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n" | - | ||||||||||||||||||||||||
| 460 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 461 | " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 462 | " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 463 | " </method>\n" | - | ||||||||||||||||||||||||
| 464 | " <method name=\"GetTextAtOffset\">\n" | - | ||||||||||||||||||||||||
| 465 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 466 | " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n" | - | ||||||||||||||||||||||||
| 467 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 468 | " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 469 | " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 470 | " </method>\n" | - | ||||||||||||||||||||||||
| 471 | " <method name=\"GetTextAfterOffset\">\n" | - | ||||||||||||||||||||||||
| 472 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 473 | " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n" | - | ||||||||||||||||||||||||
| 474 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 475 | " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 476 | " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 477 | " </method>\n" | - | ||||||||||||||||||||||||
| 478 | " <method name=\"GetCharacterAtOffset\">\n" | - | ||||||||||||||||||||||||
| 479 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 480 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 481 | " </method>\n" | - | ||||||||||||||||||||||||
| 482 | " <method name=\"GetAttributeValue\">\n" | - | ||||||||||||||||||||||||
| 483 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 484 | " <arg direction=\"in\" type=\"s\" name=\"attributeName\"/>\n" | - | ||||||||||||||||||||||||
| 485 | " <arg direction=\"out\" type=\"s\"/>\n" | - | ||||||||||||||||||||||||
| 486 | " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 487 | " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 488 | " <arg direction=\"out\" type=\"b\" name=\"defined\"/>\n" | - | ||||||||||||||||||||||||
| 489 | " </method>\n" | - | ||||||||||||||||||||||||
| 490 | " <method name=\"GetAttributes\">\n" | - | ||||||||||||||||||||||||
| 491 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 492 | " <arg direction=\"out\" type=\"a{ss}\"/>\n" | - | ||||||||||||||||||||||||
| 493 | " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 494 | " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 495 | " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 496 | " </method>\n" | - | ||||||||||||||||||||||||
| 497 | " <method name=\"GetDefaultAttributes\">\n" | - | ||||||||||||||||||||||||
| 498 | " <arg direction=\"out\" type=\"a{ss}\"/>\n" | - | ||||||||||||||||||||||||
| 499 | " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 500 | " </method>\n" | - | ||||||||||||||||||||||||
| 501 | " <method name=\"GetCharacterExtents\">\n" | - | ||||||||||||||||||||||||
| 502 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 503 | " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 504 | " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 505 | " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n" | - | ||||||||||||||||||||||||
| 506 | " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n" | - | ||||||||||||||||||||||||
| 507 | " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n" | - | ||||||||||||||||||||||||
| 508 | " </method>\n" | - | ||||||||||||||||||||||||
| 509 | " <method name=\"GetOffsetAtPoint\">\n" | - | ||||||||||||||||||||||||
| 510 | " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 511 | " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 512 | " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n" | - | ||||||||||||||||||||||||
| 513 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 514 | " </method>\n" | - | ||||||||||||||||||||||||
| 515 | " <method name=\"GetNSelections\">\n" | - | ||||||||||||||||||||||||
| 516 | " <arg direction=\"out\" type=\"i\"/>\n" | - | ||||||||||||||||||||||||
| 517 | " <method name=\"GetSelection\">\n" | - | ||||||||||||||||||||||||
| 518 | " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n" | - | ||||||||||||||||||||||||
| 519 | " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 520 | " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 521 | " </method>\n" | - | ||||||||||||||||||||||||
| 522 | " <method name=\"AddSelection\">\n" | - | ||||||||||||||||||||||||
| 523 | " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 524 | " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 525 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 526 | " </method>\n" | - | ||||||||||||||||||||||||
| 527 | " <method name=\"RemoveSelection\">\n" | - | ||||||||||||||||||||||||
| 528 | " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n" | - | ||||||||||||||||||||||||
| 529 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 530 | " </method>\n" | - | ||||||||||||||||||||||||
| 531 | " <method name=\"SetSelection\">\n" | - | ||||||||||||||||||||||||
| 532 | " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n" | - | ||||||||||||||||||||||||
| 533 | " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 534 | " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 535 | " <arg direction=\"out\" type=\"b\"/>\n" | - | ||||||||||||||||||||||||
| 536 | " </method>\n" | - | ||||||||||||||||||||||||
| 537 | " <method name=\"GetRangeExtents\">\n" | - | ||||||||||||||||||||||||
| 538 | " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 539 | " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 540 | " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 541 | " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 542 | " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n" | - | ||||||||||||||||||||||||
| 543 | " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n" | - | ||||||||||||||||||||||||
| 544 | " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n" | - | ||||||||||||||||||||||||
| 545 | " </method>\n" | - | ||||||||||||||||||||||||
| 546 | " <method name=\"GetBoundedRanges\">\n" | - | ||||||||||||||||||||||||
| 547 | " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" | - | ||||||||||||||||||||||||
| 548 | " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" | - | ||||||||||||||||||||||||
| 549 | " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n" | - | ||||||||||||||||||||||||
| 550 | " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n" | - | ||||||||||||||||||||||||
| 551 | " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n" | - | ||||||||||||||||||||||||
| 552 | " <arg direction=\"in\" type=\"u\" name=\"xClipType\"/>\n" | - | ||||||||||||||||||||||||
| 553 | " <arg direction=\"in\" type=\"u\" name=\"yClipType\"/>\n" | - | ||||||||||||||||||||||||
| 554 | " <arg direction=\"out\" type=\"a(iisv)\"/>\n" | - | ||||||||||||||||||||||||
| 555 | " <annotation value=\"QSpiRangeList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 556 | " </method>\n" | - | ||||||||||||||||||||||||
| 557 | " <method name=\"GetAttributeRun\">\n" | - | ||||||||||||||||||||||||
| 558 | " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n" | - | ||||||||||||||||||||||||
| 559 | " <arg direction=\"in\" type=\"b\" name=\"includeDefaults\"/>\n" | - | ||||||||||||||||||||||||
| 560 | " <arg direction=\"out\" type=\"a{ss}\"/>\n" | - | ||||||||||||||||||||||||
| 561 | " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n" | - | ||||||||||||||||||||||||
| 562 | " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n" | - | ||||||||||||||||||||||||
| 563 | " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 564 | " </method>\n" | - | ||||||||||||||||||||||||
| 565 | " <method name=\"GetDefaultAttributeSet\">\n" | - | ||||||||||||||||||||||||
| 566 | " <arg direction=\"out\" type=\"a{ss}\"/>\n" | - | ||||||||||||||||||||||||
| 567 | " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n" | - | ||||||||||||||||||||||||
| 568 | " </method>\n" | - | ||||||||||||||||||||||||
| 569 | " </interface>\n" | - | ||||||||||||||||||||||||
| 570 | ); | - | ||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||
| 572 | static const QLatin1String valueIntrospection( | - | ||||||||||||||||||||||||
| 573 | " <interface name=\"org.a11y.atspi.Value\">\n" | - | ||||||||||||||||||||||||
| 574 | " <property access=\"read\" type=\"d\" name=\"MinimumValue\"/>\n" | - | ||||||||||||||||||||||||
| 575 | " <property access=\"read\" type=\"d\" name=\"MaximumValue\"/>\n" | - | ||||||||||||||||||||||||
| 576 | " <property access=\"read\" type=\"d\" name=\"MinimumIncrement\"/>\n" | - | ||||||||||||||||||||||||
| 577 | " <property access=\"readwrite\" type=\"d\" name=\"CurrentValue\"/>\n" | - | ||||||||||||||||||||||||
| 578 | " <method name=\"SetCurrentValue\">\n" | - | ||||||||||||||||||||||||
| 579 | " <arg direction=\"in\" type=\"d\" name=\"value\"/>\n" | - | ||||||||||||||||||||||||
| 580 | " </method>\n" | - | ||||||||||||||||||||||||
| 581 | " </interface>\n" | - | ||||||||||||||||||||||||
| 582 | ); | - | ||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||
| 584 | QAccessibleInterface * interface = interfaceFromPath(path); | - | ||||||||||||||||||||||||
| 585 | if (!interface) {
| 0 | ||||||||||||||||||||||||
| 586 | qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find accessible on path: " << path; never executed: ;never executed: QMessageLogger(__FILE__, 586, __PRETTY_FUNCTION__).debug() << "WARNING Qt AtSpiAdaptor: Could not find accessible on path: " << path;
| 0 | ||||||||||||||||||||||||
| 587 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 588 | } | - | ||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | QStringList interfaces = accessibleInterfaces(interface); | - | ||||||||||||||||||||||||
| 591 | - | |||||||||||||||||||||||||
| 592 | QString xml; | - | ||||||||||||||||||||||||
| 593 | xml.append(accessibleIntrospection); | - | ||||||||||||||||||||||||
| 594 | - | |||||||||||||||||||||||||
| 595 | if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_COMPONENT)))
| 0 | ||||||||||||||||||||||||
| 596 | xml.append(componentIntrospection); never executed: xml.append(componentIntrospection); | 0 | ||||||||||||||||||||||||
| 597 | if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_TEXT)))
| 0 | ||||||||||||||||||||||||
| 598 | xml.append(textIntrospection); never executed: xml.append(textIntrospection); | 0 | ||||||||||||||||||||||||
| 599 | if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_EDITABLE_TEXT)))
| 0 | ||||||||||||||||||||||||
| 600 | xml.append(editableTextIntrospection); never executed: xml.append(editableTextIntrospection); | 0 | ||||||||||||||||||||||||
| 601 | if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_ACTION)))
| 0 | ||||||||||||||||||||||||
| 602 | xml.append(actionIntrospection); never executed: xml.append(actionIntrospection); | 0 | ||||||||||||||||||||||||
| 603 | if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_TABLE)))
| 0 | ||||||||||||||||||||||||
| 604 | xml.append(tableIntrospection); never executed: xml.append(tableIntrospection); | 0 | ||||||||||||||||||||||||
| 605 | if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_VALUE)))
| 0 | ||||||||||||||||||||||||
| 606 | xml.append(valueIntrospection); never executed: xml.append(valueIntrospection); | 0 | ||||||||||||||||||||||||
| 607 | if (path == QLatin1String(QSPI_OBJECT_PATH_ROOT))
| 0 | ||||||||||||||||||||||||
| 608 | xml.append(applicationIntrospection); never executed: xml.append(applicationIntrospection); | 0 | ||||||||||||||||||||||||
| 609 | - | |||||||||||||||||||||||||
| 610 | return xml; never executed: return xml; | 0 | ||||||||||||||||||||||||
| 611 | } | - | ||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||
| 613 | void AtSpiAdaptor::setBitFlag(const QString &flag) | - | ||||||||||||||||||||||||
| 614 | { | - | ||||||||||||||||||||||||
| 615 | Q_ASSERT(flag.size()); | - | ||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||
| 617 | // assume we don't get nonsense - look at first letter only | - | ||||||||||||||||||||||||
| 618 | switch (flag.at(0).toLower().toLatin1()) { | - | ||||||||||||||||||||||||
| 619 | case 'o': { never executed: case 'o': | 0 | ||||||||||||||||||||||||
| 620 | if (flag.size() <= 8) { // Object::
| 0 | ||||||||||||||||||||||||
| 621 | sendObject = 1; | - | ||||||||||||||||||||||||
| 622 | } else { // Object:Foo:Bar never executed: end of block | 0 | ||||||||||||||||||||||||
| 623 | QString right = flag.mid(7); | - | ||||||||||||||||||||||||
| 624 | if (false) { dead code: { } | - | ||||||||||||||||||||||||
| 625 | } else if (right.startsWith(QLatin1String("ActiveDescendantChanged"))) {
dead code: { } | - | ||||||||||||||||||||||||
| 626 | sendObject_active_descendant_changed = 1; | - | ||||||||||||||||||||||||
| 627 | } else if (right.startsWith(QLatin1String("AttributesChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 628 | sendObject_attributes_changed = 1; | - | ||||||||||||||||||||||||
| 629 | } else if (right.startsWith(QLatin1String("BoundsChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 630 | sendObject_bounds_changed = 1; | - | ||||||||||||||||||||||||
| 631 | } else if (right.startsWith(QLatin1String("ChildrenChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 632 | sendObject_children_changed = 1; | - | ||||||||||||||||||||||||
| 633 | } else if (right.startsWith(QLatin1String("ColumnDeleted"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 634 | sendObject_column_deleted = 1; | - | ||||||||||||||||||||||||
| 635 | } else if (right.startsWith(QLatin1String("ColumnInserted"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 636 | sendObject_column_inserted = 1; | - | ||||||||||||||||||||||||
| 637 | } else if (right.startsWith(QLatin1String("ColumnReordered"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 638 | sendObject_column_reordered = 1; | - | ||||||||||||||||||||||||
| 639 | } else if (right.startsWith(QLatin1String("LinkSelected"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 640 | sendObject_link_selected = 1; | - | ||||||||||||||||||||||||
| 641 | } else if (right.startsWith(QLatin1String("ModelChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 642 | sendObject_model_changed = 1; | - | ||||||||||||||||||||||||
| 643 | } else if (right.startsWith(QLatin1String("PropertyChange"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 644 | if (right == QLatin1String("PropertyChange:AccessibleDescription")) {
| 0 | ||||||||||||||||||||||||
| 645 | sendObject_property_change_accessible_description = 1; | - | ||||||||||||||||||||||||
| 646 | } else if (right == QLatin1String("PropertyChange:AccessibleName")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 647 | sendObject_property_change_accessible_name = 1; | - | ||||||||||||||||||||||||
| 648 | } else if (right == QLatin1String("PropertyChange:AccessibleParent")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 649 | sendObject_property_change_accessible_parent = 1; | - | ||||||||||||||||||||||||
| 650 | } else if (right == QLatin1String("PropertyChange:AccessibleRole")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 651 | sendObject_property_change_accessible_role = 1; | - | ||||||||||||||||||||||||
| 652 | } else if (right == QLatin1String("PropertyChange:TableCaption")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 653 | sendObject_property_change_accessible_table_caption = 1; | - | ||||||||||||||||||||||||
| 654 | } else if (right == QLatin1String("PropertyChange:TableColumnDescription")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 655 | sendObject_property_change_accessible_table_column_description = 1; | - | ||||||||||||||||||||||||
| 656 | } else if (right == QLatin1String("PropertyChange:TableColumnHeader")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 657 | sendObject_property_change_accessible_table_column_header = 1; | - | ||||||||||||||||||||||||
| 658 | } else if (right == QLatin1String("PropertyChange:TableRowDescription")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 659 | sendObject_property_change_accessible_table_row_description = 1; | - | ||||||||||||||||||||||||
| 660 | } else if (right == QLatin1String("PropertyChange:TableRowHeader")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 661 | sendObject_property_change_accessible_table_row_header = 1; | - | ||||||||||||||||||||||||
| 662 | } else if (right == QLatin1String("PropertyChange:TableSummary")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 663 | sendObject_property_change_accessible_table_summary = 1; | - | ||||||||||||||||||||||||
| 664 | } else if (right == QLatin1String("PropertyChange:AccessibleValue")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 665 | sendObject_property_change_accessible_value = 1; | - | ||||||||||||||||||||||||
| 666 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 667 | sendObject_property_change = 1; | - | ||||||||||||||||||||||||
| 668 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 669 | } else if (right.startsWith(QLatin1String("RowDeleted"))) {
| 0 | ||||||||||||||||||||||||
| 670 | sendObject_row_deleted = 1; | - | ||||||||||||||||||||||||
| 671 | } else if (right.startsWith(QLatin1String("RowInserted"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 672 | sendObject_row_inserted = 1; | - | ||||||||||||||||||||||||
| 673 | } else if (right.startsWith(QLatin1String("RowReordered"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 674 | sendObject_row_reordered = 1; | - | ||||||||||||||||||||||||
| 675 | } else if (right.startsWith(QLatin1String("SelectionChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 676 | sendObject_selection_changed = 1; | - | ||||||||||||||||||||||||
| 677 | } else if (right.startsWith(QLatin1String("StateChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 678 | sendObject_state_changed = 1; | - | ||||||||||||||||||||||||
| 679 | } else if (right.startsWith(QLatin1String("TextAttributesChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 680 | sendObject_text_attributes_changed = 1; | - | ||||||||||||||||||||||||
| 681 | } else if (right.startsWith(QLatin1String("TextBoundsChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 682 | sendObject_text_bounds_changed = 1; | - | ||||||||||||||||||||||||
| 683 | } else if (right.startsWith(QLatin1String("TextCaretMoved"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 684 | sendObject_text_caret_moved = 1; | - | ||||||||||||||||||||||||
| 685 | } else if (right.startsWith(QLatin1String("TextChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 686 | sendObject_text_changed = 1; | - | ||||||||||||||||||||||||
| 687 | } else if (right.startsWith(QLatin1String("TextSelectionChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 688 | sendObject_text_selection_changed = 1; | - | ||||||||||||||||||||||||
| 689 | } else if (right.startsWith(QLatin1String("ValueChanged"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 690 | sendObject_value_changed = 1; | - | ||||||||||||||||||||||||
| 691 | } else if (right.startsWith(QLatin1String("VisibleDataChanged")) never executed: end of block
| 0 | ||||||||||||||||||||||||
| 692 | || right.startsWith(QLatin1String("VisibledataChanged"))) { // typo in libatspi
| 0 | ||||||||||||||||||||||||
| 693 | sendObject_visible_data_changed = 1; | - | ||||||||||||||||||||||||
| 694 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 695 | qAtspiDebug() << "WARNING: subscription string not handled:" << flag; never executed: ;never executed: QMessageLogger(__FILE__, 695, __PRETTY_FUNCTION__).debug() << "WARNING: subscription string not handled:" << flag;
| 0 | ||||||||||||||||||||||||
| 696 | } | - | ||||||||||||||||||||||||
| 697 | } | - | ||||||||||||||||||||||||
| 698 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 699 | } | - | ||||||||||||||||||||||||
| 700 | case 'w': { // window never executed: case 'w': | 0 | ||||||||||||||||||||||||
| 701 | if (flag.size() <= 8) {
| 0 | ||||||||||||||||||||||||
| 702 | sendWindow = 1; | - | ||||||||||||||||||||||||
| 703 | } else { // object:Foo:Bar never executed: end of block | 0 | ||||||||||||||||||||||||
| 704 | QString right = flag.mid(7); | - | ||||||||||||||||||||||||
| 705 | if (false) { dead code: { } | - | ||||||||||||||||||||||||
| 706 | } else if (right.startsWith(QLatin1String("Activate"))) {
dead code: { } | - | ||||||||||||||||||||||||
| 707 | sendWindow_activate = 1; | - | ||||||||||||||||||||||||
| 708 | } else if (right.startsWith(QLatin1String("Close"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 709 | sendWindow_close= 1; | - | ||||||||||||||||||||||||
| 710 | } else if (right.startsWith(QLatin1String("Create"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 711 | sendWindow_create = 1; | - | ||||||||||||||||||||||||
| 712 | } else if (right.startsWith(QLatin1String("Deactivate"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 713 | sendWindow_deactivate = 1; | - | ||||||||||||||||||||||||
| 714 | } else if (right.startsWith(QLatin1String("Lower"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 715 | sendWindow_lower = 1; | - | ||||||||||||||||||||||||
| 716 | } else if (right.startsWith(QLatin1String("Maximize"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 717 | sendWindow_maximize = 1; | - | ||||||||||||||||||||||||
| 718 | } else if (right.startsWith(QLatin1String("Minimize"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 719 | sendWindow_minimize = 1; | - | ||||||||||||||||||||||||
| 720 | } else if (right.startsWith(QLatin1String("Move"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 721 | sendWindow_move = 1; | - | ||||||||||||||||||||||||
| 722 | } else if (right.startsWith(QLatin1String("Raise"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 723 | sendWindow_raise = 1; | - | ||||||||||||||||||||||||
| 724 | } else if (right.startsWith(QLatin1String("Reparent"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 725 | sendWindow_reparent = 1; | - | ||||||||||||||||||||||||
| 726 | } else if (right.startsWith(QLatin1String("Resize"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 727 | sendWindow_resize = 1; | - | ||||||||||||||||||||||||
| 728 | } else if (right.startsWith(QLatin1String("Restore"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 729 | sendWindow_restore = 1; | - | ||||||||||||||||||||||||
| 730 | } else if (right.startsWith(QLatin1String("Restyle"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 731 | sendWindow_restyle = 1; | - | ||||||||||||||||||||||||
| 732 | } else if (right.startsWith(QLatin1String("Shade"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 733 | sendWindow_shade = 1; | - | ||||||||||||||||||||||||
| 734 | } else if (right.startsWith(QLatin1String("Unshade"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 735 | sendWindow_unshade = 1; | - | ||||||||||||||||||||||||
| 736 | } else if (right.startsWith(QLatin1String("DesktopCreate"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 737 | // ignore this one | - | ||||||||||||||||||||||||
| 738 | } else if (right.startsWith(QLatin1String("DesktopDestroy"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 739 | // ignore this one | - | ||||||||||||||||||||||||
| 740 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 741 | qAtspiDebug() << "WARNING: subscription string not handled:" << flag; never executed: ;never executed: QMessageLogger(__FILE__, 741, __PRETTY_FUNCTION__).debug() << "WARNING: subscription string not handled:" << flag;
| 0 | ||||||||||||||||||||||||
| 742 | } | - | ||||||||||||||||||||||||
| 743 | } | - | ||||||||||||||||||||||||
| 744 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 745 | } | - | ||||||||||||||||||||||||
| 746 | case 'f': { never executed: case 'f': | 0 | ||||||||||||||||||||||||
| 747 | sendFocus = 1; | - | ||||||||||||||||||||||||
| 748 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 749 | } | - | ||||||||||||||||||||||||
| 750 | case 'd': { // document is not implemented never executed: case 'd': | 0 | ||||||||||||||||||||||||
| 751 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 752 | } | - | ||||||||||||||||||||||||
| 753 | case 't': { // terminal is not implemented never executed: case 't': | 0 | ||||||||||||||||||||||||
| 754 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 755 | } | - | ||||||||||||||||||||||||
| 756 | case 'm': { // mouse* is handled in a different way by the gnome atspi stack never executed: case 'm': | 0 | ||||||||||||||||||||||||
| 757 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 758 | } | - | ||||||||||||||||||||||||
| 759 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 760 | qAtspiDebug() << "WARNING: subscription string not handled:" << flag; never executed: ;never executed: QMessageLogger(__FILE__, 760, __PRETTY_FUNCTION__).debug() << "WARNING: subscription string not handled:" << flag;
| 0 | ||||||||||||||||||||||||
| 761 | } | - | ||||||||||||||||||||||||
| 762 | } | - | ||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||
| 764 | /*! | - | ||||||||||||||||||||||||
| 765 | Checks via dbus which events should be sent. | - | ||||||||||||||||||||||||
| 766 | */ | - | ||||||||||||||||||||||||
| 767 | void AtSpiAdaptor::updateEventListeners() | - | ||||||||||||||||||||||||
| 768 | { | - | ||||||||||||||||||||||||
| 769 | QDBusMessage m = QDBusMessage::createMethodCall(QLatin1String("org.a11y.atspi.Registry"), | - | ||||||||||||||||||||||||
| 770 | QLatin1String("/org/a11y/atspi/registry"), | - | ||||||||||||||||||||||||
| 771 | QLatin1String("org.a11y.atspi.Registry"), QLatin1String("GetRegisteredEvents")); | - | ||||||||||||||||||||||||
| 772 | QDBusReply<QSpiEventListenerArray> listenersReply = m_dbus->connection().call(m); | - | ||||||||||||||||||||||||
| 773 | if (listenersReply.isValid()) {
| 0 | ||||||||||||||||||||||||
| 774 | const QSpiEventListenerArray evList = listenersReply.value(); | - | ||||||||||||||||||||||||
| 775 | Q_FOREACH (const QSpiEventListener &ev, evList) { | - | ||||||||||||||||||||||||
| 776 | setBitFlag(ev.eventName); | - | ||||||||||||||||||||||||
| 777 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 778 | m_applicationAdaptor->sendEvents(!evList.isEmpty()); | - | ||||||||||||||||||||||||
| 779 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 780 | qAtspiDebug() << "Could not query active accessibility event listeners."; never executed: ;never executed: QMessageLogger(__FILE__, 780, __PRETTY_FUNCTION__).debug() << "Could not query active accessibility event listeners.";
| 0 | ||||||||||||||||||||||||
| 781 | } | - | ||||||||||||||||||||||||
| 782 | } | - | ||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||
| 784 | void AtSpiAdaptor::eventListenerDeregistered(const QString &/*bus*/, const QString &/*path*/) | - | ||||||||||||||||||||||||
| 785 | { | - | ||||||||||||||||||||||||
| 786 | // qAtspiDebug() << "AtSpiAdaptor::eventListenerDeregistered: " << bus << path; | - | ||||||||||||||||||||||||
| 787 | updateEventListeners(); | - | ||||||||||||||||||||||||
| 788 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||
| 790 | void AtSpiAdaptor::eventListenerRegistered(const QString &/*bus*/, const QString &/*path*/) | - | ||||||||||||||||||||||||
| 791 | { | - | ||||||||||||||||||||||||
| 792 | // qAtspiDebug() << "AtSpiAdaptor::eventListenerRegistered: " << bus << path; | - | ||||||||||||||||||||||||
| 793 | updateEventListeners(); | - | ||||||||||||||||||||||||
| 794 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 795 | - | |||||||||||||||||||||||||
| 796 | /*! | - | ||||||||||||||||||||||||
| 797 | This slot needs to get called when a \a window has be activated or deactivated (become focused). | - | ||||||||||||||||||||||||
| 798 | When \a active is true, the window just received focus, otherwise it lost the focus. | - | ||||||||||||||||||||||||
| 799 | */ | - | ||||||||||||||||||||||||
| 800 | void AtSpiAdaptor::windowActivated(QObject* window, bool active) | - | ||||||||||||||||||||||||
| 801 | { | - | ||||||||||||||||||||||||
| 802 | if (!(sendWindow || sendWindow_activate))
| 0 | ||||||||||||||||||||||||
| 803 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window); | - | ||||||||||||||||||||||||
| 806 | Q_ASSERT(iface); | - | ||||||||||||||||||||||||
| 807 | Q_ASSERT(!active || iface->isValid()); | - | ||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||
| 809 | QString windowTitle; | - | ||||||||||||||||||||||||
| 810 | // in dtor it may be invalid | - | ||||||||||||||||||||||||
| 811 | if (iface->isValid())
| 0 | ||||||||||||||||||||||||
| 812 | windowTitle = iface->text(QAccessible::Name); never executed: windowTitle = iface->text(QAccessible::Name); | 0 | ||||||||||||||||||||||||
| 813 | - | |||||||||||||||||||||||||
| 814 | QDBusVariant data; | - | ||||||||||||||||||||||||
| 815 | data.setVariant(windowTitle); | - | ||||||||||||||||||||||||
| 816 | - | |||||||||||||||||||||||||
| 817 | QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(data)); | - | ||||||||||||||||||||||||
| 818 | - | |||||||||||||||||||||||||
| 819 | QString status = active ? QLatin1String("Activate") : QLatin1String("Deactivate");
| 0 | ||||||||||||||||||||||||
| 820 | QString path = pathForObject(window); | - | ||||||||||||||||||||||||
| 821 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_WINDOW), status, args); | - | ||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||
| 823 | QVariantList stateArgs = packDBusSignalArguments(QLatin1String("active"), active ? 1 : 0, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 824 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 825 | QLatin1String("StateChanged"), stateArgs); | - | ||||||||||||||||||||||||
| 826 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 827 | - | |||||||||||||||||||||||||
| 828 | QVariantList AtSpiAdaptor::packDBusSignalArguments(const QString &type, int data1, int data2, const QVariant &variantData) const | - | ||||||||||||||||||||||||
| 829 | { | - | ||||||||||||||||||||||||
| 830 | QVariantList arguments; | - | ||||||||||||||||||||||||
| 831 | arguments << type << data1 << data2 << variantData | - | ||||||||||||||||||||||||
| 832 | << QVariant::fromValue(QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(QSPI_OBJECT_PATH_ROOT))); | - | ||||||||||||||||||||||||
| 833 | return arguments; never executed: return arguments; | 0 | ||||||||||||||||||||||||
| 834 | } | - | ||||||||||||||||||||||||
| 835 | - | |||||||||||||||||||||||||
| 836 | QVariant AtSpiAdaptor::variantForPath(const QString &path) const | - | ||||||||||||||||||||||||
| 837 | { | - | ||||||||||||||||||||||||
| 838 | QDBusVariant data; | - | ||||||||||||||||||||||||
| 839 | data.setVariant(QVariant::fromValue(QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(path)))); | - | ||||||||||||||||||||||||
| 840 | return QVariant::fromValue(data); never executed: return QVariant::fromValue(data); | 0 | ||||||||||||||||||||||||
| 841 | } | - | ||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||
| 843 | bool AtSpiAdaptor::sendDBusSignal(const QString &path, const QString &interface, const QString &signalName, const QVariantList &arguments) const | - | ||||||||||||||||||||||||
| 844 | { | - | ||||||||||||||||||||||||
| 845 | QDBusMessage message = QDBusMessage::createSignal(path, interface, signalName); | - | ||||||||||||||||||||||||
| 846 | message.setArguments(arguments); | - | ||||||||||||||||||||||||
| 847 | return m_dbus->connection().send(message); never executed: return m_dbus->connection().send(message); | 0 | ||||||||||||||||||||||||
| 848 | } | - | ||||||||||||||||||||||||
| 849 | - | |||||||||||||||||||||||||
| 850 | QAccessibleInterface *AtSpiAdaptor::interfaceFromPath(const QString& dbusPath) const | - | ||||||||||||||||||||||||
| 851 | { | - | ||||||||||||||||||||||||
| 852 | if (dbusPath == QLatin1String(QSPI_OBJECT_PATH_ROOT))
| 0 | ||||||||||||||||||||||||
| 853 | return QAccessible::queryAccessibleInterface(qApp); never executed: return QAccessible::queryAccessibleInterface((static_cast<QGuiApplication *>(QCoreApplication::instance()))); | 0 | ||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||
| 855 | QStringList parts = dbusPath.split(QLatin1Char('/')); | - | ||||||||||||||||||||||||
| 856 | if (parts.size() != 6) {
| 0 | ||||||||||||||||||||||||
| 857 | qAtspiDebug() << "invalid path: " << dbusPath; never executed: ;never executed: QMessageLogger(__FILE__, 857, __PRETTY_FUNCTION__).debug() << "invalid path: " << dbusPath;
| 0 | ||||||||||||||||||||||||
| 858 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 859 | } | - | ||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||
| 861 | QString objectString = parts.at(5); | - | ||||||||||||||||||||||||
| 862 | QAccessible::Id id = objectString.toUInt(); | - | ||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||
| 864 | // The id is always in the range [INT_MAX+1, UINT_MAX] | - | ||||||||||||||||||||||||
| 865 | if ((int)id >= 0)
| 0 | ||||||||||||||||||||||||
| 866 | qWarning() << "No accessible object found for id: " << id; never executed: QMessageLogger(__FILE__, 866, __PRETTY_FUNCTION__).warning() << "No accessible object found for id: " << id; | 0 | ||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||
| 868 | return QAccessible::accessibleInterface(id); never executed: return QAccessible::accessibleInterface(id); | 0 | ||||||||||||||||||||||||
| 869 | } | - | ||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||
| 871 | void AtSpiAdaptor::notifyStateChange(QAccessibleInterface *interface, const QString &state, int value) | - | ||||||||||||||||||||||||
| 872 | { | - | ||||||||||||||||||||||||
| 873 | QString path = pathForInterface(interface); | - | ||||||||||||||||||||||||
| 874 | QVariantList stateArgs = packDBusSignalArguments(state, value, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 875 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 876 | QLatin1String("StateChanged"), stateArgs); | - | ||||||||||||||||||||||||
| 877 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 878 | - | |||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||
| 880 | /*! | - | ||||||||||||||||||||||||
| 881 | This function gets called when Qt notifies about accessibility updates. | - | ||||||||||||||||||||||||
| 882 | */ | - | ||||||||||||||||||||||||
| 883 | void AtSpiAdaptor::notify(QAccessibleEvent *event) | - | ||||||||||||||||||||||||
| 884 | { | - | ||||||||||||||||||||||||
| 885 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 886 | case QAccessible::ObjectCreated: never executed: case QAccessible::ObjectCreated: | 0 | ||||||||||||||||||||||||
| 887 | if (sendObject || sendObject_children_changed)
| 0 | ||||||||||||||||||||||||
| 888 | notifyAboutCreation(event->accessibleInterface()); never executed: notifyAboutCreation(event->accessibleInterface()); | 0 | ||||||||||||||||||||||||
| 889 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 890 | case QAccessible::ObjectShow: { never executed: case QAccessible::ObjectShow: | 0 | ||||||||||||||||||||||||
| 891 | if (sendObject || sendObject_state_changed) {
| 0 | ||||||||||||||||||||||||
| 892 | notifyStateChange(event->accessibleInterface(), QLatin1String("showing"), 1); | - | ||||||||||||||||||||||||
| 893 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 894 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 895 | } | - | ||||||||||||||||||||||||
| 896 | case QAccessible::ObjectHide: { never executed: case QAccessible::ObjectHide: | 0 | ||||||||||||||||||||||||
| 897 | if (sendObject || sendObject_state_changed) {
| 0 | ||||||||||||||||||||||||
| 898 | notifyStateChange(event->accessibleInterface(), QLatin1String("showing"), 0); | - | ||||||||||||||||||||||||
| 899 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 900 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 901 | } | - | ||||||||||||||||||||||||
| 902 | case QAccessible::ObjectDestroyed: { never executed: case QAccessible::ObjectDestroyed: | 0 | ||||||||||||||||||||||||
| 903 | if (sendObject || sendObject_state_changed)
| 0 | ||||||||||||||||||||||||
| 904 | notifyAboutDestruction(event->accessibleInterface()); never executed: notifyAboutDestruction(event->accessibleInterface()); | 0 | ||||||||||||||||||||||||
| 905 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 906 | } | - | ||||||||||||||||||||||||
| 907 | case QAccessible::ObjectReorder: { never executed: case QAccessible::ObjectReorder: | 0 | ||||||||||||||||||||||||
| 908 | if (sendObject || sendObject_children_changed)
| 0 | ||||||||||||||||||||||||
| 909 | childrenChanged(event->accessibleInterface()); never executed: childrenChanged(event->accessibleInterface()); | 0 | ||||||||||||||||||||||||
| 910 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 911 | } | - | ||||||||||||||||||||||||
| 912 | case QAccessible::NameChanged: { never executed: case QAccessible::NameChanged: | 0 | ||||||||||||||||||||||||
| 913 | if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) {
| 0 | ||||||||||||||||||||||||
| 914 | QString path = pathForInterface(event->accessibleInterface()); | - | ||||||||||||||||||||||||
| 915 | QVariantList args = packDBusSignalArguments(QLatin1String("accessible-name"), 0, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 916 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 917 | QLatin1String("PropertyChange"), args); | - | ||||||||||||||||||||||||
| 918 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 919 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 920 | } | - | ||||||||||||||||||||||||
| 921 | case QAccessible::DescriptionChanged: { never executed: case QAccessible::DescriptionChanged: | 0 | ||||||||||||||||||||||||
| 922 | if (sendObject || sendObject_property_change || sendObject_property_change_accessible_description) {
| 0 | ||||||||||||||||||||||||
| 923 | QString path = pathForInterface(event->accessibleInterface()); | - | ||||||||||||||||||||||||
| 924 | QVariantList args = packDBusSignalArguments(QLatin1String("accessible-description"), 0, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 925 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 926 | QLatin1String("PropertyChange"), args); | - | ||||||||||||||||||||||||
| 927 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 928 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 929 | } | - | ||||||||||||||||||||||||
| 930 | case QAccessible::Focus: { never executed: case QAccessible::Focus: | 0 | ||||||||||||||||||||||||
| 931 | if (sendFocus || sendObject || sendObject_state_changed)
| 0 | ||||||||||||||||||||||||
| 932 | sendFocusChanged(event->accessibleInterface()); never executed: sendFocusChanged(event->accessibleInterface()); | 0 | ||||||||||||||||||||||||
| 933 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 934 | } | - | ||||||||||||||||||||||||
| 935 | case QAccessible::TextInserted: never executed: case QAccessible::TextInserted: | 0 | ||||||||||||||||||||||||
| 936 | case QAccessible::TextRemoved: never executed: case QAccessible::TextRemoved: | 0 | ||||||||||||||||||||||||
| 937 | case QAccessible::TextUpdated: { never executed: case QAccessible::TextUpdated: | 0 | ||||||||||||||||||||||||
| 938 | if (sendObject || sendObject_text_changed) {
| 0 | ||||||||||||||||||||||||
| 939 | QAccessibleInterface * iface = event->accessibleInterface(); | - | ||||||||||||||||||||||||
| 940 | if (!iface || !iface->textInterface()) {
| 0 | ||||||||||||||||||||||||
| 941 | qAtspiDebug() << "Received text event for invalid interface."; never executed: ;never executed: QMessageLogger(__FILE__, 941, __PRETTY_FUNCTION__).debug() << "Received text event for invalid interface.";
| 0 | ||||||||||||||||||||||||
| 942 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 943 | } | - | ||||||||||||||||||||||||
| 944 | QString path = pathForInterface(iface); | - | ||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||
| 946 | int changePosition = 0; | - | ||||||||||||||||||||||||
| 947 | int cursorPosition = 0; | - | ||||||||||||||||||||||||
| 948 | QString textRemoved; | - | ||||||||||||||||||||||||
| 949 | QString textInserted; | - | ||||||||||||||||||||||||
| 950 | - | |||||||||||||||||||||||||
| 951 | if (event->type() == QAccessible::TextInserted) {
| 0 | ||||||||||||||||||||||||
| 952 | QAccessibleTextInsertEvent *textEvent = static_cast<QAccessibleTextInsertEvent*>(event); | - | ||||||||||||||||||||||||
| 953 | textInserted = textEvent->textInserted(); | - | ||||||||||||||||||||||||
| 954 | changePosition = textEvent->changePosition(); | - | ||||||||||||||||||||||||
| 955 | cursorPosition = textEvent->cursorPosition(); | - | ||||||||||||||||||||||||
| 956 | } else if (event->type() == QAccessible::TextRemoved) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 957 | QAccessibleTextRemoveEvent *textEvent = static_cast<QAccessibleTextRemoveEvent*>(event); | - | ||||||||||||||||||||||||
| 958 | textRemoved = textEvent->textRemoved(); | - | ||||||||||||||||||||||||
| 959 | changePosition = textEvent->changePosition(); | - | ||||||||||||||||||||||||
| 960 | cursorPosition = textEvent->cursorPosition(); | - | ||||||||||||||||||||||||
| 961 | } else if (event->type() == QAccessible::TextInserted) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 962 | QAccessibleTextUpdateEvent *textEvent = static_cast<QAccessibleTextUpdateEvent*>(event); | - | ||||||||||||||||||||||||
| 963 | textInserted = textEvent->textInserted(); | - | ||||||||||||||||||||||||
| 964 | textRemoved = textEvent->textRemoved(); | - | ||||||||||||||||||||||||
| 965 | changePosition = textEvent->changePosition(); | - | ||||||||||||||||||||||||
| 966 | cursorPosition = textEvent->cursorPosition(); | - | ||||||||||||||||||||||||
| 967 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 968 | - | |||||||||||||||||||||||||
| 969 | QDBusVariant data; | - | ||||||||||||||||||||||||
| 970 | - | |||||||||||||||||||||||||
| 971 | if (!textRemoved.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 972 | data.setVariant(QVariant::fromValue(textRemoved)); | - | ||||||||||||||||||||||||
| 973 | QVariantList args = packDBusSignalArguments(QLatin1String("delete"), changePosition, textRemoved.length(), QVariant::fromValue(data)); | - | ||||||||||||||||||||||||
| 974 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 975 | QLatin1String("TextChanged"), args); | - | ||||||||||||||||||||||||
| 976 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 977 | - | |||||||||||||||||||||||||
| 978 | if (!textInserted.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 979 | data.setVariant(QVariant::fromValue(textInserted)); | - | ||||||||||||||||||||||||
| 980 | QVariantList args = packDBusSignalArguments(QLatin1String("insert"), changePosition, textInserted.length(), QVariant::fromValue(data)); | - | ||||||||||||||||||||||||
| 981 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 982 | QLatin1String("TextChanged"), args); | - | ||||||||||||||||||||||||
| 983 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 984 | - | |||||||||||||||||||||||||
| 985 | // send a cursor update | - | ||||||||||||||||||||||||
| 986 | Q_UNUSED(cursorPosition) | - | ||||||||||||||||||||||||
| 987 | // QDBusVariant cursorData; | - | ||||||||||||||||||||||||
| 988 | // cursorData.setVariant(QVariant::fromValue(cursorPosition)); | - | ||||||||||||||||||||||||
| 989 | // QVariantList args = packDBusSignalArguments(QString(), cursorPosition, 0, QVariant::fromValue(cursorData)); | - | ||||||||||||||||||||||||
| 990 | // sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 991 | // QLatin1String("TextCaretMoved"), args); | - | ||||||||||||||||||||||||
| 992 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 993 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 994 | } | - | ||||||||||||||||||||||||
| 995 | case QAccessible::TextCaretMoved: { never executed: case QAccessible::TextCaretMoved: | 0 | ||||||||||||||||||||||||
| 996 | if (sendObject || sendObject_text_caret_moved) {
| 0 | ||||||||||||||||||||||||
| 997 | QAccessibleInterface * iface = event->accessibleInterface(); | - | ||||||||||||||||||||||||
| 998 | if (!iface || !iface->textInterface()) {
| 0 | ||||||||||||||||||||||||
| 999 | qWarning() << "Sending TextCaretMoved from object that does not implement text interface: " << iface; | - | ||||||||||||||||||||||||
| 1000 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1001 | } | - | ||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||
| 1003 | QString path = pathForInterface(iface); | - | ||||||||||||||||||||||||
| 1004 | QDBusVariant cursorData; | - | ||||||||||||||||||||||||
| 1005 | int pos = iface->textInterface()->cursorPosition(); | - | ||||||||||||||||||||||||
| 1006 | cursorData.setVariant(QVariant::fromValue(pos)); | - | ||||||||||||||||||||||||
| 1007 | QVariantList args = packDBusSignalArguments(QString(), pos, 0, QVariant::fromValue(cursorData)); | - | ||||||||||||||||||||||||
| 1008 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 1009 | QLatin1String("TextCaretMoved"), args); | - | ||||||||||||||||||||||||
| 1010 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1011 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1012 | } | - | ||||||||||||||||||||||||
| 1013 | case QAccessible::TextSelectionChanged: { never executed: case QAccessible::TextSelectionChanged: | 0 | ||||||||||||||||||||||||
| 1014 | if (sendObject || sendObject_text_selection_changed) {
| 0 | ||||||||||||||||||||||||
| 1015 | QAccessibleInterface * iface = event->accessibleInterface(); | - | ||||||||||||||||||||||||
| 1016 | QString path = pathForInterface(iface); | - | ||||||||||||||||||||||||
| 1017 | QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(QString())))); | - | ||||||||||||||||||||||||
| 1018 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 1019 | QLatin1String("TextSelectionChanged"), args); | - | ||||||||||||||||||||||||
| 1020 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1021 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1022 | } | - | ||||||||||||||||||||||||
| 1023 | case QAccessible::ValueChanged: { never executed: case QAccessible::ValueChanged: | 0 | ||||||||||||||||||||||||
| 1024 | if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) {
| 0 | ||||||||||||||||||||||||
| 1025 | QAccessibleInterface * iface = event->accessibleInterface(); | - | ||||||||||||||||||||||||
| 1026 | if (!iface) {
| 0 | ||||||||||||||||||||||||
| 1027 | qWarning() << "ValueChanged event from invalid accessible."; | - | ||||||||||||||||||||||||
| 1028 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1029 | } | - | ||||||||||||||||||||||||
| 1030 | if (iface->valueInterface()) {
| 0 | ||||||||||||||||||||||||
| 1031 | QString path = pathForInterface(iface); | - | ||||||||||||||||||||||||
| 1032 | QVariantList args = packDBusSignalArguments(QLatin1String("accessible-value"), 0, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 1033 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 1034 | QLatin1String("PropertyChange"), args); | - | ||||||||||||||||||||||||
| 1035 | } else if (iface->role() == QAccessible::ComboBox) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1036 | // Combo Box with AT-SPI likes to be special | - | ||||||||||||||||||||||||
| 1037 | // It requires a name-change to update caches and then selection-changed | - | ||||||||||||||||||||||||
| 1038 | QString path = pathForInterface(iface); | - | ||||||||||||||||||||||||
| 1039 | QVariantList args1 = packDBusSignalArguments(QLatin1String("accessible-name"), 0, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 1040 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 1041 | QLatin1String("PropertyChange"), args1); | - | ||||||||||||||||||||||||
| 1042 | QVariantList args2 = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(0)))); | - | ||||||||||||||||||||||||
| 1043 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 1044 | QLatin1String("SelectionChanged"), args2); | - | ||||||||||||||||||||||||
| 1045 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1046 | qWarning() << "ValueChanged event and no ValueInterface or ComboBox: " << iface; | - | ||||||||||||||||||||||||
| 1047 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1048 | } | - | ||||||||||||||||||||||||
| 1049 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1050 | } | - | ||||||||||||||||||||||||
| 1051 | case QAccessible::SelectionAdd: never executed: case QAccessible::SelectionAdd: | 0 | ||||||||||||||||||||||||
| 1052 | case QAccessible::SelectionRemove: never executed: case QAccessible::SelectionRemove: | 0 | ||||||||||||||||||||||||
| 1053 | case QAccessible::Selection: { never executed: case QAccessible::Selection: | 0 | ||||||||||||||||||||||||
| 1054 | QAccessibleInterface * iface = event->accessibleInterface(); | - | ||||||||||||||||||||||||
| 1055 | if (!iface) {
| 0 | ||||||||||||||||||||||||
| 1056 | qWarning() << "Selection event from invalid accessible."; | - | ||||||||||||||||||||||||
| 1057 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1058 | } | - | ||||||||||||||||||||||||
| 1059 | QString path = pathForInterface(iface); | - | ||||||||||||||||||||||||
| 1060 | int selected = iface->state().selected ? 1 : 0;
| 0 | ||||||||||||||||||||||||
| 1061 | QVariantList stateArgs = packDBusSignalArguments(QLatin1String("selected"), selected, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 1062 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 1063 | QLatin1String("StateChanged"), stateArgs); | - | ||||||||||||||||||||||||
| 1064 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1065 | } | - | ||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||
| 1067 | case QAccessible::StateChanged: { never executed: case QAccessible::StateChanged: | 0 | ||||||||||||||||||||||||
| 1068 | if (sendObject || sendObject_state_changed || sendWindow || sendWindow_activate) {
| 0 | ||||||||||||||||||||||||
| 1069 | QAccessible::State stateChange = static_cast<QAccessibleStateChangeEvent*>(event)->changedStates(); | - | ||||||||||||||||||||||||
| 1070 | if (stateChange.checked) {
| 0 | ||||||||||||||||||||||||
| 1071 | QAccessibleInterface * iface = event->accessibleInterface(); | - | ||||||||||||||||||||||||
| 1072 | if (!iface) {
| 0 | ||||||||||||||||||||||||
| 1073 | qWarning() << "StateChanged event from invalid accessible."; | - | ||||||||||||||||||||||||
| 1074 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1075 | } | - | ||||||||||||||||||||||||
| 1076 | int checked = iface->state().checked; | - | ||||||||||||||||||||||||
| 1077 | notifyStateChange(iface, QLatin1String("checked"), checked); | - | ||||||||||||||||||||||||
| 1078 | } else if (stateChange.active) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1079 | QAccessibleInterface * iface = event->accessibleInterface(); | - | ||||||||||||||||||||||||
| 1080 | if (!iface || !(iface->role() == QAccessible::Window && (sendWindow || sendWindow_activate)))
| 0 | ||||||||||||||||||||||||
| 1081 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1082 | int isActive = iface->state().active; | - | ||||||||||||||||||||||||
| 1083 | QString windowTitle = iface->text(QAccessible::Name); | - | ||||||||||||||||||||||||
| 1084 | QDBusVariant data; | - | ||||||||||||||||||||||||
| 1085 | data.setVariant(windowTitle); | - | ||||||||||||||||||||||||
| 1086 | QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(data)); | - | ||||||||||||||||||||||||
| 1087 | QString status = isActive ? QLatin1String("Activate") : QLatin1String("Deactivate");
| 0 | ||||||||||||||||||||||||
| 1088 | QString path = pathForInterface(iface); | - | ||||||||||||||||||||||||
| 1089 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_WINDOW), status, args); | - | ||||||||||||||||||||||||
| 1090 | notifyStateChange(iface, QLatin1String("active"), isActive); | - | ||||||||||||||||||||||||
| 1091 | } else if (stateChange.disabled) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1092 | QAccessibleInterface *iface = event->accessibleInterface(); | - | ||||||||||||||||||||||||
| 1093 | QAccessible::State state = iface->state(); | - | ||||||||||||||||||||||||
| 1094 | bool enabled = !state.disabled; | - | ||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||
| 1096 | notifyStateChange(iface, QLatin1String("enabled"), enabled); | - | ||||||||||||||||||||||||
| 1097 | notifyStateChange(iface, QLatin1String("sensitive"), enabled); | - | ||||||||||||||||||||||||
| 1098 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1099 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1100 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1101 | } | - | ||||||||||||||||||||||||
| 1102 | // For now we ignore these events | - | ||||||||||||||||||||||||
| 1103 | case QAccessible::TableModelChanged: never executed: case QAccessible::TableModelChanged: | 0 | ||||||||||||||||||||||||
| 1104 | // For tables, setting manages_descendants should | - | ||||||||||||||||||||||||
| 1105 | // indicate to the client that it cannot cache these | - | ||||||||||||||||||||||||
| 1106 | // interfaces. | - | ||||||||||||||||||||||||
| 1107 | case QAccessible::ParentChanged: never executed: case QAccessible::ParentChanged: | 0 | ||||||||||||||||||||||||
| 1108 | case QAccessible::DialogStart: never executed: case QAccessible::DialogStart: | 0 | ||||||||||||||||||||||||
| 1109 | case QAccessible::DialogEnd: never executed: case QAccessible::DialogEnd: | 0 | ||||||||||||||||||||||||
| 1110 | case QAccessible::PopupMenuStart: never executed: case QAccessible::PopupMenuStart: | 0 | ||||||||||||||||||||||||
| 1111 | case QAccessible::PopupMenuEnd: never executed: case QAccessible::PopupMenuEnd: | 0 | ||||||||||||||||||||||||
| 1112 | case QAccessible::SoundPlayed: never executed: case QAccessible::SoundPlayed: | 0 | ||||||||||||||||||||||||
| 1113 | case QAccessible::Alert: never executed: case QAccessible::Alert: | 0 | ||||||||||||||||||||||||
| 1114 | case QAccessible::ForegroundChanged: never executed: case QAccessible::ForegroundChanged: | 0 | ||||||||||||||||||||||||
| 1115 | case QAccessible::MenuStart: never executed: case QAccessible::MenuStart: | 0 | ||||||||||||||||||||||||
| 1116 | case QAccessible::MenuEnd: never executed: case QAccessible::MenuEnd: | 0 | ||||||||||||||||||||||||
| 1117 | case QAccessible::ContextHelpStart: never executed: case QAccessible::ContextHelpStart: | 0 | ||||||||||||||||||||||||
| 1118 | case QAccessible::ContextHelpEnd: never executed: case QAccessible::ContextHelpEnd: | 0 | ||||||||||||||||||||||||
| 1119 | case QAccessible::DragDropStart: never executed: case QAccessible::DragDropStart: | 0 | ||||||||||||||||||||||||
| 1120 | case QAccessible::DragDropEnd: never executed: case QAccessible::DragDropEnd: | 0 | ||||||||||||||||||||||||
| 1121 | case QAccessible::ScrollingStart: never executed: case QAccessible::ScrollingStart: | 0 | ||||||||||||||||||||||||
| 1122 | case QAccessible::ScrollingEnd: never executed: case QAccessible::ScrollingEnd: | 0 | ||||||||||||||||||||||||
| 1123 | case QAccessible::MenuCommand: never executed: case QAccessible::MenuCommand: | 0 | ||||||||||||||||||||||||
| 1124 | case QAccessible::ActionChanged: never executed: case QAccessible::ActionChanged: | 0 | ||||||||||||||||||||||||
| 1125 | case QAccessible::ActiveDescendantChanged: never executed: case QAccessible::ActiveDescendantChanged: | 0 | ||||||||||||||||||||||||
| 1126 | case QAccessible::AttributeChanged: never executed: case QAccessible::AttributeChanged: | 0 | ||||||||||||||||||||||||
| 1127 | case QAccessible::DocumentContentChanged: never executed: case QAccessible::DocumentContentChanged: | 0 | ||||||||||||||||||||||||
| 1128 | case QAccessible::DocumentLoadComplete: never executed: case QAccessible::DocumentLoadComplete: | 0 | ||||||||||||||||||||||||
| 1129 | case QAccessible::DocumentLoadStopped: never executed: case QAccessible::DocumentLoadStopped: | 0 | ||||||||||||||||||||||||
| 1130 | case QAccessible::DocumentReload: never executed: case QAccessible::DocumentReload: | 0 | ||||||||||||||||||||||||
| 1131 | case QAccessible::HyperlinkEndIndexChanged: never executed: case QAccessible::HyperlinkEndIndexChanged: | 0 | ||||||||||||||||||||||||
| 1132 | case QAccessible::HyperlinkNumberOfAnchorsChanged: never executed: case QAccessible::HyperlinkNumberOfAnchorsChanged: | 0 | ||||||||||||||||||||||||
| 1133 | case QAccessible::HyperlinkSelectedLinkChanged: never executed: case QAccessible::HyperlinkSelectedLinkChanged: | 0 | ||||||||||||||||||||||||
| 1134 | case QAccessible::HypertextLinkActivated: never executed: case QAccessible::HypertextLinkActivated: | 0 | ||||||||||||||||||||||||
| 1135 | case QAccessible::HypertextLinkSelected: never executed: case QAccessible::HypertextLinkSelected: | 0 | ||||||||||||||||||||||||
| 1136 | case QAccessible::HyperlinkStartIndexChanged: never executed: case QAccessible::HyperlinkStartIndexChanged: | 0 | ||||||||||||||||||||||||
| 1137 | case QAccessible::HypertextChanged: never executed: case QAccessible::HypertextChanged: | 0 | ||||||||||||||||||||||||
| 1138 | case QAccessible::HypertextNLinksChanged: never executed: case QAccessible::HypertextNLinksChanged: | 0 | ||||||||||||||||||||||||
| 1139 | case QAccessible::ObjectAttributeChanged: never executed: case QAccessible::ObjectAttributeChanged: | 0 | ||||||||||||||||||||||||
| 1140 | case QAccessible::PageChanged: never executed: case QAccessible::PageChanged: | 0 | ||||||||||||||||||||||||
| 1141 | case QAccessible::SectionChanged: never executed: case QAccessible::SectionChanged: | 0 | ||||||||||||||||||||||||
| 1142 | case QAccessible::TableCaptionChanged: never executed: case QAccessible::TableCaptionChanged: | 0 | ||||||||||||||||||||||||
| 1143 | case QAccessible::TableColumnDescriptionChanged: never executed: case QAccessible::TableColumnDescriptionChanged: | 0 | ||||||||||||||||||||||||
| 1144 | case QAccessible::TableColumnHeaderChanged: never executed: case QAccessible::TableColumnHeaderChanged: | 0 | ||||||||||||||||||||||||
| 1145 | case QAccessible::TableRowDescriptionChanged: never executed: case QAccessible::TableRowDescriptionChanged: | 0 | ||||||||||||||||||||||||
| 1146 | case QAccessible::TableRowHeaderChanged: never executed: case QAccessible::TableRowHeaderChanged: | 0 | ||||||||||||||||||||||||
| 1147 | case QAccessible::TableSummaryChanged: never executed: case QAccessible::TableSummaryChanged: | 0 | ||||||||||||||||||||||||
| 1148 | case QAccessible::TextAttributeChanged: never executed: case QAccessible::TextAttributeChanged: | 0 | ||||||||||||||||||||||||
| 1149 | case QAccessible::TextColumnChanged: never executed: case QAccessible::TextColumnChanged: | 0 | ||||||||||||||||||||||||
| 1150 | case QAccessible::VisibleDataChanged: never executed: case QAccessible::VisibleDataChanged: | 0 | ||||||||||||||||||||||||
| 1151 | case QAccessible::SelectionWithin: never executed: case QAccessible::SelectionWithin: | 0 | ||||||||||||||||||||||||
| 1152 | case QAccessible::LocationChanged: never executed: case QAccessible::LocationChanged: | 0 | ||||||||||||||||||||||||
| 1153 | case QAccessible::HelpChanged: never executed: case QAccessible::HelpChanged: | 0 | ||||||||||||||||||||||||
| 1154 | case QAccessible::DefaultActionChanged: never executed: case QAccessible::DefaultActionChanged: | 0 | ||||||||||||||||||||||||
| 1155 | case QAccessible::AcceleratorChanged: never executed: case QAccessible::AcceleratorChanged: | 0 | ||||||||||||||||||||||||
| 1156 | case QAccessible::InvalidEvent: never executed: case QAccessible::InvalidEvent: | 0 | ||||||||||||||||||||||||
| 1157 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1158 | } | - | ||||||||||||||||||||||||
| 1159 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1160 | - | |||||||||||||||||||||||||
| 1161 | void AtSpiAdaptor::sendFocusChanged(QAccessibleInterface *interface) const | - | ||||||||||||||||||||||||
| 1162 | { | - | ||||||||||||||||||||||||
| 1163 | static QString lastFocusPath; | - | ||||||||||||||||||||||||
| 1164 | // "remove" old focus | - | ||||||||||||||||||||||||
| 1165 | if (!lastFocusPath.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 1166 | QVariantList stateArgs = packDBusSignalArguments(QLatin1String("focused"), 0, 0, variantForPath(lastFocusPath)); | - | ||||||||||||||||||||||||
| 1167 | sendDBusSignal(lastFocusPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 1168 | QLatin1String("StateChanged"), stateArgs); | - | ||||||||||||||||||||||||
| 1169 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1170 | // send new focus | - | ||||||||||||||||||||||||
| 1171 | { | - | ||||||||||||||||||||||||
| 1172 | QString path = pathForInterface(interface); | - | ||||||||||||||||||||||||
| 1173 | - | |||||||||||||||||||||||||
| 1174 | QVariantList stateArgs = packDBusSignalArguments(QLatin1String("focused"), 1, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 1175 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), | - | ||||||||||||||||||||||||
| 1176 | QLatin1String("StateChanged"), stateArgs); | - | ||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||
| 1178 | QVariantList focusArgs = packDBusSignalArguments(QString(), 0, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 1179 | sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_FOCUS), | - | ||||||||||||||||||||||||
| 1180 | QLatin1String("Focus"), focusArgs); | - | ||||||||||||||||||||||||
| 1181 | lastFocusPath = path; | - | ||||||||||||||||||||||||
| 1182 | } | - | ||||||||||||||||||||||||
| 1183 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1184 | - | |||||||||||||||||||||||||
| 1185 | void AtSpiAdaptor::childrenChanged(QAccessibleInterface *interface) const | - | ||||||||||||||||||||||||
| 1186 | { | - | ||||||||||||||||||||||||
| 1187 | QString parentPath = pathForInterface(interface); | - | ||||||||||||||||||||||||
| 1188 | int childCount = interface->childCount(); | - | ||||||||||||||||||||||||
| 1189 | for (int i = 0; i < interface->childCount(); ++i) {
| 0 | ||||||||||||||||||||||||
| 1190 | QString childPath = pathForInterface(interface->child(i)); | - | ||||||||||||||||||||||||
| 1191 | QVariantList args = packDBusSignalArguments(QLatin1String("add"), childCount, 0, childPath); | - | ||||||||||||||||||||||||
| 1192 | sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args); | - | ||||||||||||||||||||||||
| 1193 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1194 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1195 | - | |||||||||||||||||||||||||
| 1196 | void AtSpiAdaptor::notifyAboutCreation(QAccessibleInterface *interface) const | - | ||||||||||||||||||||||||
| 1197 | { | - | ||||||||||||||||||||||||
| 1198 | // // say hello to d-bus | - | ||||||||||||||||||||||||
| 1199 | // cache->emitAddAccessible(accessible->getCacheItem()); | - | ||||||||||||||||||||||||
| 1200 | - | |||||||||||||||||||||||||
| 1201 | // notify about the new child of our parent | - | ||||||||||||||||||||||||
| 1202 | QAccessibleInterface * parent = interface->parent(); | - | ||||||||||||||||||||||||
| 1203 | if (!parent) {
| 0 | ||||||||||||||||||||||||
| 1204 | qAtspiDebug() << "AtSpiAdaptor::notifyAboutCreation: Could not find parent for " << interface->object(); never executed: ;never executed: QMessageLogger(__FILE__, 1204, __PRETTY_FUNCTION__).debug() << "AtSpiAdaptor::notifyAboutCreation: Could not find parent for " << interface->object();
| 0 | ||||||||||||||||||||||||
| 1205 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1206 | } | - | ||||||||||||||||||||||||
| 1207 | QString path = pathForInterface(interface); | - | ||||||||||||||||||||||||
| 1208 | int childCount = parent->childCount(); | - | ||||||||||||||||||||||||
| 1209 | QString parentPath = pathForInterface(parent); | - | ||||||||||||||||||||||||
| 1210 | QVariantList args = packDBusSignalArguments(QLatin1String("add"), childCount, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 1211 | sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args); | - | ||||||||||||||||||||||||
| 1212 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1213 | - | |||||||||||||||||||||||||
| 1214 | void AtSpiAdaptor::notifyAboutDestruction(QAccessibleInterface *interface) const | - | ||||||||||||||||||||||||
| 1215 | { | - | ||||||||||||||||||||||||
| 1216 | if (!interface || !interface->isValid())
| 0 | ||||||||||||||||||||||||
| 1217 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1218 | - | |||||||||||||||||||||||||
| 1219 | QAccessibleInterface * parent = interface->parent(); | - | ||||||||||||||||||||||||
| 1220 | if (!parent) {
| 0 | ||||||||||||||||||||||||
| 1221 | qAtspiDebug() << "AtSpiAdaptor::notifyAboutDestruction: Could not find parent for " << interface->object(); never executed: ;never executed: QMessageLogger(__FILE__, 1221, __PRETTY_FUNCTION__).debug() << "AtSpiAdaptor::notifyAboutDestruction: Could not find parent for " << interface->object();
| 0 | ||||||||||||||||||||||||
| 1222 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1223 | } | - | ||||||||||||||||||||||||
| 1224 | QString path = pathForInterface(interface); | - | ||||||||||||||||||||||||
| 1225 | - | |||||||||||||||||||||||||
| 1226 | // this is in the destructor. we have no clue which child we used to be. | - | ||||||||||||||||||||||||
| 1227 | // FIXME | - | ||||||||||||||||||||||||
| 1228 | int childIndex = -1; | - | ||||||||||||||||||||||||
| 1229 | // if (child) { | - | ||||||||||||||||||||||||
| 1230 | // childIndex = child; | - | ||||||||||||||||||||||||
| 1231 | // } else { | - | ||||||||||||||||||||||||
| 1232 | // childIndex = parent->indexOfChild(interface); | - | ||||||||||||||||||||||||
| 1233 | // } | - | ||||||||||||||||||||||||
| 1234 | - | |||||||||||||||||||||||||
| 1235 | QString parentPath = pathForInterface(parent); | - | ||||||||||||||||||||||||
| 1236 | QVariantList args = packDBusSignalArguments(QLatin1String("remove"), childIndex, 0, variantForPath(path)); | - | ||||||||||||||||||||||||
| 1237 | sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args); | - | ||||||||||||||||||||||||
| 1238 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||
| 1240 | /*! | - | ||||||||||||||||||||||||
| 1241 | Handle incoming DBus message. | - | ||||||||||||||||||||||||
| 1242 | This function dispatches the dbus message to the right interface handler. | - | ||||||||||||||||||||||||
| 1243 | */ | - | ||||||||||||||||||||||||
| 1244 | bool AtSpiAdaptor::handleMessage(const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 1245 | { | - | ||||||||||||||||||||||||
| 1246 | // get accessible interface | - | ||||||||||||||||||||||||
| 1247 | QAccessibleInterface * accessible = interfaceFromPath(message.path()); | - | ||||||||||||||||||||||||
| 1248 | if (!accessible) {
| 0 | ||||||||||||||||||||||||
| 1249 | qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find accessible on path: " << message.path(); never executed: ;never executed: QMessageLogger(__FILE__, 1249, __PRETTY_FUNCTION__).debug() << "WARNING Qt AtSpiAdaptor: Could not find accessible on path: " << message.path();
| 0 | ||||||||||||||||||||||||
| 1250 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1251 | } | - | ||||||||||||||||||||||||
| 1252 | if (!accessible->isValid()) {
| 0 | ||||||||||||||||||||||||
| 1253 | qWarning() << "WARNING Qt AtSpiAdaptor: Accessible invalid: " << accessible << message.path(); | - | ||||||||||||||||||||||||
| 1254 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1255 | } | - | ||||||||||||||||||||||||
| 1256 | - | |||||||||||||||||||||||||
| 1257 | QString interface = message.interface(); | - | ||||||||||||||||||||||||
| 1258 | QString function = message.member(); | - | ||||||||||||||||||||||||
| 1259 | - | |||||||||||||||||||||||||
| 1260 | // qAtspiDebug() << "AtSpiAdaptor::handleMessage: " << interface << function; | - | ||||||||||||||||||||||||
| 1261 | - | |||||||||||||||||||||||||
| 1262 | if (function == QLatin1String("Introspect")) {
| 0 | ||||||||||||||||||||||||
| 1263 | //introspect(message.path()); | - | ||||||||||||||||||||||||
| 1264 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1265 | } | - | ||||||||||||||||||||||||
| 1266 | - | |||||||||||||||||||||||||
| 1267 | // handle properties like regular functions | - | ||||||||||||||||||||||||
| 1268 | if (interface == QLatin1String("org.freedesktop.DBus.Properties")) {
| 0 | ||||||||||||||||||||||||
| 1269 | interface = message.arguments().at(0).toString(); | - | ||||||||||||||||||||||||
| 1270 | // Get/Set + Name | - | ||||||||||||||||||||||||
| 1271 | function = message.member() + message.arguments().at(1).toString(); | - | ||||||||||||||||||||||||
| 1272 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1273 | - | |||||||||||||||||||||||||
| 1274 | // switch interface to call | - | ||||||||||||||||||||||||
| 1275 | if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_ACCESSIBLE))
| 0 | ||||||||||||||||||||||||
| 1276 | return accessibleInterface(accessible, function, message, connection); never executed: return accessibleInterface(accessible, function, message, connection); | 0 | ||||||||||||||||||||||||
| 1277 | if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_APPLICATION))
| 0 | ||||||||||||||||||||||||
| 1278 | return applicationInterface(accessible, function, message, connection); never executed: return applicationInterface(accessible, function, message, connection); | 0 | ||||||||||||||||||||||||
| 1279 | if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_COMPONENT))
| 0 | ||||||||||||||||||||||||
| 1280 | return componentInterface(accessible, function, message, connection); never executed: return componentInterface(accessible, function, message, connection); | 0 | ||||||||||||||||||||||||
| 1281 | if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_ACTION))
| 0 | ||||||||||||||||||||||||
| 1282 | return actionInterface(accessible, function, message, connection); never executed: return actionInterface(accessible, function, message, connection); | 0 | ||||||||||||||||||||||||
| 1283 | if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_TEXT))
| 0 | ||||||||||||||||||||||||
| 1284 | return textInterface(accessible, function, message, connection); never executed: return textInterface(accessible, function, message, connection); | 0 | ||||||||||||||||||||||||
| 1285 | if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_EDITABLE_TEXT))
| 0 | ||||||||||||||||||||||||
| 1286 | return editableTextInterface(accessible, function, message, connection); never executed: return editableTextInterface(accessible, function, message, connection); | 0 | ||||||||||||||||||||||||
| 1287 | if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_VALUE))
| 0 | ||||||||||||||||||||||||
| 1288 | return valueInterface(accessible, function, message, connection); never executed: return valueInterface(accessible, function, message, connection); | 0 | ||||||||||||||||||||||||
| 1289 | if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_TABLE))
| 0 | ||||||||||||||||||||||||
| 1290 | return tableInterface(accessible, function, message, connection); never executed: return tableInterface(accessible, function, message, connection); | 0 | ||||||||||||||||||||||||
| 1291 | - | |||||||||||||||||||||||||
| 1292 | qAtspiDebug() << "AtSpiAdaptor::handleMessage with unknown interface: " << message.path() << interface << function; never executed: ;never executed: QMessageLogger(__FILE__, 1292, __PRETTY_FUNCTION__).debug() << "AtSpiAdaptor::handleMessage with unknown interface: " << message.path() << interface << function;
| 0 | ||||||||||||||||||||||||
| 1293 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1294 | } | - | ||||||||||||||||||||||||
| 1295 | - | |||||||||||||||||||||||||
| 1296 | // Application | - | ||||||||||||||||||||||||
| 1297 | bool AtSpiAdaptor::applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 1298 | { | - | ||||||||||||||||||||||||
| 1299 | if (message.path() != QLatin1String(ATSPI_DBUS_PATH_ROOT)) {
| 0 | ||||||||||||||||||||||||
| 1300 | qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find application interface for: " << message.path() << interface; never executed: ;never executed: QMessageLogger(__FILE__, 1300, __PRETTY_FUNCTION__).debug() << "WARNING Qt AtSpiAdaptor: Could not find application interface for: " << message.path() << interface;
| 0 | ||||||||||||||||||||||||
| 1301 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1302 | } | - | ||||||||||||||||||||||||
| 1303 | - | |||||||||||||||||||||||||
| 1304 | if (function == QLatin1String("SetId")) {
| 0 | ||||||||||||||||||||||||
| 1305 | Q_ASSERT(message.signature() == QLatin1String("ssv")); | - | ||||||||||||||||||||||||
| 1306 | QVariant value = qvariant_cast<QDBusVariant>(message.arguments().at(2)).variant(); | - | ||||||||||||||||||||||||
| 1307 | - | |||||||||||||||||||||||||
| 1308 | m_applicationId = value.toInt(); | - | ||||||||||||||||||||||||
| 1309 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 1310 | } | - | ||||||||||||||||||||||||
| 1311 | if (function == QLatin1String("GetId")) {
| 0 | ||||||||||||||||||||||||
| 1312 | Q_ASSERT(message.signature() == QLatin1String("ss")); | - | ||||||||||||||||||||||||
| 1313 | QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(m_applicationId))); | - | ||||||||||||||||||||||||
| 1314 | return connection.send(reply); never executed: return connection.send(reply); | 0 | ||||||||||||||||||||||||
| 1315 | } | - | ||||||||||||||||||||||||
| 1316 | if (function == QLatin1String("GetToolkitName")) {
| 0 | ||||||||||||||||||||||||
| 1317 | Q_ASSERT(message.signature() == QLatin1String("ss")); | - | ||||||||||||||||||||||||
| 1318 | QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String("Qt")))); | - | ||||||||||||||||||||||||
| 1319 | return connection.send(reply); never executed: return connection.send(reply); | 0 | ||||||||||||||||||||||||
| 1320 | } | - | ||||||||||||||||||||||||
| 1321 | if (function == QLatin1String("GetVersion")) {
| 0 | ||||||||||||||||||||||||
| 1322 | Q_ASSERT(message.signature() == QLatin1String("ss")); | - | ||||||||||||||||||||||||
| 1323 | QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String(qVersion())))); | - | ||||||||||||||||||||||||
| 1324 | return connection.send(reply); never executed: return connection.send(reply); | 0 | ||||||||||||||||||||||||
| 1325 | } | - | ||||||||||||||||||||||||
| 1326 | if (function == QLatin1String("GetLocale")) {
| 0 | ||||||||||||||||||||||||
| 1327 | Q_ASSERT(message.signature() == QLatin1String("u")); | - | ||||||||||||||||||||||||
| 1328 | QDBusMessage reply = message.createReply(QVariant::fromValue(QLocale().name())); | - | ||||||||||||||||||||||||
| 1329 | return connection.send(reply); never executed: return connection.send(reply); | 0 | ||||||||||||||||||||||||
| 1330 | } | - | ||||||||||||||||||||||||
| 1331 | qAtspiDebug() << "AtSpiAdaptor::applicationInterface " << message.path() << interface << function; never executed: ;never executed: QMessageLogger(__FILE__, 1331, __PRETTY_FUNCTION__).debug() << "AtSpiAdaptor::applicationInterface " << message.path() << interface << function;
| 0 | ||||||||||||||||||||||||
| 1332 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1333 | } | - | ||||||||||||||||||||||||
| 1334 | - | |||||||||||||||||||||||||
| 1335 | /*! | - | ||||||||||||||||||||||||
| 1336 | Register this application as accessible on the accessibility DBus. | - | ||||||||||||||||||||||||
| 1337 | */ | - | ||||||||||||||||||||||||
| 1338 | void AtSpiAdaptor::registerApplication() | - | ||||||||||||||||||||||||
| 1339 | { | - | ||||||||||||||||||||||||
| 1340 | OrgA11yAtspiSocketInterface *registry; | - | ||||||||||||||||||||||||
| 1341 | registry = new OrgA11yAtspiSocketInterface(QLatin1String(QSPI_REGISTRY_NAME), | - | ||||||||||||||||||||||||
| 1342 | QLatin1String(QSPI_OBJECT_PATH_ROOT), m_dbus->connection()); | - | ||||||||||||||||||||||||
| 1343 | - | |||||||||||||||||||||||||
| 1344 | QDBusPendingReply<QSpiObjectReference> reply; | - | ||||||||||||||||||||||||
| 1345 | QSpiObjectReference ref = QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(QSPI_OBJECT_PATH_ROOT)); | - | ||||||||||||||||||||||||
| 1346 | reply = registry->Embed(ref); | - | ||||||||||||||||||||||||
| 1347 | reply.waitForFinished(); // TODO: make this async | - | ||||||||||||||||||||||||
| 1348 | if (reply.isValid ()) {
| 0 | ||||||||||||||||||||||||
| 1349 | const QSpiObjectReference &socket = reply.value(); | - | ||||||||||||||||||||||||
| 1350 | accessibilityRegistry = QSpiObjectReference(socket); | - | ||||||||||||||||||||||||
| 1351 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1352 | qAtspiDebug() << "Error in contacting registry: " never executed: ;never executed: QMessageLogger(__FILE__, 1352, __PRETTY_FUNCTION__).debug() << "Error in contacting registry: " << reply.error().name() << reply.error().message();
| 0 | ||||||||||||||||||||||||
| 1353 | << reply.error().name() never executed: QMessageLogger(__FILE__, 1352, __PRETTY_FUNCTION__).debug() << "Error in contacting registry: " << reply.error().name() << reply.error().message(); | 0 | ||||||||||||||||||||||||
| 1354 | << reply.error().message(); never executed: QMessageLogger(__FILE__, 1352, __PRETTY_FUNCTION__).debug() << "Error in contacting registry: " << reply.error().name() << reply.error().message(); | 0 | ||||||||||||||||||||||||
| 1355 | } | - | ||||||||||||||||||||||||
| 1356 | delete registry; | - | ||||||||||||||||||||||||
| 1357 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1358 | - | |||||||||||||||||||||||||
| 1359 | // Accessible | - | ||||||||||||||||||||||||
| 1360 | bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 1361 | { | - | ||||||||||||||||||||||||
| 1362 | if (function == QLatin1String("GetRole")) {
| 0 | ||||||||||||||||||||||||
| 1363 | sendReply(connection, message, (uint) getRole(interface)); | - | ||||||||||||||||||||||||
| 1364 | } else if (function == QLatin1String("GetName")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1365 | sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->text(QAccessible::Name)))); | - | ||||||||||||||||||||||||
| 1366 | } else if (function == QLatin1String("GetRoleName")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1367 | sendReply(connection, message, qSpiRoleMapping[interface->role()].name()); | - | ||||||||||||||||||||||||
| 1368 | } else if (function == QLatin1String("GetLocalizedRoleName")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1369 | sendReply(connection, message, QVariant::fromValue(qSpiRoleMapping[interface->role()].localizedName())); | - | ||||||||||||||||||||||||
| 1370 | } else if (function == QLatin1String("GetChildCount")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1371 | sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->childCount()))); | - | ||||||||||||||||||||||||
| 1372 | } else if (function == QLatin1String("GetIndexInParent")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1373 | int childIndex = -1; | - | ||||||||||||||||||||||||
| 1374 | QAccessibleInterface * parent = interface->parent(); | - | ||||||||||||||||||||||||
| 1375 | if (parent) {
| 0 | ||||||||||||||||||||||||
| 1376 | childIndex = parent->indexOfChild(interface); | - | ||||||||||||||||||||||||
| 1377 | if (childIndex < 0) {
| 0 | ||||||||||||||||||||||||
| 1378 | qAtspiDebug() << "GetIndexInParent get invalid index: " << childIndex << interface; never executed: ;never executed: QMessageLogger(__FILE__, 1378, __PRETTY_FUNCTION__).debug() << "GetIndexInParent get invalid index: " << childIndex << interface;
| 0 | ||||||||||||||||||||||||
| 1379 | } | - | ||||||||||||||||||||||||
| 1380 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1381 | sendReply(connection, message, childIndex); | - | ||||||||||||||||||||||||
| 1382 | } else if (function == QLatin1String("GetParent")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1383 | QString path; | - | ||||||||||||||||||||||||
| 1384 | QAccessibleInterface * parent = interface->parent(); | - | ||||||||||||||||||||||||
| 1385 | if (!parent) {
| 0 | ||||||||||||||||||||||||
| 1386 | path = QLatin1String(ATSPI_DBUS_PATH_NULL); | - | ||||||||||||||||||||||||
| 1387 | } else if (parent->role() == QAccessible::Application) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1388 | path = QLatin1String(ATSPI_DBUS_PATH_ROOT); | - | ||||||||||||||||||||||||
| 1389 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1390 | path = pathForInterface(parent); | - | ||||||||||||||||||||||||
| 1391 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1392 | // Parent is a property, so it needs to be wrapped inside an extra variant. | - | ||||||||||||||||||||||||
| 1393 | sendReply(connection, message, QVariant::fromValue( | - | ||||||||||||||||||||||||
| 1394 | QDBusVariant(QVariant::fromValue(QSpiObjectReference(connection, QDBusObjectPath(path)))))); | - | ||||||||||||||||||||||||
| 1395 | } else if (function == QLatin1String("GetChildAtIndex")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1396 | int index = message.arguments().first().toInt(); | - | ||||||||||||||||||||||||
| 1397 | if (index < 0) {
| 0 | ||||||||||||||||||||||||
| 1398 | sendReply(connection, message, QVariant::fromValue( | - | ||||||||||||||||||||||||
| 1399 | QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL)))); | - | ||||||||||||||||||||||||
| 1400 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1401 | QAccessibleInterface * childInterface = interface->child(index); | - | ||||||||||||||||||||||||
| 1402 | sendReply(connection, message, QVariant::fromValue( | - | ||||||||||||||||||||||||
| 1403 | QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(childInterface))))); | - | ||||||||||||||||||||||||
| 1404 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1405 | } else if (function == QLatin1String("GetInterfaces")) {
| 0 | ||||||||||||||||||||||||
| 1406 | sendReply(connection, message, accessibleInterfaces(interface)); | - | ||||||||||||||||||||||||
| 1407 | } else if (function == QLatin1String("GetDescription")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1408 | sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->text(QAccessible::Description)))); | - | ||||||||||||||||||||||||
| 1409 | } else if (function == QLatin1String("GetState")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1410 | quint64 spiState = spiStatesFromQState(interface->state()); | - | ||||||||||||||||||||||||
| 1411 | if (interface->tableInterface()) {
| 0 | ||||||||||||||||||||||||
| 1412 | setSpiStateBit(&spiState, ATSPI_STATE_MANAGES_DESCENDANTS); | - | ||||||||||||||||||||||||
| 1413 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1414 | QAccessible::Role role = interface->role(); | - | ||||||||||||||||||||||||
| 1415 | if (role == QAccessible::TreeItem ||
| 0 | ||||||||||||||||||||||||
| 1416 | role == QAccessible::ListItem) {
| 0 | ||||||||||||||||||||||||
| 1417 | /* Transient means libatspi2 will not cache items. | - | ||||||||||||||||||||||||
| 1418 | This is important because when adding/removing an item | - | ||||||||||||||||||||||||
| 1419 | the cache becomes outdated and we don't change the paths of | - | ||||||||||||||||||||||||
| 1420 | items in lists/trees/tables. */ | - | ||||||||||||||||||||||||
| 1421 | setSpiStateBit(&spiState, ATSPI_STATE_TRANSIENT); | - | ||||||||||||||||||||||||
| 1422 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1423 | sendReply(connection, message, | - | ||||||||||||||||||||||||
| 1424 | QVariant::fromValue(spiStateSetFromSpiStates(spiState))); | - | ||||||||||||||||||||||||
| 1425 | } else if (function == QLatin1String("GetAttributes")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1426 | sendReply(connection, message, QVariant::fromValue(QSpiAttributeSet())); | - | ||||||||||||||||||||||||
| 1427 | } else if (function == QLatin1String("GetRelationSet")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1428 | sendReply(connection, message, QVariant::fromValue(relationSet(interface, connection))); | - | ||||||||||||||||||||||||
| 1429 | } else if (function == QLatin1String("GetApplication")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1430 | sendReply(connection, message, QVariant::fromValue( | - | ||||||||||||||||||||||||
| 1431 | QSpiObjectReference(connection, QDBusObjectPath(QSPI_OBJECT_PATH_ROOT)))); | - | ||||||||||||||||||||||||
| 1432 | } else if (function == QLatin1String("GetChildren")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1433 | QSpiObjectReferenceArray children; | - | ||||||||||||||||||||||||
| 1434 | const int numChildren = interface->childCount(); | - | ||||||||||||||||||||||||
| 1435 | children.reserve(numChildren); | - | ||||||||||||||||||||||||
| 1436 | for (int i = 0; i < numChildren; ++i) {
| 0 | ||||||||||||||||||||||||
| 1437 | QString childPath = pathForInterface(interface->child(i)); | - | ||||||||||||||||||||||||
| 1438 | QSpiObjectReference ref(connection, QDBusObjectPath(childPath)); | - | ||||||||||||||||||||||||
| 1439 | children << ref; | - | ||||||||||||||||||||||||
| 1440 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1441 | connection.send(message.createReply(QVariant::fromValue(children))); | - | ||||||||||||||||||||||||
| 1442 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1443 | qAtspiDebug() << "WARNING: AtSpiAdaptor::accessibleInterface does not implement " << function << message.path(); never executed: ;never executed: QMessageLogger(__FILE__, 1443, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::accessibleInterface does not implement " << function << message.path();
| 0 | ||||||||||||||||||||||||
| 1444 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1445 | } | - | ||||||||||||||||||||||||
| 1446 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 1447 | } | - | ||||||||||||||||||||||||
| 1448 | - | |||||||||||||||||||||||||
| 1449 | AtspiRole AtSpiAdaptor::getRole(QAccessibleInterface *interface) const | - | ||||||||||||||||||||||||
| 1450 | { | - | ||||||||||||||||||||||||
| 1451 | if ((interface->role() == QAccessible::EditableText) && interface->state().passwordEdit)
| 0 | ||||||||||||||||||||||||
| 1452 | return ATSPI_ROLE_PASSWORD_TEXT; never executed: return ATSPI_ROLE_PASSWORD_TEXT; | 0 | ||||||||||||||||||||||||
| 1453 | return qSpiRoleMapping[interface->role()].spiRole(); never executed: return qSpiRoleMapping[interface->role()].spiRole(); | 0 | ||||||||||||||||||||||||
| 1454 | } | - | ||||||||||||||||||||||||
| 1455 | - | |||||||||||||||||||||||||
| 1456 | //#define ACCESSIBLE_CREATION_DEBUG | - | ||||||||||||||||||||||||
| 1457 | - | |||||||||||||||||||||||||
| 1458 | QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface) const | - | ||||||||||||||||||||||||
| 1459 | { | - | ||||||||||||||||||||||||
| 1460 | QStringList ifaces; | - | ||||||||||||||||||||||||
| 1461 | #ifdef ACCESSIBLE_CREATION_DEBUG | - | ||||||||||||||||||||||||
| 1462 | qAtspiDebug() << "AtSpiAdaptor::accessibleInterfaces create: " << interface->object(); | - | ||||||||||||||||||||||||
| 1463 | #endif | - | ||||||||||||||||||||||||
| 1464 | ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_ACCESSIBLE); | - | ||||||||||||||||||||||||
| 1465 | - | |||||||||||||||||||||||||
| 1466 | if ( (!interface->rect().isEmpty()) ||
| 0 | ||||||||||||||||||||||||
| 1467 | (interface->object() && interface->object()->isWidgetType()) ||
| 0 | ||||||||||||||||||||||||
| 1468 | (interface->role() == QAccessible::ListItem) ||
| 0 | ||||||||||||||||||||||||
| 1469 | (interface->role() == QAccessible::Cell) ||
| 0 | ||||||||||||||||||||||||
| 1470 | (interface->role() == QAccessible::TreeItem) ||
| 0 | ||||||||||||||||||||||||
| 1471 | (interface->role() == QAccessible::Row) ||
| 0 | ||||||||||||||||||||||||
| 1472 | (interface->object() && interface->object()->inherits("QSGItem"))
| 0 | ||||||||||||||||||||||||
| 1473 | ) { | - | ||||||||||||||||||||||||
| 1474 | ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_COMPONENT); | - | ||||||||||||||||||||||||
| 1475 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1476 | #ifdef ACCESSIBLE_CREATION_DEBUG | - | ||||||||||||||||||||||||
| 1477 | else { | - | ||||||||||||||||||||||||
| 1478 | qAtspiDebug() << " IS NOT a component"; | - | ||||||||||||||||||||||||
| 1479 | } | - | ||||||||||||||||||||||||
| 1480 | #endif | - | ||||||||||||||||||||||||
| 1481 | if (interface->role() == QAccessible::Application)
| 0 | ||||||||||||||||||||||||
| 1482 | ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_APPLICATION); never executed: ifaces << QLatin1String("org.a11y.atspi.Application"); | 0 | ||||||||||||||||||||||||
| 1483 | - | |||||||||||||||||||||||||
| 1484 | if (interface->actionInterface() || interface->valueInterface())
| 0 | ||||||||||||||||||||||||
| 1485 | ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_ACTION); never executed: ifaces << QLatin1String("org.a11y.atspi.Action"); | 0 | ||||||||||||||||||||||||
| 1486 | - | |||||||||||||||||||||||||
| 1487 | if (interface->textInterface())
| 0 | ||||||||||||||||||||||||
| 1488 | ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_TEXT); never executed: ifaces << QLatin1String("org.a11y.atspi.Text"); | 0 | ||||||||||||||||||||||||
| 1489 | - | |||||||||||||||||||||||||
| 1490 | if (interface->editableTextInterface())
| 0 | ||||||||||||||||||||||||
| 1491 | ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_EDITABLE_TEXT); never executed: ifaces << QLatin1String("org.a11y.atspi.EditableText"); | 0 | ||||||||||||||||||||||||
| 1492 | - | |||||||||||||||||||||||||
| 1493 | if (interface->valueInterface())
| 0 | ||||||||||||||||||||||||
| 1494 | ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_VALUE); never executed: ifaces << QLatin1String("org.a11y.atspi.Value"); | 0 | ||||||||||||||||||||||||
| 1495 | - | |||||||||||||||||||||||||
| 1496 | if (interface->tableInterface())
| 0 | ||||||||||||||||||||||||
| 1497 | ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_TABLE); never executed: ifaces << QLatin1String("org.a11y.atspi.Table"); | 0 | ||||||||||||||||||||||||
| 1498 | - | |||||||||||||||||||||||||
| 1499 | return ifaces; never executed: return ifaces; | 0 | ||||||||||||||||||||||||
| 1500 | } | - | ||||||||||||||||||||||||
| 1501 | - | |||||||||||||||||||||||||
| 1502 | QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const | - | ||||||||||||||||||||||||
| 1503 | { | - | ||||||||||||||||||||||||
| 1504 | typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair; | - | ||||||||||||||||||||||||
| 1505 | QVector<RelationPair> relationInterfaces; | - | ||||||||||||||||||||||||
| 1506 | relationInterfaces = interface->relations(); | - | ||||||||||||||||||||||||
| 1507 | - | |||||||||||||||||||||||||
| 1508 | QSpiRelationArray relations; | - | ||||||||||||||||||||||||
| 1509 | Q_FOREACH (const RelationPair &pair, relationInterfaces) { | - | ||||||||||||||||||||||||
| 1510 | // FIXME: this loop seems a bit strange... "related" always have one item when we check. | - | ||||||||||||||||||||||||
| 1511 | //And why is it a list, when it always have one item? And it seems to assume that the QAccessible::Relation enum maps directly to AtSpi | - | ||||||||||||||||||||||||
| 1512 | QSpiObjectReferenceArray related; | - | ||||||||||||||||||||||||
| 1513 | - | |||||||||||||||||||||||||
| 1514 | QDBusObjectPath path = QDBusObjectPath(pathForInterface(pair.first)); | - | ||||||||||||||||||||||||
| 1515 | related.append(QSpiObjectReference(connection, path)); | - | ||||||||||||||||||||||||
| 1516 | - | |||||||||||||||||||||||||
| 1517 | if (!related.isEmpty())
| 0 | ||||||||||||||||||||||||
| 1518 | relations.append(QSpiRelationArrayEntry(qAccessibleRelationToAtSpiRelation(pair.second), related)); never executed: relations.append(QSpiRelationArrayEntry(qAccessibleRelationToAtSpiRelation(pair.second), related)); | 0 | ||||||||||||||||||||||||
| 1519 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1520 | return relations; never executed: return relations; | 0 | ||||||||||||||||||||||||
| 1521 | } | - | ||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||
| 1523 | void AtSpiAdaptor::sendReply(const QDBusConnection &connection, const QDBusMessage &message, const QVariant &argument) const | - | ||||||||||||||||||||||||
| 1524 | { | - | ||||||||||||||||||||||||
| 1525 | QDBusMessage reply = message.createReply(argument); | - | ||||||||||||||||||||||||
| 1526 | connection.send(reply); | - | ||||||||||||||||||||||||
| 1527 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1528 | - | |||||||||||||||||||||||||
| 1529 | - | |||||||||||||||||||||||||
| 1530 | QString AtSpiAdaptor::pathForObject(QObject *object) const | - | ||||||||||||||||||||||||
| 1531 | { | - | ||||||||||||||||||||||||
| 1532 | Q_ASSERT(object); | - | ||||||||||||||||||||||||
| 1533 | - | |||||||||||||||||||||||||
| 1534 | if (inheritsQAction(object)) {
| 0 | ||||||||||||||||||||||||
| 1535 | qAtspiDebug() << "AtSpiAdaptor::pathForObject: warning: creating path with QAction as object."; never executed: ;never executed: QMessageLogger(__FILE__, 1535, __PRETTY_FUNCTION__).debug() << "AtSpiAdaptor::pathForObject: warning: creating path with QAction as object.";
| 0 | ||||||||||||||||||||||||
| 1536 | } | - | ||||||||||||||||||||||||
| 1537 | - | |||||||||||||||||||||||||
| 1538 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(object); | - | ||||||||||||||||||||||||
| 1539 | return pathForInterface(iface); never executed: return pathForInterface(iface); | 0 | ||||||||||||||||||||||||
| 1540 | } | - | ||||||||||||||||||||||||
| 1541 | - | |||||||||||||||||||||||||
| 1542 | QString AtSpiAdaptor::pathForInterface(QAccessibleInterface *interface) const | - | ||||||||||||||||||||||||
| 1543 | { | - | ||||||||||||||||||||||||
| 1544 | if (!interface || !interface->isValid())
| 0 | ||||||||||||||||||||||||
| 1545 | return QLatin1String(ATSPI_DBUS_PATH_NULL); never executed: return QLatin1String("/org/a11y/atspi/null"); | 0 | ||||||||||||||||||||||||
| 1546 | if (interface->role() == QAccessible::Application)
| 0 | ||||||||||||||||||||||||
| 1547 | return QLatin1String(QSPI_OBJECT_PATH_ROOT); never executed: return QLatin1String("/org/a11y/atspi/accessible/" "root"); | 0 | ||||||||||||||||||||||||
| 1548 | - | |||||||||||||||||||||||||
| 1549 | QAccessible::Id id = QAccessible::uniqueId(interface); | - | ||||||||||||||||||||||||
| 1550 | Q_ASSERT((int)id < 0); | - | ||||||||||||||||||||||||
| 1551 | return QLatin1String(QSPI_OBJECT_PATH_PREFIX) + QString::number(id); never executed: return QLatin1String("/org/a11y/atspi/accessible/") + QString::number(id); | 0 | ||||||||||||||||||||||||
| 1552 | } | - | ||||||||||||||||||||||||
| 1553 | - | |||||||||||||||||||||||||
| 1554 | bool AtSpiAdaptor::inheritsQAction(QObject *object) | - | ||||||||||||||||||||||||
| 1555 | { | - | ||||||||||||||||||||||||
| 1556 | const QMetaObject *mo = object->metaObject(); | - | ||||||||||||||||||||||||
| 1557 | while (mo) {
| 0 | ||||||||||||||||||||||||
| 1558 | const QLatin1String cn(mo->className()); | - | ||||||||||||||||||||||||
| 1559 | if (cn == QLatin1String("QAction"))
| 0 | ||||||||||||||||||||||||
| 1560 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 1561 | mo = mo->superClass(); | - | ||||||||||||||||||||||||
| 1562 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1563 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1564 | } | - | ||||||||||||||||||||||||
| 1565 | - | |||||||||||||||||||||||||
| 1566 | // Component | - | ||||||||||||||||||||||||
| 1567 | static QAccessibleInterface * getWindow(QAccessibleInterface * interface) | - | ||||||||||||||||||||||||
| 1568 | { | - | ||||||||||||||||||||||||
| 1569 | if (interface->role() == QAccessible::Window)
| 0 | ||||||||||||||||||||||||
| 1570 | return interface; never executed: return interface; | 0 | ||||||||||||||||||||||||
| 1571 | - | |||||||||||||||||||||||||
| 1572 | QAccessibleInterface * parent = interface->parent(); | - | ||||||||||||||||||||||||
| 1573 | while (parent && parent->role() != QAccessible::Window)
| 0 | ||||||||||||||||||||||||
| 1574 | parent = parent->parent(); never executed: parent = parent->parent(); | 0 | ||||||||||||||||||||||||
| 1575 | - | |||||||||||||||||||||||||
| 1576 | return parent; never executed: return parent; | 0 | ||||||||||||||||||||||||
| 1577 | } | - | ||||||||||||||||||||||||
| 1578 | - | |||||||||||||||||||||||||
| 1579 | static QRect getRelativeRect(QAccessibleInterface *interface) | - | ||||||||||||||||||||||||
| 1580 | { | - | ||||||||||||||||||||||||
| 1581 | QAccessibleInterface * window; | - | ||||||||||||||||||||||||
| 1582 | QRect wr, cr; | - | ||||||||||||||||||||||||
| 1583 | - | |||||||||||||||||||||||||
| 1584 | cr = interface->rect(); | - | ||||||||||||||||||||||||
| 1585 | - | |||||||||||||||||||||||||
| 1586 | window = getWindow(interface); | - | ||||||||||||||||||||||||
| 1587 | if (window) {
| 0 | ||||||||||||||||||||||||
| 1588 | wr = window->rect(); | - | ||||||||||||||||||||||||
| 1589 | - | |||||||||||||||||||||||||
| 1590 | cr.setX(cr.x() - wr.x()); | - | ||||||||||||||||||||||||
| 1591 | cr.setY(cr.x() - wr.y()); | - | ||||||||||||||||||||||||
| 1592 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1593 | return cr; never executed: return cr; | 0 | ||||||||||||||||||||||||
| 1594 | } | - | ||||||||||||||||||||||||
| 1595 | - | |||||||||||||||||||||||||
| 1596 | bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 1597 | { | - | ||||||||||||||||||||||||
| 1598 | if (function == QLatin1String("Contains")) {
| 0 | ||||||||||||||||||||||||
| 1599 | bool ret = false; | - | ||||||||||||||||||||||||
| 1600 | int x = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1601 | int y = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1602 | uint coordType = message.arguments().at(2).toUInt(); | - | ||||||||||||||||||||||||
| 1603 | if (coordType == ATSPI_COORD_TYPE_SCREEN)
| 0 | ||||||||||||||||||||||||
| 1604 | ret = interface->rect().contains(x, y); never executed: ret = interface->rect().contains(x, y); | 0 | ||||||||||||||||||||||||
| 1605 | else | - | ||||||||||||||||||||||||
| 1606 | ret = getRelativeRect(interface).contains(x, y); never executed: ret = getRelativeRect(interface).contains(x, y); | 0 | ||||||||||||||||||||||||
| 1607 | sendReply(connection, message, ret); | - | ||||||||||||||||||||||||
| 1608 | } else if (function == QLatin1String("GetAccessibleAtPoint")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1609 | int x = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1610 | int y = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1611 | uint coordType = message.arguments().at(2).toUInt(); | - | ||||||||||||||||||||||||
| 1612 | Q_UNUSED (coordType) // FIXME | - | ||||||||||||||||||||||||
| 1613 | - | |||||||||||||||||||||||||
| 1614 | QAccessibleInterface * childInterface(interface->childAt(x, y)); | - | ||||||||||||||||||||||||
| 1615 | QAccessibleInterface * iface = 0; | - | ||||||||||||||||||||||||
| 1616 | while (childInterface) {
| 0 | ||||||||||||||||||||||||
| 1617 | iface = childInterface; | - | ||||||||||||||||||||||||
| 1618 | childInterface = iface->childAt(x, y); | - | ||||||||||||||||||||||||
| 1619 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1620 | if (iface) {
| 0 | ||||||||||||||||||||||||
| 1621 | QString path = pathForInterface(iface); | - | ||||||||||||||||||||||||
| 1622 | sendReply(connection, message, QVariant::fromValue( | - | ||||||||||||||||||||||||
| 1623 | QSpiObjectReference(connection, QDBusObjectPath(path)))); | - | ||||||||||||||||||||||||
| 1624 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1625 | sendReply(connection, message, QVariant::fromValue( | - | ||||||||||||||||||||||||
| 1626 | QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL)))); | - | ||||||||||||||||||||||||
| 1627 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1628 | } else if (function == QLatin1String("GetAlpha")) {
| 0 | ||||||||||||||||||||||||
| 1629 | sendReply(connection, message, (double) 1.0); | - | ||||||||||||||||||||||||
| 1630 | } else if (function == QLatin1String("GetExtents")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1631 | uint coordType = message.arguments().at(0).toUInt(); | - | ||||||||||||||||||||||||
| 1632 | sendReply(connection, message, QVariant::fromValue(getExtents(interface, coordType))); | - | ||||||||||||||||||||||||
| 1633 | } else if (function == QLatin1String("GetLayer")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1634 | sendReply(connection, message, QVariant::fromValue((uint)1)); | - | ||||||||||||||||||||||||
| 1635 | } else if (function == QLatin1String("GetMDIZOrder")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1636 | sendReply(connection, message, QVariant::fromValue((short)0)); | - | ||||||||||||||||||||||||
| 1637 | } else if (function == QLatin1String("GetPosition")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1638 | uint coordType = message.arguments().at(0).toUInt(); | - | ||||||||||||||||||||||||
| 1639 | QRect rect; | - | ||||||||||||||||||||||||
| 1640 | if (coordType == ATSPI_COORD_TYPE_SCREEN)
| 0 | ||||||||||||||||||||||||
| 1641 | rect = interface->rect(); never executed: rect = interface->rect(); | 0 | ||||||||||||||||||||||||
| 1642 | else | - | ||||||||||||||||||||||||
| 1643 | rect = getRelativeRect(interface); never executed: rect = getRelativeRect(interface); | 0 | ||||||||||||||||||||||||
| 1644 | QVariantList pos; | - | ||||||||||||||||||||||||
| 1645 | pos << rect.x() << rect.y(); | - | ||||||||||||||||||||||||
| 1646 | connection.send(message.createReply(pos)); | - | ||||||||||||||||||||||||
| 1647 | } else if (function == QLatin1String("GetSize")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1648 | QRect rect = interface->rect(); | - | ||||||||||||||||||||||||
| 1649 | QVariantList size; | - | ||||||||||||||||||||||||
| 1650 | size << rect.width() << rect.height(); | - | ||||||||||||||||||||||||
| 1651 | connection.send(message.createReply(size)); | - | ||||||||||||||||||||||||
| 1652 | } else if (function == QLatin1String("GrabFocus")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1653 | QAccessibleActionInterface *actionIface = interface->actionInterface(); | - | ||||||||||||||||||||||||
| 1654 | if (actionIface && actionIface->actionNames().contains(QAccessibleActionInterface::setFocusAction())) {
| 0 | ||||||||||||||||||||||||
| 1655 | actionIface->doAction(QAccessibleActionInterface::setFocusAction()); | - | ||||||||||||||||||||||||
| 1656 | sendReply(connection, message, true); | - | ||||||||||||||||||||||||
| 1657 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1658 | sendReply(connection, message, false); | - | ||||||||||||||||||||||||
| 1659 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1660 | } else if (function == QLatin1String("SetExtents")) {
| 0 | ||||||||||||||||||||||||
| 1661 | // int x = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1662 | // int y = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1663 | // int width = message.arguments().at(2).toInt(); | - | ||||||||||||||||||||||||
| 1664 | // int height = message.arguments().at(3).toInt(); | - | ||||||||||||||||||||||||
| 1665 | // uint coordinateType = message.arguments().at(4).toUInt(); | - | ||||||||||||||||||||||||
| 1666 | qAtspiDebug() << "SetExtents is not implemented."; never executed: ;never executed: QMessageLogger(__FILE__, 1666, __PRETTY_FUNCTION__).debug() << "SetExtents is not implemented.";
| 0 | ||||||||||||||||||||||||
| 1667 | sendReply(connection, message, false); | - | ||||||||||||||||||||||||
| 1668 | } else if (function == QLatin1String("SetPosition")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1669 | // int x = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1670 | // int y = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1671 | // uint coordinateType = message.arguments().at(2).toUInt(); | - | ||||||||||||||||||||||||
| 1672 | qAtspiDebug() << "SetPosition is not implemented."; never executed: ;never executed: QMessageLogger(__FILE__, 1672, __PRETTY_FUNCTION__).debug() << "SetPosition is not implemented.";
| 0 | ||||||||||||||||||||||||
| 1673 | sendReply(connection, message, false); | - | ||||||||||||||||||||||||
| 1674 | } else if (function == QLatin1String("SetSize")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1675 | // int width = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1676 | // int height = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1677 | qAtspiDebug() << "SetSize is not implemented."; never executed: ;never executed: QMessageLogger(__FILE__, 1677, __PRETTY_FUNCTION__).debug() << "SetSize is not implemented.";
| 0 | ||||||||||||||||||||||||
| 1678 | sendReply(connection, message, false); | - | ||||||||||||||||||||||||
| 1679 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1680 | qAtspiDebug() << "WARNING: AtSpiAdaptor::componentInterface does not implement " << function << message.path(); never executed: ;never executed: QMessageLogger(__FILE__, 1680, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::componentInterface does not implement " << function << message.path();
| 0 | ||||||||||||||||||||||||
| 1681 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1682 | } | - | ||||||||||||||||||||||||
| 1683 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 1684 | } | - | ||||||||||||||||||||||||
| 1685 | - | |||||||||||||||||||||||||
| 1686 | QRect AtSpiAdaptor::getExtents(QAccessibleInterface *interface, uint coordType) | - | ||||||||||||||||||||||||
| 1687 | { | - | ||||||||||||||||||||||||
| 1688 | return (coordType == ATSPI_COORD_TYPE_SCREEN) ? interface->rect() : getRelativeRect(interface); never executed: return (coordType == ATSPI_COORD_TYPE_SCREEN) ? interface->rect() : getRelativeRect(interface);
| 0 | ||||||||||||||||||||||||
| 1689 | } | - | ||||||||||||||||||||||||
| 1690 | - | |||||||||||||||||||||||||
| 1691 | // Action interface | - | ||||||||||||||||||||||||
| 1692 | bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 1693 | { | - | ||||||||||||||||||||||||
| 1694 | if (function == QLatin1String("GetNActions")) {
| 0 | ||||||||||||||||||||||||
| 1695 | int count = QAccessibleBridgeUtils::effectiveActionNames(interface).count(); | - | ||||||||||||||||||||||||
| 1696 | sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(count)))); | - | ||||||||||||||||||||||||
| 1697 | } else if (function == QLatin1String("DoAction")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1698 | int index = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1699 | const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); | - | ||||||||||||||||||||||||
| 1700 | if (index < 0 || index >= actionNames.count())
| 0 | ||||||||||||||||||||||||
| 1701 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1702 | const QString actionName = actionNames.at(index); | - | ||||||||||||||||||||||||
| 1703 | bool success = QAccessibleBridgeUtils::performEffectiveAction(interface, actionName); | - | ||||||||||||||||||||||||
| 1704 | sendReply(connection, message, success); | - | ||||||||||||||||||||||||
| 1705 | } else if (function == QLatin1String("GetActions")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1706 | sendReply(connection, message, QVariant::fromValue(getActions(interface))); | - | ||||||||||||||||||||||||
| 1707 | } else if (function == QLatin1String("GetName")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1708 | int index = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1709 | const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); | - | ||||||||||||||||||||||||
| 1710 | if (index < 0 || index >= actionNames.count())
| 0 | ||||||||||||||||||||||||
| 1711 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1712 | sendReply(connection, message, actionNames.at(index)); | - | ||||||||||||||||||||||||
| 1713 | } else if (function == QLatin1String("GetDescription")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1714 | int index = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1715 | const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); | - | ||||||||||||||||||||||||
| 1716 | if (index < 0 || index >= actionNames.count())
| 0 | ||||||||||||||||||||||||
| 1717 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1718 | QString description; | - | ||||||||||||||||||||||||
| 1719 | if (QAccessibleActionInterface *actionIface = interface->actionInterface())
| 0 | ||||||||||||||||||||||||
| 1720 | description = actionIface->localizedActionDescription(actionNames.at(index)); never executed: description = actionIface->localizedActionDescription(actionNames.at(index)); | 0 | ||||||||||||||||||||||||
| 1721 | else | - | ||||||||||||||||||||||||
| 1722 | description = qAccessibleLocalizedActionDescription(actionNames.at(index)); never executed: description = qAccessibleLocalizedActionDescription(actionNames.at(index)); | 0 | ||||||||||||||||||||||||
| 1723 | sendReply(connection, message, description); | - | ||||||||||||||||||||||||
| 1724 | } else if (function == QLatin1String("GetKeyBinding")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1725 | int index = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1726 | const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); | - | ||||||||||||||||||||||||
| 1727 | if (index < 0 || index >= actionNames.count())
| 0 | ||||||||||||||||||||||||
| 1728 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1729 | QStringList keyBindings; | - | ||||||||||||||||||||||||
| 1730 | if (QAccessibleActionInterface *actionIface = interface->actionInterface())
| 0 | ||||||||||||||||||||||||
| 1731 | keyBindings = actionIface->keyBindingsForAction(actionNames.at(index)); never executed: keyBindings = actionIface->keyBindingsForAction(actionNames.at(index)); | 0 | ||||||||||||||||||||||||
| 1732 | if (keyBindings.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 1733 | QString acc = interface->text(QAccessible::Accelerator); | - | ||||||||||||||||||||||||
| 1734 | if (!acc.isEmpty())
| 0 | ||||||||||||||||||||||||
| 1735 | keyBindings.append(acc); never executed: keyBindings.append(acc); | 0 | ||||||||||||||||||||||||
| 1736 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1737 | if (keyBindings.length() > 0)
| 0 | ||||||||||||||||||||||||
| 1738 | sendReply(connection, message, keyBindings.join(QLatin1Char(';'))); never executed: sendReply(connection, message, keyBindings.join(QLatin1Char(';'))); | 0 | ||||||||||||||||||||||||
| 1739 | else | - | ||||||||||||||||||||||||
| 1740 | sendReply(connection, message, QString()); never executed: sendReply(connection, message, QString()); | 0 | ||||||||||||||||||||||||
| 1741 | } else { | - | ||||||||||||||||||||||||
| 1742 | qAtspiDebug() << "WARNING: AtSpiAdaptor::actionInterface does not implement " << function << message.path(); never executed: ;never executed: QMessageLogger(__FILE__, 1742, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::actionInterface does not implement " << function << message.path();
| 0 | ||||||||||||||||||||||||
| 1743 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1744 | } | - | ||||||||||||||||||||||||
| 1745 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 1746 | } | - | ||||||||||||||||||||||||
| 1747 | - | |||||||||||||||||||||||||
| 1748 | QSpiActionArray AtSpiAdaptor::getActions(QAccessibleInterface *interface) const | - | ||||||||||||||||||||||||
| 1749 | { | - | ||||||||||||||||||||||||
| 1750 | QAccessibleActionInterface *actionInterface = interface->actionInterface(); | - | ||||||||||||||||||||||||
| 1751 | QSpiActionArray actions; | - | ||||||||||||||||||||||||
| 1752 | const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); | - | ||||||||||||||||||||||||
| 1753 | actions.reserve(actionNames.size()); | - | ||||||||||||||||||||||||
| 1754 | Q_FOREACH (const QString &actionName, actionNames) { | - | ||||||||||||||||||||||||
| 1755 | QSpiAction action; | - | ||||||||||||||||||||||||
| 1756 | QStringList keyBindings; | - | ||||||||||||||||||||||||
| 1757 | - | |||||||||||||||||||||||||
| 1758 | action.name = actionName; | - | ||||||||||||||||||||||||
| 1759 | if (actionInterface) {
| 0 | ||||||||||||||||||||||||
| 1760 | action.description = actionInterface->localizedActionDescription(actionName); | - | ||||||||||||||||||||||||
| 1761 | keyBindings = actionInterface->keyBindingsForAction(actionName); | - | ||||||||||||||||||||||||
| 1762 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1763 | action.description = qAccessibleLocalizedActionDescription(actionName); | - | ||||||||||||||||||||||||
| 1764 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1765 | - | |||||||||||||||||||||||||
| 1766 | if (keyBindings.length() > 0)
| 0 | ||||||||||||||||||||||||
| 1767 | action.keyBinding = keyBindings[0]; never executed: action.keyBinding = keyBindings[0]; | 0 | ||||||||||||||||||||||||
| 1768 | else | - | ||||||||||||||||||||||||
| 1769 | action.keyBinding = QString(); never executed: action.keyBinding = QString(); | 0 | ||||||||||||||||||||||||
| 1770 | - | |||||||||||||||||||||||||
| 1771 | actions << action; | - | ||||||||||||||||||||||||
| 1772 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1773 | return actions; never executed: return actions; | 0 | ||||||||||||||||||||||||
| 1774 | } | - | ||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||
| 1776 | // Text interface | - | ||||||||||||||||||||||||
| 1777 | bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 1778 | { | - | ||||||||||||||||||||||||
| 1779 | if (!interface->textInterface())
| 0 | ||||||||||||||||||||||||
| 1780 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1781 | - | |||||||||||||||||||||||||
| 1782 | // properties | - | ||||||||||||||||||||||||
| 1783 | if (function == QLatin1String("GetCaretOffset")) {
| 0 | ||||||||||||||||||||||||
| 1784 | sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(interface->textInterface()->cursorPosition())))); | - | ||||||||||||||||||||||||
| 1785 | } else if (function == QLatin1String("GetCharacterCount")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1786 | sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(interface->textInterface()->characterCount())))); | - | ||||||||||||||||||||||||
| 1787 | - | |||||||||||||||||||||||||
| 1788 | // functions | - | ||||||||||||||||||||||||
| 1789 | } else if (function == QLatin1String("AddSelection")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1790 | int startOffset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1791 | int endOffset = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1792 | int lastSelection = interface->textInterface()->selectionCount(); | - | ||||||||||||||||||||||||
| 1793 | interface->textInterface()->setSelection(lastSelection, startOffset, endOffset); | - | ||||||||||||||||||||||||
| 1794 | sendReply(connection, message, (interface->textInterface()->selectionCount() > lastSelection)); | - | ||||||||||||||||||||||||
| 1795 | } else if (function == QLatin1String("GetAttributeRun")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1796 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1797 | bool includeDefaults = message.arguments().at(1).toBool(); | - | ||||||||||||||||||||||||
| 1798 | Q_UNUSED(includeDefaults) | - | ||||||||||||||||||||||||
| 1799 | connection.send(message.createReply(getAttributes(interface, offset, includeDefaults))); | - | ||||||||||||||||||||||||
| 1800 | } else if (function == QLatin1String("GetAttributeValue")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1801 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1802 | QString attributeName = message.arguments().at(1).toString(); | - | ||||||||||||||||||||||||
| 1803 | connection.send(message.createReply(getAttributeValue(interface, offset, attributeName))); | - | ||||||||||||||||||||||||
| 1804 | } else if (function == QLatin1String("GetAttributes")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1805 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1806 | connection.send(message.createReply(getAttributes(interface, offset, true))); | - | ||||||||||||||||||||||||
| 1807 | } else if (function == QLatin1String("GetBoundedRanges")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1808 | int x = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1809 | int y = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1810 | int width = message.arguments().at(2).toInt(); | - | ||||||||||||||||||||||||
| 1811 | int height = message.arguments().at(3).toInt(); | - | ||||||||||||||||||||||||
| 1812 | uint coordType = message.arguments().at(4).toUInt(); | - | ||||||||||||||||||||||||
| 1813 | uint xClipType = message.arguments().at(5).toUInt(); | - | ||||||||||||||||||||||||
| 1814 | uint yClipType = message.arguments().at(6).toUInt(); | - | ||||||||||||||||||||||||
| 1815 | Q_UNUSED(x) Q_UNUSED (y) Q_UNUSED(width) | - | ||||||||||||||||||||||||
| 1816 | Q_UNUSED(height) Q_UNUSED(coordType) | - | ||||||||||||||||||||||||
| 1817 | Q_UNUSED(xClipType) Q_UNUSED(yClipType) | - | ||||||||||||||||||||||||
| 1818 | qAtspiDebug("Not implemented: QSpiAdaptor::GetBoundedRanges"); never executed: ;never executed: QMessageLogger(__FILE__, 1818, __PRETTY_FUNCTION__).debug("Not implemented: QSpiAdaptor::GetBoundedRanges");
| 0 | ||||||||||||||||||||||||
| 1819 | sendReply(connection, message, QVariant::fromValue(QSpiTextRangeList())); | - | ||||||||||||||||||||||||
| 1820 | } else if (function == QLatin1String("GetCharacterAtOffset")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1821 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1822 | int start; | - | ||||||||||||||||||||||||
| 1823 | int end; | - | ||||||||||||||||||||||||
| 1824 | QString result = interface->textInterface()->textAtOffset(offset, QAccessible::CharBoundary, &start, &end); | - | ||||||||||||||||||||||||
| 1825 | sendReply(connection, message, (int) *(qPrintable (result))); | - | ||||||||||||||||||||||||
| 1826 | } else if (function == QLatin1String("GetCharacterExtents")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1827 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1828 | int coordType = message.arguments().at(1).toUInt(); | - | ||||||||||||||||||||||||
| 1829 | connection.send(message.createReply(getCharacterExtents(interface, offset, coordType))); | - | ||||||||||||||||||||||||
| 1830 | } else if (function == QLatin1String("GetDefaultAttributeSet") || function == QLatin1String("GetDefaultAttributes")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1831 | // GetDefaultAttributes is deprecated in favour of GetDefaultAttributeSet. | - | ||||||||||||||||||||||||
| 1832 | // Empty set seems reasonable. There is no default attribute set. | - | ||||||||||||||||||||||||
| 1833 | sendReply(connection, message, QVariant::fromValue(QSpiAttributeSet())); | - | ||||||||||||||||||||||||
| 1834 | } else if (function == QLatin1String("GetNSelections")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1835 | sendReply(connection, message, interface->textInterface()->selectionCount()); | - | ||||||||||||||||||||||||
| 1836 | } else if (function == QLatin1String("GetOffsetAtPoint")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1837 | qAtspiDebug() << message.signature(); never executed: ;never executed: QMessageLogger(__FILE__, 1837, __PRETTY_FUNCTION__).debug() << message.signature();
| 0 | ||||||||||||||||||||||||
| 1838 | Q_ASSERT(!message.signature().isEmpty()); | - | ||||||||||||||||||||||||
| 1839 | QPoint point(message.arguments().at(0).toInt(), message.arguments().at(1).toInt()); | - | ||||||||||||||||||||||||
| 1840 | uint coordType = message.arguments().at(2).toUInt(); | - | ||||||||||||||||||||||||
| 1841 | if (coordType == ATSPI_COORD_TYPE_WINDOW) {
| 0 | ||||||||||||||||||||||||
| 1842 | QWindow *win = interface->window(); | - | ||||||||||||||||||||||||
| 1843 | point -= QPoint(win->x(), win->y()); | - | ||||||||||||||||||||||||
| 1844 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1845 | int offset = interface->textInterface()->offsetAtPoint(point); | - | ||||||||||||||||||||||||
| 1846 | sendReply(connection, message, offset); | - | ||||||||||||||||||||||||
| 1847 | } else if (function == QLatin1String("GetRangeExtents")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1848 | int startOffset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1849 | int endOffset = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1850 | uint coordType = message.arguments().at(2).toUInt(); | - | ||||||||||||||||||||||||
| 1851 | connection.send(message.createReply(getRangeExtents(interface, startOffset, endOffset, coordType))); | - | ||||||||||||||||||||||||
| 1852 | } else if (function == QLatin1String("GetSelection")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1853 | int selectionNum = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1854 | int start, end; | - | ||||||||||||||||||||||||
| 1855 | interface->textInterface()->selection(selectionNum, &start, &end); | - | ||||||||||||||||||||||||
| 1856 | if (start < 0)
| 0 | ||||||||||||||||||||||||
| 1857 | start = end = interface->textInterface()->cursorPosition(); never executed: start = end = interface->textInterface()->cursorPosition(); | 0 | ||||||||||||||||||||||||
| 1858 | QVariantList sel; | - | ||||||||||||||||||||||||
| 1859 | sel << start << end; | - | ||||||||||||||||||||||||
| 1860 | connection.send(message.createReply(sel)); | - | ||||||||||||||||||||||||
| 1861 | } else if (function == QLatin1String("GetText")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1862 | int startOffset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1863 | int endOffset = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1864 | if (endOffset == -1) // AT-SPI uses -1 to signal all characters
| 0 | ||||||||||||||||||||||||
| 1865 | endOffset = interface->textInterface()->characterCount(); never executed: endOffset = interface->textInterface()->characterCount(); | 0 | ||||||||||||||||||||||||
| 1866 | sendReply(connection, message, interface->textInterface()->text(startOffset, endOffset)); | - | ||||||||||||||||||||||||
| 1867 | } else if (function == QLatin1String("GetTextAfterOffset")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1868 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1869 | int type = message.arguments().at(1).toUInt(); | - | ||||||||||||||||||||||||
| 1870 | int startOffset, endOffset; | - | ||||||||||||||||||||||||
| 1871 | QString text = interface->textInterface()->textAfterOffset(offset, qAccessibleBoundaryType(type), &startOffset, &endOffset); | - | ||||||||||||||||||||||||
| 1872 | QVariantList ret; | - | ||||||||||||||||||||||||
| 1873 | ret << text << startOffset << endOffset; | - | ||||||||||||||||||||||||
| 1874 | connection.send(message.createReply(ret)); | - | ||||||||||||||||||||||||
| 1875 | } else if (function == QLatin1String("GetTextAtOffset")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1876 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1877 | int type = message.arguments().at(1).toUInt(); | - | ||||||||||||||||||||||||
| 1878 | int startOffset, endOffset; | - | ||||||||||||||||||||||||
| 1879 | QString text = interface->textInterface()->textAtOffset(offset, qAccessibleBoundaryType(type), &startOffset, &endOffset); | - | ||||||||||||||||||||||||
| 1880 | QVariantList ret; | - | ||||||||||||||||||||||||
| 1881 | ret << text << startOffset << endOffset; | - | ||||||||||||||||||||||||
| 1882 | connection.send(message.createReply(ret)); | - | ||||||||||||||||||||||||
| 1883 | } else if (function == QLatin1String("GetTextBeforeOffset")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1884 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1885 | int type = message.arguments().at(1).toUInt(); | - | ||||||||||||||||||||||||
| 1886 | int startOffset, endOffset; | - | ||||||||||||||||||||||||
| 1887 | QString text = interface->textInterface()->textBeforeOffset(offset, qAccessibleBoundaryType(type), &startOffset, &endOffset); | - | ||||||||||||||||||||||||
| 1888 | QVariantList ret; | - | ||||||||||||||||||||||||
| 1889 | ret << text << startOffset << endOffset; | - | ||||||||||||||||||||||||
| 1890 | connection.send(message.createReply(ret)); | - | ||||||||||||||||||||||||
| 1891 | } else if (function == QLatin1String("RemoveSelection")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1892 | int selectionNum = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1893 | interface->textInterface()->removeSelection(selectionNum); | - | ||||||||||||||||||||||||
| 1894 | sendReply(connection, message, true); | - | ||||||||||||||||||||||||
| 1895 | } else if (function == QLatin1String("SetCaretOffset")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1896 | int offset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1897 | interface->textInterface()->setCursorPosition(offset); | - | ||||||||||||||||||||||||
| 1898 | sendReply(connection, message, true); | - | ||||||||||||||||||||||||
| 1899 | } else if (function == QLatin1String("SetSelection")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1900 | int selectionNum = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 1901 | int startOffset = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 1902 | int endOffset = message.arguments().at(2).toInt(); | - | ||||||||||||||||||||||||
| 1903 | interface->textInterface()->setSelection(selectionNum, startOffset, endOffset); | - | ||||||||||||||||||||||||
| 1904 | sendReply(connection, message, true); | - | ||||||||||||||||||||||||
| 1905 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1906 | qAtspiDebug() << "WARNING: AtSpiAdaptor::textInterface does not implement " << function << message.path(); never executed: ;never executed: QMessageLogger(__FILE__, 1906, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::textInterface does not implement " << function << message.path();
| 0 | ||||||||||||||||||||||||
| 1907 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1908 | } | - | ||||||||||||||||||||||||
| 1909 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 1910 | } | - | ||||||||||||||||||||||||
| 1911 | - | |||||||||||||||||||||||||
| 1912 | QAccessible::TextBoundaryType AtSpiAdaptor::qAccessibleBoundaryType(int atspiTextBoundaryType) const | - | ||||||||||||||||||||||||
| 1913 | { | - | ||||||||||||||||||||||||
| 1914 | switch (atspiTextBoundaryType) { | - | ||||||||||||||||||||||||
| 1915 | case ATSPI_TEXT_BOUNDARY_CHAR: never executed: case ATSPI_TEXT_BOUNDARY_CHAR: | 0 | ||||||||||||||||||||||||
| 1916 | return QAccessible::CharBoundary; never executed: return QAccessible::CharBoundary; | 0 | ||||||||||||||||||||||||
| 1917 | case ATSPI_TEXT_BOUNDARY_WORD_START: never executed: case ATSPI_TEXT_BOUNDARY_WORD_START: | 0 | ||||||||||||||||||||||||
| 1918 | case ATSPI_TEXT_BOUNDARY_WORD_END: never executed: case ATSPI_TEXT_BOUNDARY_WORD_END: | 0 | ||||||||||||||||||||||||
| 1919 | return QAccessible::WordBoundary; never executed: return QAccessible::WordBoundary; | 0 | ||||||||||||||||||||||||
| 1920 | case ATSPI_TEXT_BOUNDARY_SENTENCE_START: never executed: case ATSPI_TEXT_BOUNDARY_SENTENCE_START: | 0 | ||||||||||||||||||||||||
| 1921 | case ATSPI_TEXT_BOUNDARY_SENTENCE_END: never executed: case ATSPI_TEXT_BOUNDARY_SENTENCE_END: | 0 | ||||||||||||||||||||||||
| 1922 | return QAccessible::SentenceBoundary; never executed: return QAccessible::SentenceBoundary; | 0 | ||||||||||||||||||||||||
| 1923 | case ATSPI_TEXT_BOUNDARY_LINE_START: never executed: case ATSPI_TEXT_BOUNDARY_LINE_START: | 0 | ||||||||||||||||||||||||
| 1924 | case ATSPI_TEXT_BOUNDARY_LINE_END: never executed: case ATSPI_TEXT_BOUNDARY_LINE_END: | 0 | ||||||||||||||||||||||||
| 1925 | return QAccessible::LineBoundary; never executed: return QAccessible::LineBoundary; | 0 | ||||||||||||||||||||||||
| 1926 | } | - | ||||||||||||||||||||||||
| 1927 | Q_ASSERT_X(0, "", "Requested invalid boundary type."); | - | ||||||||||||||||||||||||
| 1928 | return QAccessible::CharBoundary; never executed: return QAccessible::CharBoundary; | 0 | ||||||||||||||||||||||||
| 1929 | } | - | ||||||||||||||||||||||||
| 1930 | - | |||||||||||||||||||||||||
| 1931 | namespace | - | ||||||||||||||||||||||||
| 1932 | { | - | ||||||||||||||||||||||||
| 1933 | struct AtSpiAttribute { | - | ||||||||||||||||||||||||
| 1934 | QString name; | - | ||||||||||||||||||||||||
| 1935 | QString value; | - | ||||||||||||||||||||||||
| 1936 | AtSpiAttribute(const QString &aName, const QString &aValue) : name(aName), value(aValue) {} never executed: end of block | 0 | ||||||||||||||||||||||||
| 1937 | bool isNull() const { return name.isNull() || value.isNull(); } never executed: return name.isNull() || value.isNull();
| 0 | ||||||||||||||||||||||||
| 1938 | }; | - | ||||||||||||||||||||||||
| 1939 | - | |||||||||||||||||||||||||
| 1940 | QString atspiColor(const QString &ia2Color) | - | ||||||||||||||||||||||||
| 1941 | { | - | ||||||||||||||||||||||||
| 1942 | // "rgb(%u,%u,%u)" -> "%u,%u,%u" | - | ||||||||||||||||||||||||
| 1943 | return ia2Color.mid(4, ia2Color.length() - (4+1)); never executed: return ia2Color.mid(4, ia2Color.length() - (4+1)); | 0 | ||||||||||||||||||||||||
| 1944 | } | - | ||||||||||||||||||||||||
| 1945 | - | |||||||||||||||||||||||||
| 1946 | QString atspiSize(const QString &ia2Size) | - | ||||||||||||||||||||||||
| 1947 | { | - | ||||||||||||||||||||||||
| 1948 | // "%fpt" -> "%f" | - | ||||||||||||||||||||||||
| 1949 | return ia2Size.left(ia2Size.length() - 2); never executed: return ia2Size.left(ia2Size.length() - 2); | 0 | ||||||||||||||||||||||||
| 1950 | } | - | ||||||||||||||||||||||||
| 1951 | - | |||||||||||||||||||||||||
| 1952 | AtSpiAttribute atspiTextAttribute(const QString &ia2Name, const QString &ia2Value) | - | ||||||||||||||||||||||||
| 1953 | { | - | ||||||||||||||||||||||||
| 1954 | QString name = ia2Name; | - | ||||||||||||||||||||||||
| 1955 | QString value = ia2Value; | - | ||||||||||||||||||||||||
| 1956 | - | |||||||||||||||||||||||||
| 1957 | // IAccessible2: http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/textattributes | - | ||||||||||||||||||||||||
| 1958 | // ATK attribute names: https://git.gnome.org/browse/orca/tree/src/orca/text_attribute_names.py | - | ||||||||||||||||||||||||
| 1959 | // ATK attribute values: https://developer.gnome.org/atk/unstable/AtkText.html#AtkTextAttribute | - | ||||||||||||||||||||||||
| 1960 | - | |||||||||||||||||||||||||
| 1961 | // https://bugzilla.gnome.org/show_bug.cgi?id=744553 "ATK docs provide no guidance for allowed values of some text attributes" | - | ||||||||||||||||||||||||
| 1962 | // specifically for "weight", "invalid", "language" and value range for colors | - | ||||||||||||||||||||||||
| 1963 | - | |||||||||||||||||||||||||
| 1964 | if (ia2Name == QLatin1String("background-color")) {
| 0 | ||||||||||||||||||||||||
| 1965 | name = QStringLiteral("bg-color"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1966 | value = atspiColor(value); | - | ||||||||||||||||||||||||
| 1967 | } else if (ia2Name == QLatin1String("font-family")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1968 | name = QStringLiteral("family-name"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1969 | } else if (ia2Name == QLatin1String("color")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1970 | name = QStringLiteral("fg-color"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1971 | value = atspiColor(value); | - | ||||||||||||||||||||||||
| 1972 | } else if (ia2Name == QLatin1String("text-align")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1973 | name = QStringLiteral("justification"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1974 | if (value == QLatin1String("justify")) {
| 0 | ||||||||||||||||||||||||
| 1975 | value = QStringLiteral("fill"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1976 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1977 | if (value != QLatin1String("left") &&
| 0 | ||||||||||||||||||||||||
| 1978 | value != QLatin1String("right") &&
| 0 | ||||||||||||||||||||||||
| 1979 | value != QLatin1String("center")
| 0 | ||||||||||||||||||||||||
| 1980 | ) { | - | ||||||||||||||||||||||||
| 1981 | value = QString(); | - | ||||||||||||||||||||||||
| 1982 | qAtspiDebug() << "Unknown text-align attribute value \"" << value << "\" cannot be translated to AT-SPI."; never executed: ;never executed: QMessageLogger(__FILE__, 1982, __PRETTY_FUNCTION__).debug() << "Unknown text-align attribute value \"" << value << "\" cannot be translated to AT-SPI.";
| 0 | ||||||||||||||||||||||||
| 1983 | } | - | ||||||||||||||||||||||||
| 1984 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1985 | } else if (ia2Name == QLatin1String("font-size")) {
| 0 | ||||||||||||||||||||||||
| 1986 | name = QStringLiteral("size"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1987 | value = atspiSize(value); | - | ||||||||||||||||||||||||
| 1988 | } else if (ia2Name == QLatin1String("font-style")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1989 | name = QStringLiteral("style"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1990 | if (value != QLatin1String("normal") &&
| 0 | ||||||||||||||||||||||||
| 1991 | value != QLatin1String("italic") &&
| 0 | ||||||||||||||||||||||||
| 1992 | value != QLatin1String("oblique")
| 0 | ||||||||||||||||||||||||
| 1993 | ) { | - | ||||||||||||||||||||||||
| 1994 | value = QString(); | - | ||||||||||||||||||||||||
| 1995 | qAtspiDebug() << "Unknown font-style attribute value \"" << value << "\" cannot be translated to AT-SPI."; never executed: ;never executed: QMessageLogger(__FILE__, 1995, __PRETTY_FUNCTION__).debug() << "Unknown font-style attribute value \"" << value << "\" cannot be translated to AT-SPI.";
| 0 | ||||||||||||||||||||||||
| 1996 | } | - | ||||||||||||||||||||||||
| 1997 | } else if (ia2Name == QLatin1String("text-underline-type")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1998 | name = QStringLiteral("underline"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1999 | if (value != QLatin1String("none") &&
| 0 | ||||||||||||||||||||||||
| 2000 | value != QLatin1String("single") &&
| 0 | ||||||||||||||||||||||||
| 2001 | value != QLatin1String("double")
| 0 | ||||||||||||||||||||||||
| 2002 | ) { | - | ||||||||||||||||||||||||
| 2003 | value = QString(); | - | ||||||||||||||||||||||||
| 2004 | qAtspiDebug() << "Unknown text-underline-type attribute value \"" << value << "\" cannot be translated to AT-SPI."; never executed: ;never executed: QMessageLogger(__FILE__, 2004, __PRETTY_FUNCTION__).debug() << "Unknown text-underline-type attribute value \"" << value << "\" cannot be translated to AT-SPI.";
| 0 | ||||||||||||||||||||||||
| 2005 | } | - | ||||||||||||||||||||||||
| 2006 | } else if (ia2Name == QLatin1String("font-weight")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2007 | name = QStringLiteral("weight"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 2008 | if (value == QLatin1String("normal"))
| 0 | ||||||||||||||||||||||||
| 2009 | // Orca seems to accept all IAccessible2 values except for "normal" | - | ||||||||||||||||||||||||
| 2010 | // (on which it produces traceback and fails to read any following text attributes), | - | ||||||||||||||||||||||||
| 2011 | // but that is the default value, so omit it anyway | - | ||||||||||||||||||||||||
| 2012 | value = QString(); never executed: value = QString(); | 0 | ||||||||||||||||||||||||
| 2013 | } else if (ia2Name == QLatin1String("text-position")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2014 | name = QStringLiteral("vertical-align"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 2015 | if (value != QLatin1String("baseline") &&
| 0 | ||||||||||||||||||||||||
| 2016 | value != QLatin1String("super") &&
| 0 | ||||||||||||||||||||||||
| 2017 | value != QLatin1String("sub")
| 0 | ||||||||||||||||||||||||
| 2018 | ) { | - | ||||||||||||||||||||||||
| 2019 | value = QString(); | - | ||||||||||||||||||||||||
| 2020 | qAtspiDebug() << "Unknown text-position attribute value \"" << value << "\" cannot be translated to AT-SPI."; never executed: ;never executed: QMessageLogger(__FILE__, 2020, __PRETTY_FUNCTION__).debug() << "Unknown text-position attribute value \"" << value << "\" cannot be translated to AT-SPI.";
| 0 | ||||||||||||||||||||||||
| 2021 | } | - | ||||||||||||||||||||||||
| 2022 | } else if (ia2Name == QLatin1String("writing-mode")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2023 | name = QStringLiteral("direction"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 2024 | if (value == QLatin1String("lr"))
| 0 | ||||||||||||||||||||||||
| 2025 | value = QStringLiteral("ltr"); never executed: value = ([]() -> QString { enum { Size = sizeof(u"" "ltr")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ltr" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 2026 | else if (value == QLatin1String("rl"))
| 0 | ||||||||||||||||||||||||
| 2027 | value = QStringLiteral("rtl"); never executed: value = ([]() -> QString { enum { Size = sizeof(u"" "rtl")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "rtl" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 2028 | else if (value == QLatin1String("tb")) {
| 0 | ||||||||||||||||||||||||
| 2029 | // IAccessible2 docs refer to XSL, which specifies "tb" is shorthand for "tb-rl"; so at least give a hint about the horizontal direction (ATK does not support vertical direction in this attribute (yet)) | - | ||||||||||||||||||||||||
| 2030 | value = QStringLiteral("rtl"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 2031 | qAtspiDebug() << "writing-mode attribute value \"tb\" translated only w.r.t. horizontal direction; vertical direction ignored"; never executed: ;never executed: QMessageLogger(__FILE__, 2031, __PRETTY_FUNCTION__).debug() << "writing-mode attribute value \"tb\" translated only w.r.t. horizontal direction; vertical direction ignored";
| 0 | ||||||||||||||||||||||||
| 2032 | } else { | - | ||||||||||||||||||||||||
| 2033 | value = QString(); | - | ||||||||||||||||||||||||
| 2034 | qAtspiDebug() << "Unknown writing-mode attribute value \"" << value << "\" cannot be translated to AT-SPI."; never executed: ;never executed: QMessageLogger(__FILE__, 2034, __PRETTY_FUNCTION__).debug() << "Unknown writing-mode attribute value \"" << value << "\" cannot be translated to AT-SPI.";
| 0 | ||||||||||||||||||||||||
| 2035 | } | - | ||||||||||||||||||||||||
| 2036 | } else if (ia2Name == QLatin1String("language")) {
| 0 | ||||||||||||||||||||||||
| 2037 | // OK - ATK has no docs on the format of the value, IAccessible2 has reasonable format - leave it at that now | - | ||||||||||||||||||||||||
| 2038 | } else if (ia2Name == QLatin1String("invalid")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2039 | // OK - ATK docs are vague but suggest they support the same range of values as IAccessible2 | - | ||||||||||||||||||||||||
| 2040 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2041 | // attribute we know nothing about | - | ||||||||||||||||||||||||
| 2042 | name = QString(); | - | ||||||||||||||||||||||||
| 2043 | value = QString(); | - | ||||||||||||||||||||||||
| 2044 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2045 | return AtSpiAttribute(name, value); never executed: return AtSpiAttribute(name, value); | 0 | ||||||||||||||||||||||||
| 2046 | } | - | ||||||||||||||||||||||||
| 2047 | } | - | ||||||||||||||||||||||||
| 2048 | - | |||||||||||||||||||||||||
| 2049 | // FIXME all attribute methods below should share code | - | ||||||||||||||||||||||||
| 2050 | QVariantList AtSpiAdaptor::getAttributes(QAccessibleInterface *interface, int offset, bool includeDefaults) const | - | ||||||||||||||||||||||||
| 2051 | { | - | ||||||||||||||||||||||||
| 2052 | Q_UNUSED(includeDefaults); | - | ||||||||||||||||||||||||
| 2053 | - | |||||||||||||||||||||||||
| 2054 | QSpiAttributeSet set; | - | ||||||||||||||||||||||||
| 2055 | int startOffset; | - | ||||||||||||||||||||||||
| 2056 | int endOffset; | - | ||||||||||||||||||||||||
| 2057 | - | |||||||||||||||||||||||||
| 2058 | QString joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset); | - | ||||||||||||||||||||||||
| 2059 | QStringList attributes = joined.split (QLatin1Char(';'), QString::SkipEmptyParts, Qt::CaseSensitive); | - | ||||||||||||||||||||||||
| 2060 | foreach (const QString &attr, attributes) { | - | ||||||||||||||||||||||||
| 2061 | QStringList items; | - | ||||||||||||||||||||||||
| 2062 | items = attr.split(QLatin1Char(':'), QString::SkipEmptyParts, Qt::CaseSensitive); | - | ||||||||||||||||||||||||
| 2063 | AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]); | - | ||||||||||||||||||||||||
| 2064 | if (!attribute.isNull())
| 0 | ||||||||||||||||||||||||
| 2065 | set[attribute.name] = attribute.value; never executed: set[attribute.name] = attribute.value; | 0 | ||||||||||||||||||||||||
| 2066 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2067 | - | |||||||||||||||||||||||||
| 2068 | QVariantList list; | - | ||||||||||||||||||||||||
| 2069 | list << QVariant::fromValue(set) << startOffset << endOffset; | - | ||||||||||||||||||||||||
| 2070 | - | |||||||||||||||||||||||||
| 2071 | return list; never executed: return list; | 0 | ||||||||||||||||||||||||
| 2072 | } | - | ||||||||||||||||||||||||
| 2073 | - | |||||||||||||||||||||||||
| 2074 | QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, int offset, const QString &attributeName) const | - | ||||||||||||||||||||||||
| 2075 | { | - | ||||||||||||||||||||||||
| 2076 | QString mapped; | - | ||||||||||||||||||||||||
| 2077 | QString joined; | - | ||||||||||||||||||||||||
| 2078 | QStringList attributes; | - | ||||||||||||||||||||||||
| 2079 | QSpiAttributeSet map; | - | ||||||||||||||||||||||||
| 2080 | int startOffset; | - | ||||||||||||||||||||||||
| 2081 | int endOffset; | - | ||||||||||||||||||||||||
| 2082 | - | |||||||||||||||||||||||||
| 2083 | joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset); | - | ||||||||||||||||||||||||
| 2084 | attributes = joined.split (QLatin1Char(';'), QString::SkipEmptyParts, Qt::CaseSensitive); | - | ||||||||||||||||||||||||
| 2085 | foreach (const QString& attr, attributes) { | - | ||||||||||||||||||||||||
| 2086 | QStringList items; | - | ||||||||||||||||||||||||
| 2087 | items = attr.split(QLatin1Char(':'), QString::SkipEmptyParts, Qt::CaseSensitive); | - | ||||||||||||||||||||||||
| 2088 | AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]); | - | ||||||||||||||||||||||||
| 2089 | if (!attribute.isNull())
| 0 | ||||||||||||||||||||||||
| 2090 | map[attribute.name] = attribute.value; never executed: map[attribute.name] = attribute.value; | 0 | ||||||||||||||||||||||||
| 2091 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2092 | mapped = map[attributeName]; | - | ||||||||||||||||||||||||
| 2093 | const bool defined = !mapped.isEmpty(); | - | ||||||||||||||||||||||||
| 2094 | QVariantList list; | - | ||||||||||||||||||||||||
| 2095 | list << mapped << startOffset << endOffset << defined; | - | ||||||||||||||||||||||||
| 2096 | return list; never executed: return list; | 0 | ||||||||||||||||||||||||
| 2097 | } | - | ||||||||||||||||||||||||
| 2098 | - | |||||||||||||||||||||||||
| 2099 | QList<QVariant> AtSpiAdaptor::getCharacterExtents(QAccessibleInterface *interface, int offset, uint coordType) const | - | ||||||||||||||||||||||||
| 2100 | { | - | ||||||||||||||||||||||||
| 2101 | QRect rect = interface->textInterface()->characterRect(offset); | - | ||||||||||||||||||||||||
| 2102 | - | |||||||||||||||||||||||||
| 2103 | if (coordType == ATSPI_COORD_TYPE_WINDOW)
| 0 | ||||||||||||||||||||||||
| 2104 | rect = translateRectToWindowCoordinates(interface, rect); never executed: rect = translateRectToWindowCoordinates(interface, rect); | 0 | ||||||||||||||||||||||||
| 2105 | - | |||||||||||||||||||||||||
| 2106 | return QList<QVariant>() << rect.x() << rect.y() << rect.width() << rect.height(); never executed: return QList<QVariant>() << rect.x() << rect.y() << rect.width() << rect.height(); | 0 | ||||||||||||||||||||||||
| 2107 | } | - | ||||||||||||||||||||||||
| 2108 | - | |||||||||||||||||||||||||
| 2109 | QList<QVariant> AtSpiAdaptor::getRangeExtents(QAccessibleInterface *interface, | - | ||||||||||||||||||||||||
| 2110 | int startOffset, int endOffset, uint coordType) const | - | ||||||||||||||||||||||||
| 2111 | { | - | ||||||||||||||||||||||||
| 2112 | if (endOffset == -1)
| 0 | ||||||||||||||||||||||||
| 2113 | endOffset = interface->textInterface()->characterCount(); never executed: endOffset = interface->textInterface()->characterCount(); | 0 | ||||||||||||||||||||||||
| 2114 | - | |||||||||||||||||||||||||
| 2115 | QAccessibleTextInterface *textInterface = interface->textInterface(); | - | ||||||||||||||||||||||||
| 2116 | if (endOffset <= startOffset || !textInterface)
| 0 | ||||||||||||||||||||||||
| 2117 | return QList<QVariant>() << -1 << -1 << 0 << 0; never executed: return QList<QVariant>() << -1 << -1 << 0 << 0; | 0 | ||||||||||||||||||||||||
| 2118 | - | |||||||||||||||||||||||||
| 2119 | QRect rect = textInterface->characterRect(startOffset); | - | ||||||||||||||||||||||||
| 2120 | for (int i=startOffset + 1; i <= endOffset; i++)
| 0 | ||||||||||||||||||||||||
| 2121 | rect = rect | textInterface->characterRect(i); never executed: rect = rect | textInterface->characterRect(i); | 0 | ||||||||||||||||||||||||
| 2122 | - | |||||||||||||||||||||||||
| 2123 | // relative to window | - | ||||||||||||||||||||||||
| 2124 | if (coordType == ATSPI_COORD_TYPE_WINDOW)
| 0 | ||||||||||||||||||||||||
| 2125 | rect = translateRectToWindowCoordinates(interface, rect); never executed: rect = translateRectToWindowCoordinates(interface, rect); | 0 | ||||||||||||||||||||||||
| 2126 | - | |||||||||||||||||||||||||
| 2127 | return QList<QVariant>() << rect.x() << rect.y() << rect.width() << rect.height(); never executed: return QList<QVariant>() << rect.x() << rect.y() << rect.width() << rect.height(); | 0 | ||||||||||||||||||||||||
| 2128 | } | - | ||||||||||||||||||||||||
| 2129 | - | |||||||||||||||||||||||||
| 2130 | QRect AtSpiAdaptor::translateRectToWindowCoordinates(QAccessibleInterface *interface, const QRect &rect) | - | ||||||||||||||||||||||||
| 2131 | { | - | ||||||||||||||||||||||||
| 2132 | QAccessibleInterface * window = getWindow(interface); | - | ||||||||||||||||||||||||
| 2133 | if (window)
| 0 | ||||||||||||||||||||||||
| 2134 | return rect.translated(-window->rect().x(), -window->rect().y()); never executed: return rect.translated(-window->rect().x(), -window->rect().y()); | 0 | ||||||||||||||||||||||||
| 2135 | - | |||||||||||||||||||||||||
| 2136 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||
| 2137 | } | - | ||||||||||||||||||||||||
| 2138 | - | |||||||||||||||||||||||||
| 2139 | - | |||||||||||||||||||||||||
| 2140 | // Editable Text interface | - | ||||||||||||||||||||||||
| 2141 | static QString textForRange(QAccessibleInterface *accessible, int startOffset, int endOffset) | - | ||||||||||||||||||||||||
| 2142 | { | - | ||||||||||||||||||||||||
| 2143 | if (QAccessibleTextInterface *textIface = accessible->textInterface()) {
| 0 | ||||||||||||||||||||||||
| 2144 | if (endOffset == -1)
| 0 | ||||||||||||||||||||||||
| 2145 | endOffset = textIface->characterCount(); never executed: endOffset = textIface->characterCount(); | 0 | ||||||||||||||||||||||||
| 2146 | return textIface->text(startOffset, endOffset); never executed: return textIface->text(startOffset, endOffset); | 0 | ||||||||||||||||||||||||
| 2147 | } | - | ||||||||||||||||||||||||
| 2148 | QString txt = accessible->text(QAccessible::Value); | - | ||||||||||||||||||||||||
| 2149 | if (endOffset == -1)
| 0 | ||||||||||||||||||||||||
| 2150 | endOffset = txt.length(); never executed: endOffset = txt.length(); | 0 | ||||||||||||||||||||||||
| 2151 | return txt.mid(startOffset, endOffset - startOffset); never executed: return txt.mid(startOffset, endOffset - startOffset); | 0 | ||||||||||||||||||||||||
| 2152 | } | - | ||||||||||||||||||||||||
| 2153 | - | |||||||||||||||||||||||||
| 2154 | static void replaceTextFallback(QAccessibleInterface *accessible, long startOffset, long endOffset, const QString &txt) | - | ||||||||||||||||||||||||
| 2155 | { | - | ||||||||||||||||||||||||
| 2156 | QString t = textForRange(accessible, 0, -1); | - | ||||||||||||||||||||||||
| 2157 | if (endOffset == -1)
| 0 | ||||||||||||||||||||||||
| 2158 | endOffset = t.length(); never executed: endOffset = t.length(); | 0 | ||||||||||||||||||||||||
| 2159 | if (endOffset - startOffset == 0)
| 0 | ||||||||||||||||||||||||
| 2160 | t.insert(startOffset, txt); never executed: t.insert(startOffset, txt); | 0 | ||||||||||||||||||||||||
| 2161 | else | - | ||||||||||||||||||||||||
| 2162 | t.replace(startOffset, endOffset - startOffset, txt); never executed: t.replace(startOffset, endOffset - startOffset, txt); | 0 | ||||||||||||||||||||||||
| 2163 | accessible->setText(QAccessible::Value, t); | - | ||||||||||||||||||||||||
| 2164 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2165 | - | |||||||||||||||||||||||||
| 2166 | bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 2167 | { | - | ||||||||||||||||||||||||
| 2168 | if (function == QLatin1String("CopyText")) {
| 0 | ||||||||||||||||||||||||
| 2169 | #ifndef QT_NO_CLIPBOARD | - | ||||||||||||||||||||||||
| 2170 | int startOffset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2171 | int endOffset = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 2172 | const QString t = textForRange(interface, startOffset, endOffset); | - | ||||||||||||||||||||||||
| 2173 | QGuiApplication::clipboard()->setText(t); | - | ||||||||||||||||||||||||
| 2174 | #endif | - | ||||||||||||||||||||||||
| 2175 | connection.send(message.createReply(true)); | - | ||||||||||||||||||||||||
| 2176 | } else if (function == QLatin1String("CutText")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2177 | #ifndef QT_NO_CLIPBOARD | - | ||||||||||||||||||||||||
| 2178 | int startOffset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2179 | int endOffset = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 2180 | const QString t = textForRange(interface, startOffset, endOffset); | - | ||||||||||||||||||||||||
| 2181 | if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
| 0 | ||||||||||||||||||||||||
| 2182 | editableTextIface->deleteText(startOffset, endOffset); never executed: editableTextIface->deleteText(startOffset, endOffset); | 0 | ||||||||||||||||||||||||
| 2183 | else | - | ||||||||||||||||||||||||
| 2184 | replaceTextFallback(interface, startOffset, endOffset, QString()); never executed: replaceTextFallback(interface, startOffset, endOffset, QString()); | 0 | ||||||||||||||||||||||||
| 2185 | QGuiApplication::clipboard()->setText(t); | - | ||||||||||||||||||||||||
| 2186 | #endif | - | ||||||||||||||||||||||||
| 2187 | connection.send(message.createReply(true)); | - | ||||||||||||||||||||||||
| 2188 | } else if (function == QLatin1String("DeleteText")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2189 | int startOffset = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2190 | int endOffset = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 2191 | if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
| 0 | ||||||||||||||||||||||||
| 2192 | editableTextIface->deleteText(startOffset, endOffset); never executed: editableTextIface->deleteText(startOffset, endOffset); | 0 | ||||||||||||||||||||||||
| 2193 | else | - | ||||||||||||||||||||||||
| 2194 | replaceTextFallback(interface, startOffset, endOffset, QString()); never executed: replaceTextFallback(interface, startOffset, endOffset, QString()); | 0 | ||||||||||||||||||||||||
| 2195 | connection.send(message.createReply(true)); | - | ||||||||||||||||||||||||
| 2196 | } else if (function == QLatin1String("InsertText")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2197 | int position = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2198 | QString text = message.arguments().at(1).toString(); | - | ||||||||||||||||||||||||
| 2199 | int length = message.arguments().at(2).toInt(); | - | ||||||||||||||||||||||||
| 2200 | text.resize(length); | - | ||||||||||||||||||||||||
| 2201 | if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
| 0 | ||||||||||||||||||||||||
| 2202 | editableTextIface->insertText(position, text); never executed: editableTextIface->insertText(position, text); | 0 | ||||||||||||||||||||||||
| 2203 | else | - | ||||||||||||||||||||||||
| 2204 | replaceTextFallback(interface, position, position, text); never executed: replaceTextFallback(interface, position, position, text); | 0 | ||||||||||||||||||||||||
| 2205 | connection.send(message.createReply(true)); | - | ||||||||||||||||||||||||
| 2206 | } else if (function == QLatin1String("PasteText")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2207 | #ifndef QT_NO_CLIPBOARD | - | ||||||||||||||||||||||||
| 2208 | int position = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2209 | const QString txt = QGuiApplication::clipboard()->text(); | - | ||||||||||||||||||||||||
| 2210 | if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
| 0 | ||||||||||||||||||||||||
| 2211 | editableTextIface->insertText(position, txt); never executed: editableTextIface->insertText(position, txt); | 0 | ||||||||||||||||||||||||
| 2212 | else | - | ||||||||||||||||||||||||
| 2213 | replaceTextFallback(interface, position, position, txt); never executed: replaceTextFallback(interface, position, position, txt); | 0 | ||||||||||||||||||||||||
| 2214 | #endif | - | ||||||||||||||||||||||||
| 2215 | connection.send(message.createReply(true)); | - | ||||||||||||||||||||||||
| 2216 | } else if (function == QLatin1String("SetTextContents")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2217 | QString newContents = message.arguments().at(0).toString(); | - | ||||||||||||||||||||||||
| 2218 | if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
| 0 | ||||||||||||||||||||||||
| 2219 | editableTextIface->replaceText(0, interface->textInterface()->characterCount(), newContents); never executed: editableTextIface->replaceText(0, interface->textInterface()->characterCount(), newContents); | 0 | ||||||||||||||||||||||||
| 2220 | else | - | ||||||||||||||||||||||||
| 2221 | replaceTextFallback(interface, 0, -1, newContents); never executed: replaceTextFallback(interface, 0, -1, newContents); | 0 | ||||||||||||||||||||||||
| 2222 | connection.send(message.createReply(true)); | - | ||||||||||||||||||||||||
| 2223 | } else if (function == QLatin1String("")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2224 | connection.send(message.createReply()); | - | ||||||||||||||||||||||||
| 2225 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2226 | qAtspiDebug() << "WARNING: AtSpiAdaptor::editableTextInterface does not implement " << function << message.path(); never executed: ;never executed: QMessageLogger(__FILE__, 2226, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::editableTextInterface does not implement " << function << message.path();
| 0 | ||||||||||||||||||||||||
| 2227 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2228 | } | - | ||||||||||||||||||||||||
| 2229 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 2230 | } | - | ||||||||||||||||||||||||
| 2231 | - | |||||||||||||||||||||||||
| 2232 | // Value interface | - | ||||||||||||||||||||||||
| 2233 | bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 2234 | { | - | ||||||||||||||||||||||||
| 2235 | QAccessibleValueInterface *valueIface = interface->valueInterface(); | - | ||||||||||||||||||||||||
| 2236 | if (!valueIface)
| 0 | ||||||||||||||||||||||||
| 2237 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2238 | - | |||||||||||||||||||||||||
| 2239 | if (function == QLatin1String("SetCurrentValue")) {
| 0 | ||||||||||||||||||||||||
| 2240 | QDBusVariant v = message.arguments().at(2).value<QDBusVariant>(); | - | ||||||||||||||||||||||||
| 2241 | double value = v.variant().toDouble(); | - | ||||||||||||||||||||||||
| 2242 | //Temporary fix | - | ||||||||||||||||||||||||
| 2243 | //See https://bugzilla.gnome.org/show_bug.cgi?id=652596 | - | ||||||||||||||||||||||||
| 2244 | valueIface->setCurrentValue(value); | - | ||||||||||||||||||||||||
| 2245 | connection.send(message.createReply()); // FIXME is the reply needed? | - | ||||||||||||||||||||||||
| 2246 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2247 | QVariant value; | - | ||||||||||||||||||||||||
| 2248 | if (function == QLatin1String("GetCurrentValue"))
| 0 | ||||||||||||||||||||||||
| 2249 | value = valueIface->currentValue(); never executed: value = valueIface->currentValue(); | 0 | ||||||||||||||||||||||||
| 2250 | else if (function == QLatin1String("GetMaximumValue"))
| 0 | ||||||||||||||||||||||||
| 2251 | value = valueIface->maximumValue(); never executed: value = valueIface->maximumValue(); | 0 | ||||||||||||||||||||||||
| 2252 | else if (function == QLatin1String("GetMinimumIncrement"))
| 0 | ||||||||||||||||||||||||
| 2253 | value = valueIface->minimumStepSize(); never executed: value = valueIface->minimumStepSize(); | 0 | ||||||||||||||||||||||||
| 2254 | else if (function == QLatin1String("GetMinimumValue"))
| 0 | ||||||||||||||||||||||||
| 2255 | value = valueIface->minimumValue(); never executed: value = valueIface->minimumValue(); | 0 | ||||||||||||||||||||||||
| 2256 | else { | - | ||||||||||||||||||||||||
| 2257 | qAtspiDebug() << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path(); never executed: ;never executed: QMessageLogger(__FILE__, 2257, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path();
| 0 | ||||||||||||||||||||||||
| 2258 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2259 | } | - | ||||||||||||||||||||||||
| 2260 | if (!value.canConvert(QVariant::Double)) {
| 0 | ||||||||||||||||||||||||
| 2261 | qAtspiDebug() << "AtSpiAdaptor::valueInterface: Could not convert to double: " << function; never executed: ;never executed: QMessageLogger(__FILE__, 2261, __PRETTY_FUNCTION__).debug() << "AtSpiAdaptor::valueInterface: Could not convert to double: " << function;
| 0 | ||||||||||||||||||||||||
| 2262 | } | - | ||||||||||||||||||||||||
| 2263 | - | |||||||||||||||||||||||||
| 2264 | // explicitly convert to dbus-variant containing one double since atspi expects that | - | ||||||||||||||||||||||||
| 2265 | // everything else might fail to convert back on the other end | - | ||||||||||||||||||||||||
| 2266 | connection.send(message.createReply( | - | ||||||||||||||||||||||||
| 2267 | QVariant::fromValue(QDBusVariant(QVariant::fromValue(value.toDouble()))))); | - | ||||||||||||||||||||||||
| 2268 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2269 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 2270 | } | - | ||||||||||||||||||||||||
| 2271 | - | |||||||||||||||||||||||||
| 2272 | // Table interface | - | ||||||||||||||||||||||||
| 2273 | bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) | - | ||||||||||||||||||||||||
| 2274 | { | - | ||||||||||||||||||||||||
| 2275 | if (!(interface->tableInterface() || interface->tableCellInterface())) {
| 0 | ||||||||||||||||||||||||
| 2276 | qAtspiDebug() << "WARNING Qt AtSpiAdaptor: Could not find table interface for: " << message.path() << interface; never executed: ;never executed: QMessageLogger(__FILE__, 2276, __PRETTY_FUNCTION__).debug() << "WARNING Qt AtSpiAdaptor: Could not find table interface for: " << message.path() << interface;
| 0 | ||||||||||||||||||||||||
| 2277 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2278 | } | - | ||||||||||||||||||||||||
| 2279 | - | |||||||||||||||||||||||||
| 2280 | if (0) { dead code: { } | - | ||||||||||||||||||||||||
| 2281 | // properties dead code: { } | - | ||||||||||||||||||||||||
| 2282 | } else if (function == QLatin1String("GetCaption")) {
dead code: { } | - | ||||||||||||||||||||||||
| 2283 | QAccessibleInterface * captionInterface= interface->tableInterface()->caption(); | - | ||||||||||||||||||||||||
| 2284 | if (captionInterface) {
| 0 | ||||||||||||||||||||||||
| 2285 | QSpiObjectReference ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(captionInterface))); | - | ||||||||||||||||||||||||
| 2286 | sendReply(connection, message, QVariant::fromValue(ref)); | - | ||||||||||||||||||||||||
| 2287 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2288 | sendReply(connection, message, QVariant::fromValue( | - | ||||||||||||||||||||||||
| 2289 | QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL)))); | - | ||||||||||||||||||||||||
| 2290 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2291 | } else if (function == QLatin1String("GetNColumns")) {
| 0 | ||||||||||||||||||||||||
| 2292 | connection.send(message.createReply(QVariant::fromValue(QDBusVariant( | - | ||||||||||||||||||||||||
| 2293 | QVariant::fromValue(interface->tableInterface()->columnCount()))))); | - | ||||||||||||||||||||||||
| 2294 | } else if (function == QLatin1String("GetNRows")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2295 | connection.send(message.createReply(QVariant::fromValue(QDBusVariant( | - | ||||||||||||||||||||||||
| 2296 | QVariant::fromValue(interface->tableInterface()->rowCount()))))); | - | ||||||||||||||||||||||||
| 2297 | } else if (function == QLatin1String("GetNSelectedColumns")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2298 | connection.send(message.createReply(QVariant::fromValue(QDBusVariant( | - | ||||||||||||||||||||||||
| 2299 | QVariant::fromValue(interface->tableInterface()->selectedColumnCount()))))); | - | ||||||||||||||||||||||||
| 2300 | } else if (function == QLatin1String("GetNSelectedRows")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2301 | connection.send(message.createReply(QVariant::fromValue(QDBusVariant( | - | ||||||||||||||||||||||||
| 2302 | QVariant::fromValue(interface->tableInterface()->selectedRowCount()))))); | - | ||||||||||||||||||||||||
| 2303 | } else if (function == QLatin1String("GetSummary")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2304 | QAccessibleInterface * summary = interface->tableInterface() ? interface->tableInterface()->summary() : 0;
| 0 | ||||||||||||||||||||||||
| 2305 | QSpiObjectReference ref(connection, QDBusObjectPath(pathForInterface(summary))); | - | ||||||||||||||||||||||||
| 2306 | connection.send(message.createReply(QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref))))); | - | ||||||||||||||||||||||||
| 2307 | } else if (function == QLatin1String("GetAccessibleAt")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2308 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2309 | int column = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 2310 | if ((row < 0) ||
| 0 | ||||||||||||||||||||||||
| 2311 | (column < 0) ||
| 0 | ||||||||||||||||||||||||
| 2312 | (row >= interface->tableInterface()->rowCount()) ||
| 0 | ||||||||||||||||||||||||
| 2313 | (column >= interface->tableInterface()->columnCount())) {
| 0 | ||||||||||||||||||||||||
| 2314 | qAtspiDebug() << "WARNING: invalid index for tableInterface GetAccessibleAt (" << row << ", " << column << ')'; never executed: ;never executed: QMessageLogger(__FILE__, 2314, __PRETTY_FUNCTION__).debug() << "WARNING: invalid index for tableInterface GetAccessibleAt (" << row << ", " << column << ')';
| 0 | ||||||||||||||||||||||||
| 2315 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2316 | } | - | ||||||||||||||||||||||||
| 2317 | - | |||||||||||||||||||||||||
| 2318 | QSpiObjectReference ref; | - | ||||||||||||||||||||||||
| 2319 | QAccessibleInterface * cell(interface->tableInterface()->cellAt(row, column)); | - | ||||||||||||||||||||||||
| 2320 | if (cell) {
| 0 | ||||||||||||||||||||||||
| 2321 | ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(cell))); | - | ||||||||||||||||||||||||
| 2322 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2323 | qAtspiDebug() << "WARNING: no cell interface returned for " << interface->object() << row << column; never executed: ;never executed: QMessageLogger(__FILE__, 2323, __PRETTY_FUNCTION__).debug() << "WARNING: no cell interface returned for " << interface->object() << row << column;
| 0 | ||||||||||||||||||||||||
| 2324 | ref = QSpiObjectReference(); | - | ||||||||||||||||||||||||
| 2325 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2326 | connection.send(message.createReply(QVariant::fromValue(ref))); | - | ||||||||||||||||||||||||
| 2327 | - | |||||||||||||||||||||||||
| 2328 | } else if (function == QLatin1String("GetIndexAt")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2329 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2330 | int column = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 2331 | QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, column); | - | ||||||||||||||||||||||||
| 2332 | if (!cell) {
| 0 | ||||||||||||||||||||||||
| 2333 | qAtspiDebug() << "WARNING: AtSpiAdaptor::GetIndexAt(" << row << ',' << column << ") did not find a cell. " << interface; never executed: ;never executed: QMessageLogger(__FILE__, 2333, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::GetIndexAt(" << row << ',' << column << ") did not find a cell. " << interface;
| 0 | ||||||||||||||||||||||||
| 2334 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2335 | } | - | ||||||||||||||||||||||||
| 2336 | int index = interface->indexOfChild(cell); | - | ||||||||||||||||||||||||
| 2337 | qAtspiDebug() << "QSpiAdaptor::GetIndexAt row:" << row << " col:" << column << " logical index:" << index; never executed: ;never executed: QMessageLogger(__FILE__, 2337, __PRETTY_FUNCTION__).debug() << "QSpiAdaptor::GetIndexAt row:" << row << " col:" << column << " logical index:" << index;
| 0 | ||||||||||||||||||||||||
| 2338 | Q_ASSERT(index > 0); | - | ||||||||||||||||||||||||
| 2339 | connection.send(message.createReply(index)); | - | ||||||||||||||||||||||||
| 2340 | } else if ((function == QLatin1String("GetColumnAtIndex")) || (function == QLatin1String("GetRowAtIndex"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2341 | int index = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2342 | int ret = -1; | - | ||||||||||||||||||||||||
| 2343 | if (index >= 0) {
| 0 | ||||||||||||||||||||||||
| 2344 | QAccessibleInterface * cell = interface->child(index); | - | ||||||||||||||||||||||||
| 2345 | if (cell) {
| 0 | ||||||||||||||||||||||||
| 2346 | if (function == QLatin1String("GetColumnAtIndex")) {
| 0 | ||||||||||||||||||||||||
| 2347 | if (cell->role() == QAccessible::ColumnHeader) {
| 0 | ||||||||||||||||||||||||
| 2348 | ret = index; | - | ||||||||||||||||||||||||
| 2349 | } else if (cell->role() == QAccessible::RowHeader) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2350 | ret = -1; | - | ||||||||||||||||||||||||
| 2351 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2352 | if (!cell->tableCellInterface()) {
| 0 | ||||||||||||||||||||||||
| 2353 | qAtspiDebug() << "WARNING: AtSpiAdaptor::" << function << " No table cell interface: " << cell; never executed: ;never executed: QMessageLogger(__FILE__, 2353, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::" << function << " No table cell interface: " << cell;
| 0 | ||||||||||||||||||||||||
| 2354 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2355 | } | - | ||||||||||||||||||||||||
| 2356 | ret = cell->tableCellInterface()->columnIndex(); | - | ||||||||||||||||||||||||
| 2357 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2358 | } else { | - | ||||||||||||||||||||||||
| 2359 | if (cell->role() == QAccessible::ColumnHeader) {
| 0 | ||||||||||||||||||||||||
| 2360 | ret = -1; | - | ||||||||||||||||||||||||
| 2361 | } else if (cell->role() == QAccessible::RowHeader) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2362 | ret = index % interface->tableInterface()->columnCount(); | - | ||||||||||||||||||||||||
| 2363 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2364 | if (!cell->tableCellInterface()) {
| 0 | ||||||||||||||||||||||||
| 2365 | qAtspiDebug() << "WARNING: AtSpiAdaptor::" << function << " No table cell interface: " << cell; never executed: ;never executed: QMessageLogger(__FILE__, 2365, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::" << function << " No table cell interface: " << cell;
| 0 | ||||||||||||||||||||||||
| 2366 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2367 | } | - | ||||||||||||||||||||||||
| 2368 | ret = cell->tableCellInterface()->rowIndex(); | - | ||||||||||||||||||||||||
| 2369 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2370 | } | - | ||||||||||||||||||||||||
| 2371 | } else { | - | ||||||||||||||||||||||||
| 2372 | qAtspiDebug() << "WARNING: AtSpiAdaptor::" << function << " No cell at index: " << index << interface; never executed: ;never executed: QMessageLogger(__FILE__, 2372, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::" << function << " No cell at index: " << index << interface;
| 0 | ||||||||||||||||||||||||
| 2373 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2374 | } | - | ||||||||||||||||||||||||
| 2375 | } | - | ||||||||||||||||||||||||
| 2376 | connection.send(message.createReply(ret)); | - | ||||||||||||||||||||||||
| 2377 | - | |||||||||||||||||||||||||
| 2378 | } else if (function == QLatin1String("GetColumnDescription")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2379 | int column = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2380 | connection.send(message.createReply(interface->tableInterface()->columnDescription(column))); | - | ||||||||||||||||||||||||
| 2381 | } else if (function == QLatin1String("GetRowDescription")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2382 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2383 | connection.send(message.createReply(interface->tableInterface()->rowDescription(row))); | - | ||||||||||||||||||||||||
| 2384 | - | |||||||||||||||||||||||||
| 2385 | - | |||||||||||||||||||||||||
| 2386 | - | |||||||||||||||||||||||||
| 2387 | } else if (function == QLatin1String("GetRowColumnExtentsAtIndex")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2388 | int index = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2389 | bool success = false; | - | ||||||||||||||||||||||||
| 2390 | - | |||||||||||||||||||||||||
| 2391 | int row = -1; | - | ||||||||||||||||||||||||
| 2392 | int col = -1; | - | ||||||||||||||||||||||||
| 2393 | int rowExtents = -1; | - | ||||||||||||||||||||||||
| 2394 | int colExtents = -1; | - | ||||||||||||||||||||||||
| 2395 | bool isSelected = false; | - | ||||||||||||||||||||||||
| 2396 | - | |||||||||||||||||||||||||
| 2397 | int cols = interface->tableInterface()->columnCount(); | - | ||||||||||||||||||||||||
| 2398 | if (cols > 0) {
| 0 | ||||||||||||||||||||||||
| 2399 | row = index / cols; | - | ||||||||||||||||||||||||
| 2400 | col = index % cols; | - | ||||||||||||||||||||||||
| 2401 | QAccessibleTableCellInterface *cell = interface->tableInterface()->cellAt(row, col)->tableCellInterface(); | - | ||||||||||||||||||||||||
| 2402 | if (cell) {
| 0 | ||||||||||||||||||||||||
| 2403 | row = cell->rowIndex(); | - | ||||||||||||||||||||||||
| 2404 | col = cell->columnIndex(); | - | ||||||||||||||||||||||||
| 2405 | rowExtents = cell->rowExtent(); | - | ||||||||||||||||||||||||
| 2406 | colExtents = cell->columnExtent(); | - | ||||||||||||||||||||||||
| 2407 | isSelected = cell->isSelected(); | - | ||||||||||||||||||||||||
| 2408 | success = true; | - | ||||||||||||||||||||||||
| 2409 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2410 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2411 | QVariantList list; | - | ||||||||||||||||||||||||
| 2412 | list << success << row << col << rowExtents << colExtents << isSelected; | - | ||||||||||||||||||||||||
| 2413 | connection.send(message.createReply(list)); | - | ||||||||||||||||||||||||
| 2414 | - | |||||||||||||||||||||||||
| 2415 | } else if (function == QLatin1String("GetColumnExtentAt")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2416 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2417 | int column = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 2418 | connection.send(message.createReply(interface->tableInterface()->cellAt(row, column)->tableCellInterface()->columnExtent())); | - | ||||||||||||||||||||||||
| 2419 | - | |||||||||||||||||||||||||
| 2420 | } else if (function == QLatin1String("GetRowExtentAt")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2421 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2422 | int column = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 2423 | connection.send(message.createReply(interface->tableInterface()->cellAt(row, column)->tableCellInterface()->rowExtent())); | - | ||||||||||||||||||||||||
| 2424 | - | |||||||||||||||||||||||||
| 2425 | } else if (function == QLatin1String("GetColumnHeader")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2426 | int column = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2427 | QSpiObjectReference ref; | - | ||||||||||||||||||||||||
| 2428 | - | |||||||||||||||||||||||||
| 2429 | QAccessibleInterface * cell(interface->tableInterface()->cellAt(0, column)); | - | ||||||||||||||||||||||||
| 2430 | if (cell && cell->tableCellInterface()) {
| 0 | ||||||||||||||||||||||||
| 2431 | QList<QAccessibleInterface*> header = cell->tableCellInterface()->columnHeaderCells(); | - | ||||||||||||||||||||||||
| 2432 | if (header.size() > 0) {
| 0 | ||||||||||||||||||||||||
| 2433 | ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(header.takeAt(0)))); | - | ||||||||||||||||||||||||
| 2434 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2435 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2436 | connection.send(message.createReply(QVariant::fromValue(ref))); | - | ||||||||||||||||||||||||
| 2437 | - | |||||||||||||||||||||||||
| 2438 | } else if (function == QLatin1String("GetRowHeader")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2439 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2440 | QSpiObjectReference ref; | - | ||||||||||||||||||||||||
| 2441 | QAccessibleTableCellInterface *cell = interface->tableInterface()->cellAt(row, 0)->tableCellInterface(); | - | ||||||||||||||||||||||||
| 2442 | if (cell) {
| 0 | ||||||||||||||||||||||||
| 2443 | QList<QAccessibleInterface*> header = cell->rowHeaderCells(); | - | ||||||||||||||||||||||||
| 2444 | if (header.size() > 0) {
| 0 | ||||||||||||||||||||||||
| 2445 | ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(header.takeAt(0)))); | - | ||||||||||||||||||||||||
| 2446 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2447 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2448 | connection.send(message.createReply(QVariant::fromValue(ref))); | - | ||||||||||||||||||||||||
| 2449 | - | |||||||||||||||||||||||||
| 2450 | } else if (function == QLatin1String("GetSelectedColumns")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2451 | connection.send(message.createReply(QVariant::fromValue(interface->tableInterface()->selectedColumns()))); | - | ||||||||||||||||||||||||
| 2452 | } else if (function == QLatin1String("GetSelectedRows")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2453 | connection.send(message.createReply(QVariant::fromValue(interface->tableInterface()->selectedRows()))); | - | ||||||||||||||||||||||||
| 2454 | } else if (function == QLatin1String("IsColumnSelected")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2455 | int column = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2456 | connection.send(message.createReply(interface->tableInterface()->isColumnSelected(column))); | - | ||||||||||||||||||||||||
| 2457 | } else if (function == QLatin1String("IsRowSelected")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2458 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2459 | connection.send(message.createReply(interface->tableInterface()->isRowSelected(row))); | - | ||||||||||||||||||||||||
| 2460 | } else if (function == QLatin1String("IsSelected")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2461 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2462 | int column = message.arguments().at(1).toInt(); | - | ||||||||||||||||||||||||
| 2463 | QAccessibleTableCellInterface* cell = interface->tableInterface()->cellAt(row, column)->tableCellInterface(); | - | ||||||||||||||||||||||||
| 2464 | connection.send(message.createReply(cell->isSelected())); | - | ||||||||||||||||||||||||
| 2465 | } else if (function == QLatin1String("AddColumnSelection")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2466 | int column = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2467 | connection.send(message.createReply(interface->tableInterface()->selectColumn(column))); | - | ||||||||||||||||||||||||
| 2468 | } else if (function == QLatin1String("AddRowSelection")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2469 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2470 | connection.send(message.createReply(interface->tableInterface()->selectRow(row))); | - | ||||||||||||||||||||||||
| 2471 | } else if (function == QLatin1String("RemoveColumnSelection")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2472 | int column = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2473 | connection.send(message.createReply(interface->tableInterface()->unselectColumn(column))); | - | ||||||||||||||||||||||||
| 2474 | } else if (function == QLatin1String("RemoveRowSelection")) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2475 | int row = message.arguments().at(0).toInt(); | - | ||||||||||||||||||||||||
| 2476 | connection.send(message.createReply(interface->tableInterface()->unselectRow(row))); | - | ||||||||||||||||||||||||
| 2477 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2478 | qAtspiDebug() << "WARNING: AtSpiAdaptor::tableInterface does not implement " << function << message.path(); never executed: ;never executed: QMessageLogger(__FILE__, 2478, __PRETTY_FUNCTION__).debug() << "WARNING: AtSpiAdaptor::tableInterface does not implement " << function << message.path();
| 0 | ||||||||||||||||||||||||
| 2479 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2480 | } | - | ||||||||||||||||||||||||
| 2481 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 2482 | } | - | ||||||||||||||||||||||||
| 2483 | - | |||||||||||||||||||||||||
| 2484 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 2485 | #endif //QT_NO_ACCESSIBILITY | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |