Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/escapeLittleAmpersand into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Zsombor Egri
Approved revision: 2101
Merged at revision: 2113
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/escapeLittleAmpersand
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 59 lines (+8/-6)
2 files modified
src/UbuntuToolkit/ucaction.cpp (+5/-3)
tests/unit/visual/tst_shortcuts.13.qml (+3/-3)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/escapeLittleAmpersand
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Zsombor Egri Approve
Review via email: mp+305730@code.launchpad.net

Commit message

&& escapes an ampersand used in a mnemonic label

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Oh, nice catch, thank you!!!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/UbuntuToolkit/ucaction.cpp'
2--- src/UbuntuToolkit/ucaction.cpp 2016-09-09 18:16:57 +0000
3+++ src/UbuntuToolkit/ucaction.cpp 2016-09-14 16:13:21 +0000
4@@ -194,10 +194,12 @@
5 *
6 * Mnemonics are shortcuts prefixed in the text with \&. If the text has multiple
7 * occurences of the \& character, the first one will be considered for the shortcut.
8+ * However \&\& can be used for a single \& in the text, not as a mnemonic.
9 * The \& character cannot be used as shortcut.
10 */
11 QString UCAction::text()
12 {
13+ QString displayText(m_text);
14 // if we have a mnemonic, underscore it
15 if (!m_mnemonic.isEmpty()) {
16
17@@ -211,7 +213,6 @@
18 mnemonicIndex = m_text.indexOf(mnemonic);
19 }
20 ACT_TRACE("MNEM" << mnemonic);
21- QString displayText(m_text);
22 // FIXME: we need QInputDeviceInfo to detect the keyboard attechment
23 // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1276808
24 if (QuickUtils::instance()->keyboardAttached()) {
25@@ -220,9 +221,10 @@
26 } else {
27 displayText.remove(mnemonicIndex, 1);
28 }
29- return displayText;
30 }
31- return m_text;
32+ // Escape ampersands
33+ displayText.replace("&&", "&amp;");
34+ return displayText;
35 }
36 void UCAction::setText(const QString &text)
37 {
38
39=== modified file 'tests/unit/visual/tst_shortcuts.13.qml'
40--- tests/unit/visual/tst_shortcuts.13.qml 2016-06-15 13:46:51 +0000
41+++ tests/unit/visual/tst_shortcuts.13.qml 2016-09-14 16:13:21 +0000
42@@ -122,14 +122,14 @@
43 {tag: "HW keyboard, valid '&Save & Exit", kbd: true, text: "&Save & Exit", displayText: "<u>S</u>ave & Exit", key: Qt.Key_S, xfail: false},
44 {tag: "HW keyboard, valid 'Hide &Seek'", kbd: true, text: "Hide&Seek", displayText: "Hide<u>S</u>eek", key: Qt.Key_S, xfail: false},
45 {tag: "HW keyboard, valid 'Save & Exit'", kbd: true, text: "Save & Exit", displayText: "Save <u> </u>Exit", key: Qt.Key_Space, xfail: false},
46- {tag: "HW keyboard, valid 'Paste &&&Proceed'", kbd: true, text: "Paste &&&Proceed", displayText: "Paste &&<u>P</u>roceed", key: Qt.Key_P, xfail: false},
47+ {tag: "HW keyboard, valid 'Paste &&&Proceed'", kbd: true, text: "Paste &&&Proceed", displayText: "Paste &amp;<u>P</u>roceed", key: Qt.Key_P, xfail: false},
48 {tag: "HW keyboard, valid 'Cut &$'", kbd: true, text: "Cut &$", displayText: "Cut <u>$</u>", key: Qt.Key_Dollar, xfail: false},
49 {tag: "HW keyboard, valid 'At &@'", kbd: true, text: "At &@", displayText: "At <u>@</u>", key: Qt.Key_At, xfail: false},
50 {tag: "HW keyboard, valid '&_'", kbd: true, text: "&_", displayText: "<u>_</u>", key: Qt.Key_Underscore, xfail: false},
51
52- {tag: "HW keyboard, invalid '&&Call'", kbd: true, text: "&&Call", displayText: "&&Call", key: Qt.Key_Asterisk, xfail: true},
53+ {tag: "HW keyboard, invalid 'Apps && Scopes'", kbd: true, text: "Apps && Scopes", displayText: "Apps &amp; Scopes", key: Qt.Key_Asterisk, xfail: true},
54 {tag: "HW keyboard, invalid 'Jump &'", kbd: true, text: "Jump &", displayText: "Jump &", key: Qt.Key_Asterisk, xfail: true},
55- {tag: "HW keyboard, invalid '&&'", kbd: true, text: "&&", displayText: "&&", key: Qt.Key_Asterisk, xfail: true},
56+ {tag: "HW keyboard, invalid '&&'", kbd: true, text: "&&", displayText: "&amp;", key: Qt.Key_Asterisk, xfail: true},
57
58 {tag: "no HW keyboard", kbd: false, text: "&Call", displayText: "Call", key: Qt.Key_C, xfail: false},
59 ];

Subscribers

People subscribed via source and target branches