Replace (un)checkAction with toggleAction (1/3)
authorJan-Arve Saether <jan-arve.saether@nokia.com>
Tue, 22 May 2012 06:58:48 +0000 (08:58 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 22 May 2012 07:54:18 +0000 (09:54 +0200)
Add toggleAction to QAccessibleActionInterface.

This change is split into separate modules, thus we have to be careful
of not breaking qtdeclarative, which currently depends (un)checkAction.
Therefore we apply the patches in this order:
1. Add toggleAction to QAccessibleActionInterface (in qtbase)
2. Replace all references to (un)checkAction with toggleAction
   (in qtdeclarative)
3. Remove all references to (un)checkAction (in qtbase)

Change-Id: Ib00fee3139eeabbece97295bc3d713ab119c92e6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/gui/accessible/qaccessible2.cpp
src/gui/accessible/qaccessible2.h

index d3dafb8..5ada74c 100644 (file)
@@ -461,6 +461,7 @@ struct QAccessibleActionStrings
         decreaseAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Decrease"))),
         showMenuAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "ShowMenu"))),
         setFocusAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "SetFocus"))),
+        toggleAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Toggle"))),
         checkAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Check"))),
         uncheckAction(QStringLiteral(QT_TRANSLATE_NOOP("QAccessibleActionInterface", "Uncheck"))) {}
 
@@ -469,6 +470,7 @@ struct QAccessibleActionStrings
     const QString decreaseAction;
     const QString showMenuAction;
     const QString setFocusAction;
+    const QString toggleAction;
     const QString checkAction;
     const QString uncheckAction;
 };
@@ -493,6 +495,8 @@ QString QAccessibleActionInterface::localizedActionDescription(const QString &ac
         return tr("Shows the menu");
     else if (actionName == strings->setFocusAction)
         return tr("Sets the focus");
+    else if (actionName == strings->toggleAction)
+        return tr("Toggles the state");
     else if (actionName == strings->checkAction)
         return tr("Checks the checkbox");
     else if (actionName == strings->uncheckAction)
@@ -547,6 +551,15 @@ const QString &QAccessibleActionInterface::setFocusAction()
 }
 
 /*!
+    Returns the name of the toggle default action.
+    \sa actionNames(), localizedActionName()
+  */
+const QString &QAccessibleActionInterface::toggleAction()
+{
+    return accessibleActionStrings()->toggleAction;
+}
+
+/*!
     Returns the name of the check default action.
     \sa actionNames(), localizedActionName()
   */
index dcac22e..94e5319 100644 (file)
@@ -232,6 +232,7 @@ public:
     static const QString &decreaseAction();
     static const QString &showMenuAction();
     static const QString &setFocusAction();
+    static const QString &toggleAction();
     static const QString &checkAction();
     static const QString &uncheckAction();
 };