diff options
Diffstat (limited to 'src/platformsupport/linuxaccessibility/atspiadaptor.cpp')
-rw-r--r-- | src/platformsupport/linuxaccessibility/atspiadaptor.cpp | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 84f82cdeda..48cd01413f 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -910,6 +910,11 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) notifyAboutDestruction(event->accessibleInterface()); break; } + case QAccessible::ObjectReorder: { + if (sendObject || sendObject_children_changed) + childrenChanged(event->accessibleInterface()); + break; + } case QAccessible::NameChanged: { if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) { QString path = pathForInterface(event->accessibleInterface()); @@ -1078,16 +1083,14 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) QAccessibleInterface * iface = event->accessibleInterface(); if (!iface || !(iface->role() == QAccessible::Window && (sendWindow || sendWindow_activate))) return; + int isActive = iface->state().active; QString windowTitle = iface->text(QAccessible::Name); QDBusVariant data; data.setVariant(windowTitle); QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(data)); - - QString status = iface->state().active ? QLatin1String("Activate") : QLatin1String("Deactivate"); + QString status = isActive ? QLatin1String("Activate") : QLatin1String("Deactivate"); QString path = pathForInterface(iface); sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_WINDOW), status, args); - - int isActive = iface->state().active; notifyStateChange(iface, QLatin1String("active"), isActive); } else if (stateChange.disabled) { QAccessibleInterface *iface = event->accessibleInterface(); @@ -1150,7 +1153,6 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) case QAccessible::TextAttributeChanged: case QAccessible::TextColumnChanged: case QAccessible::VisibleDataChanged: - case QAccessible::ObjectReorder: case QAccessible::SelectionAdd: case QAccessible::SelectionWithin: case QAccessible::LocationChanged: @@ -1186,6 +1188,17 @@ void AtSpiAdaptor::sendFocusChanged(QAccessibleInterface *interface) const } } +void AtSpiAdaptor::childrenChanged(QAccessibleInterface *interface) const +{ + QString parentPath = pathForInterface(interface); + int childCount = interface->childCount(); + for (int i = 0; i < interface->childCount(); ++i) { + QString childPath = pathForInterface(interface->child(i)); + QVariantList args = packDBusSignalArguments(QLatin1String("add"), childCount, 0, childPath); + sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args); + } +} + void AtSpiAdaptor::notifyAboutCreation(QAccessibleInterface *interface) const { // // say hello to d-bus @@ -1641,13 +1654,13 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt size << rect.width() << rect.height(); connection.send(message.createReply(size)); } else if (function == QLatin1String("GrabFocus")) { -// FIXME: implement focus grabbing -// if (interface->object() && interface->object()->isWidgetType()) { -// QWidget* w = static_cast<QWidget*>(interface->object()); -// w->setFocus(Qt::OtherFocusReason); -// sendReply(connection, message, true); -// } - sendReply(connection, message, false); + QAccessibleActionInterface *actionIface = interface->actionInterface(); + if (actionIface && actionIface->actionNames().contains(QAccessibleActionInterface::setFocusAction())) { + actionIface->doAction(QAccessibleActionInterface::setFocusAction()); + sendReply(connection, message, true); + } else { + sendReply(connection, message, false); + } } else if (function == QLatin1String("SetExtents")) { // int x = message.arguments().at(0).toInt(); // int y = message.arguments().at(1).toInt(); @@ -1952,17 +1965,17 @@ QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, in return list; } -QRect AtSpiAdaptor::getCharacterExtents(QAccessibleInterface *interface, int offset, uint coordType) const +QList<QVariant> AtSpiAdaptor::getCharacterExtents(QAccessibleInterface *interface, int offset, uint coordType) const { QRect rect = interface->textInterface()->characterRect(offset); if (coordType == ATSPI_COORD_TYPE_WINDOW) rect = translateRectToWindowCoordinates(interface, rect); - return rect; + return QList<QVariant>() << rect.x() << rect.y() << rect.width() << rect.height(); } -QRect AtSpiAdaptor::getRangeExtents(QAccessibleInterface *interface, +QList<QVariant> AtSpiAdaptor::getRangeExtents(QAccessibleInterface *interface, int startOffset, int endOffset, uint coordType) const { if (endOffset == -1) @@ -1970,7 +1983,7 @@ QRect AtSpiAdaptor::getRangeExtents(QAccessibleInterface *interface, QAccessibleTextInterface *textInterface = interface->textInterface(); if (endOffset <= startOffset || !textInterface) - return QRect(); + return QList<QVariant>() << -1 << -1 << 0 << 0; QRect rect = textInterface->characterRect(startOffset); for (int i=startOffset + 1; i <= endOffset; i++) @@ -1980,7 +1993,7 @@ QRect AtSpiAdaptor::getRangeExtents(QAccessibleInterface *interface, if (coordType == ATSPI_COORD_TYPE_WINDOW) rect = translateRectToWindowCoordinates(interface, rect); - return rect; + return QList<QVariant>() << rect.x() << rect.y() << rect.width() << rect.height(); } QRect AtSpiAdaptor::translateRectToWindowCoordinates(QAccessibleInterface *interface, const QRect &rect) |