Merge lp:~gerboland/unity-2d/hud-a11y-fix into lp:unity-2d

Proposed by Gerry Boland
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 955
Merged at revision: 1006
Proposed branch: lp:~gerboland/unity-2d/hud-a11y-fix
Merge into: lp:unity-2d
Diff against target: 79 lines (+17/-1)
4 files modified
libunity-2d-private/src/hud.cpp (+7/-0)
libunity-2d-private/src/hud.h (+1/-0)
shell/hud/ResultItem.qml (+1/-1)
tests/manual-tests/hud.txt (+8/-0)
To merge this branch: bzr merge lp:~gerboland/unity-2d/hud-a11y-fix
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
Paweł Stołowski Pending
Review via email: mp+98395@code.launchpad.net

Commit message

[hud] [a11y] completionText not supplied by HUD for A11Y, so need to convert resultText html to plain text and use that as A11Y string

Description of the change

[hud] [a11y] completionText not supplied by HUD for A11Y, so need to convert resultText html to plain text and use that as A11Y string

Manual test added as infrastructure for Automated testing of A11Y has yet to be assembled.

To post a comment you must log in.
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

works great.
Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libunity-2d-private/src/hud.cpp'
--- libunity-2d-private/src/hud.cpp 2012-02-20 09:12:49 +0000
+++ libunity-2d-private/src/hud.cpp 2012-03-20 11:18:20 +0000
@@ -28,6 +28,7 @@
2828
29// Qt29// Qt
30#include <QDateTime>30#include <QDateTime>
31#include <QTextDocument>
3132
32static const char* HUD_DBUS_SERVICE = "com.canonical.hud";33static const char* HUD_DBUS_SERVICE = "com.canonical.hud";
33static const char* HUD_DBUS_PATH = "/com/canonical/hud";34static const char* HUD_DBUS_PATH = "/com/canonical/hud";
@@ -39,6 +40,7 @@
39 QHash<int, QByteArray> names;40 QHash<int, QByteArray> names;
40 names[ResultIdRole] = "resultId";41 names[ResultIdRole] = "resultId";
41 names[FormattedTextRole] = "formattedText";42 names[FormattedTextRole] = "formattedText";
43 names[PlainTextRole] = "plainText";
42 names[IconNameRole] = "iconName";44 names[IconNameRole] = "iconName";
43 names[ItemIconRole] = "itemIcon";45 names[ItemIconRole] = "itemIcon";
44 names[CompletionTextRole] = "completionText";46 names[CompletionTextRole] = "completionText";
@@ -71,6 +73,7 @@
71 if (!index.isValid() || m_searchQuery.isEmpty()) {73 if (!index.isValid() || m_searchQuery.isEmpty()) {
72 return QVariant();74 return QVariant();
73 }75 }
76 QTextDocument formattedText;
7477
75 std::shared_ptr<unity::hud::Query> result;78 std::shared_ptr<unity::hud::Query> result;
7679
@@ -86,6 +89,10 @@
86 return index.row();89 return index.row();
87 case Hud::FormattedTextRole:90 case Hud::FormattedTextRole:
88 return QString::fromStdString(result->formatted_text);91 return QString::fromStdString(result->formatted_text);
92 /* Work around the fact that HUD does not return plain text results for a11y */
93 case Hud::PlainTextRole:
94 formattedText.setHtml(QString::fromStdString(result->formatted_text));
95 return formattedText.toPlainText();
89 case Hud::IconNameRole:96 case Hud::IconNameRole:
90 return QString::fromStdString(result->icon_name);97 return QString::fromStdString(result->icon_name);
91 case Hud::ItemIconRole:98 case Hud::ItemIconRole:
9299
=== modified file 'libunity-2d-private/src/hud.h'
--- libunity-2d-private/src/hud.h 2012-02-15 18:48:53 +0000
+++ libunity-2d-private/src/hud.h 2012-03-20 11:18:20 +0000
@@ -41,6 +41,7 @@
41 enum Roles {41 enum Roles {
42 ResultIdRole = Qt::UserRole+1,42 ResultIdRole = Qt::UserRole+1,
43 FormattedTextRole,43 FormattedTextRole,
44 PlainTextRole,
44 IconNameRole,45 IconNameRole,
45 ItemIconRole,46 ItemIconRole,
46 CompletionTextRole,47 CompletionTextRole,
4748
=== modified file 'shell/hud/ResultItem.qml'
--- shell/hud/ResultItem.qml 2012-02-16 11:41:43 +0000
+++ shell/hud/ResultItem.qml 2012-03-20 11:18:20 +0000
@@ -23,7 +23,7 @@
23 id: delegate23 id: delegate
24 property string icon: ""24 property string icon: ""
2525
26 Accessible.name: completionText26 Accessible.name: plainText
27 Accessible.role: Accessible.Button27 Accessible.role: Accessible.Button
2828
29 Rectangle {29 Rectangle {
3030
=== modified file 'tests/manual-tests/hud.txt'
--- tests/manual-tests/hud.txt 2012-02-17 15:18:47 +0000
+++ tests/manual-tests/hud.txt 2012-03-20 11:18:20 +0000
@@ -7,3 +7,11 @@
7--> check tile is updated to reflect the app/indicator listed7--> check tile is updated to reflect the app/indicator listed
8--> click on one and ensure the action is performed8--> click on one and ensure the action is performed
9--> Check HUD closes9--> Check HUD closes
10
11----
12 * Enable Accessibility and Orca speech output
13 * Tap Alt key
14 * Enter a few characters
15 * Use arrow keys to navigate up/down through the options returned
16
17--> Check Orca speaks the contents of the results

Subscribers

People subscribed via source and target branches