summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-11-06 11:06:16 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-11-07 07:57:58 +0100
commit66fa5aeec5dbeba978f70fe464fbc87c3aba8ed2 (patch)
tree7192770929d1ad3e296b348ab6779667d503a882
parente510da3b0379c63e6ecfefeb7358251591226701 (diff)
qt a11y: Set passwordEdit state for PASSWORD_TEXT
The Qt API doesn't have a separate role to distinguish password edits from other text edits, but has a `passwordEdit` state. Set that state for objects that have role `AccessibleRole::PASSWORD_TEXT`. With this in place, password entries, e.g. the one in the "Tools" -> "Options" -> "Security" -> "Password for Web Connections" -> "Master Password" dialog, are exposed via the `ATSPI_ROLE_PASSWORD_TEXT` role with the qt6 VCL plugin on Linux, because Qt's AT-SPI adapter takes the `passwordEdit` state into account when mapping the Qt a11y roles to AT-SPI ones. [1] [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=c5d9e4a7a78b82ed31e5225c169de4718dfe4f05#n1637 Change-Id: Icb3f0935e703e2786c5704007cad7eea9070f8a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158987 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/qt5/QtAccessibleWidget.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index cba67bc60cc8..cbd750a4da38 100644
--- a/vcl/qt5/QtAccessibleWidget.cxx
+++ b/vcl/qt5/QtAccessibleWidget.cxx
@@ -465,6 +465,8 @@ QAccessible::Role QtAccessibleWidget::role() const
case AccessibleRole::BLOCK_QUOTE:
return QAccessible::Paragraph;
case AccessibleRole::PASSWORD_TEXT:
+ // Qt API doesn't have a separate role to distinguish password edits,
+ // but a 'passwordEdit' state
return QAccessible::EditableText;
case AccessibleRole::POPUP_MENU:
return QAccessible::PopupMenu;
@@ -687,6 +689,9 @@ QAccessible::State QtAccessibleWidget::state() const
lcl_addState(&state, nState);
}
+ if (xAc->getAccessibleRole() == AccessibleRole::PASSWORD_TEXT)
+ state.passwordEdit = true;
+
return state;
}