Merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-url-layout into lp:phablet-extras/maliit-plugins

Proposed by Thomas Moenicke
Status: Merged
Approved by: Thomas Moenicke
Approved revision: 2150
Merged at revision: 2138
Proposed branch: lp:~thomas-moenicke/phablet-extras/maliit-plugins-url-layout
Merge into: lp:phablet-extras/maliit-plugins
Diff against target: 1628 lines (+1208/-74)
24 files modified
.bzrignore (+23/-0)
buildOnDevice.sh (+118/-0)
debian/changelog (+6/-0)
maliit-keyboard/data/languages/email.xml (+487/-0)
maliit-keyboard/data/languages/number.xml (+20/-23)
maliit-keyboard/lib/logic/dynamiclayout.cpp (+24/-28)
maliit-keyboard/lib/logic/keyareaconverter.cpp (+1/-2)
maliit-keyboard/lib/logic/layoutupdater.cpp (+0/-2)
maliit-keyboard/lib/models/layout.cpp (+14/-0)
maliit-keyboard/lib/models/layout.h (+8/-0)
maliit-keyboard/maliit-keyboard.pro (+0/-1)
maliit-keyboard/plugin/inputmethod.cpp (+69/-9)
maliit-keyboard/plugin/inputmethod.h (+6/-0)
maliit-keyboard/tests/common/common.pro (+3/-0)
maliit-keyboard/tests/common/helper.js (+13/-0)
maliit-keyboard/tests/language-layout-switching/main.cpp (+2/-0)
maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir (+2/-0)
maliit-keyboard/tests/qml-api-tests/plugin.cpp (+55/-0)
maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro (+20/-0)
maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml (+124/-0)
maliit-keyboard/tests/qml-test-app/layout-test.qml (+202/-0)
maliit-keyboard/tests/qml-test-app/qml-test-app.pro (+2/-1)
maliit-keyboard/tests/tests.pro (+1/-0)
unittests.sh (+8/-8)
To merge this branch: bzr merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-url-layout
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Günter Schwann (community) Approve
Review via email: mp+178264@code.launchpad.net

Commit message

adding contentType property to inputmethod

Description of the change

enable url layout: adding contentType property to inputmethod

To post a comment you must log in.
2139. By Thomas Moenicke

minor change: using Maliit::ContentType

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2140. By Thomas Moenicke

changing layout in onCOntentTypeChanged slot
using Maliit::TextContentType type

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
2141. By Thomas Moenicke

according to contentType, inputmethod switches to special layouts, or back to the active language

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2142. By Thomas Moenicke

exposed activeView to maliit-qml
added qml API tests

2143. By Thomas Moenicke

adding file to build on device
adding .bzrignore

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
2144. By Thomas Moenicke

removed old subdir in pro file

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

for testing, change in the browser in /usr/share/webbrowser-app/AddressBar.qml:
TextField {
   id: textField
   inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhUrlCharactersOnly

install the packages, then reboot.
For the browser, it should show a .com key. In phone app or notes app, it should show the regular layout.

2145. By Thomas Moenicke

set a default activeId in constructor, fixes crash

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2146. By Thomas Moenicke

adding support for number, phonenumber and email layouts
adding test app for layouts

2147. By Thomas Moenicke

removed useless assert

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2148. By Thomas Moenicke

fixed caluclation of margins: if no layout was loaded before, it took values from wrong cache.
Instead of caching the margins, we should reduce calling switchToMainView() and reduce creating new keyAreas
see also:
    void LayoutUpdater::switchToMainView()
     converter.keyArea()
      createFromKeyboard(m_attributes, m_loader->keyboard(), m_orientation);

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Günter Schwann (schwann) wrote :

707 +<!--
712 +<!--
Commented code should be removed

Rest looks ok, and it works

review: Approve
2149. By Thomas Moenicke

removed commented code/xml

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2150. By Thomas Moenicke

bumped changelog: url, phonenumber and number layouts

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
=== added file '.bzrignore'
--- .bzrignore 1970-01-01 00:00:00 +0000
+++ .bzrignore 2013-08-08 14:28:50 +0000
@@ -0,0 +1,23 @@
1Makefile
2moc_*
3*.pro.user
4*.moc
5debian/tmp
6debian/ubuntu-keyboard/
7debian/ubuntu-keyboard-data/
8debian/files
9debian/maliit-keyboard/
10debian/maliit-keyboard-data/
11debian/nemo-keyboard/
12*.debhelper.log
13*.substvars
14*.so
15*/benchmark/maliit-keyboard-benchmark
16*/tests/editor/editor
17*/tests/language-layout-loading/language-layout-loading
18*/tests/language-layout-switching/language-layout-switching
19*/tests/preedit-string/preedit-string
20*/tests/repeat-backspace/repeat-backspace
21*/tests/unittests/libdummy.so.1*
22*/tests/word-candidates/word-candidates
23libdummy.so*
024
=== added file 'buildOnDevice.sh'
--- buildOnDevice.sh 1970-01-01 00:00:00 +0000
+++ buildOnDevice.sh 2013-08-08 14:28:50 +0000
@@ -0,0 +1,118 @@
1#!/bin/sh
2CODE_DIR=ubuntu-keyboard
3USER=phablet
4USER_ID=32011
5PASSWORD=phablet
6PACKAGE=maliit-keyboard
7BINARY=maliit-server
8TARGET_IP=127.0.0.1
9TARGET_SSH_PORT=2222
10TARGET_DEBUG_PORT=3768
11RUN_OPTIONS=""
12# -qmljsdebugger=port:$TARGET_DEBUG_PORT"
13SETUP=false
14SUDO="echo $PASSWORD | sudo -S"
15
16usage() {
17 echo "usage: run_on_device [OPTIONS]\n"
18 echo "Script to setup a build environment for the shell and sync build and run it on the device\n"
19 echo "OPTIONS:"
20 echo " -s, --setup Setup the build environment"
21 echo ""
22 echo "IMPORTANT:"
23 echo " * Make sure to have the networking and PPAs setup on the device beforehand (phablet-deploy-networking && phablet-ppa-fetch)."
24 echo " * Execute that script from a directory containing a branch of the shell code."
25 exit 1
26}
27
28exec_with_ssh() {
29 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t $USER@$TARGET_IP -p $TARGET_SSH_PORT "bash -ic \"$@\""
30}
31
32exec_with_adb() {
33 adb shell chroot /data/ubuntu /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@"
34}
35
36adb_root() {
37 adb root
38 adb wait-for-device
39}
40
41install_ssh_key() {
42 ssh-keygen -R $TARGET_IP
43 HOME_DIR=/data/ubuntu/home/phablet
44 adb push ~/.ssh/id_rsa.pub $HOME_DIR/.ssh/authorized_keys
45 adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh
46 adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh/authorized_keys
47 adb shell chmod 700 $HOME_DIR/.ssh
48 adb shell chmod 600 $HOME_DIR/.ssh/authorized_keys
49}
50
51install_dependencies() {
52 exec_with_adb apt-get -y install openssh-server
53 exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb libglib2.0-bin
54 exec_with_ssh $SUDO add-apt-repository -y ppa:canonical-qt5-edgers/qt5-proper
55 exec_with_ssh $SUDO add-apt-repository -s -y ppa:phablet-team/ppa
56 exec_with_ssh $SUDO apt-get update
57 exec_with_ssh $SUDO apt-get -y install qt5-qmake qtdeclarative5-dev-tools qtdeclarative5-test-plugin qtdeclarative5-private-dev libqt5v8-5-private-dev fakeroot
58 exec_with_ssh $SUDO apt-get -y build-dep $PACKAGE
59}
60
61reset_screen_powerdown() {
62 exec_with_ssh $SUDO dbus-launch gsettings set com.canonical.powerd activity-timeout 600
63 exec_with_ssh $SUDO sudo initctl restart powerd
64}
65
66setup_adb_forwarding() {
67 adb forward tcp:$TARGET_SSH_PORT tcp:22
68 adb forward tcp:$TARGET_DEBUG_PORT tcp:$TARGET_DEBUG_PORT
69}
70
71sync_code() {
72 bzr export --uncommitted --format=dir /tmp/$CODE_DIR
73 rsync -crlOzv -e "ssh -p $TARGET_SSH_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" /tmp/$CODE_DIR/ $USER@$TARGET_IP:$CODE_DIR/
74 rm -rf /tmp/$CODE_DIR
75}
76
77build() {
78# exec_with_ssh "cd $CODE_DIR/ && qmake . && make -j 2"
79 exec_with_ssh "cd $CODE_DIR/ && dpkg-buildpackage -j4"
80}
81
82run() {
83# exec_with_ssh $SUDO "make install"
84 exec_with_ssh $SUDO "/sbin/initctl stop maliit-server"
85# adb shell pkill $BINARY
86# exec_with_ssh "$BINARY $RUN_OPTIONS"
87}
88
89set -- `getopt -n$0 -u -a --longoptions="setup,help" "sh" "$@"`
90
91# FIXME: giving incorrect arguments does not call usage and exit
92while [ $# -gt 0 ]
93do
94 case "$1" in
95 -s|--setup) SETUP=true;;
96 -h|--help) usage;;
97 --) shift;break;;
98 esac
99 shift
100done
101
102adb_root
103setup_adb_forwarding
104
105if $SETUP; then
106 echo "Setting up environment for building shell.."
107 install_ssh_key
108 install_dependencies
109 reset_screen_powerdown
110 sync_code
111else
112 echo "Transferring code.."
113 sync_code
114 echo "Building.."
115 build
116 echo "Running.."
117 run
118fi
0119
=== modified file 'debian/changelog'
--- debian/changelog 2013-07-31 14:44:31 +0000
+++ debian/changelog 2013-08-08 14:28:50 +0000
@@ -1,3 +1,9 @@
1maliit-plugins (0.99.trunk.phablet4) saycu; urgency=low
2
3 * url, phonenumber and number layouts
4
5 -- Thomas Moenicke <thomas@pachamama> Thu, 08 Aug 2013 16:27:47 +0200
6
1maliit-plugins (0.99.trunk.phablet3) saucy; urgency=low7maliit-plugins (0.99.trunk.phablet3) saucy; urgency=low
28
3 * support for inputMethodHints and contentOrientation9 * support for inputMethodHints and contentOrientation
410
=== added file 'maliit-keyboard/data/languages/email.xml'
--- maliit-keyboard/data/languages/email.xml 1970-01-01 00:00:00 +0000
+++ maliit-keyboard/data/languages/email.xml 2013-08-08 14:28:50 +0000
@@ -0,0 +1,487 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!DOCTYPE keyboard SYSTEM "VirtualKeyboardLayout.dtd">
3
4<keyboard catalog="en_us" language="en_us" title="English (US)" version="1.0">
5 <layout type="general">
6 <section id="main">
7 <row>
8 <key>
9 <binding label="q">
10 <modifiers keys="shift">
11 <binding label="Q" />
12 </modifiers>
13 </binding>
14 </key>
15 <key>
16 <binding label="w">
17 <modifiers keys="shift">
18 <binding label="W" />
19 </modifiers>
20 </binding>
21 </key>
22 <key>
23 <extended>
24 <row>
25 <key>
26 <binding label="è">
27 <modifiers keys="shift">
28 <binding label="È" />
29 </modifiers>
30 </binding>
31 </key>
32 <key>
33 <binding label="é">
34 <modifiers keys="shift">
35 <binding label="É" />
36 </modifiers>
37 </binding>
38 </key>
39 <key>
40 <binding label="ê">
41 <modifiers keys="shift">
42 <binding label="Ê" />
43 </modifiers>
44 </binding>
45 </key>
46 <key>
47 <binding label="ë">
48 <modifiers keys="shift">
49 <binding label="Ë" />
50 </modifiers>
51 </binding>
52 </key>
53 <key>
54 <binding label="€">
55 <modifiers keys="shift">
56 <binding label="€" />
57 </modifiers>
58 </binding>
59 </key>
60 </row>
61 </extended>
62 <binding label="e">
63 <modifiers keys="shift">
64 <binding label="E" />
65 </modifiers>
66 </binding>
67 </key>
68 <key>
69 <binding label="r">
70 <modifiers keys="shift">
71 <binding label="R" />
72 </modifiers>
73 </binding>
74 </key>
75 <key>
76 <extended>
77 <row>
78 <key>
79 <binding label="þ">
80 <modifiers keys="shift">
81 <binding label="Þ" />
82 </modifiers>
83 </binding>
84 </key>
85 </row>
86 </extended>
87 <binding label="t">
88 <modifiers keys="shift">
89 <binding label="T" />
90 </modifiers>
91 </binding>
92 </key>
93 <key>
94 <extended>
95 <row>
96 <key>
97 <binding label="ý">
98 <modifiers keys="shift">
99 <binding label="Ý" />
100 </modifiers>
101 </binding>
102 </key>
103 <key>
104 <binding label="¥">
105 <modifiers keys="shift">
106 <binding label="¥" />
107 </modifiers>
108 </binding>
109 </key>
110 </row>
111 </extended>
112 <binding label="y">
113 <modifiers keys="shift">
114 <binding label="Y" />
115 </modifiers>
116 </binding>
117 </key>
118 <key>
119 <extended>
120 <row>
121 <key>
122 <binding label="û">
123 <modifiers keys="shift">
124 <binding label="Û" />
125 </modifiers>
126 </binding>
127 </key>
128 <key>
129 <binding label="ù">
130 <modifiers keys="shift">
131 <binding label="Ù" />
132 </modifiers>
133 </binding>
134 </key>
135 <key>
136 <binding label="ú">
137 <modifiers keys="shift">
138 <binding label="Ú" />
139 </modifiers>
140 </binding>
141 </key>
142 <key>
143 <binding label="ü">
144 <modifiers keys="shift">
145 <binding label="Ü" />
146 </modifiers>
147 </binding>
148 </key>
149 </row>
150 </extended>
151 <binding label="u">
152 <modifiers keys="shift">
153 <binding label="U" />
154 </modifiers>
155 </binding>
156 </key>
157 <key>
158 <extended>
159 <row>
160 <key>
161 <binding label="î">
162 <modifiers keys="shift">
163 <binding label="Î" />
164 </modifiers>
165 </binding>
166 </key>
167 <key>
168 <binding label="ï">
169 <modifiers keys="shift">
170 <binding label="Ï" />
171 </modifiers>
172 </binding>
173 </key>
174 <key>
175 <binding label="ì">
176 <modifiers keys="shift">
177 <binding label="Ì" />
178 </modifiers>
179 </binding>
180 </key>
181 <key>
182 <binding label="í">
183 <modifiers keys="shift">
184 <binding label="Í" />
185 </modifiers>
186 </binding>
187 </key>
188 </row>
189 </extended>
190 <binding label="i">
191 <modifiers keys="shift">
192 <binding label="I" />
193 </modifiers>
194 </binding>
195 </key>
196 <key>
197 <extended>
198 <row>
199 <key>
200 <binding label="ö">
201 <modifiers keys="shift">
202 <binding label="Ö" />
203 </modifiers>
204 </binding>
205 </key>
206 <key>
207 <binding label="ô">
208 <modifiers keys="shift">
209 <binding label="Ô" />
210 </modifiers>
211 </binding>
212 </key>
213 <key>
214 <binding label="ò">
215 <modifiers keys="shift">
216 <binding label="Ò" />
217 </modifiers>
218 </binding>
219 </key>
220 <key>
221 <binding label="ó">
222 <modifiers keys="shift">
223 <binding label="Ó" />
224 </modifiers>
225 </binding>
226 </key>
227 </row>
228 </extended>
229 <binding label="o">
230 <modifiers keys="shift">
231 <binding label="O" />
232 </modifiers>
233 </binding>
234 </key>
235 <key>
236 <binding label="p">
237 <modifiers keys="shift">
238 <binding label="P" />
239 </modifiers>
240 </binding>
241 </key>
242 </row>
243 <row>
244 <spacer />
245 <key>
246 <extended>
247 <row>
248 <key>
249 <binding label="ä">
250 <modifiers keys="shift">
251 <binding label="Ä" />
252 </modifiers>
253 </binding>
254 </key>
255 <key>
256 <binding label="à">
257 <modifiers keys="shift">
258 <binding label="À" />
259 </modifiers>
260 </binding>
261 </key>
262 <key>
263 <binding label="â">
264 <modifiers keys="shift">
265 <binding label="Â" />
266 </modifiers>
267 </binding>
268 </key>
269 <key>
270 <binding label="á">
271 <modifiers keys="shift">
272 <binding label="Á" />
273 </modifiers>
274 </binding>
275 </key>
276 <key>
277 <binding label="ã">
278 <modifiers keys="shift">
279 <binding label="Ã" />
280 </modifiers>
281 </binding>
282 </key>
283 <key>
284 <binding label="å">
285 <modifiers keys="shift">
286 <binding label="Å" />
287 </modifiers>
288 </binding>
289 </key>
290 </row>
291 </extended>
292 <binding label="a">
293 <modifiers keys="shift">
294 <binding label="A" />
295 </modifiers>
296 </binding>
297 </key>
298 <key>
299 <extended>
300 <row>
301 <key>
302 <binding label="ß">
303 <modifiers keys="shift">
304 <binding label="$" />
305 </modifiers>
306 </binding>
307 </key>
308 <key>
309 <binding label="$" />
310 </key>
311 </row>
312 </extended>
313 <binding label="s">
314 <modifiers keys="shift">
315 <binding label="S" />
316 </modifiers>
317 </binding>
318 </key>
319 <key>
320 <extended>
321 <row>
322 <key>
323 <binding label="ð">
324 <modifiers keys="shift">
325 <binding label="Ð" />
326 </modifiers>
327 </binding>
328 </key>
329 </row>
330 </extended>
331 <binding label="d">
332 <modifiers keys="shift">
333 <binding label="D" />
334 </modifiers>
335 </binding>
336 </key>
337 <key>
338 <binding label="f">
339 <modifiers keys="shift">
340 <binding label="F" />
341 </modifiers>
342 </binding>
343 </key>
344 <key>
345 <binding label="g">
346 <modifiers keys="shift">
347 <binding label="G" />
348 </modifiers>
349 </binding>
350 </key>
351 <key>
352 <binding label="h">
353 <modifiers keys="shift">
354 <binding label="H" />
355 </modifiers>
356 </binding>
357 </key>
358 <key>
359 <binding label="j">
360 <modifiers keys="shift">
361 <binding label="J" />
362 </modifiers>
363 </binding>
364 </key>
365 <key>
366 <binding label="k">
367 <modifiers keys="shift">
368 <binding label="K" />
369 </modifiers>
370 </binding>
371 </key>
372 <key>
373 <binding label="l">
374 <modifiers keys="shift">
375 <binding label="L" />
376 </modifiers>
377 </binding>
378 </key>
379 <spacer />
380 </row>
381 <row>
382 <key style="special" width="large">
383 <binding action="shift" />
384 </key>
385 <spacer />
386 <key>
387 <binding label="z">
388 <modifiers keys="shift">
389 <binding label="Z" />
390 </modifiers>
391 </binding>
392 </key>
393 <key>
394 <binding label="x">
395 <modifiers keys="shift">
396 <binding label="X" />
397 </modifiers>
398 </binding>
399 </key>
400 <key>
401 <extended>
402 <row>
403 <key>
404 <binding label="ç">
405 <modifiers keys="shift">
406 <binding label="Ç" />
407 </modifiers>
408 </binding>
409 </key>
410 </row>
411 </extended>
412 <binding label="c">
413 <modifiers keys="shift">
414 <binding label="C" />
415 </modifiers>
416 </binding>
417 </key>
418 <key>
419 <binding label="v">
420 <modifiers keys="shift">
421 <binding label="V" />
422 </modifiers>
423 </binding>
424 </key>
425 <key>
426 <binding label="b">
427 <modifiers keys="shift">
428 <binding label="B" />
429 </modifiers>
430 </binding>
431 </key>
432 <key>
433 <extended>
434 <row>
435 <key>
436 <binding label="ñ">
437 <modifiers keys="shift">
438 <binding label="Ñ" />
439 </modifiers>
440 </binding>
441 </key>
442 </row>
443 </extended>
444 <binding label="n">
445 <modifiers keys="shift">
446 <binding label="N" />
447 </modifiers>
448 </binding>
449 </key>
450 <key>
451 <binding label="m">
452 <modifiers keys="shift">
453 <binding label="M" />
454 </modifiers>
455 </binding>
456 </key>
457 <spacer />
458 <key style="special" width="large">
459 <binding action="backspace" />
460 </key>
461 </row>
462 <row>
463 <key style="special" width="x-large">
464 <binding action="sym" label="?123" />
465 </key>
466 <spacer />
467 <key id="urlKey">
468 <binding label=".com" />
469 </key>
470 <key width="large">
471 <binding action="space" />
472 </key>
473 <key id="urlKey" width="large">
474 <binding label=".com" />
475 </key>
476 <key>
477 <binding label="." />
478 </key>
479 <spacer />
480 <key id="actionKey" style="special" width="x-large">
481 <binding action="return" />
482 </key>
483 </row>
484 </section>
485 </layout>
486 <import file="symbols_en.xml" />
487</keyboard>
0488
=== modified file 'maliit-keyboard/data/languages/number.xml'
--- maliit-keyboard/data/languages/number.xml 2012-08-17 12:00:21 +0000
+++ maliit-keyboard/data/languages/number.xml 2013-08-08 14:28:50 +0000
@@ -5,51 +5,48 @@
5 <layout orientation="landscape" type="number">5 <layout orientation="landscape" type="number">
6 <section id="main" movable="false">6 <section id="main" movable="false">
7 <row>7 <row>
8 <key>8 <key width="x-large">
9 <binding label="1" />9 <binding label="1" />
10 </key>10 </key>
11 <key>11 <key width="x-large">
12 <binding label="2" />12 <binding label="2" />
13 </key>13 </key>
14 <key>14 <key width="x-large">
15 <binding label="3" />15 <binding label="3" />
16 </key>16 </key>
17 <key>17 </row>
18 <row>
19 <key width="x-large">
18 <binding label="4" />20 <binding label="4" />
19 </key>21 </key>
20 <key>22 <key width="x-large">
21 <binding label="5" />23 <binding label="5" />
22 </key>24 </key>
23 <key>25 <key width="x-large">
24 <binding label="6" />26 <binding label="6" />
25 </key>27 </key>
26 <key>28 </row>
29 <row>
30 <key width="x-large">
27 <binding label="7" />31 <binding label="7" />
28 </key>32 </key>
29 <key>33 <key width="x-large">
30 <binding label="8" />34 <binding label="8" />
31 </key>35 </key>
32 <key>36 <key width="x-large">
33 <binding label="9" />37 <binding label="9" />
34 </key>38 </key>
35 <key>39 </row>
40 <row>
41 <key width="x-large">
42 <binding action="plus_minus_toggle" label="+/-" />
43 </key>
44 <key width="x-large">
36 <binding label="0" />45 <binding label="0" />
37 </key>46 </key>
38 </row>47 <key style="special" width="x-large">
39 <row>
40 <spacer />
41 <key width="large">
42 <binding action="plus_minus_toggle" label="+/-" />
43 </key>
44 <key width="large">
45 <binding action="decimal_separator" />
46 </key>
47 <key style="special" width="large">
48 <binding action="backspace" label="" />48 <binding action="backspace" label="" />
49 </key>49 </key>
50 <key id="actionKey" style="special" width="large">
51 <binding action="return" />
52 </key>
53 </row>50 </row>
54 </section>51 </section>
55 </layout>52 </layout>
5653
=== modified file 'maliit-keyboard/lib/logic/dynamiclayout.cpp'
--- maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-07-30 16:16:14 +0000
+++ maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-08-08 14:28:50 +0000
@@ -33,40 +33,36 @@
33 return vMargin;33 return vMargin;
34}34}
3535
36/*
37 * calculates margin per row
38 **/
39
36QVector<int> DynamicLayout::calculateMargins(LayoutHelper::Orientation orientation,40QVector<int> DynamicLayout::calculateMargins(LayoutHelper::Orientation orientation,
37 Keyboard& kb)41 Keyboard& kb)
38{42{
39 if (d->marginsCachedOrientation != orientation)43 const qreal keyboardWidth = windowWidth(orientation);
40 d->invalidateMarginsCache();44
4145 QVector<int> margins;
42 if (!d->marginsCacheValid) {46 int spaceTakenByKeys = 0;
43 const qreal keyboardWidth = windowWidth(orientation);47 int numberOfKeysInRow = 0;
4448 for (int index = 0; index < kb.keys.count(); ++index) {
45 QVector<int> margins;49 const KeyDescription &desc(kb.key_descriptions.at(index));
46 int spaceTakenByKeys = 0;50 int width = uiConst->keyWidth(orientation, desc.width);
47 int numberOfKeysInRow = 0;51 spaceTakenByKeys += width;
48 for (int index = 0; index < kb.keys.count(); ++index) {52 numberOfKeysInRow++;
49 const KeyDescription &desc(kb.key_descriptions.at(index));53
50 int width = uiConst->keyWidth(orientation, desc.width);54 bool at_row_end((index + 1 == kb.keys.count())
51 spaceTakenByKeys += width;55 || (index + 1 < kb.keys.count()
52 numberOfKeysInRow++;56 && kb.key_descriptions.at(index + 1).row > desc.row));
5357
54 bool at_row_end((index + 1 == kb.keys.count())58 if (at_row_end) {
55 || (index + 1 < kb.keys.count()59 int marginThisRow = ( (keyboardWidth - spaceTakenByKeys) / (numberOfKeysInRow-1) ) / 2;
56 && kb.key_descriptions.at(index + 1).row > desc.row));60 margins.append(marginThisRow);
5761 spaceTakenByKeys = 0;
58 if (at_row_end) {
59 int marginThisRow = ( (keyboardWidth - spaceTakenByKeys) / (numberOfKeysInRow-1) ) / 2;
60 d->marginsCached.append(marginThisRow);
61 spaceTakenByKeys = 0;
62 }
63 }62 }
64
65 d->marginsCachedOrientation = orientation;
66 d->marginsCacheValid = true;
67 }63 }
6864
69 return d->marginsCached;65 return margins;
70}66}
7167
72void DynamicLayout::calculateNumberOfRows(Keyboard& kb)68void DynamicLayout::calculateNumberOfRows(Keyboard& kb)
7369
=== modified file 'maliit-keyboard/lib/logic/keyareaconverter.cpp'
--- maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-07-30 16:16:14 +0000
+++ maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-08-08 14:28:50 +0000
@@ -100,11 +100,10 @@
100 qreal consumed_width = 0;100 qreal consumed_width = 0;
101101
102 QVector<int> margins = uiConst->calculateMargins(orientation, kb);102 QVector<int> margins = uiConst->calculateMargins(orientation, kb);
103 Q_ASSERT(margins.size() > 0);
104 qreal margin = margins[0];
105103
106 int row = 0;104 int row = 0;
107 for (int index = 0; index < kb.keys.count(); ++index) {105 for (int index = 0; index < kb.keys.count(); ++index) {
106 const qreal margin = margins[row];
108 row_indices.append(index);107 row_indices.append(index);
109 Key &key(kb.keys[index]);108 Key &key(kb.keys[index]);
110 const KeyDescription &desc(kb.key_descriptions.at(index));109 const KeyDescription &desc(kb.key_descriptions.at(index));
111110
=== modified file 'maliit-keyboard/lib/logic/layoutupdater.cpp'
--- maliit-keyboard/lib/logic/layoutupdater.cpp 2013-07-29 11:52:26 +0000
+++ maliit-keyboard/lib/logic/layoutupdater.cpp 2013-08-08 14:28:50 +0000
@@ -332,8 +332,6 @@
332 d->layout->setCenterPanel(d->inShiftedState() ? converter.shiftedKeyArea()332 d->layout->setCenterPanel(d->inShiftedState() ? converter.shiftedKeyArea()
333 : converter.keyArea());333 : converter.keyArea());
334334
335 converter.keyArea();
336 d->layout->setCenterPanel(converter.keyArea());
337 if (isWordRibbonVisible())335 if (isWordRibbonVisible())
338 applyStyleToWordRibbon(d->layout->wordRibbon(), d->style, orientation);336 applyStyleToWordRibbon(d->layout->wordRibbon(), d->style, orientation);
339337
340338
=== modified file 'maliit-keyboard/lib/models/layout.cpp'
--- maliit-keyboard/lib/models/layout.cpp 2013-06-05 14:58:50 +0000
+++ maliit-keyboard/lib/models/layout.cpp 2013-08-08 14:28:50 +0000
@@ -63,6 +63,7 @@
63 KeyArea key_area;63 KeyArea key_area;
64 QString image_directory;64 QString image_directory;
65 QHash<int, QByteArray> roles;65 QHash<int, QByteArray> roles;
66 QString activeViewId;
6667
67 explicit LayoutPrivate();68 explicit LayoutPrivate();
68};69};
@@ -229,6 +230,19 @@
229 qGuiApp->primaryScreen()->orientation()) );230 qGuiApp->primaryScreen()->orientation()) );
230}231}
231232
233
234QString Layout::activeView() const
235{
236 Q_D(const Layout);
237 return d->activeViewId;
238}
239
240void Layout::setActiveView(const QString& activeViewId)
241{
242 Q_D(Layout);
243 d->activeViewId = activeViewId;
244}
245
232void Layout::setImageDirectory(const QString &directory)246void Layout::setImageDirectory(const QString &directory)
233{247{
234 Q_D(Layout);248 Q_D(Layout);
235249
=== modified file 'maliit-keyboard/lib/models/layout.h'
--- maliit-keyboard/lib/models/layout.h 2013-06-05 14:58:50 +0000
+++ maliit-keyboard/lib/models/layout.h 2013-08-08 14:28:50 +0000
@@ -78,6 +78,10 @@
78 Q_PROPERTY(int invisible_toucharea_height READ invisibleTouchAreaHeight78 Q_PROPERTY(int invisible_toucharea_height READ invisibleTouchAreaHeight
79 NOTIFY invisibleTouchAreaHeightChanged)79 NOTIFY invisibleTouchAreaHeightChanged)
8080
81 Q_PROPERTY(QString activeView READ activeView WRITE setActiveView
82 NOTIFY activeViewChanged)
83
84
81public:85public:
82 enum Roles {86 enum Roles {
83 RoleKeyRectangle = Qt::UserRole + 1,87 RoleKeyRectangle = Qt::UserRole + 1,
@@ -133,6 +137,10 @@
133 Q_SLOT int invisibleTouchAreaHeight() const;137 Q_SLOT int invisibleTouchAreaHeight() const;
134 Q_SIGNAL void invisibleTouchAreaHeightChanged(int &changed);138 Q_SIGNAL void invisibleTouchAreaHeightChanged(int &changed);
135139
140 Q_SLOT QString activeView() const;
141 Q_SLOT void setActiveView(const QString& activeViewId);
142 Q_SIGNAL void activeViewChanged(const QString &activeViewId);
143
136 virtual QHash<int, QByteArray> roleNames() const;144 virtual QHash<int, QByteArray> roleNames() const;
137 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;145 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
138 virtual QVariant data(const QModelIndex &index,146 virtual QVariant data(const QModelIndex &index,
139147
=== modified file 'maliit-keyboard/maliit-keyboard.pro'
--- maliit-keyboard/maliit-keyboard.pro 2013-07-29 13:51:23 +0000
+++ maliit-keyboard/maliit-keyboard.pro 2013-08-08 14:28:50 +0000
@@ -9,7 +9,6 @@
9 tests \9 tests \
10 benchmark \10 benchmark \
1111
12
13!notests {12!notests {
14 SUBDIRS += tests13 SUBDIRS += tests
15}14}
1615
=== modified file 'maliit-keyboard/plugin/inputmethod.cpp'
--- maliit-keyboard/plugin/inputmethod.cpp 2013-07-30 16:16:14 +0000
+++ maliit-keyboard/plugin/inputmethod.cpp 2013-08-08 14:28:50 +0000
@@ -62,7 +62,7 @@
62#include <maliit/plugins/abstractpluginsetting.h>62#include <maliit/plugins/abstractpluginsetting.h>
63#include <maliit/plugins/updateevent.h>63#include <maliit/plugins/updateevent.h>
64#include <maliit/plugins/abstractinputmethodhost.h>64#include <maliit/plugins/abstractinputmethodhost.h>
6565#include <maliit/namespace.h>
6666
67#include <QApplication>67#include <QApplication>
68#include <QWidget>68#include <QWidget>
@@ -169,6 +169,8 @@
169 QQuickView* view;169 QQuickView* view;
170170
171 bool predictionEnabled;171 bool predictionEnabled;
172 Maliit::TextContentType contentType;
173 QString activeLanguageId;
172174
173 explicit InputMethodPrivate(InputMethod * const q,175 explicit InputMethodPrivate(InputMethod * const q,
174 MAbstractInputMethodHost *host);176 MAbstractInputMethodHost *host);
@@ -176,6 +178,7 @@
176 void updateKeyboardOrientation();178 void updateKeyboardOrientation();
177 void updateWordRibbon();179 void updateWordRibbon();
178180
181 void setActiveKeyboardId(const QString& id);
179 void connectToNotifier();182 void connectToNotifier();
180 void setContextProperties(QQmlContext *qml_context);183 void setContextProperties(QQmlContext *qml_context);
181};184};
@@ -204,6 +207,8 @@
204 , host(host)207 , host(host)
205 , view(0)208 , view(0)
206 , predictionEnabled(false)209 , predictionEnabled(false)
210 , contentType(Maliit::FreeTextContentType)
211 , activeLanguageId("en_us")
207{212{
208 view = createWindow(host);213 view = createWindow(host);
209214
@@ -359,6 +364,20 @@
359 setLayoutOrientation(QGuiApplication::primaryScreen()->orientation());364 setLayoutOrientation(QGuiApplication::primaryScreen()->orientation());
360}365}
361366
367/*
368 * changes keyboard layout
369 * called directly to show URL or num layout for special contentTypes,
370 * does not change the current language id / activeView
371 */
372
373void InputMethodPrivate::setActiveKeyboardId(const QString &id)
374{
375 // FIXME: Perhaps better to let both LayoutUpdater share the same KeyboardLoader instance?
376 layout.updater.setActiveKeyboardId(id);
377 extended_layout.updater.setActiveKeyboardId(id);
378 layout.model.setActiveView(id);
379}
380
362void InputMethodPrivate::connectToNotifier()381void InputMethodPrivate::connectToNotifier()
363{382{
364#ifdef TEMP_DISABLED383#ifdef TEMP_DISABLED
@@ -436,6 +455,7 @@
436 connect(this, SIGNAL(wordRibbonEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool)));455 connect(this, SIGNAL(wordRibbonEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool)));
437456
438 connect(this, SIGNAL(predictionEnabledChanged()), this, SLOT(updateWordEngine()));457 connect(this, SIGNAL(predictionEnabledChanged()), this, SLOT(updateWordEngine()));
458 connect(this, SIGNAL(contentTypeChanged(Maliit::TextContentType)), this, SLOT(onContentTypeChanged(Maliit::TextContentType)));
439459
440 registerStyleSetting(host);460 registerStyleSetting(host);
441461
@@ -457,13 +477,9 @@
457void InputMethod::show()477void InputMethod::show()
458{478{
459 Q_D(InputMethod);479 Q_D(InputMethod);
460 bool valid = true;
461480
462 d->view->setVisible(true);481 d->view->setVisible(true);
463482
464 if (d->host->contentType(valid) == Maliit::UrlContentType)
465 setActiveSubView("url");
466
467#ifdef EXTENDED_SURFACE_TEMP_DISABLED483#ifdef EXTENDED_SURFACE_TEMP_DISABLED
468 d->surface->show();484 d->surface->show();
469 d->extended_surface->show();485 d->extended_surface->show();
@@ -551,15 +567,17 @@
551 return views;567 return views;
552}568}
553569
570// called by settings change/language change
554void InputMethod::setActiveSubView(const QString &id,571void InputMethod::setActiveSubView(const QString &id,
555 Maliit::HandlerState state)572 Maliit::HandlerState state)
556{573{
557 Q_UNUSED(state)574 Q_UNUSED(state)
558 Q_D(InputMethod);575 Q_D(InputMethod);
559576
560 // FIXME: Perhaps better to let both LayoutUpdater share the same KeyboardLoader instance?577 // store language id, so we can switch back to current active view
561 d->layout.updater.setActiveKeyboardId(id);578 // after showing special layouts as e.g. URL or Num layouts
562 d->extended_layout.updater.setActiveKeyboardId(id);579 d->activeLanguageId = id;
580 d->setActiveKeyboardId(id);
563}581}
564582
565QString InputMethod::activeSubView(Maliit::HandlerState state) const583QString InputMethod::activeSubView(Maliit::HandlerState state) const
@@ -610,7 +628,6 @@
610 return true;628 return true;
611}629}
612630
613
614void InputMethod::registerStyleSetting(MAbstractInputMethodHost *host)631void InputMethod::registerStyleSetting(MAbstractInputMethodHost *host)
615{632{
616 Q_D(InputMethod);633 Q_D(InputMethod);
@@ -899,6 +916,8 @@
899 bool valid;916 bool valid;
900917
901 bool emitPredictionEnabled = false;918 bool emitPredictionEnabled = false;
919 bool emitContentType = false;
920
902 bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid);921 bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid);
903922
904 if (!valid)923 if (!valid)
@@ -908,9 +927,24 @@
908 d->predictionEnabled = newPredictionEnabled;927 d->predictionEnabled = newPredictionEnabled;
909 emitPredictionEnabled = true;928 emitPredictionEnabled = true;
910 }929 }
930
931 Maliit::TextContentType newContentType = static_cast<Maliit::TextContentType>( inputMethodHost()->contentType(valid) );
932 if (!valid) {
933 newContentType = Maliit::FreeTextContentType;
934 }
935
936 if (newContentType != d->contentType) {
937 d->contentType = newContentType;
938 emitContentType = true;
939 }
940
941
911 if (emitPredictionEnabled)942 if (emitPredictionEnabled)
912 Q_EMIT predictionEnabledChanged();943 Q_EMIT predictionEnabledChanged();
913944
945 if (emitContentType)
946 Q_EMIT contentTypeChanged(d->contentType);
947
914}948}
915949
916void InputMethod::updateWordEngine()950void InputMethod::updateWordEngine()
@@ -931,6 +965,32 @@
931 return d->predictionEnabled;965 return d->predictionEnabled;
932}966}
933967
968Maliit::TextContentType InputMethod::contentType()
969{
970 Q_D(InputMethod);
971 return d->contentType;
972}
973
974void InputMethod::onContentTypeChanged(Maliit::TextContentType contentType)
975{
976 Q_D(InputMethod);
977
978 if (contentType == Maliit::FreeTextContentType)
979 d->setActiveKeyboardId( d->activeLanguageId );
980
981 if (contentType == Maliit::NumberContentType)
982 d->setActiveKeyboardId( "number" );
983
984 if (contentType == Maliit::PhoneNumberContentType)
985 d->setActiveKeyboardId( "phonenumber" );
986
987 if (contentType == Maliit::EmailContentType)
988 d->setActiveKeyboardId( "email" );
989
990 if (contentType == Maliit::UrlContentType)
991 d->setActiveKeyboardId("url");
992}
993
934void InputMethod::onQQuickViewStatusChanged(QQuickView::Status status)994void InputMethod::onQQuickViewStatusChanged(QQuickView::Status status)
935{995{
936 Q_D(InputMethod);996 Q_D(InputMethod);
937997
=== modified file 'maliit-keyboard/plugin/inputmethod.h'
--- maliit-keyboard/plugin/inputmethod.h 2013-07-30 11:04:20 +0000
+++ maliit-keyboard/plugin/inputmethod.h 2013-08-08 14:28:50 +0000
@@ -80,12 +80,16 @@
80 Q_SLOT void onQQuickViewStatusChanged(QQuickView::Status status);80 Q_SLOT void onQQuickViewStatusChanged(QQuickView::Status status);
8181
82 Q_PROPERTY(bool predictionEnabled READ predictionEnabled NOTIFY predictionEnabledChanged)82 Q_PROPERTY(bool predictionEnabled READ predictionEnabled NOTIFY predictionEnabledChanged)
83 Q_PROPERTY(Maliit::TextContentType contentType READ contentType NOTIFY contentTypeChanged)
8384
84 bool predictionEnabled();85 bool predictionEnabled();
86 Maliit::TextContentType contentType();
87
85 void update();88 void update();
8689
87Q_SIGNALS:90Q_SIGNALS:
88 void predictionEnabledChanged();91 void predictionEnabledChanged();
92 void contentTypeChanged(Maliit::TextContentType contentType);
8993
90private:94private:
91 void registerStyleSetting(MAbstractInputMethodHost *host);95 void registerStyleSetting(MAbstractInputMethodHost *host);
@@ -115,6 +119,8 @@
115 Q_SLOT void onMagnifierLayoutOriginChanged(const QPoint &origin);119 Q_SLOT void onMagnifierLayoutOriginChanged(const QPoint &origin);
116#endif120#endif
117121
122 Q_SLOT void onContentTypeChanged(Maliit::TextContentType contentType);
123
118 Q_SLOT void onHideAnimationFinished();124 Q_SLOT void onHideAnimationFinished();
119 Q_SIGNAL void wordEngineEnabledChanged(bool wordEngineEnabled);125 Q_SIGNAL void wordEngineEnabledChanged(bool wordEngineEnabled);
120 Q_SIGNAL void wordRibbonEnabledChanged(bool wordRibbonEnabled);126 Q_SIGNAL void wordRibbonEnabledChanged(bool wordRibbonEnabled);
121127
=== modified file 'maliit-keyboard/tests/common/common.pro'
--- maliit-keyboard/tests/common/common.pro 2012-11-21 15:19:50 +0000
+++ maliit-keyboard/tests/common/common.pro 2013-08-08 14:28:50 +0000
@@ -29,3 +29,6 @@
29check.target = check29check.target = check
30check.command = $$system(true)30check.command = $$system(true)
31check.depends += libtests-common.a31check.depends += libtests-common.a
32
33OTHER_FILES += \
34 helper.js
3235
=== added file 'maliit-keyboard/tests/common/helper.js'
--- maliit-keyboard/tests/common/helper.js 1970-01-01 00:00:00 +0000
+++ maliit-keyboard/tests/common/helper.js 2013-08-08 14:28:50 +0000
@@ -0,0 +1,13 @@
1.pragma library
2
3// Find an object with the given name recursively, starting
4// at the given object "obj"
5function findChild(obj,objectName) {
6 for (var i in obj.children) {
7 var child = obj.children[i];
8 if (child.objectName === objectName) return child;
9 var subChild = findChild(child,objectName);
10 if (subChild !== undefined) return subChild;
11 }
12 return undefined;
13}
014
=== modified file 'maliit-keyboard/tests/language-layout-switching/main.cpp'
--- maliit-keyboard/tests/language-layout-switching/main.cpp 2013-03-22 16:40:29 +0000
+++ maliit-keyboard/tests/language-layout-switching/main.cpp 2013-08-08 14:28:50 +0000
@@ -87,6 +87,8 @@
87 QCOMPARE(layout.activeKeyArea().keys().count(), expected_key_count);87 QCOMPARE(layout.activeKeyArea().keys().count(), expected_key_count);
88 }88 }
8989
90 // Note: this feature is not important in Ubuntu UX
91
90 // This test is very trivial. It's required however because none of the92 // This test is very trivial. It's required however because none of the
91 // current mainline layouts feature layout switch keys, thus making93 // current mainline layouts feature layout switch keys, thus making
92 // regressions impossible to spot.94 // regressions impossible to spot.
9395
=== added directory 'maliit-keyboard/tests/qml-api-tests'
=== added directory 'maliit-keyboard/tests/qml-api-tests/imports'
=== added directory 'maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport'
=== added file 'maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir'
--- maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir 1970-01-01 00:00:00 +0000
+++ maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir 2013-08-08 14:28:50 +0000
@@ -0,0 +1,2 @@
1module MaliitTestSupport
2plugin maliitqmlhelperplugin
03
=== added file 'maliit-keyboard/tests/qml-api-tests/plugin.cpp'
--- maliit-keyboard/tests/qml-api-tests/plugin.cpp 1970-01-01 00:00:00 +0000
+++ maliit-keyboard/tests/qml-api-tests/plugin.cpp 2013-08-08 14:28:50 +0000
@@ -0,0 +1,55 @@
1#include <QtQml/QQmlExtensionPlugin>
2#include <QtQml/qqml.h>
3#include <qdebug.h>
4#include <qcoreapplication.h>
5
6#include <QStringList>
7#include <QUrl>
8#include <QFile>
9
10class MaliitTestHelper : public QObject
11{
12 Q_OBJECT
13
14public:
15 MaliitTestHelper(QObject *parent=0) : QObject(parent)
16 {
17 }
18
19 ~MaliitTestHelper()
20 {
21 }
22
23 Q_INVOKABLE QStringList localeUiLanguages(QVariant value) {
24 QLocale locale = value.toLocale();
25 return locale.uiLanguages();
26 }
27
28 Q_INVOKABLE QString localeName(QVariant value) {
29 QLocale locale = value.toLocale();
30 return locale.name();
31 }
32
33signals:
34private:
35};
36
37
38class MaliitQmlHelperPlugin : public QQmlExtensionPlugin
39{
40 Q_OBJECT
41 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
42
43public:
44
45 void registerTypes(const char *uri)
46 {
47 Q_ASSERT(uri == QLatin1String("MaliitTestSupport"));
48 qmlRegisterType<MaliitTestHelper>(uri, 1, 0, "MaliitTestHelper");
49 }
50};
51
52
53#include "plugin.moc"
54
55
056
=== added file 'maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro'
--- maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro 1970-01-01 00:00:00 +0000
+++ maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro 2013-08-08 14:28:50 +0000
@@ -0,0 +1,20 @@
1include(../../config-plugin.pri)
2
3TARGET = maliitqmlhelperplugin
4DESTDIR = imports/MaliitTestSupport
5TEMPLATE = lib
6CONFIG += qt plugin
7
8SOURCES += \
9 plugin.cpp
10
11QT = core gui qml quick qml-private
12
13INCLUDEPATH += ../../lib ../../
14
15pluginfiles.files += \
16 imports/MaliitTestSupport/qmldir \
17
18OTHER_FILES += \
19 tst_inputMethodHints.qml
20
021
=== added file 'maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml'
--- maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml 1970-01-01 00:00:00 +0000
+++ maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml 2013-08-08 14:28:50 +0000
@@ -0,0 +1,124 @@
1
2import QtQuick 2.0
3import QtTest 1.0 // for TestCase
4import Ubuntu.Components 0.1
5import MaliitTestSupport 1.0
6
7/*
8 * qmltestrunner -import maliit-keyboard/tests/qml-api-tests/imports/ -input maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml
9 *
10 * Note: if tests fail, try to increase asyncDelay
11 */
12
13Item {
14 id: mainWindow
15
16 width: 1280
17 height: 720
18
19 anchors.margins: 60
20
21 /**
22 maliitTestHelper.localeName(Qt.inputMethod.locale)
23 maliitTestHelper.localeUiLanguages(Qt.inputMethod.locale)
24 */
25
26 MaliitTestHelper {
27 id: maliitTestHelper
28 }
29
30 Rectangle
31 {
32 anchors.fill: parent
33 color: "red"
34 }
35
36 TextField {
37 id: unusedTextField
38 anchors {
39 top: mainWindow.top
40 horizontalCenter: parent.horizontalCenter
41 topMargin: 50
42 }
43 inputMethodHints: Qt.ImhUrlCharactersOnly
44 }
45
46 TextField {
47 id: textField
48 anchors {
49 top: unusedTextField.bottom
50 horizontalCenter: parent.horizontalCenter
51 topMargin: 50
52 }
53 inputMethodHints: Qt.ImhUrlCharactersOnly
54 }
55
56 TextField {
57 id: noPredictiveTextField
58 anchors {
59 top: textField.bottom
60 horizontalCenter: parent.horizontalCenter
61 topMargin: 50
62 }
63 inputMethodHints: Qt.ImhNoPredictiveText
64 }
65
66 TestCase {
67 id: inputMethodHintsTest
68 name: "inputMethodHints"
69
70 // We must wait until the window is shown because we're going to do mouse interaction
71 when: windowShown
72
73 function initTestCase() {
74 }
75
76 function test_1_oskShownHide()
77 {
78 compare(Qt.inputMethod.visible, false)
79
80 click(textField)
81
82 tryCompare(Qt.inputMethod, "visible", true)
83
84 wait(500)
85
86 // TODO get actual values from MaliitTestHelper, e.g height 608
87 verify(Qt.inputMethod.keyboardRectangle.height > 0)
88
89 textField.focus = false
90 compare(textField.focus, false)
91
92 wait(500)
93
94 tryCompare(Qt.inputMethod, "visible", false)
95 tryCompare(Qt.inputMethod.keyboardRectangle, "height", 0)
96 }
97
98 function test_2_noPredictiveText()
99 {
100 textField.focus = true
101
102 click(textField)
103
104 tryCompare(Qt.inputMethod, "visible", true)
105 wait(500)
106 verify(Qt.inputMethod.keyboardRectangle.height > 0)
107 tryCompare(Qt.inputMethod.keyboardRectangle, "height", 796)
108
109 textField.focus = false
110 noPredictiveTextField.focus = true
111
112 tryCompare(Qt.inputMethod.keyboardRectangle, "height", 608)
113 }
114
115 /* helper */
116
117 function click(target) {
118 mouseClick(target, (target).width / 2, (target).height / 2)
119 keyClick(Qt.Key_5)
120 }
121
122 }
123
124}
0125
=== added file 'maliit-keyboard/tests/qml-test-app/layout-test.qml'
--- maliit-keyboard/tests/qml-test-app/layout-test.qml 1970-01-01 00:00:00 +0000
+++ maliit-keyboard/tests/qml-test-app/layout-test.qml 2013-08-08 14:28:50 +0000
@@ -0,0 +1,202 @@
1import QtQuick 2.0
2
3
4
5import QtQuick 2.0
6import Ubuntu.Components 0.1
7
8MainView {
9 id: root
10
11 automaticOrientation: true
12
13 Rectangle {
14 anchors.fill: parent
15 color: "lightblue"
16 }
17
18 Column {
19
20 y: units.gu(3)
21 width: parent.width
22 anchors.horizontalCenter: parent.horizontalCenter
23 spacing: units.gu(1)
24
25 anchors.margins: units.gu(1)
26
27 Text {
28 id: label
29 text: "OSK Layout Test"
30 anchors.horizontalCenter: parent.horizontalCenter
31 font.pixelSize: units.gu(2)
32 font.bold: true
33 }
34
35 Rectangle {
36 anchors.horizontalCenter: parent.horizontalCenter
37 width: units.gu(18);
38 height: units.gu(6);
39
40 anchors.leftMargin: units.gu(1)
41
42 color: "white"
43
44 TextInput {
45 id: input;
46 anchors.fill: parent
47 color: "black"; selectionColor: "red"
48
49 // Qt.ImhPreferNumbers
50 inputMethodHints: Qt.ImhUrlCharactersOnly
51 font.pixelSize: units.gu(3)
52 font.bold: true
53 }
54 }
55
56 Rectangle {
57 anchors.horizontalCenter: parent.horizontalCenter;
58 width: units.gu(18);
59 height: units.gu(6);
60
61 color: "white"
62
63 TextInput {
64 id: secondInput;
65 anchors.fill: parent
66 font.pixelSize: units.gu(3)
67 inputMethodHints: Qt.ImhNone
68 }
69 }
70
71 Rectangle {
72 anchors.horizontalCenter: parent.horizontalCenter;
73 width: units.gu(18);
74 height: units.gu(6);
75
76 color: "white"
77
78 TextInput {
79 anchors.fill: parent
80 font.pixelSize: units.gu(3)
81 inputMethodHints: Qt.ImhDigitsOnly
82 }
83 }
84
85 Rectangle {
86 anchors.horizontalCenter: parent.horizontalCenter;
87 width: units.gu(18);
88 height: units.gu(6);
89
90 color: "white"
91
92 TextInput {
93 anchors.fill: parent
94 font.pixelSize: units.gu(3)
95 inputMethodHints: Qt.ImhDialableCharactersOnly
96 }
97 }
98
99
100 Row {
101 anchors.horizontalCenter: parent.horizontalCenter;
102
103 Text {
104 id: textRectangle
105
106 font.pixelSize: units.gu(1)
107 text: Qt.inputMethod.keyboardRectangle + " "
108 }
109
110 Rectangle {
111 id: clickBehindOSKDetectedIndicator
112
113 width: units.gu(18)
114 height: units.gu(3)
115 state: "default"
116
117 Text {
118 id: clickBehindOSKDetectedIndicatorText
119 anchors.centerIn: parent
120 text: "clicked"
121 font.pixelSize: units.gu(2)
122 font.bold: true
123 }
124
125 states: [
126 State {
127 name: "default"
128 PropertyChanges {
129 target: clickBehindOSKDetectedIndicator
130 color: "gray"
131 }
132 PropertyChanges {
133 target: clickBehindOSKDetectedIndicatorText
134 color: "gray"
135 }
136 },
137 State {
138 name: "highlight"
139 PropertyChanges {
140 target: clickBehindOSKDetectedIndicator
141 color: "red"
142 }
143 PropertyChanges {
144 target: clickBehindOSKDetectedIndicatorText
145 color: "white"
146 }
147 }
148 ]
149 }
150
151 }
152
153 Text {
154 id: textVisible
155
156 anchors.horizontalCenter: parent.horizontalCenter;
157
158 font.pixelSize: units.gu(2)
159 text: "keyboard reports visible: " + Qt.inputMethod.visible
160 }
161
162 } // column
163
164 Rectangle {
165 id: fakeBrowserUrlBar
166 width: keyboardRect.width
167 height: units.gu(4)
168 color: "orange"
169 anchors.bottom: keyboardRect.top
170
171 Text {
172 visible: Qt.inputMethod.visible
173 anchors.centerIn: parent
174 font.pixelSize: units.gu(1)
175 text: "browser url bar"
176 }
177 }
178
179 Rectangle {
180 id: keyboardRect
181
182 width: Qt.inputMethod.keyboardRectangle.width
183 height: Qt.inputMethod.keyboardRectangle.height
184
185 anchors.bottom: parent.bottom
186 color: " green"
187
188 Text {
189 visible: Qt.inputMethod.visible
190 anchors.centerIn: parent
191 font.pointSize: 24
192 text: Qt.inputMethod.keyboardRectangle + " "
193 }
194
195 MouseArea {
196 anchors.fill: parent
197 onClicked: clickBehindOSKDetectedIndicator.visible = true
198 onPressed: clickBehindOSKDetectedIndicator.state = "highlight"
199 onReleased: clickBehindOSKDetectedIndicator.state = "default"
200 }
201 }
202}
0203
=== modified file 'maliit-keyboard/tests/qml-test-app/qml-test-app.pro'
--- maliit-keyboard/tests/qml-test-app/qml-test-app.pro 2013-05-15 14:35:21 +0000
+++ maliit-keyboard/tests/qml-test-app/qml-test-app.pro 2013-08-08 14:28:50 +0000
@@ -6,5 +6,6 @@
66
7INSTALLS += qml7INSTALLS += qml
8OTHER_FILES += \8OTHER_FILES += \
9 keyboard-test.qml9 keyboard-test.qml \
10 layout-test.qml
1011
1112
=== modified file 'maliit-keyboard/tests/tests.pro'
--- maliit-keyboard/tests/tests.pro 2013-07-29 13:51:23 +0000
+++ maliit-keyboard/tests/tests.pro 2013-08-08 14:28:50 +0000
@@ -8,6 +8,7 @@
8 word-candidates \8 word-candidates \
9 language-layout-loading \9 language-layout-loading \
10 qml-test-app \10 qml-test-app \
11 qml-api-tests \
11 wordengine \12 wordengine \
1213
13CONFIG += ordered14CONFIG += ordered
1415
=== modified file 'unittests.sh'
--- unittests.sh 2013-07-29 13:51:23 +0000
+++ unittests.sh 2013-08-08 14:28:50 +0000
@@ -1,11 +1,11 @@
11
22# to be run on the device
3adb push maliit-keyboard/plugin/libmaliit-keyboard-plugin.so /data/ubuntu/usr/lib/maliit/plugins/libmaliit-keyboard-plugin.so3
4adb push maliit-keyboard/tests/wordengine/ut_wordengine /data/ubuntu/usr/bin4LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/editor/ut_editor
5adb push maliit-keyboard/tests/editor/ut_editor /data/ubuntu/usr/bin5LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/wordengine/ut_wordengine
66LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/dynamic-layout/ut_dynamiclayout
7adb shell QT_QPA_PLATFORM=minimal LD_LIBRARY_PATH=/usr/lib/maliit/plugins:$_LD_LIBRARY_PATH /usr/bin/ut_editor7LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/language-layout-switching/language-layout-switching
8adb shell QT_QPA_PLATFORM=minimal LD_LIBRARY_PATH=/usr/lib/maliit/plugins:$_LD_LIBRARY_PATH /usr/bin/ut_wordengine8
99qmltestrunner -import maliit-keyboard/tests/qml-api-tests/imports/ -input maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml
1010
1111

Subscribers

People subscribed via source and target branches