summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-10-06 14:54:49 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-19 19:25:42 +0200
commit4dc25c1f2995a5e02da47f0f6f3522af9eb6f78c (patch)
tree86391ff6c57ed46295df684a4c87ba9db0b73263 /src/plugins/platforms/windows
parent663cd1771883e1e7ac9c1a0dc8b797601b59ba17 (diff)
Refactor QAccessibleActionInterface.
Some refinements done by Jan-Arve Sæther. Change-Id: I99195b3c7273316cfa9c46e451924bbcfddd11a9 Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowsaccessibility.cpp49
1 files changed, 32 insertions, 17 deletions
diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/qwindowsaccessibility.cpp
index 7434071bf3..a344b422a5 100644
--- a/src/plugins/platforms/windows/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/qwindowsaccessibility.cpp
@@ -58,7 +58,7 @@
#include <QtGui/qaccessible.h>
#include <QtGui/qplatformnativeinterface_qpa.h>
#include <QtGui/qwindow.h>
-
+#include <QtGui/qaccessible2.h>
#include <OleAcc.h>
//#include <uiautomationcoreapi.h>
@@ -949,27 +949,35 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accParent(IDispatch** ppdispPa
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
{
+ Q_UNUSED(varID);
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
- return accessible->doAction(DefaultAction, varID.lVal, QVariantList()) ? S_OK : S_FALSE;
+ if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
+ const QString def = actionIface->actionNames().value(0);
+ if (!def.isEmpty()) {
+ actionIface->doAction(def);
+ return S_OK;
+ }
+ }
+ return S_FALSE;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accDefaultAction(VARIANT varID, BSTR* pszDefaultAction)
{
+ Q_UNUSED(varID);
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
- QString def = accessible->actionText(DefaultAction, Name, varID.lVal);
- if (def.isEmpty()) {
- *pszDefaultAction = 0;
- return S_FALSE;
+ *pszDefaultAction = 0;
+ if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
+ const QString def = actionIface->actionNames().value(0);
+ if (!def.isEmpty())
+ *pszDefaultAction = QStringToBSTR(def);
}
-
- *pszDefaultAction = QStringToBSTR(def);
- return S_OK;
+ return *pszDefaultAction ? S_OK : S_FALSE;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accDescription(VARIANT varID, BSTR* pszDescription)
@@ -1011,18 +1019,21 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accHelpTopic(BSTR *, VARIANT,
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accKeyboardShortcut(VARIANT varID, BSTR *pszKeyboardShortcut)
{
+ Q_UNUSED(varID);
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
- QString sc = accessible->text(Accelerator, varID.lVal);
- if (sc.size()) {
- *pszKeyboardShortcut = QStringToBSTR(sc);
- return S_OK;
- }
-
*pszKeyboardShortcut = 0;
- return S_FALSE;
+ if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
+ const QString def = actionIface->actionNames().value(0);
+ if (!def.isEmpty()) {
+ const QString keyBoardShortCut = actionIface->keyBindingsForAction(def).value(0);
+ if (!keyBoardShortCut.isEmpty())
+ *pszKeyboardShortcut = QStringToBSTR(keyBoardShortCut);
+ }
+ }
+ return *pszKeyboardShortcut ? S_OK : S_FALSE;
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accName(VARIANT varID, BSTR* pszName)
@@ -1106,6 +1117,10 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accSelect(long flagsSelect, VARIAN
bool res = false;
+/*
+ ### Check for accessibleTableInterface() or accessibleTextInterface()
+
+ ### and if there are no ia2 interfaces we should do nothing??
if (flagsSelect & SELFLAG_TAKEFOCUS)
res = accessible->doAction(SetFocus, varID.lVal, QVariantList());
if (flagsSelect & SELFLAG_TAKESELECTION) {
@@ -1118,7 +1133,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accSelect(long flagsSelect, VARIAN
res = accessible->doAction(AddToSelection, varID.lVal, QVariantList());
if (flagsSelect & SELFLAG_REMOVESELECTION)
res = accessible->doAction(RemoveSelection, varID.lVal, QVariantList());
-
+*/
return res ? S_OK : S_FALSE;
}