Merge lp:~michael-sheldon/ubuntu-keyboard/fix-1281384 into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 159
Merged at revision: 155
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-1281384
Merge into: lp:ubuntu-keyboard
Diff against target: 230 lines (+66/-28)
10 files modified
plugins/pinyin/qml/Keyboard_zh_cn_pinyin.qml (+26/-26)
plugins/pinyin/src/chineselanguagefeatures.cpp (+14/-0)
plugins/pinyin/src/chineselanguagefeatures.h (+2/-0)
plugins/westernsupport/westernlanguagefeatures.cpp (+10/-0)
plugins/westernsupport/westernlanguagefeatures.h (+2/-0)
src/lib/logic/abstractlanguagefeatures.h (+2/-0)
src/plugin/inputmethod.cpp (+4/-2)
tests/unittests/common/wordengineprobe.h (+2/-0)
tests/unittests/ut_editor/wordengineprobe.h (+2/-0)
tests/unittests/ut_word-candidates/wordengineprobe.h (+2/-0)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-1281384
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+215653@code.launchpad.net

Commit message

Implement capital letters for Pinyin keyboard, ignore auto-capitalisation and always display word ribbon when using Pinyin regardless of input hints.

Description of the change

Implement capital letters for Pinyin keyboard, ignore auto-capitalisation and always display word ribbon when using Pinyin regardless of input hints.

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Looking at this I think there might be a better way of handling the disabling of the capitalisation through the language features so it doesn't need a special case in the input method, so I'll take another look at this before it's ready for review.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
159. By Michael Sheldon

Merge changes from trunk

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-keyboard) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No changes

If you changed the packaging (debian), did you subscribe a core-dev to this MP?

 * No changes

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?
yes

Did CI run pass? If not, please explain why.
yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/pinyin/qml/Keyboard_zh_cn_pinyin.qml'
2--- plugins/pinyin/qml/Keyboard_zh_cn_pinyin.qml 2013-12-12 16:26:16 +0000
3+++ plugins/pinyin/qml/Keyboard_zh_cn_pinyin.qml 2014-04-15 14:40:35 +0000
4@@ -32,31 +32,31 @@
5 anchors.horizontalCenter: parent.horizontalCenter;
6 spacing: 0
7
8- CharKey { label: "q"; }
9- CharKey { label: "w"; }
10- CharKey { label: "e"; }
11- CharKey { label: "r"; }
12- CharKey { label: "t"; }
13- CharKey { label: "y"; }
14- CharKey { label: "u"; }
15- CharKey { label: "i"; }
16- CharKey { label: "o"; }
17- CharKey { label: "p"; }
18+ CharKey { label: "q"; shifted: "Q"; }
19+ CharKey { label: "w"; shifted: "W"; }
20+ CharKey { label: "e"; shifted: "E"; }
21+ CharKey { label: "r"; shifted: "R"; }
22+ CharKey { label: "t"; shifted: "T"; }
23+ CharKey { label: "y"; shifted: "Y"; }
24+ CharKey { label: "u"; shifted: "U"; }
25+ CharKey { label: "i"; shifted: "I"; }
26+ CharKey { label: "o"; shifted: "O"; }
27+ CharKey { label: "p"; shifted: "P"; }
28 }
29
30 Row {
31 anchors.horizontalCenter: parent.horizontalCenter;
32 spacing: 0
33
34- CharKey { label: "a"; }
35- CharKey { label: "s"; }
36- CharKey { label: "d"; }
37- CharKey { label: "f"; }
38- CharKey { label: "g"; }
39- CharKey { label: "h"; }
40- CharKey { label: "j"; }
41- CharKey { label: "k"; }
42- CharKey { label: "l"; }
43+ CharKey { label: "a"; shifted: "A"; }
44+ CharKey { label: "s"; shifted: "S"; }
45+ CharKey { label: "d"; shifted: "D"; }
46+ CharKey { label: "f"; shifted: "F"; }
47+ CharKey { label: "g"; shifted: "G"; }
48+ CharKey { label: "h"; shifted: "H"; }
49+ CharKey { label: "j"; shifted: "J"; }
50+ CharKey { label: "k"; shifted: "K"; }
51+ CharKey { label: "l"; shifted: "L"; }
52 }
53
54 Row {
55@@ -64,13 +64,13 @@
56 spacing: 0
57
58 ShiftKey {}
59- CharKey { label: "z"; }
60- CharKey { label: "x"; }
61- CharKey { label: "c"; }
62- CharKey { label: "v"; }
63- CharKey { label: "b"; }
64- CharKey { label: "n"; }
65- CharKey { label: "m"; }
66+ CharKey { label: "z"; shifted: "Z"; }
67+ CharKey { label: "x"; shifted: "X"; }
68+ CharKey { label: "c"; shifted: "C"; }
69+ CharKey { label: "v"; shifted: "V"; }
70+ CharKey { label: "b"; shifted: "B"; }
71+ CharKey { label: "n"; shifted: "N"; }
72+ CharKey { label: "m"; shifted: "M"; }
73 BackspaceKey {}
74 }
75
76
77=== modified file 'plugins/pinyin/src/chineselanguagefeatures.cpp'
78--- plugins/pinyin/src/chineselanguagefeatures.cpp 2013-12-12 16:26:16 +0000
79+++ plugins/pinyin/src/chineselanguagefeatures.cpp 2014-04-15 14:40:35 +0000
80@@ -25,6 +25,20 @@
81 {
82 }
83
84+bool ChineseLanguageFeatures::alwaysShowSuggestions() const
85+{
86+ // Pinyin characters can only be entered via suggestions, so we ignore
87+ // hints that would otherwise disable them.
88+ return true;
89+}
90+
91+bool ChineseLanguageFeatures::autoCapsAvailable() const
92+{
93+ // Automatic switching to capital letters doen't make sense when
94+ // inputting Pinyin
95+ return false;
96+}
97+
98 bool ChineseLanguageFeatures::activateAutoCaps(const QString &preedit) const
99 {
100 Q_UNUSED(preedit)
101
102=== modified file 'plugins/pinyin/src/chineselanguagefeatures.h'
103--- plugins/pinyin/src/chineselanguagefeatures.h 2013-12-12 16:26:16 +0000
104+++ plugins/pinyin/src/chineselanguagefeatures.h 2014-04-15 14:40:35 +0000
105@@ -27,6 +27,8 @@
106 explicit ChineseLanguageFeatures(QObject *parent = 0);
107 virtual ~ChineseLanguageFeatures();
108
109+ virtual bool alwaysShowSuggestions() const;
110+ virtual bool autoCapsAvailable() const;
111 virtual bool activateAutoCaps(const QString &preedit) const;
112 virtual QString appendixForReplacedPreedit(const QString &preedit) const;
113 };
114
115=== modified file 'plugins/westernsupport/westernlanguagefeatures.cpp'
116--- plugins/westernsupport/westernlanguagefeatures.cpp 2014-03-11 12:14:10 +0000
117+++ plugins/westernsupport/westernlanguagefeatures.cpp 2014-04-15 14:40:35 +0000
118@@ -42,6 +42,16 @@
119 {
120 }
121
122+bool WesternLanguageFeatures::alwaysShowSuggestions() const
123+{
124+ return false;
125+}
126+
127+bool WesternLanguageFeatures::autoCapsAvailable() const
128+{
129+ return true;
130+}
131+
132 bool WesternLanguageFeatures::activateAutoCaps(const QString &preedit) const
133 {
134 static const QString sentenceBreak = QString::fromUtf8("!.?:\r\n");
135
136=== modified file 'plugins/westernsupport/westernlanguagefeatures.h'
137--- plugins/westernsupport/westernlanguagefeatures.h 2013-11-28 14:40:54 +0000
138+++ plugins/westernsupport/westernlanguagefeatures.h 2014-04-15 14:40:35 +0000
139@@ -42,6 +42,8 @@
140 explicit WesternLanguageFeatures(QObject *parent = 0);
141 virtual ~WesternLanguageFeatures();
142
143+ virtual bool alwaysShowSuggestions() const;
144+ virtual bool autoCapsAvailable() const;
145 virtual bool activateAutoCaps(const QString &preedit) const;
146 virtual QString appendixForReplacedPreedit(const QString &preedit) const;
147 };
148
149=== modified file 'src/lib/logic/abstractlanguagefeatures.h'
150--- src/lib/logic/abstractlanguagefeatures.h 2013-11-21 13:26:12 +0000
151+++ src/lib/logic/abstractlanguagefeatures.h 2014-04-15 14:40:35 +0000
152@@ -41,6 +41,8 @@
153 public:
154 virtual ~AbstractLanguageFeatures() {}
155
156+ virtual bool alwaysShowSuggestions() const = 0;
157+ virtual bool autoCapsAvailable() const = 0;
158 virtual bool activateAutoCaps(const QString &preedit) const = 0;
159 virtual QString appendixForReplacedPreedit(const QString &preedit) const = 0;
160 };
161
162=== modified file 'src/plugin/inputmethod.cpp'
163--- src/plugin/inputmethod.cpp 2014-03-12 18:04:55 +0000
164+++ src/plugin/inputmethod.cpp 2014-04-15 14:40:35 +0000
165@@ -37,6 +37,7 @@
166 #include "models/wordribbon.h"
167 #include "models/layout.h"
168
169+#include "logic/abstractlanguagefeatures.h"
170 // #include "logic/layouthelper.h"
171 //#include "logic/style.h"
172
173@@ -245,7 +246,7 @@
174 bool enabled = d->m_settings.autoCapitalization();
175 enabled &= d->contentType == FreeTextContentType;
176 bool valid = true;
177- bool autocap = d->host->autoCapitalizationEnabled(valid);
178+ bool autocap = d->host->autoCapitalizationEnabled(valid) && d->editor.wordEngine()->languageFeature()->autoCapsAvailable();
179 enabled &= autocap;
180
181 if (enabled != d->autocapsEnabled) {
182@@ -341,7 +342,8 @@
183
184 bool emitPredictionEnabled = false;
185
186- bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid);
187+ bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid)
188+ || d->editor.wordEngine()->languageFeature()->alwaysShowSuggestions();
189
190 if (!valid)
191 newPredictionEnabled = true;
192
193=== modified file 'tests/unittests/common/wordengineprobe.h'
194--- tests/unittests/common/wordengineprobe.h 2013-11-21 18:46:54 +0000
195+++ tests/unittests/common/wordengineprobe.h 2014-04-15 14:40:35 +0000
196@@ -43,6 +43,8 @@
197 explicit MockLanguageFeatures() {}
198 virtual ~MockLanguageFeatures() {}
199
200+ virtual bool alwaysShowSuggestions() const { return false; }
201+ virtual bool autoCapsAvailable() const { return false; }
202 virtual bool activateAutoCaps(const QString &preedit) const { Q_UNUSED(preedit); return false; }
203 virtual QString appendixForReplacedPreedit(const QString &preedit) const { Q_UNUSED(preedit); return ""; }
204 };
205
206=== modified file 'tests/unittests/ut_editor/wordengineprobe.h'
207--- tests/unittests/ut_editor/wordengineprobe.h 2013-11-21 18:46:54 +0000
208+++ tests/unittests/ut_editor/wordengineprobe.h 2014-04-15 14:40:35 +0000
209@@ -43,6 +43,8 @@
210 explicit MockLanguageFeatures() {}
211 virtual ~MockLanguageFeatures() {}
212
213+ virtual bool alwaysShowSuggestions() const { return false; }
214+ virtual bool autoCapsAvailable() const { return false; }
215 virtual bool activateAutoCaps(const QString &preedit) const { Q_UNUSED(preedit); return false; }
216 virtual QString appendixForReplacedPreedit(const QString &preedit) const { Q_UNUSED(preedit); return ""; }
217 };
218
219=== modified file 'tests/unittests/ut_word-candidates/wordengineprobe.h'
220--- tests/unittests/ut_word-candidates/wordengineprobe.h 2013-11-21 18:46:54 +0000
221+++ tests/unittests/ut_word-candidates/wordengineprobe.h 2014-04-15 14:40:35 +0000
222@@ -43,6 +43,8 @@
223 explicit MockLanguageFeatures() {}
224 virtual ~MockLanguageFeatures() {}
225
226+ virtual bool alwaysShowSuggestions() const { return false; }
227+ virtual bool autoCapsAvailable() const { return false; }
228 virtual bool activateAutoCaps(const QString &preedit) const { Q_UNUSED(preedit); return false; }
229 virtual QString appendixForReplacedPreedit(const QString &preedit) const { Q_UNUSED(preedit); return ""; }
230 };

Subscribers

People subscribed via source and target branches