diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-06-07 01:13:25 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-01 19:01:36 +0200 |
commit | b31c9d8c03c471c9bb9296408f1f7ee6a512d3db (patch) | |
tree | b38ae9603099540ad2688d0739cae0c5ab587724 /src/plugins/platforms/cocoa | |
parent | e6a94778d0c26b59e367e9f9fe4f401725fc9c4e (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index b309df6242..9f803e411d 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -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); } } |