summaryrefslogtreecommitdiff
path: root/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-06-20 14:05:09 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-08-19 14:22:48 +0200
commitcf621f1b9e472d394bcab922d0a1a205bc539b02 (patch)
tree12394809a73fa1c8faa1a33bb5c54128f3aef6d0 /src/platformsupport/linuxaccessibility/atspiadaptor.cpp
parentae5f2a66720a4bb22c120bd7d1564652cac00367 (diff)
downloadqtbase-cf621f1b9e472d394bcab922d0a1a205bc539b02.tar.gz
Accessibility Linux: add action interfaces for value
Change-Id: I454493fc6e9e93f44d15986ca843c3244f97cbe6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/platformsupport/linuxaccessibility/atspiadaptor.cpp')
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp57
1 files changed, 35 insertions, 22 deletions
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index 48cd01413f..2207ea9968 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -51,6 +51,7 @@
#include "socket_interface.h"
#include "constant_mappings_p.h"
+#include "../accessibility/qaccessiblebridgeutils_p.h"
#include "application_p.h"
/*!
@@ -1485,7 +1486,7 @@ QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface)
if (interface->role() == QAccessible::Application)
ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_APPLICATION);
- if (interface->actionInterface())
+ if (interface->actionInterface() || interface->valueInterface())
ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_ACTION);
if (interface->textInterface())
@@ -1695,36 +1696,44 @@ QRect AtSpiAdaptor::getExtents(QAccessibleInterface *interface, uint coordType)
// Action interface
bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
{
- QAccessibleActionInterface *actionIface = interface->actionInterface();
- if (!actionIface)
- return false;
-
if (function == QLatin1String("GetNActions")) {
- sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(actionIface->actionNames().count()))));
+ int count = QAccessibleBridgeUtils::effectiveActionNames(interface).count();
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(count))));
} else if (function == QLatin1String("DoAction")) {
int index = message.arguments().at(0).toInt();
- if (index < 0 || index >= actionIface->actionNames().count())
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ if (index < 0 || index >= actionNames.count())
return false;
- interface->actionInterface()->doAction(actionIface->actionNames().at(index));
- sendReply(connection, message, true);
+ const QString actionName = actionNames.at(index);
+ bool success = QAccessibleBridgeUtils::performEffectiveAction(interface, actionName);
+ sendReply(connection, message, success);
} else if (function == QLatin1String("GetActions")) {
- sendReply(connection, message, QVariant::fromValue(getActions(actionIface)));
+ sendReply(connection, message, QVariant::fromValue(getActions(interface)));
} else if (function == QLatin1String("GetName")) {
int index = message.arguments().at(0).toInt();
- if (index < 0 || index >= actionIface->actionNames().count())
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ if (index < 0 || index >= actionNames.count())
return false;
- sendReply(connection, message, actionIface->actionNames().at(index));
+ sendReply(connection, message, actionNames.at(index));
} else if (function == QLatin1String("GetDescription")) {
int index = message.arguments().at(0).toInt();
- if (index < 0 || index >= actionIface->actionNames().count())
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ if (index < 0 || index >= actionNames.count())
return false;
- sendReply(connection, message, actionIface->localizedActionDescription(actionIface->actionNames().at(index)));
+ QString description;
+ if (QAccessibleActionInterface *actionIface = interface->actionInterface())
+ description = actionIface->localizedActionDescription(actionNames.at(index));
+ else
+ description = qAccessibleLocalizedActionDescription(actionNames.at(index));
+ sendReply(connection, message, description);
} else if (function == QLatin1String("GetKeyBinding")) {
int index = message.arguments().at(0).toInt();
- if (index < 0 || index >= actionIface->actionNames().count())
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ if (index < 0 || index >= actionNames.count())
return false;
QStringList keyBindings;
- keyBindings = actionIface->keyBindingsForAction(actionIface->actionNames().value(index));
+ if (QAccessibleActionInterface *actionIface = interface->actionInterface())
+ keyBindings = actionIface->keyBindingsForAction(actionNames.at(index));
if (keyBindings.isEmpty()) {
QString acc = interface->text(QAccessible::Accelerator);
if (!acc.isEmpty())
@@ -1741,20 +1750,24 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin
return true;
}
-QSpiActionArray AtSpiAdaptor::getActions(QAccessibleActionInterface *actionInterface) const
+QSpiActionArray AtSpiAdaptor::getActions(QAccessibleInterface *interface) const
{
+ QAccessibleActionInterface *actionInterface = interface->actionInterface();
QSpiActionArray actions;
- Q_FOREACH (const QString &actionName, actionInterface->actionNames()) {
+ Q_FOREACH (const QString &actionName, QAccessibleBridgeUtils::effectiveActionNames(interface)) {
QSpiAction action;
QStringList keyBindings;
action.name = actionName;
- action.description = actionInterface->localizedActionDescription(actionName);
-
- keyBindings = actionInterface->keyBindingsForAction(actionName);
+ if (actionInterface) {
+ action.description = actionInterface->localizedActionDescription(actionName);
+ keyBindings = actionInterface->keyBindingsForAction(actionName);
+ } else {
+ action.description = qAccessibleLocalizedActionDescription(actionName);
+ }
if (keyBindings.length() > 0)
- action.keyBinding = keyBindings[0];
+ action.keyBinding = keyBindings[0];
else
action.keyBinding = QString();