From 679cd99f3d43ac624ad2683f6d3b1b97b3b2cb0d Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 7 May 2014 16:06:22 +0200 Subject: Accessibility: Update ComboBox text on arrow keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use ValueChanged to notify of changes in the ComboBox. On Linux we need to update name and then send selection-changed for Orca. Task-number: QTBUG-36814 Change-Id: Icdd34adddeac532476a6dd910d1e8bd33bcd590b Reviewed-by: Jan Arve Sæther --- .../linuxaccessibility/atspiadaptor.cpp | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/platformsupport/linuxaccessibility/atspiadaptor.cpp') diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 1ccab0a859..0fa1d96242 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1024,15 +1024,28 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) case QAccessible::ValueChanged: { if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) { QAccessibleInterface * iface = event->accessibleInterface(); - if (!iface || !iface->valueInterface()) { - qWarning() << "ValueChanged event from invalid accessible: " << iface; + if (!iface) { + qWarning() << "ValueChanged event from invalid accessible."; return; } - - QString path = pathForInterface(iface); - QVariantList args = packDBusSignalArguments(QLatin1String("accessible-value"), 0, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("PropertyChange"), args); + if (iface->valueInterface()) { + QString path = pathForInterface(iface); + QVariantList args = packDBusSignalArguments(QLatin1String("accessible-value"), 0, 0, variantForPath(path)); + sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), + QLatin1String("PropertyChange"), args); + } else if (iface->role() == QAccessible::ComboBox) { + // Combo Box with AT-SPI likes to be special + // It requires a name-change to update caches and then selection-changed + QString path = pathForInterface(iface); + QVariantList args1 = packDBusSignalArguments(QLatin1String("accessible-name"), 0, 0, variantForPath(path)); + sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), + QLatin1String("PropertyChange"), args1); + QVariantList args2 = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(0)))); + sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), + QLatin1String("SelectionChanged"), args2); + } else { + qWarning() << "ValueChanged event and no ValueInterface or ComboBox: " << iface; + } } break; } -- cgit v1.2.3