diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2012-11-03 19:21:12 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-12 15:30:53 +0100 |
commit | 22c234a34e8af6a26b374ef810630ba9e82c696a (patch) | |
tree | ef16e919f2295810d78398a5b7590bd01b6a1dd3 /src/platformsupport/linuxaccessibility/atspiadaptor.cpp | |
parent | 225a8357776dea2fc469bc51fe8b04092b7e84dd (diff) |
Accessible: Improve value interfacev5.0.0-rc2
The stepSize property was missing in Qt 4 and is
a sensible addition to the value interface.
Change-Id: I7571800d50ee7e4194c09c4db40300809a1ce45a
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/platformsupport/linuxaccessibility/atspiadaptor.cpp')
-rw-r--r-- | src/platformsupport/linuxaccessibility/atspiadaptor.cpp | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 6926f546a2..1eda1dfab9 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1049,7 +1049,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) break; } case QAccessible::ValueChanged: { - if (sendObject || sendObject_value_changed) { + if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) { QAIPointer iface = QAIPointer(event->accessibleInterface()); Q_ASSERT(iface->valueInterface()); QString path = pathForInterface(iface); @@ -2093,44 +2093,34 @@ bool AtSpiAdaptor::editableTextInterface(const QAIPointer &interface, const QStr // Value interface bool AtSpiAdaptor::valueInterface(const QAIPointer &interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { - if (0) { - } else if (function == QLatin1String("SetCurrentValue")) { + if (function == QLatin1String("SetCurrentValue")) { QDBusVariant v = message.arguments().at(2).value<QDBusVariant>(); double value = v.variant().toDouble(); //Temporary fix //See https://bugzilla.gnome.org/show_bug.cgi?id=652596 interface->valueInterface()->setCurrentValue(value); connection.send(message.createReply()); // FIXME is the reply needed? - } else if (function == QLatin1String("GetCurrentValue")) { - bool success; - double val = interface->valueInterface()->currentValue().toDouble(&success); - if (!success) { - qAtspiDebug ("AtSpiAdaptor::valueInterface: Could not convert current value to double."); - } - connection.send(message.createReply( - QVariant::fromValue(QDBusVariant(QVariant::fromValue(val))))); - } else if (function == QLatin1String("GetMaximumValue")) { - bool success; - double val = interface->valueInterface()->maximumValue().toDouble(&success); - if (!success) { - qAtspiDebug ("AtSpiAdaptor::valueInterface: Could not convert current value to double."); - } - connection.send(message.createReply( - QVariant::fromValue(QDBusVariant(QVariant::fromValue(val))))); - } else if (function == QLatin1String("GetMinimumIncrement")) { - connection.send(message.createReply( - QVariant::fromValue(QDBusVariant(QVariant::fromValue(0.0))))); - } else if (function == QLatin1String("GetMinimumValue")) { - bool success; - double val = interface->valueInterface()->minimumValue().toDouble(&success); - if (!success) { - qAtspiDebug ("AtSpiAdaptor::valueInterface: Could not convert current value to double."); + } else { + QVariant value; + if (function == QLatin1String("GetCurrentValue")) + value = interface->valueInterface()->currentValue(); + else if (function == QLatin1String("GetMaximumValue")) + value = interface->valueInterface()->maximumValue(); + else if (function == QLatin1String("GetMinimumIncrement")) + value = interface->valueInterface()->minimumStepSize(); + else if (function == QLatin1String("GetMinimumValue")) + value = interface->valueInterface()->minimumValue(); + else { + qAtspiDebug() << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path(); + return false; } + if (!value.canConvert(QVariant::Double)) + qAtspiDebug() << "AtSpiAdaptor::valueInterface: Could not convert to double: " << function; + + // explicitly convert to dbus-variant containing one double since atspi expects that + // everything else might fail to convert back on the other end connection.send(message.createReply( - QVariant::fromValue(QDBusVariant(QVariant::fromValue(val))))); - } else { - qAtspiDebug() << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path(); - return false; + QVariant::fromValue(QDBusVariant(QVariant::fromValue(value.toDouble()))))); } return true; } |