Improve accessibility actions descriptions on Mac
authorMorten Johan Sorvig <morten.sorvig@nokia.com>
Thu, 12 Jan 2012 09:14:56 +0000 (10:14 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 17 Jan 2012 18:24:29 +0000 (19:24 +0100)
Use built-in descriptions for built-in actions

Change-Id: Ic5581e89e4568abcc6c3add126d492345d26d87d
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm

index 830e686..ceb60fa 100644 (file)
@@ -195,11 +195,12 @@ static QAccessibleInterface *acast(void *ptr)
 
 - (NSString *)accessibilityActionDescription:(NSString *)action {
     QAccessibleActionInterface *actionInterface = acast(accessibleInterface)->actionInterface();
-    if (actionInterface) {
-        QString qtAction = QCocoaAccessible::translateAction(action);
+    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);
-        if (!description.isEmpty())
-            return qt_mac_QStringToNSString(description);
+        return qt_mac_QStringToNSString(description);
     }
 
     return NSAccessibilityActionDescription(action);