Merge lp:~michael-sheldon/ubuntu-keyboard/emoji into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 247
Merged at revision: 261
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/emoji
Merge into: lp:ubuntu-keyboard
Diff against target: 1131 lines (+822/-20)
29 files modified
debian/control (+8/-0)
debian/ubuntu-keyboard-emoji.install (+1/-0)
plugins/emoji/emoji.pro (+9/-0)
plugins/emoji/qml/Keyboard_emoji.qml (+188/-0)
plugins/emoji/qml/Keyboard_emoji_email.qml (+93/-0)
plugins/emoji/qml/Keyboard_emoji_url.qml (+92/-0)
plugins/emoji/qml/Keyboard_emoji_url_search.qml (+94/-0)
plugins/emoji/qml/emoji.js (+14/-0)
plugins/emoji/qml/qml.pro (+20/-0)
plugins/emoji/src/emojilanguagefeatures.cpp (+83/-0)
plugins/emoji/src/emojilanguagefeatures.h (+39/-0)
plugins/emoji/src/emojiplugin.cpp (+19/-0)
plugins/emoji/src/emojiplugin.h (+29/-0)
plugins/emoji/src/emojiplugin.json (+7/-0)
plugins/emoji/src/src.pro (+32/-0)
plugins/pinyin/src/chineselanguagefeatures.cpp (+5/-0)
plugins/pinyin/src/chineselanguagefeatures.h (+1/-0)
plugins/plugins.pro (+1/-0)
plugins/westernsupport/westernlanguagefeatures.cpp (+5/-0)
plugins/westernsupport/westernlanguagefeatures.h (+1/-0)
qml/KeyboardContainer.qml (+14/-2)
qml/keys/LanguageKey.qml (+8/-1)
qml/keys/LanguageMenu.qml (+1/-0)
src/lib/logic/abstractlanguagefeatures.h (+1/-0)
src/lib/logic/wordengine.cpp (+6/-1)
src/plugin/inputmethod.cpp (+1/-6)
src/plugin/inputmethod_p.h (+0/-9)
tests/autopilot/ubuntu_keyboard/emulators/keyboard.py (+5/-0)
tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py (+45/-1)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/emoji
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Bill Filler (community) Approve
Ken VanDine Approve
Review via email: mp+244008@code.launchpad.net

Commit message

Add emoji layout

Description of the change

Add emoji layout

To post a comment you must log in.
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?

 * Emoji layout not yet specified by design (waiting for colour emoji support before full design is specified)

If you changed UI labels, did you update the pot file?

 * No change

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

 * Yes

Revision history for this message
Ken VanDine (ken-vandine) wrote :

The package description says it provides data files for the emoji keyboard. It looks like this builds a plugin as well. So that makes arch: any appropriate, however could this cause any multi-arch issues? Perhaps the data files should go in a -data package as arch: all?

review: Needs Information
Revision history for this message
Ken VanDine (ken-vandine) wrote :

My multi-arch question above was answered on IRC, this plugin is packaged the same as the others. So if that's an issue, it's been there for the other plugins. Packaging changes look fine to me.

review: Approve
Revision history for this message
Bill Filler (bfiller) wrote :

works great, nice job!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-12-01 16:32:25 +0000
+++ debian/control 2014-12-08 15:48:42 +0000
@@ -162,6 +162,14 @@
162Description: Ubuntu on-screen keyboard data files - Dutch162Description: Ubuntu on-screen keyboard data files - Dutch
163 Data files for the Ubuntu virtual keyboard - Dutch163 Data files for the Ubuntu virtual keyboard - Dutch
164164
165Package: ubuntu-keyboard-emoji
166Architecture: any
167Depends: ubuntu-keyboard (= ${binary:Version}),
168 ${misc:Depends},
169 ${shlibs:Depends},
170Description: Ubuntu on-screen keyboard data files - Emoji
171 Data files for the Ubuntu virtual keyboard - Emoji
172
165Package: ubuntu-keyboard-english173Package: ubuntu-keyboard-english
166Architecture: any174Architecture: any
167Depends: ubuntu-keyboard (= ${binary:Version}),175Depends: ubuntu-keyboard (= ${binary:Version}),
168176
=== added file 'debian/ubuntu-keyboard-emoji.install'
--- debian/ubuntu-keyboard-emoji.install 1970-01-01 00:00:00 +0000
+++ debian/ubuntu-keyboard-emoji.install 2014-12-08 15:48:42 +0000
@@ -0,0 +1,1 @@
1usr/share/maliit/plugins/com/ubuntu/lib/emoji/
02
=== added directory 'plugins/emoji'
=== added file 'plugins/emoji/emoji.pro'
--- plugins/emoji/emoji.pro 1970-01-01 00:00:00 +0000
+++ plugins/emoji/emoji.pro 2014-12-08 15:48:42 +0000
@@ -0,0 +1,9 @@
1CONFIG += ordered
2TEMPLATE = subdirs
3SUBDIRS = \
4 src \
5 qml
6
7QMAKE_EXTRA_TARGETS += check
8check.target = check
9check.CONFIG = recursive
010
=== added directory 'plugins/emoji/qml'
=== added file 'plugins/emoji/qml/Keyboard_emoji.qml'
--- plugins/emoji/qml/Keyboard_emoji.qml 1970-01-01 00:00:00 +0000
+++ plugins/emoji/qml/Keyboard_emoji.qml 2014-12-08 15:48:42 +0000
@@ -0,0 +1,188 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../keys"
19import "../../keys/key_constants.js" as UI
20import "emoji.js" as Emoji
21
22KeyPad {
23 anchors.fill: parent
24
25 content: c1
26 symbols: "languages/Keyboard_symbols.qml"
27
28 QtObject {
29 id: internal
30 property int offset: 740
31 property var chars: calculateChars()
32
33 function calculateChars() {
34 var totalSkips = 0;
35 var c = [];
36 for (var block = 0; block < Emoji.start.length; block++) {
37 for (var i = Emoji.start[block][1]; i < Emoji.end[block][1]; i++) {
38 while (Emoji.skip[block].indexOf(i) != -1) {
39 i++;
40 }
41 c.push(String.fromCharCode(Emoji.start[block][0], i));
42 }
43 }
44 return c;
45 }
46 }
47
48 Column {
49 id: c1
50 anchors.fill: parent
51 spacing: 0
52
53 Row {
54 anchors.horizontalCenter: parent.horizontalCenter
55 spacing: 0
56
57 Repeater {
58 model: 10
59 CharKey {
60 label: internal.chars[internal.offset + index]
61 shifted: label
62 leftSide: index == 0
63 rightSide: index == 9
64 }
65 }
66 }
67
68 Row {
69 anchors.horizontalCenter: parent.horizontalCenter
70 spacing: 0
71
72 ActionKey {
73 iconNormal: "go-previous"
74 iconShifted: "go-previous"
75 iconCapsLock: "go-previous"
76 overridePressArea: true
77 onPressed: {
78 if (internal.offset == 0) {
79 // Wrap around
80 internal.offset = internal.chars.length - 18
81 } else if (internal.offset - 18 < 0) {
82 internal.offset = 0
83 } else {
84 internal.offset -= 18;
85 }
86 }
87 }
88
89 Repeater {
90 model: 8
91 CharKey {
92 label: internal.chars[10 + internal.offset + index]
93 shifted: label
94 }
95 }
96
97 ActionKey {
98 iconNormal: "go-next"
99 iconShifted: "go-next"
100 iconCapsLock: "go-next"
101 overridePressArea: true
102 onPressed: {
103 if (internal.offset + 18 == internal.chars.length) {
104 // Wrap around
105 internal.offset = 0
106 } else if (internal.offset + 36 >= internal.chars.length) {
107 internal.offset = internal.chars.length - 18
108 } else {
109 internal.offset += 18
110 }
111 }
112 }
113 }
114
115 Row {
116 anchors.horizontalCenter: parent.horizontalCenter
117 spacing: 0
118
119 ActionKey {
120 label: "😀"
121 shifted: label
122 overridePressArea: true
123 onPressed: {
124 internal.offset = 740
125 }
126 }
127
128 ActionKey {
129 label: "🚀"
130 shifted: label
131 overridePressArea: true
132 onPressed: {
133 internal.offset = 865
134 }
135 }
136
137 ActionKey {
138 label: "🕜"
139 shifted: label
140 overridePressArea: true
141 onPressed: {
142 internal.offset = 569
143 }
144 }
145
146 ActionKey {
147 label: "🐀"
148 shifted: label
149 overridePressArea: true
150 onPressed: {
151 internal.offset = 237
152 }
153 }
154
155 ActionKey {
156 label: "🏠"
157 shifted: label
158 overridePressArea: true
159 onPressed: {
160 internal.offset = 214
161 }
162 }
163
164 ActionKey {
165 label: "🌍"
166 shifted: label
167 overridePressArea: true
168 onPressed: {
169 internal.offset = 14
170 }
171 }
172
173 BackspaceKey { padding: 0; width: enterKey.width }
174 }
175
176 Item {
177 anchors.left: parent.left
178 anchors.right: parent.right
179
180 height: panel.keyHeight + units.gu(UI.row_margin);
181
182 SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
183 LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; switchBack: true }
184 SpaceKey { id: spaceKey; anchors.left: languageMenuButton.right; anchors.right: enterKey.left; noMagnifier: true; height: parent.height; }
185 ReturnKey { id: enterKey; anchors.right: parent.right; height: parent.height; }
186 }
187 } // column
188}
0189
=== added file 'plugins/emoji/qml/Keyboard_emoji_email.qml'
--- plugins/emoji/qml/Keyboard_emoji_email.qml 1970-01-01 00:00:00 +0000
+++ plugins/emoji/qml/Keyboard_emoji_email.qml 2014-12-08 15:48:42 +0000
@@ -0,0 +1,93 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../keys"
19import "../../keys/key_constants.js" as UI
20
21KeyPad {
22 anchors.fill: parent
23
24 content: c1
25 symbols: "languages/Keyboard_symbols.qml"
26
27 Column {
28 id: c1
29 anchors.fill: parent
30 spacing: 0
31
32 Row {
33 anchors.horizontalCenter: parent.horizontalCenter;
34 spacing: 0
35
36 CharKey { label: "q"; shifted: "Q"; extended: ["1"]; extendedShifted: ["1"]; leftSide: true; }
37 CharKey { label: "w"; shifted: "W"; extended: ["2"]; extendedShifted: ["2"] }
38 CharKey { label: "e"; shifted: "E"; extended: ["3", "è", "é", "ê", "ë", "€"]; extendedShifted: ["3", "È","É", "Ê", "Ë", "€"] }
39 CharKey { label: "r"; shifted: "R"; extended: ["4"]; extendedShifted: ["4"] }
40 CharKey { label: "t"; shifted: "T"; extended: ["5", "þ"]; extendedShifted: ["5", "Þ"] }
41 CharKey { label: "y"; shifted: "Y"; extended: ["6", "ý", "¥"]; extendedShifted: ["6", "Ý", "¥"] }
42 CharKey { label: "u"; shifted: "U"; extended: ["7", "û","ù","ú","ü"]; extendedShifted: ["7", "Û","Ù","Ú","Ü"] }
43 CharKey { label: "i"; shifted: "I"; extended: ["8", "î","ï","ì","í"]; extendedShifted: ["8", "Î","Ï","Ì","Í"] }
44 CharKey { label: "o"; shifted: "O"; extended: ["9", "ö","ô","ò","ó"]; extendedShifted: ["9", "Ö","Ô","Ò","Ó"] }
45 CharKey { label: "p"; shifted: "P"; extended: ["0"]; extendedShifted: ["0"]; rightSide: true; }
46 }
47
48 Row {
49 anchors.horizontalCenter: parent.horizontalCenter;
50 spacing: 0
51
52 CharKey { label: "a"; shifted: "A"; extended: ["ä","à","â","á","ã","å"]; extendedShifted: ["Ä","À","Â","Á","Ã","Å"]; leftSide: true; }
53 CharKey { label: "s"; shifted: "S"; extended: ["ß","$"]; extendedShifted: ["$"] }
54 CharKey { label: "d"; shifted: "D"; extended: ["ð"]; extendedShifted: ["Ð"] }
55 CharKey { label: "f"; shifted: "F"; }
56 CharKey { label: "g"; shifted: "G"; }
57 CharKey { label: "h"; shifted: "H"; }
58 CharKey { label: "j"; shifted: "J"; }
59 CharKey { label: "k"; shifted: "K"; }
60 CharKey { label: "l"; shifted: "L"; rightSide: true; }
61 }
62
63 Row {
64 anchors.horizontalCenter: parent.horizontalCenter;
65 spacing: 0
66
67 ShiftKey {}
68 CharKey { label: "z"; shifted: "Z"; }
69 CharKey { label: "x"; shifted: "X"; }
70 CharKey { label: "c"; shifted: "C"; extended: ["ç"]; extendedShifted: ["Ç"] }
71 CharKey { label: "v"; shifted: "V"; }
72 CharKey { label: "b"; shifted: "B"; }
73 CharKey { label: "n"; shifted: "N"; extended: ["ñ"]; extendedShifted: ["Ñ"] }
74 CharKey { label: "m"; shifted: "M"; }
75 BackspaceKey {}
76 }
77
78 Item {
79 anchors.left: parent.left
80 anchors.right: parent.right
81
82 height: panel.keyHeight + units.gu(UI.row_margin);
83
84 SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
85 LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
86 CharKey { id: atKey; label: "@"; shifted: "@"; anchors.left: languageMenuButton.right; height: parent.height; }
87 SpaceKey { id: spaceKey; anchors.left: atKey.right; anchors.right: urlKey.left; noMagnifier: true; height: parent.height; }
88 UrlKey { id: urlKey; label: ".com"; extended: [".co.uk", ".net", ".org", ".edu", ".gov", ".ac.uk"]; anchors.right: dotKey.left; height: parent.height; }
89 CharKey { id: dotKey; label: "."; shifted: "."; extended: ["?", "!"]; extendedShifted: ["?", "!"]; anchors.right: enterKey.left; height: parent.height; }
90 ReturnKey { id: enterKey; anchors.right: parent.right; height: parent.height; }
91 }
92 } // column
93}
094
=== added file 'plugins/emoji/qml/Keyboard_emoji_url.qml'
--- plugins/emoji/qml/Keyboard_emoji_url.qml 1970-01-01 00:00:00 +0000
+++ plugins/emoji/qml/Keyboard_emoji_url.qml 2014-12-08 15:48:42 +0000
@@ -0,0 +1,92 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../keys"
19import "../../keys/key_constants.js" as UI
20
21KeyPad {
22 anchors.fill: parent
23
24 content: c1
25 symbols: "languages/Keyboard_symbols.qml"
26
27 Column {
28 id: c1
29 anchors.fill: parent
30 spacing: 0
31
32 Row {
33 anchors.horizontalCenter: parent.horizontalCenter;
34 spacing: 0
35
36 CharKey { label: "q"; shifted: "Q"; extended: ["1"]; extendedShifted: ["1"]; leftSide: true; }
37 CharKey { label: "w"; shifted: "W"; extended: ["2"]; extendedShifted: ["2"] }
38 CharKey { label: "e"; shifted: "E"; extended: ["3", "è", "é", "ê", "ë", "€"]; extendedShifted: ["3", "È","É", "Ê", "Ë", "€"] }
39 CharKey { label: "r"; shifted: "R"; extended: ["4"]; extendedShifted: ["4"] }
40 CharKey { label: "t"; shifted: "T"; extended: ["5", "þ"]; extendedShifted: ["5", "Þ"] }
41 CharKey { label: "y"; shifted: "Y"; extended: ["6", "ý", "¥"]; extendedShifted: ["6", "Ý", "¥"] }
42 CharKey { label: "u"; shifted: "U"; extended: ["7", "û","ù","ú","ü"]; extendedShifted: ["7", "Û","Ù","Ú","Ü"] }
43 CharKey { label: "i"; shifted: "I"; extended: ["8", "î","ï","ì","í"]; extendedShifted: ["8", "Î","Ï","Ì","Í"] }
44 CharKey { label: "o"; shifted: "O"; extended: ["9", "ö","ô","ò","ó"]; extendedShifted: ["9", "Ö","Ô","Ò","Ó"] }
45 CharKey { label: "p"; shifted: "P"; extended: ["0"]; extendedShifted: ["0"]; rightSide: true; }
46 }
47
48 Row {
49 anchors.horizontalCenter: parent.horizontalCenter;
50 spacing: 0
51
52 CharKey { label: "a"; shifted: "A"; extended: ["ä","à","â","á","ã","å"]; extendedShifted: ["Ä","À","Â","Á","Ã","Å"]; leftSide: true; }
53 CharKey { label: "s"; shifted: "S"; extended: ["ß","$"]; extendedShifted: ["$"] }
54 CharKey { label: "d"; shifted: "D"; extended: ["ð"]; extendedShifted: ["Ð"] }
55 CharKey { label: "f"; shifted: "F"; }
56 CharKey { label: "g"; shifted: "G"; }
57 CharKey { label: "h"; shifted: "H"; }
58 CharKey { label: "j"; shifted: "J"; }
59 CharKey { label: "k"; shifted: "K"; }
60 CharKey { label: "l"; shifted: "L"; rightSide: true; }
61 }
62
63 Row {
64 anchors.horizontalCenter: parent.horizontalCenter;
65 spacing: 0
66
67 ShiftKey {}
68 CharKey { label: "z"; shifted: "Z"; }
69 CharKey { label: "x"; shifted: "X"; }
70 CharKey { label: "c"; shifted: "C"; extended: ["ç"]; extendedShifted: ["Ç"] }
71 CharKey { label: "v"; shifted: "V"; }
72 CharKey { label: "b"; shifted: "B"; }
73 CharKey { label: "n"; shifted: "N"; extended: ["ñ"]; extendedShifted: ["Ñ"] }
74 CharKey { label: "m"; shifted: "M"; }
75 BackspaceKey {}
76 }
77
78 Item {
79 anchors.left: parent.left
80 anchors.right: parent.right
81
82 height: panel.keyHeight + units.gu(UI.row_margin);
83
84 SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
85 LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
86 CharKey { id: slashKey; label: "/"; shifted: "/"; anchors.left: languageMenuButton.right; height: parent.height; }
87 UrlKey { id: urlKey; label: ".com"; extended: [".co.uk", ".net", ".org", ".edu", ".gov", ".ac.uk"]; anchors.right: dotKey.left; height: parent.height; }
88 CharKey { id: dotKey; label: "."; shifted: "."; extended: ["?", "!"]; extendedShifted: ["?", "!"]; anchors.right: enterKey.left; height: parent.height; }
89 ReturnKey { id: enterKey; anchors.right: parent.right; height: parent.height; }
90 }
91 } // column
92}
093
=== added file 'plugins/emoji/qml/Keyboard_emoji_url_search.qml'
--- plugins/emoji/qml/Keyboard_emoji_url_search.qml 1970-01-01 00:00:00 +0000
+++ plugins/emoji/qml/Keyboard_emoji_url_search.qml 2014-12-08 15:48:42 +0000
@@ -0,0 +1,94 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../keys"
19import "../../keys/key_constants.js" as UI
20
21KeyPad {
22 anchors.fill: parent
23
24 content: c1
25 symbols: "languages/Keyboard_symbols.qml"
26
27 Column {
28 id: c1
29 anchors.fill: parent
30
31 spacing: 0
32
33 Row {
34 anchors.horizontalCenter: parent.horizontalCenter;
35 spacing: 0
36
37 CharKey { label: "q"; shifted: "Q"; extended: ["1"]; extendedShifted: ["1"]; leftSide: true; }
38 CharKey { label: "w"; shifted: "W"; extended: ["2"]; extendedShifted: ["2"] }
39 CharKey { label: "e"; shifted: "E"; extended: ["3", "è", "é", "ê", "ë", "€"]; extendedShifted: ["3", "È","É", "Ê", "Ë", "€"] }
40 CharKey { label: "r"; shifted: "R"; extended: ["4"]; extendedShifted: ["4"] }
41 CharKey { label: "t"; shifted: "T"; extended: ["5", "þ"]; extendedShifted: ["5", "Þ"] }
42 CharKey { label: "y"; shifted: "Y"; extended: ["6", "ý", "¥"]; extendedShifted: ["6", "Ý", "¥"] }
43 CharKey { label: "u"; shifted: "U"; extended: ["7", "û","ù","ú","ü"]; extendedShifted: ["7", "Û","Ù","Ú","Ü"] }
44 CharKey { label: "i"; shifted: "I"; extended: ["8", "î","ï","ì","í"]; extendedShifted: ["8", "Î","Ï","Ì","Í"] }
45 CharKey { label: "o"; shifted: "O"; extended: ["9", "ö","ô","ò","ó"]; extendedShifted: ["9", "Ö","Ô","Ò","Ó"] }
46 CharKey { label: "p"; shifted: "P"; extended: ["0"]; extendedShifted: ["0"]; rightSide: true; }
47 }
48
49 Row {
50 anchors.horizontalCenter: parent.horizontalCenter;
51 spacing: 0
52
53 CharKey { label: "a"; shifted: "A"; extended: ["ä","à","â","á","ã","å"]; extendedShifted: ["Ä","À","Â","Á","Ã","Å"]; leftSide: true; }
54 CharKey { label: "s"; shifted: "S"; extended: ["ß","$"]; extendedShifted: ["$"] }
55 CharKey { label: "d"; shifted: "D"; extended: ["ð"]; extendedShifted: ["Ð"] }
56 CharKey { label: "f"; shifted: "F"; }
57 CharKey { label: "g"; shifted: "G"; }
58 CharKey { label: "h"; shifted: "H"; }
59 CharKey { label: "j"; shifted: "J"; }
60 CharKey { label: "k"; shifted: "K"; }
61 CharKey { label: "l"; shifted: "L"; rightSide: true; }
62 }
63
64 Row {
65 anchors.horizontalCenter: parent.horizontalCenter;
66 spacing: 0
67
68 ShiftKey {}
69 CharKey { label: "z"; shifted: "Z"; }
70 CharKey { label: "x"; shifted: "X"; }
71 CharKey { label: "c"; shifted: "C"; extended: ["ç"]; extendedShifted: ["Ç"] }
72 CharKey { label: "v"; shifted: "V"; }
73 CharKey { label: "b"; shifted: "B"; }
74 CharKey { label: "n"; shifted: "N"; extended: ["ñ"]; extendedShifted: ["Ñ"] }
75 CharKey { label: "m"; shifted: "M"; }
76 BackspaceKey {}
77 }
78
79 Item {
80 anchors.left: parent.left
81 anchors.right: parent.right
82
83 height: panel.keyHeight + units.gu(UI.row_margin);
84
85 SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
86 LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
87 CharKey { id: slashKey; label: "/"; shifted: "/"; anchors.left: languageMenuButton.right; height: parent.height; }
88 SpaceKey { id: spaceKey; anchors.left: slashKey.right; anchors.right: urlKey.left; noMagnifier: true; height: parent.height; }
89 UrlKey { id: urlKey; label: ".com"; extended: [".co.uk", ".net", ".org", ".edu", ".gov", ".ac.uk"]; anchors.right: dotKey.left; height: parent.height; }
90 CharKey { id: dotKey; label: "."; shifted: "."; extended: ["?", "!"]; extendedShifted: ["?", "!"]; anchors.right: enterKey.left; height: parent.height; }
91 ReturnKey { id: enterKey; anchors.right: parent.right; height: parent.height; }
92 }
93 } // column
94}
095
=== added file 'plugins/emoji/qml/emoji.js'
--- plugins/emoji/qml/emoji.js 1970-01-01 00:00:00 +0000
+++ plugins/emoji/qml/emoji.js 2014-12-08 15:48:42 +0000
@@ -0,0 +1,14 @@
1// We have two blocks of utf-16 characters that can be used as emoji
2var start = [[55356, 57088], [55357, 56320]];
3var end = [[55356, 57335], [55357, 57301]];
4
5// Not supported by any of the installed fonts
6var skip = [[57133, 57134, 57135, 57214, 57215, 57295, 57296, 57297, 57298, 57299],
7 [56575, 56651, 56652, 56653, 56654, 56655, 56675, 56826, 56884, 56899,
8 56900, 56698, 57040, 57041, 57042, 57043, 57044, 57045, 57046, 57047,
9 57048, 57049, 57050, 57051, 57052, 57053, 57054, 57055, 57069, 57070,
10 57071, 57076, 57077, 57078, 57079, 57080, 57081, 57082, 57083, 57084,
11 57085, 57086, 57087, 57204, 57205, 57206, 57207, 57208, 57209, 57210,
12 57211, 57212, 57213, 57214, 57215
13 ]
14 ];
015
=== added file 'plugins/emoji/qml/qml.pro'
--- plugins/emoji/qml/qml.pro 1970-01-01 00:00:00 +0000
+++ plugins/emoji/qml/qml.pro 2014-12-08 15:48:42 +0000
@@ -0,0 +1,20 @@
1TOP_BUILDDIR = $$OUT_PWD/../../..
2TOP_SRCDIR = $$PWD/../../..
3
4include($${TOP_SRCDIR}/config.pri)
5
6TARGET = dummy
7TEMPLATE = lib
8
9lang_emoji.path = "$${UBUNTU_KEYBOARD_LIB_DIR}/emoji/"
10lang_emoji.files = *.qml *.js
11
12INSTALLS += lang_emoji
13
14# for QtCreator
15OTHER_FILES += \
16 Keyboard_emoji.qml \
17 Keyboard_emoji_email.qml \
18 Keyboard_emoji_url.qml \
19 Keyboard_emoji_url_search.qml
20
021
=== added directory 'plugins/emoji/src'
=== added file 'plugins/emoji/src/emojilanguagefeatures.cpp'
--- plugins/emoji/src/emojilanguagefeatures.cpp 1970-01-01 00:00:00 +0000
+++ plugins/emoji/src/emojilanguagefeatures.cpp 2014-12-08 15:48:42 +0000
@@ -0,0 +1,83 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "emojilanguagefeatures.h"
18
19EmojiLanguageFeatures::EmojiLanguageFeatures(QObject *parent) :
20 QObject(parent)
21{
22}
23
24EmojiLanguageFeatures::~EmojiLanguageFeatures()
25{
26}
27
28bool EmojiLanguageFeatures::alwaysShowSuggestions() const
29{
30 return false;
31}
32
33bool EmojiLanguageFeatures::autoCapsAvailable() const
34{
35 return false;
36}
37
38bool EmojiLanguageFeatures::activateAutoCaps(const QString &preedit) const
39{
40 Q_UNUSED(preedit)
41 return false;
42}
43
44QString EmojiLanguageFeatures::appendixForReplacedPreedit(const QString &preedit) const
45{
46 Q_UNUSED(preedit)
47 return QString("");
48}
49
50bool EmojiLanguageFeatures::isSeparator(const QString &text) const
51{
52 static const QString separators = QString::fromUtf8("。、,!?:;.\r\n");
53
54 if (text.isEmpty()) {
55 return false;
56 }
57
58 if (separators.contains(text.right(1))) {
59 return true;
60 }
61
62 return false;
63}
64
65bool EmojiLanguageFeatures::isSymbol(const QString &text) const
66{
67 static const QString symbols = QString::fromUtf8("*#+=()@~/\\€£$¥₹%<>[]`^|_§{}¡¿«»\"“”„&0123456789");
68
69 if (text.isEmpty()) {
70 return false;
71 }
72
73 if (symbols.contains(text.right(1))) {
74 return true;
75 }
76
77 return false;
78}
79
80bool EmojiLanguageFeatures::ignoreSimilarity() const
81{
82 return true;
83}
084
=== added file 'plugins/emoji/src/emojilanguagefeatures.h'
--- plugins/emoji/src/emojilanguagefeatures.h 1970-01-01 00:00:00 +0000
+++ plugins/emoji/src/emojilanguagefeatures.h 2014-12-08 15:48:42 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef EMOJILANGUAGEFEATURES_H
18#define EMOJILANGUAGEFEATURES_H
19
20#include "abstractlanguagefeatures.h"
21#include <QObject>
22
23class EmojiLanguageFeatures : public QObject, public AbstractLanguageFeatures
24{
25 Q_OBJECT
26public:
27 explicit EmojiLanguageFeatures(QObject *parent = 0);
28 virtual ~EmojiLanguageFeatures();
29
30 virtual bool alwaysShowSuggestions() const;
31 virtual bool autoCapsAvailable() const;
32 virtual bool activateAutoCaps(const QString &preedit) const;
33 virtual QString appendixForReplacedPreedit(const QString &preedit) const;
34 virtual bool isSeparator(const QString &text) const;
35 virtual bool isSymbol(const QString &text) const;
36 virtual bool ignoreSimilarity() const;
37};
38
39#endif // EMOJILANGUAGEFEATURES_H
040
=== added file 'plugins/emoji/src/emojiplugin.cpp'
--- plugins/emoji/src/emojiplugin.cpp 1970-01-01 00:00:00 +0000
+++ plugins/emoji/src/emojiplugin.cpp 2014-12-08 15:48:42 +0000
@@ -0,0 +1,19 @@
1#include "emojiplugin.h"
2#include "emojilanguagefeatures.h"
3
4#include <QDebug>
5
6EmojiPlugin::EmojiPlugin(QObject *parent) :
7 AbstractLanguagePlugin(parent)
8 , m_emojiLanguageFeatures(new EmojiLanguageFeatures)
9{
10}
11
12EmojiPlugin::~EmojiPlugin()
13{
14}
15
16AbstractLanguageFeatures* EmojiPlugin::languageFeature()
17{
18 return m_emojiLanguageFeatures;
19}
020
=== added file 'plugins/emoji/src/emojiplugin.h'
--- plugins/emoji/src/emojiplugin.h 1970-01-01 00:00:00 +0000
+++ plugins/emoji/src/emojiplugin.h 2014-12-08 15:48:42 +0000
@@ -0,0 +1,29 @@
1#ifndef EMOJIPLUGIN_H
2#define EMOJIPLUGIN_H
3
4#include <QObject>
5#include <QStringList>
6#include "languageplugininterface.h"
7#include "abstractlanguageplugin.h"
8
9#include <iostream>
10
11class EmojiLanguageFeatures;
12
13class EmojiPlugin : public AbstractLanguagePlugin
14{
15 Q_OBJECT
16 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.EmojiPlugin" FILE "emojiplugin.json")
17 Q_INTERFACES(LanguagePluginInterface)
18
19public:
20 explicit EmojiPlugin(QObject *parent = 0);
21 virtual ~EmojiPlugin();
22
23 virtual AbstractLanguageFeatures* languageFeature();
24
25private:
26 EmojiLanguageFeatures* m_emojiLanguageFeatures;
27};
28
29#endif // EMOJIPLUGIN_H
030
=== added file 'plugins/emoji/src/emojiplugin.json'
--- plugins/emoji/src/emojiplugin.json 1970-01-01 00:00:00 +0000
+++ plugins/emoji/src/emojiplugin.json 2014-12-08 15:48:42 +0000
@@ -0,0 +1,7 @@
1{
2 "IID": "org.qt-project.Qt.Examples.EmojiPlugin",
3 "MetaData": {
4 },
5 "className": "EmojiPlugin",
6 "debug": true
7}
08
=== added file 'plugins/emoji/src/src.pro'
--- plugins/emoji/src/src.pro 1970-01-01 00:00:00 +0000
+++ plugins/emoji/src/src.pro 2014-12-08 15:48:42 +0000
@@ -0,0 +1,32 @@
1TOP_BUILDDIR = $$OUT_PWD/../../..
2TOP_SRCDIR = $$PWD/../../..
3
4include($${TOP_SRCDIR}/config.pri)
5
6TEMPLATE = lib
7CONFIG += plugin
8QT += widgets
9INCLUDEPATH += \
10 $${TOP_SRCDIR}/src/ \
11 $${TOP_SRCDIR}/src/lib/logic
12
13HEADERS = \
14 emojiplugin.h \
15 emojilanguagefeatures.h \
16 $${TOP_SRCDIR}/src/lib/logic/abstractlanguageplugin.h
17
18SOURCES = \
19 emojiplugin.cpp \
20 emojilanguagefeatures.cpp \
21 $${TOP_SRCDIR}/src/lib/logic/abstractlanguageplugin.cpp
22
23TARGET = $$qtLibraryTarget(emojiplugin)
24
25EXAMPLE_FILES = emojiplugin.json
26
27# install
28target.path = $${UBUNTU_KEYBOARD_LIB_DIR}/emoji/
29INSTALLS += target
30
31OTHER_FILES += \
32 emojiplugin.json
033
=== added directory 'plugins/emoji/tests'
=== modified file 'plugins/pinyin/src/chineselanguagefeatures.cpp'
--- plugins/pinyin/src/chineselanguagefeatures.cpp 2014-11-25 13:28:55 +0000
+++ plugins/pinyin/src/chineselanguagefeatures.cpp 2014-12-08 15:48:42 +0000
@@ -88,3 +88,8 @@
88{88{
89 return true;89 return true;
90}90}
91
92bool ChineseLanguageFeatures::wordEngineAvailable() const
93{
94 return true;
95}
9196
=== modified file 'plugins/pinyin/src/chineselanguagefeatures.h'
--- plugins/pinyin/src/chineselanguagefeatures.h 2014-10-21 18:54:25 +0000
+++ plugins/pinyin/src/chineselanguagefeatures.h 2014-12-08 15:48:42 +0000
@@ -34,6 +34,7 @@
34 virtual bool isSeparator(const QString &text) const;34 virtual bool isSeparator(const QString &text) const;
35 virtual bool isSymbol(const QString &text) const;35 virtual bool isSymbol(const QString &text) const;
36 virtual bool ignoreSimilarity() const;36 virtual bool ignoreSimilarity() const;
37 virtual bool wordEngineAvailable() const;
37};38};
3839
39#endif // CHINESELANGUAGEFEATURES_H40#endif // CHINESELANGUAGEFEATURES_H
4041
=== modified file 'plugins/plugins.pro'
--- plugins/plugins.pro 2014-11-12 15:19:36 +0000
+++ plugins/plugins.pro 2014-12-08 15:48:42 +0000
@@ -9,6 +9,7 @@
9 cs \9 cs \
10 da \10 da \
11 de \11 de \
12 emoji \
12 en \13 en \
13 es \14 es \
14 fi \15 fi \
1516
=== modified file 'plugins/westernsupport/westernlanguagefeatures.cpp'
--- plugins/westernsupport/westernlanguagefeatures.cpp 2014-10-21 18:54:25 +0000
+++ plugins/westernsupport/westernlanguagefeatures.cpp 2014-12-08 15:48:42 +0000
@@ -109,3 +109,8 @@
109{109{
110 return false;110 return false;
111}111}
112
113bool WesternLanguageFeatures::wordEngineAvailable() const
114{
115 return true;
116}
112117
=== modified file 'plugins/westernsupport/westernlanguagefeatures.h'
--- plugins/westernsupport/westernlanguagefeatures.h 2014-10-21 18:54:25 +0000
+++ plugins/westernsupport/westernlanguagefeatures.h 2014-12-08 15:48:42 +0000
@@ -50,6 +50,7 @@
50 virtual QString fullStopSequence() const { return QString("."); }50 virtual QString fullStopSequence() const { return QString("."); }
51 virtual bool isSymbol(const QString &text) const;51 virtual bool isSymbol(const QString &text) const;
52 virtual bool ignoreSimilarity() const;52 virtual bool ignoreSimilarity() const;
53 virtual bool wordEngineAvailable() const;
53};54};
5455
55#endif // MALIITKEYBOARD_LANGUAGEFEATURES_H56#endif // MALIITKEYBOARD_LANGUAGEFEATURES_H
5657
=== modified file 'qml/KeyboardContainer.qml'
--- qml/KeyboardContainer.qml 2014-11-20 17:06:32 +0000
+++ qml/KeyboardContainer.qml 2014-12-08 15:48:42 +0000
@@ -33,6 +33,7 @@
3333
34 property string activeKeypadState: "NORMAL"34 property string activeKeypadState: "NORMAL"
35 property alias popoverEnabled: extendedKeysSelector.enabled35 property alias popoverEnabled: extendedKeysSelector.enabled
36 property string previousLanguage
3637
37 state: "CHARACTERS"38 state: "CHARACTERS"
3839
@@ -125,6 +126,7 @@
125 "cs",126 "cs",
126 "da",127 "da",
127 "de",128 "de",
129 "emoji",
128 "en",130 "en",
129 "es",131 "es",
130 "fi",132 "fi",
@@ -147,7 +149,12 @@
147 /// Returns the relative path to the keyboard QML file for a given language for free text149 /// Returns the relative path to the keyboard QML file for a given language for free text
148 function freeTextLanguageKeyboard(language)150 function freeTextLanguageKeyboard(language)
149 {151 {
150 language = language .slice(0,2).toLowerCase();152 language = language.toLowerCase();
153 if (!languageIsSupported(language)) {
154 // If we don't have a layout for this specific locale
155 // check more generic locale
156 language = language.slice(0,2);
157 }
151158
152 if (!languageIsSupported(language)) {159 if (!languageIsSupported(language)) {
153 console.log("Language '"+language+"' not supported - using 'en' instead");160 console.log("Language '"+language+"' not supported - using 'en' instead");
@@ -168,6 +175,8 @@
168 return "lib/da/Keyboard_da.qml";175 return "lib/da/Keyboard_da.qml";
169 if (language === "de")176 if (language === "de")
170 return "lib/de/Keyboard_de.qml";177 return "lib/de/Keyboard_de.qml";
178 if (language === "emoji")
179 return "lib/emoji/Keyboard_emoji.qml";
171 if (language === "en")180 if (language === "en")
172 return "lib/en/Keyboard_en.qml";181 return "lib/en/Keyboard_en.qml";
173 if (language === "es")182 if (language === "es")
@@ -214,7 +223,10 @@
214 return "languages/Keyboard_telephone.qml";223 return "languages/Keyboard_telephone.qml";
215 }224 }
216225
217 var locale = activeLanguage.slice(0,2).toLowerCase();226 var locale = activeLanguage.toLowerCase();
227 if (!languageIsSupported(locale)) {
228 locale = locale.slice(0,2);
229 }
218 if (!languageIsSupported(locale)) {230 if (!languageIsSupported(locale)) {
219 console.log("System language '"+locale+"' can't be used in OSK - using 'en' instead")231 console.log("System language '"+locale+"' can't be used in OSK - using 'en' instead")
220 locale = "en"232 locale = "en"
221233
=== modified file 'qml/keys/LanguageKey.qml'
--- qml/keys/LanguageKey.qml 2014-08-22 15:45:03 +0000
+++ qml/keys/LanguageKey.qml 2014-12-08 15:48:42 +0000
@@ -17,6 +17,8 @@
17import QtQuick 2.017import QtQuick 2.0
1818
19ActionKey {19ActionKey {
20 property bool switchBack: false // Switch back to previous layout without showing menu
21
20 iconNormal: "language-chooser";22 iconNormal: "language-chooser";
21 iconShifted: "language-chooser";23 iconShifted: "language-chooser";
22 iconCapsLock: "language-chooser";24 iconCapsLock: "language-chooser";
@@ -34,6 +36,11 @@
34 if (maliit_input_method.useHapticFeedback)36 if (maliit_input_method.useHapticFeedback)
35 pressEffect.start();37 pressEffect.start();
3638
37 canvas.languageMenuShown = true39 if (switchBack && panel.previousLanguage) {
40 maliit_input_method.activeLanguage = panel.previousLanguage
41 } else {
42 panel.previousLanguage = maliit_input_method.activeLanguage
43 canvas.languageMenuShown = true
44 }
38 } 45 }
39}46}
4047
=== modified file 'qml/keys/LanguageMenu.qml'
--- qml/keys/LanguageMenu.qml 2014-11-12 15:19:36 +0000
+++ qml/keys/LanguageMenu.qml 2014-12-08 15:48:42 +0000
@@ -78,6 +78,7 @@
78 if (languageId == "cs") return i18n.tr("Czech");78 if (languageId == "cs") return i18n.tr("Czech");
79 if (languageId == "da") return i18n.tr("Danish");79 if (languageId == "da") return i18n.tr("Danish");
80 if (languageId == "de") return i18n.tr("German");80 if (languageId == "de") return i18n.tr("German");
81 if (languageId == "emoji") return i18n.tr("Emoji");
81 if (languageId == "en") return i18n.tr("English");82 if (languageId == "en") return i18n.tr("English");
82 if (languageId == "es") return i18n.tr("Spanish");83 if (languageId == "es") return i18n.tr("Spanish");
83 if (languageId == "fi") return i18n.tr("Finnish");84 if (languageId == "fi") return i18n.tr("Finnish");
8485
=== modified file 'src/lib/logic/abstractlanguagefeatures.h'
--- src/lib/logic/abstractlanguagefeatures.h 2014-11-25 13:28:55 +0000
+++ src/lib/logic/abstractlanguagefeatures.h 2014-12-08 15:48:42 +0000
@@ -53,6 +53,7 @@
53 // to the user's input. However for input methods such as pinyin this53 // to the user's input. However for input methods such as pinyin this
54 // can be disabled by implementing this method to return true.54 // can be disabled by implementing this method to return true.
55 virtual bool ignoreSimilarity() const { return false; }55 virtual bool ignoreSimilarity() const { return false; }
56 virtual bool wordEngineAvailable() const { return false; }
5657
57 Maliit::TextContentType contentType() const { return m_contentType; }58 Maliit::TextContentType contentType() const { return m_contentType; }
58 void setContentType(Maliit::TextContentType contentType) { m_contentType = contentType; }59 void setContentType(Maliit::TextContentType contentType) { m_contentType = contentType; }
5960
=== modified file 'src/lib/logic/wordengine.cpp'
--- src/lib/logic/wordengine.cpp 2014-11-19 15:39:41 +0000
+++ src/lib/logic/wordengine.cpp 2014-12-08 15:48:42 +0000
@@ -141,7 +141,8 @@
141{141{
142 Q_D(const WordEngine);142 Q_D(const WordEngine);
143 return (AbstractWordEngine::isEnabled() &&143 return (AbstractWordEngine::isEnabled() &&
144 (d->use_predictive_text || d->use_spell_checker));144 (d->use_predictive_text || d->use_spell_checker) &&
145 d->languagePlugin->languageFeature()->wordEngineAvailable());
145}146}
146147
147void WordEngine::appendToCandidates(WordCandidateList *candidates,148void WordEngine::appendToCandidates(WordCandidateList *candidates,
@@ -391,6 +392,8 @@
391 d->loadPlugin("libdanishplugin.so", "da");392 d->loadPlugin("libdanishplugin.so", "da");
392 else if (languageId == "de")393 else if (languageId == "de")
393 d->loadPlugin("libgermanplugin.so", "de");394 d->loadPlugin("libgermanplugin.so", "de");
395 else if (languageId == "emoji")
396 d->loadPlugin("libemojiplugin.so", "emoji");
394 else if (languageId == "en")397 else if (languageId == "en")
395 d->loadPlugin("libenglishplugin.so", "en");398 d->loadPlugin("libenglishplugin.so", "en");
396 else if (languageId == "es")399 else if (languageId == "es")
@@ -426,6 +429,8 @@
426429
427 d->languagePlugin->setLanguage(languageId);430 d->languagePlugin->setLanguage(languageId);
428431
432 Q_EMIT enabledChanged(isEnabled());
433
429 connect((AbstractLanguagePlugin *) d->languagePlugin, SIGNAL(newSpellingSuggestions(QString, QStringList)), this, SLOT(newSpellingSuggestions(QString, QStringList)));434 connect((AbstractLanguagePlugin *) d->languagePlugin, SIGNAL(newSpellingSuggestions(QString, QStringList)), this, SLOT(newSpellingSuggestions(QString, QStringList)));
430 connect((AbstractLanguagePlugin *) d->languagePlugin, SIGNAL(newPredictionSuggestions(QString, QStringList)), this, SLOT(newPredictionSuggestions(QString, QStringList)));435 connect((AbstractLanguagePlugin *) d->languagePlugin, SIGNAL(newPredictionSuggestions(QString, QStringList)), this, SLOT(newPredictionSuggestions(QString, QStringList)));
431 Q_EMIT pluginChanged();436 Q_EMIT pluginChanged();
432437
=== modified file 'src/plugin/inputmethod.cpp'
--- src/plugin/inputmethod.cpp 2014-11-26 15:02:05 +0000
+++ src/plugin/inputmethod.cpp 2014-12-08 15:48:42 +0000
@@ -276,7 +276,7 @@
276void InputMethod::onEnabledLanguageSettingsChanged()276void InputMethod::onEnabledLanguageSettingsChanged()
277{277{
278 Q_D(InputMethod);278 Q_D(InputMethod);
279 d->truncateEnabledLanguageLocales(d->m_settings.enabledLanguages());279 d->enabledLanguages = d->m_settings.enabledLanguages();
280 Q_EMIT enabledLanguagesChanged(d->enabledLanguages);280 Q_EMIT enabledLanguagesChanged(d->enabledLanguages);
281}281}
282282
@@ -517,11 +517,6 @@
517{517{
518 Q_D(InputMethod);518 Q_D(InputMethod);
519519
520 if (newLanguage.length() != 2) {
521 qWarning() << Q_FUNC_INFO << "newLanguage is not valid:" << newLanguage;
522 return;
523 }
524
525 qDebug() << "in inputMethod.cpp setActiveLanguage() activeLanguage is:" << newLanguage;520 qDebug() << "in inputMethod.cpp setActiveLanguage() activeLanguage is:" << newLanguage;
526521
527 if (d->activeLanguage == newLanguage)522 if (d->activeLanguage == newLanguage)
528523
=== modified file 'src/plugin/inputmethod_p.h'
--- src/plugin/inputmethod_p.h 2014-11-26 15:02:05 +0000
+++ src/plugin/inputmethod_p.h 2014-12-08 15:48:42 +0000
@@ -270,13 +270,4 @@
270270
271 applicationApiWrapper->reportOSKInvisible();271 applicationApiWrapper->reportOSKInvisible();
272 }272 }
273
274 void truncateEnabledLanguageLocales(QStringList locales)
275 {
276 enabledLanguages.clear();
277 foreach (QString locale, locales) {
278 locale.truncate(2);
279 enabledLanguages << locale;
280 }
281 }
282};273};
283274
=== modified file 'tests/autopilot/ubuntu_keyboard/emulators/keyboard.py'
--- tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2014-11-21 00:04:17 +0000
+++ tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2014-12-08 15:48:42 +0000
@@ -297,6 +297,11 @@
297 self._current_keypad_name,297 self._current_keypad_name,
298 "shift"298 "shift"
299 )299 )
300
301 if key_pos == None:
302 # Not all layouts have a shift key
303 return
304
300 self._tap_key(key_pos)305 self._tap_key(key_pos)
301 self._keyboard_container.activeKeypadState.wait_for(state)306 self._keyboard_container.activeKeypadState.wait_for(state)
302 self.active_keypad.opacity.wait_for(1.0)307 self.active_keypad.opacity.wait_for(1.0)
303308
=== modified file 'tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py'
--- tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2014-12-02 19:24:45 +0000
+++ tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2014-12-08 15:48:42 +0000
@@ -83,7 +83,7 @@
83 def set_test_settings(self):83 def set_test_settings(self):
84 gsettings = Gio.Settings.new("com.canonical.keyboard.maliit")84 gsettings = Gio.Settings.new("com.canonical.keyboard.maliit")
85 gsettings.set_string("active-language", "en")85 gsettings.set_string("active-language", "en")
86 gsettings.set_strv("enabled-languages", ["en", "es", "de", "zh"])86 gsettings.set_strv("enabled-languages", ["en", "es", "de", "zh", "emoji"])
87 gsettings.set_boolean("auto-capitalization", True)87 gsettings.set_boolean("auto-capitalization", True)
88 gsettings.set_boolean("auto-completion", True)88 gsettings.set_boolean("auto-completion", True)
89 gsettings.set_boolean("predictive-text", True)89 gsettings.set_boolean("predictive-text", True)
@@ -603,3 +603,47 @@
603 Eventually(Equals(expected))603 Eventually(Equals(expected))
604 )604 )
605605
606
607class UbuntuKeyboardEmoji(UbuntuKeyboardTests):
608
609 def set_test_settings(self):
610 gsettings = Gio.Settings.new("com.canonical.keyboard.maliit")
611 gsettings.set_string("active-language", "emoji")
612 gsettings.set_boolean("auto-capitalization", True)
613 gsettings.set_boolean("auto-completion", True)
614 gsettings.set_boolean("predictive-text", True)
615 gsettings.set_boolean("spell-checking", True)
616 gsettings.set_boolean("double-space-full-stop", True)
617
618 def test_emoji_input(self):
619 text_area = self.launch_test_input_area()
620 self.ensure_focus_on_input(text_area)
621 keyboard = Keyboard()
622 self.addCleanup(keyboard.dismiss)
623
624 keyboard.type('😁😆😃😏')
625
626 expected = "😁😆😃😏"
627 self.assertThat(
628 text_area.text,
629 Eventually(Equals(expected))
630 )
631
632 def test_emoji_deletion(self):
633 """Emoji characters should be deleted completely, despite being made up
634 of multiple bytes.
635
636 """
637 text_area = self.launch_test_input_area()
638 self.ensure_focus_on_input(text_area)
639 keyboard = Keyboard()
640 self.addCleanup(keyboard.dismiss)
641
642 keyboard.type('😁😆😃😏\b')
643
644 expected = "😁😆😃"
645 self.assertThat(
646 text_area.text,
647 Eventually(Equals(expected))
648 )
649

Subscribers

People subscribed via source and target branches