Accessibility OS X: Publish synthetic increase and decrease actions

Increase and decrease actions can be generally applied to any value
interface. We therefore make them available regardless of the
existence of any action interface.

Change-Id: If5916c7cfd79812e2139e882a397ac1e040aca78
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
Jan Arve Saether 2014-06-07 01:13:25 +02:00 committed by Frederik Gladhorn
parent e6a94778d0
commit b31c9d8c03

View File

@ -43,7 +43,7 @@
#include "qcocoahelpers.h"
#include "qcocoawindow.h"
#include "private/qaccessiblecache_p.h"
#include <QtPlatformSupport/private/qaccessiblebridgeutils_p.h>
#include <QtGui/qaccessible.h>
#import <AppKit/NSAccessibility.h>
@ -430,15 +430,11 @@
if (!iface)
return nsActions;
QAccessibleActionInterface *actionInterface = iface->actionInterface();
if (actionInterface) {
QStringList supportedActionNames = actionInterface->actionNames();
foreach (const QString &qtAction, supportedActionNames) {
NSString *nsAction = QCocoaAccessible::getTranslatedAction(qtAction);
if (nsAction)
[nsActions addObject : nsAction];
}
const QStringList &supportedActionNames = QAccessibleBridgeUtils::effectiveActionNames(iface);
foreach (const QString &qtAction, supportedActionNames) {
NSString *nsAction = QCocoaAccessible::getTranslatedAction(qtAction);
if (nsAction)
[nsActions addObject : nsAction];
}
return nsActions;
@ -448,27 +444,25 @@
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
if (!iface)
return nil; // FIXME is that the right return type??
QAccessibleActionInterface *actionInterface = iface->actionInterface();
if (actionInterface) {
QString qtAction = QCocoaAccessible::translateAction(action);
// Return a description from the action interface if this action is not known to the OS.
if (qtAction.isEmpty()) {
QString description = actionInterface->localizedActionDescription(qtAction);
return QCFString::toNSString(description);
QString qtAction = QCocoaAccessible::translateAction(action);
QString description;
// Return a description from the action interface if this action is not known to the OS.
if (qtAction.isEmpty()) {
if (QAccessibleActionInterface *actionInterface = iface->actionInterface()) {
qtAction = QString::fromNSString((NSString *)action);
description = actionInterface->localizedActionDescription(qtAction);
}
} else {
description = qAccessibleLocalizedActionDescription(qtAction);
}
return NSAccessibilityActionDescription(action);
return QCFString::toNSString(description);
}
- (void)accessibilityPerformAction:(NSString *)action {
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
if (iface) {
QAccessibleActionInterface *actionInterface = iface->actionInterface();
if (actionInterface) {
actionInterface->doAction(QCocoaAccessible::translateAction(action));
}
const QString qtAction = QCocoaAccessible::translateAction(action);
QAccessibleBridgeUtils::performEffectiveAction(iface, qtAction);
}
}