[Libreoffice-commits] core.git: vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 2 13:06:03 UTC 2018


 vcl/qt5/Qt5AccessibleWidget.cxx |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 754f3614837ecd7348b241c9000d5f1d15d16947
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Oct 1 15:44:07 2018 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Oct 2 15:05:36 2018 +0200

    Qt5AccessibleWidget: Implement keyBindingsForAction
    
    Change-Id: I53d6d36374fc35eb8370ad6d83723aafb01fb8b4
    Reviewed-on: https://gerrit.libreoffice.org/61199
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index 2d691a2d112c..898123af0711 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -34,9 +34,11 @@
 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
 #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
 
 #include <sal/log.hxx>
 #include <vcl/popupmenuwindow.hxx>
+#include <comphelper/AccessibleImplementationHelper.hxx>
 
 using namespace css;
 using namespace css::accessibility;
@@ -584,9 +586,27 @@ void Qt5AccessibleWidget::doAction(const QString& actionName)
     xAccessibleAction->doAccessibleAction(index);
 }
 
-QStringList Qt5AccessibleWidget::keyBindingsForAction(const QString& /* actionName */) const
+QStringList Qt5AccessibleWidget::keyBindingsForAction(const QString& actionName) const
 {
-    return QStringList();
+    QStringList keyBindings;
+    Reference<XAccessibleAction> xAccessibleAction(m_xAccessible, UNO_QUERY);
+    if (!xAccessibleAction.is())
+        return keyBindings;
+
+    int index = actionNames().indexOf(actionName);
+    if (index == -1)
+        return keyBindings;
+
+    Reference<XAccessibleKeyBinding> xKeyBinding
+        = xAccessibleAction->getAccessibleActionKeyBinding(index);
+
+    int count = xKeyBinding->getAccessibleKeyBindingCount();
+    for (int i = 0; i < count; i++)
+    {
+        Sequence<awt::KeyStroke> keyStroke = xKeyBinding->getAccessibleKeyBinding(i);
+        keyBindings.append(toQString(comphelper::GetkeyBindingStrByXkeyBinding(keyStroke)));
+    }
+    return keyBindings;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list