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 on 2013-08-02

minor change: using Maliit::ContentType

2140. By Thomas Moenicke on 2013-08-02

changing layout in onCOntentTypeChanged slot
using Maliit::TextContentType type

2141. By Thomas Moenicke on 2013-08-02

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

2142. By Thomas Moenicke on 2013-08-06

exposed activeView to maliit-qml
added qml API tests

2143. By Thomas Moenicke on 2013-08-06

adding file to build on device
adding .bzrignore

2144. By Thomas Moenicke on 2013-08-07

removed old subdir in pro file

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 on 2013-08-07

set a default activeId in constructor, fixes crash

2146. By Thomas Moenicke on 2013-08-07

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

2147. By Thomas Moenicke on 2013-08-07

removed useless assert

2148. By Thomas Moenicke on 2013-08-08

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);

Günter Schwann (schwann) wrote :

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

Rest looks ok, and it works

review: Approve
2149. By Thomas Moenicke on 2013-08-08

removed commented code/xml

2150. By Thomas Moenicke on 2013-08-08

bumped changelog: url, phonenumber and number layouts

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2013-08-08 14:28:50 +0000
4@@ -0,0 +1,23 @@
5+Makefile
6+moc_*
7+*.pro.user
8+*.moc
9+debian/tmp
10+debian/ubuntu-keyboard/
11+debian/ubuntu-keyboard-data/
12+debian/files
13+debian/maliit-keyboard/
14+debian/maliit-keyboard-data/
15+debian/nemo-keyboard/
16+*.debhelper.log
17+*.substvars
18+*.so
19+*/benchmark/maliit-keyboard-benchmark
20+*/tests/editor/editor
21+*/tests/language-layout-loading/language-layout-loading
22+*/tests/language-layout-switching/language-layout-switching
23+*/tests/preedit-string/preedit-string
24+*/tests/repeat-backspace/repeat-backspace
25+*/tests/unittests/libdummy.so.1*
26+*/tests/word-candidates/word-candidates
27+libdummy.so*
28
29=== added file 'buildOnDevice.sh'
30--- buildOnDevice.sh 1970-01-01 00:00:00 +0000
31+++ buildOnDevice.sh 2013-08-08 14:28:50 +0000
32@@ -0,0 +1,118 @@
33+#!/bin/sh
34+CODE_DIR=ubuntu-keyboard
35+USER=phablet
36+USER_ID=32011
37+PASSWORD=phablet
38+PACKAGE=maliit-keyboard
39+BINARY=maliit-server
40+TARGET_IP=127.0.0.1
41+TARGET_SSH_PORT=2222
42+TARGET_DEBUG_PORT=3768
43+RUN_OPTIONS=""
44+# -qmljsdebugger=port:$TARGET_DEBUG_PORT"
45+SETUP=false
46+SUDO="echo $PASSWORD | sudo -S"
47+
48+usage() {
49+ echo "usage: run_on_device [OPTIONS]\n"
50+ echo "Script to setup a build environment for the shell and sync build and run it on the device\n"
51+ echo "OPTIONS:"
52+ echo " -s, --setup Setup the build environment"
53+ echo ""
54+ echo "IMPORTANT:"
55+ echo " * Make sure to have the networking and PPAs setup on the device beforehand (phablet-deploy-networking && phablet-ppa-fetch)."
56+ echo " * Execute that script from a directory containing a branch of the shell code."
57+ exit 1
58+}
59+
60+exec_with_ssh() {
61+ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t $USER@$TARGET_IP -p $TARGET_SSH_PORT "bash -ic \"$@\""
62+}
63+
64+exec_with_adb() {
65+ adb shell chroot /data/ubuntu /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@"
66+}
67+
68+adb_root() {
69+ adb root
70+ adb wait-for-device
71+}
72+
73+install_ssh_key() {
74+ ssh-keygen -R $TARGET_IP
75+ HOME_DIR=/data/ubuntu/home/phablet
76+ adb push ~/.ssh/id_rsa.pub $HOME_DIR/.ssh/authorized_keys
77+ adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh
78+ adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh/authorized_keys
79+ adb shell chmod 700 $HOME_DIR/.ssh
80+ adb shell chmod 600 $HOME_DIR/.ssh/authorized_keys
81+}
82+
83+install_dependencies() {
84+ exec_with_adb apt-get -y install openssh-server
85+ exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb libglib2.0-bin
86+ exec_with_ssh $SUDO add-apt-repository -y ppa:canonical-qt5-edgers/qt5-proper
87+ exec_with_ssh $SUDO add-apt-repository -s -y ppa:phablet-team/ppa
88+ exec_with_ssh $SUDO apt-get update
89+ exec_with_ssh $SUDO apt-get -y install qt5-qmake qtdeclarative5-dev-tools qtdeclarative5-test-plugin qtdeclarative5-private-dev libqt5v8-5-private-dev fakeroot
90+ exec_with_ssh $SUDO apt-get -y build-dep $PACKAGE
91+}
92+
93+reset_screen_powerdown() {
94+ exec_with_ssh $SUDO dbus-launch gsettings set com.canonical.powerd activity-timeout 600
95+ exec_with_ssh $SUDO sudo initctl restart powerd
96+}
97+
98+setup_adb_forwarding() {
99+ adb forward tcp:$TARGET_SSH_PORT tcp:22
100+ adb forward tcp:$TARGET_DEBUG_PORT tcp:$TARGET_DEBUG_PORT
101+}
102+
103+sync_code() {
104+ bzr export --uncommitted --format=dir /tmp/$CODE_DIR
105+ rsync -crlOzv -e "ssh -p $TARGET_SSH_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" /tmp/$CODE_DIR/ $USER@$TARGET_IP:$CODE_DIR/
106+ rm -rf /tmp/$CODE_DIR
107+}
108+
109+build() {
110+# exec_with_ssh "cd $CODE_DIR/ && qmake . && make -j 2"
111+ exec_with_ssh "cd $CODE_DIR/ && dpkg-buildpackage -j4"
112+}
113+
114+run() {
115+# exec_with_ssh $SUDO "make install"
116+ exec_with_ssh $SUDO "/sbin/initctl stop maliit-server"
117+# adb shell pkill $BINARY
118+# exec_with_ssh "$BINARY $RUN_OPTIONS"
119+}
120+
121+set -- `getopt -n$0 -u -a --longoptions="setup,help" "sh" "$@"`
122+
123+# FIXME: giving incorrect arguments does not call usage and exit
124+while [ $# -gt 0 ]
125+do
126+ case "$1" in
127+ -s|--setup) SETUP=true;;
128+ -h|--help) usage;;
129+ --) shift;break;;
130+ esac
131+ shift
132+done
133+
134+adb_root
135+setup_adb_forwarding
136+
137+if $SETUP; then
138+ echo "Setting up environment for building shell.."
139+ install_ssh_key
140+ install_dependencies
141+ reset_screen_powerdown
142+ sync_code
143+else
144+ echo "Transferring code.."
145+ sync_code
146+ echo "Building.."
147+ build
148+ echo "Running.."
149+ run
150+fi
151
152=== modified file 'debian/changelog'
153--- debian/changelog 2013-07-31 14:44:31 +0000
154+++ debian/changelog 2013-08-08 14:28:50 +0000
155@@ -1,3 +1,9 @@
156+maliit-plugins (0.99.trunk.phablet4) saycu; urgency=low
157+
158+ * url, phonenumber and number layouts
159+
160+ -- Thomas Moenicke <thomas@pachamama> Thu, 08 Aug 2013 16:27:47 +0200
161+
162 maliit-plugins (0.99.trunk.phablet3) saucy; urgency=low
163
164 * support for inputMethodHints and contentOrientation
165
166=== added file 'maliit-keyboard/data/languages/email.xml'
167--- maliit-keyboard/data/languages/email.xml 1970-01-01 00:00:00 +0000
168+++ maliit-keyboard/data/languages/email.xml 2013-08-08 14:28:50 +0000
169@@ -0,0 +1,487 @@
170+<?xml version="1.0" encoding="utf-8"?>
171+<!DOCTYPE keyboard SYSTEM "VirtualKeyboardLayout.dtd">
172+
173+<keyboard catalog="en_us" language="en_us" title="English (US)" version="1.0">
174+ <layout type="general">
175+ <section id="main">
176+ <row>
177+ <key>
178+ <binding label="q">
179+ <modifiers keys="shift">
180+ <binding label="Q" />
181+ </modifiers>
182+ </binding>
183+ </key>
184+ <key>
185+ <binding label="w">
186+ <modifiers keys="shift">
187+ <binding label="W" />
188+ </modifiers>
189+ </binding>
190+ </key>
191+ <key>
192+ <extended>
193+ <row>
194+ <key>
195+ <binding label="è">
196+ <modifiers keys="shift">
197+ <binding label="È" />
198+ </modifiers>
199+ </binding>
200+ </key>
201+ <key>
202+ <binding label="é">
203+ <modifiers keys="shift">
204+ <binding label="É" />
205+ </modifiers>
206+ </binding>
207+ </key>
208+ <key>
209+ <binding label="ê">
210+ <modifiers keys="shift">
211+ <binding label="Ê" />
212+ </modifiers>
213+ </binding>
214+ </key>
215+ <key>
216+ <binding label="ë">
217+ <modifiers keys="shift">
218+ <binding label="Ë" />
219+ </modifiers>
220+ </binding>
221+ </key>
222+ <key>
223+ <binding label="€">
224+ <modifiers keys="shift">
225+ <binding label="€" />
226+ </modifiers>
227+ </binding>
228+ </key>
229+ </row>
230+ </extended>
231+ <binding label="e">
232+ <modifiers keys="shift">
233+ <binding label="E" />
234+ </modifiers>
235+ </binding>
236+ </key>
237+ <key>
238+ <binding label="r">
239+ <modifiers keys="shift">
240+ <binding label="R" />
241+ </modifiers>
242+ </binding>
243+ </key>
244+ <key>
245+ <extended>
246+ <row>
247+ <key>
248+ <binding label="þ">
249+ <modifiers keys="shift">
250+ <binding label="Þ" />
251+ </modifiers>
252+ </binding>
253+ </key>
254+ </row>
255+ </extended>
256+ <binding label="t">
257+ <modifiers keys="shift">
258+ <binding label="T" />
259+ </modifiers>
260+ </binding>
261+ </key>
262+ <key>
263+ <extended>
264+ <row>
265+ <key>
266+ <binding label="ý">
267+ <modifiers keys="shift">
268+ <binding label="Ý" />
269+ </modifiers>
270+ </binding>
271+ </key>
272+ <key>
273+ <binding label="¥">
274+ <modifiers keys="shift">
275+ <binding label="¥" />
276+ </modifiers>
277+ </binding>
278+ </key>
279+ </row>
280+ </extended>
281+ <binding label="y">
282+ <modifiers keys="shift">
283+ <binding label="Y" />
284+ </modifiers>
285+ </binding>
286+ </key>
287+ <key>
288+ <extended>
289+ <row>
290+ <key>
291+ <binding label="û">
292+ <modifiers keys="shift">
293+ <binding label="Û" />
294+ </modifiers>
295+ </binding>
296+ </key>
297+ <key>
298+ <binding label="ù">
299+ <modifiers keys="shift">
300+ <binding label="Ù" />
301+ </modifiers>
302+ </binding>
303+ </key>
304+ <key>
305+ <binding label="ú">
306+ <modifiers keys="shift">
307+ <binding label="Ú" />
308+ </modifiers>
309+ </binding>
310+ </key>
311+ <key>
312+ <binding label="ü">
313+ <modifiers keys="shift">
314+ <binding label="Ü" />
315+ </modifiers>
316+ </binding>
317+ </key>
318+ </row>
319+ </extended>
320+ <binding label="u">
321+ <modifiers keys="shift">
322+ <binding label="U" />
323+ </modifiers>
324+ </binding>
325+ </key>
326+ <key>
327+ <extended>
328+ <row>
329+ <key>
330+ <binding label="î">
331+ <modifiers keys="shift">
332+ <binding label="Î" />
333+ </modifiers>
334+ </binding>
335+ </key>
336+ <key>
337+ <binding label="ï">
338+ <modifiers keys="shift">
339+ <binding label="Ï" />
340+ </modifiers>
341+ </binding>
342+ </key>
343+ <key>
344+ <binding label="ì">
345+ <modifiers keys="shift">
346+ <binding label="Ì" />
347+ </modifiers>
348+ </binding>
349+ </key>
350+ <key>
351+ <binding label="í">
352+ <modifiers keys="shift">
353+ <binding label="Í" />
354+ </modifiers>
355+ </binding>
356+ </key>
357+ </row>
358+ </extended>
359+ <binding label="i">
360+ <modifiers keys="shift">
361+ <binding label="I" />
362+ </modifiers>
363+ </binding>
364+ </key>
365+ <key>
366+ <extended>
367+ <row>
368+ <key>
369+ <binding label="ö">
370+ <modifiers keys="shift">
371+ <binding label="Ö" />
372+ </modifiers>
373+ </binding>
374+ </key>
375+ <key>
376+ <binding label="ô">
377+ <modifiers keys="shift">
378+ <binding label="Ô" />
379+ </modifiers>
380+ </binding>
381+ </key>
382+ <key>
383+ <binding label="ò">
384+ <modifiers keys="shift">
385+ <binding label="Ò" />
386+ </modifiers>
387+ </binding>
388+ </key>
389+ <key>
390+ <binding label="ó">
391+ <modifiers keys="shift">
392+ <binding label="Ó" />
393+ </modifiers>
394+ </binding>
395+ </key>
396+ </row>
397+ </extended>
398+ <binding label="o">
399+ <modifiers keys="shift">
400+ <binding label="O" />
401+ </modifiers>
402+ </binding>
403+ </key>
404+ <key>
405+ <binding label="p">
406+ <modifiers keys="shift">
407+ <binding label="P" />
408+ </modifiers>
409+ </binding>
410+ </key>
411+ </row>
412+ <row>
413+ <spacer />
414+ <key>
415+ <extended>
416+ <row>
417+ <key>
418+ <binding label="ä">
419+ <modifiers keys="shift">
420+ <binding label="Ä" />
421+ </modifiers>
422+ </binding>
423+ </key>
424+ <key>
425+ <binding label="à">
426+ <modifiers keys="shift">
427+ <binding label="À" />
428+ </modifiers>
429+ </binding>
430+ </key>
431+ <key>
432+ <binding label="â">
433+ <modifiers keys="shift">
434+ <binding label="Â" />
435+ </modifiers>
436+ </binding>
437+ </key>
438+ <key>
439+ <binding label="á">
440+ <modifiers keys="shift">
441+ <binding label="Á" />
442+ </modifiers>
443+ </binding>
444+ </key>
445+ <key>
446+ <binding label="ã">
447+ <modifiers keys="shift">
448+ <binding label="Ã" />
449+ </modifiers>
450+ </binding>
451+ </key>
452+ <key>
453+ <binding label="å">
454+ <modifiers keys="shift">
455+ <binding label="Å" />
456+ </modifiers>
457+ </binding>
458+ </key>
459+ </row>
460+ </extended>
461+ <binding label="a">
462+ <modifiers keys="shift">
463+ <binding label="A" />
464+ </modifiers>
465+ </binding>
466+ </key>
467+ <key>
468+ <extended>
469+ <row>
470+ <key>
471+ <binding label="ß">
472+ <modifiers keys="shift">
473+ <binding label="$" />
474+ </modifiers>
475+ </binding>
476+ </key>
477+ <key>
478+ <binding label="$" />
479+ </key>
480+ </row>
481+ </extended>
482+ <binding label="s">
483+ <modifiers keys="shift">
484+ <binding label="S" />
485+ </modifiers>
486+ </binding>
487+ </key>
488+ <key>
489+ <extended>
490+ <row>
491+ <key>
492+ <binding label="ð">
493+ <modifiers keys="shift">
494+ <binding label="Ð" />
495+ </modifiers>
496+ </binding>
497+ </key>
498+ </row>
499+ </extended>
500+ <binding label="d">
501+ <modifiers keys="shift">
502+ <binding label="D" />
503+ </modifiers>
504+ </binding>
505+ </key>
506+ <key>
507+ <binding label="f">
508+ <modifiers keys="shift">
509+ <binding label="F" />
510+ </modifiers>
511+ </binding>
512+ </key>
513+ <key>
514+ <binding label="g">
515+ <modifiers keys="shift">
516+ <binding label="G" />
517+ </modifiers>
518+ </binding>
519+ </key>
520+ <key>
521+ <binding label="h">
522+ <modifiers keys="shift">
523+ <binding label="H" />
524+ </modifiers>
525+ </binding>
526+ </key>
527+ <key>
528+ <binding label="j">
529+ <modifiers keys="shift">
530+ <binding label="J" />
531+ </modifiers>
532+ </binding>
533+ </key>
534+ <key>
535+ <binding label="k">
536+ <modifiers keys="shift">
537+ <binding label="K" />
538+ </modifiers>
539+ </binding>
540+ </key>
541+ <key>
542+ <binding label="l">
543+ <modifiers keys="shift">
544+ <binding label="L" />
545+ </modifiers>
546+ </binding>
547+ </key>
548+ <spacer />
549+ </row>
550+ <row>
551+ <key style="special" width="large">
552+ <binding action="shift" />
553+ </key>
554+ <spacer />
555+ <key>
556+ <binding label="z">
557+ <modifiers keys="shift">
558+ <binding label="Z" />
559+ </modifiers>
560+ </binding>
561+ </key>
562+ <key>
563+ <binding label="x">
564+ <modifiers keys="shift">
565+ <binding label="X" />
566+ </modifiers>
567+ </binding>
568+ </key>
569+ <key>
570+ <extended>
571+ <row>
572+ <key>
573+ <binding label="ç">
574+ <modifiers keys="shift">
575+ <binding label="Ç" />
576+ </modifiers>
577+ </binding>
578+ </key>
579+ </row>
580+ </extended>
581+ <binding label="c">
582+ <modifiers keys="shift">
583+ <binding label="C" />
584+ </modifiers>
585+ </binding>
586+ </key>
587+ <key>
588+ <binding label="v">
589+ <modifiers keys="shift">
590+ <binding label="V" />
591+ </modifiers>
592+ </binding>
593+ </key>
594+ <key>
595+ <binding label="b">
596+ <modifiers keys="shift">
597+ <binding label="B" />
598+ </modifiers>
599+ </binding>
600+ </key>
601+ <key>
602+ <extended>
603+ <row>
604+ <key>
605+ <binding label="ñ">
606+ <modifiers keys="shift">
607+ <binding label="Ñ" />
608+ </modifiers>
609+ </binding>
610+ </key>
611+ </row>
612+ </extended>
613+ <binding label="n">
614+ <modifiers keys="shift">
615+ <binding label="N" />
616+ </modifiers>
617+ </binding>
618+ </key>
619+ <key>
620+ <binding label="m">
621+ <modifiers keys="shift">
622+ <binding label="M" />
623+ </modifiers>
624+ </binding>
625+ </key>
626+ <spacer />
627+ <key style="special" width="large">
628+ <binding action="backspace" />
629+ </key>
630+ </row>
631+ <row>
632+ <key style="special" width="x-large">
633+ <binding action="sym" label="?123" />
634+ </key>
635+ <spacer />
636+ <key id="urlKey">
637+ <binding label=".com" />
638+ </key>
639+ <key width="large">
640+ <binding action="space" />
641+ </key>
642+ <key id="urlKey" width="large">
643+ <binding label=".com" />
644+ </key>
645+ <key>
646+ <binding label="." />
647+ </key>
648+ <spacer />
649+ <key id="actionKey" style="special" width="x-large">
650+ <binding action="return" />
651+ </key>
652+ </row>
653+ </section>
654+ </layout>
655+ <import file="symbols_en.xml" />
656+</keyboard>
657
658=== modified file 'maliit-keyboard/data/languages/number.xml'
659--- maliit-keyboard/data/languages/number.xml 2012-08-17 12:00:21 +0000
660+++ maliit-keyboard/data/languages/number.xml 2013-08-08 14:28:50 +0000
661@@ -5,51 +5,48 @@
662 <layout orientation="landscape" type="number">
663 <section id="main" movable="false">
664 <row>
665- <key>
666+ <key width="x-large">
667 <binding label="1" />
668 </key>
669- <key>
670+ <key width="x-large">
671 <binding label="2" />
672 </key>
673- <key>
674+ <key width="x-large">
675 <binding label="3" />
676 </key>
677- <key>
678+ </row>
679+ <row>
680+ <key width="x-large">
681 <binding label="4" />
682 </key>
683- <key>
684+ <key width="x-large">
685 <binding label="5" />
686 </key>
687- <key>
688+ <key width="x-large">
689 <binding label="6" />
690 </key>
691- <key>
692+ </row>
693+ <row>
694+ <key width="x-large">
695 <binding label="7" />
696 </key>
697- <key>
698+ <key width="x-large">
699 <binding label="8" />
700 </key>
701- <key>
702+ <key width="x-large">
703 <binding label="9" />
704 </key>
705- <key>
706+ </row>
707+ <row>
708+ <key width="x-large">
709+ <binding action="plus_minus_toggle" label="+/-" />
710+ </key>
711+ <key width="x-large">
712 <binding label="0" />
713 </key>
714- </row>
715- <row>
716- <spacer />
717- <key width="large">
718- <binding action="plus_minus_toggle" label="+/-" />
719- </key>
720- <key width="large">
721- <binding action="decimal_separator" />
722- </key>
723- <key style="special" width="large">
724+ <key style="special" width="x-large">
725 <binding action="backspace" label="" />
726 </key>
727- <key id="actionKey" style="special" width="large">
728- <binding action="return" />
729- </key>
730 </row>
731 </section>
732 </layout>
733
734=== modified file 'maliit-keyboard/lib/logic/dynamiclayout.cpp'
735--- maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-07-30 16:16:14 +0000
736+++ maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-08-08 14:28:50 +0000
737@@ -33,40 +33,36 @@
738 return vMargin;
739 }
740
741+/*
742+ * calculates margin per row
743+ **/
744+
745 QVector<int> DynamicLayout::calculateMargins(LayoutHelper::Orientation orientation,
746 Keyboard& kb)
747 {
748- if (d->marginsCachedOrientation != orientation)
749- d->invalidateMarginsCache();
750-
751- if (!d->marginsCacheValid) {
752- const qreal keyboardWidth = windowWidth(orientation);
753-
754- QVector<int> margins;
755- int spaceTakenByKeys = 0;
756- int numberOfKeysInRow = 0;
757- for (int index = 0; index < kb.keys.count(); ++index) {
758- const KeyDescription &desc(kb.key_descriptions.at(index));
759- int width = uiConst->keyWidth(orientation, desc.width);
760- spaceTakenByKeys += width;
761- numberOfKeysInRow++;
762-
763- bool at_row_end((index + 1 == kb.keys.count())
764- || (index + 1 < kb.keys.count()
765- && kb.key_descriptions.at(index + 1).row > desc.row));
766-
767- if (at_row_end) {
768- int marginThisRow = ( (keyboardWidth - spaceTakenByKeys) / (numberOfKeysInRow-1) ) / 2;
769- d->marginsCached.append(marginThisRow);
770- spaceTakenByKeys = 0;
771- }
772+ const qreal keyboardWidth = windowWidth(orientation);
773+
774+ QVector<int> margins;
775+ int spaceTakenByKeys = 0;
776+ int numberOfKeysInRow = 0;
777+ for (int index = 0; index < kb.keys.count(); ++index) {
778+ const KeyDescription &desc(kb.key_descriptions.at(index));
779+ int width = uiConst->keyWidth(orientation, desc.width);
780+ spaceTakenByKeys += width;
781+ numberOfKeysInRow++;
782+
783+ bool at_row_end((index + 1 == kb.keys.count())
784+ || (index + 1 < kb.keys.count()
785+ && kb.key_descriptions.at(index + 1).row > desc.row));
786+
787+ if (at_row_end) {
788+ int marginThisRow = ( (keyboardWidth - spaceTakenByKeys) / (numberOfKeysInRow-1) ) / 2;
789+ margins.append(marginThisRow);
790+ spaceTakenByKeys = 0;
791 }
792-
793- d->marginsCachedOrientation = orientation;
794- d->marginsCacheValid = true;
795 }
796
797- return d->marginsCached;
798+ return margins;
799 }
800
801 void DynamicLayout::calculateNumberOfRows(Keyboard& kb)
802
803=== modified file 'maliit-keyboard/lib/logic/keyareaconverter.cpp'
804--- maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-07-30 16:16:14 +0000
805+++ maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-08-08 14:28:50 +0000
806@@ -100,11 +100,10 @@
807 qreal consumed_width = 0;
808
809 QVector<int> margins = uiConst->calculateMargins(orientation, kb);
810- Q_ASSERT(margins.size() > 0);
811- qreal margin = margins[0];
812
813 int row = 0;
814 for (int index = 0; index < kb.keys.count(); ++index) {
815+ const qreal margin = margins[row];
816 row_indices.append(index);
817 Key &key(kb.keys[index]);
818 const KeyDescription &desc(kb.key_descriptions.at(index));
819
820=== modified file 'maliit-keyboard/lib/logic/layoutupdater.cpp'
821--- maliit-keyboard/lib/logic/layoutupdater.cpp 2013-07-29 11:52:26 +0000
822+++ maliit-keyboard/lib/logic/layoutupdater.cpp 2013-08-08 14:28:50 +0000
823@@ -332,8 +332,6 @@
824 d->layout->setCenterPanel(d->inShiftedState() ? converter.shiftedKeyArea()
825 : converter.keyArea());
826
827- converter.keyArea();
828- d->layout->setCenterPanel(converter.keyArea());
829 if (isWordRibbonVisible())
830 applyStyleToWordRibbon(d->layout->wordRibbon(), d->style, orientation);
831
832
833=== modified file 'maliit-keyboard/lib/models/layout.cpp'
834--- maliit-keyboard/lib/models/layout.cpp 2013-06-05 14:58:50 +0000
835+++ maliit-keyboard/lib/models/layout.cpp 2013-08-08 14:28:50 +0000
836@@ -63,6 +63,7 @@
837 KeyArea key_area;
838 QString image_directory;
839 QHash<int, QByteArray> roles;
840+ QString activeViewId;
841
842 explicit LayoutPrivate();
843 };
844@@ -229,6 +230,19 @@
845 qGuiApp->primaryScreen()->orientation()) );
846 }
847
848+
849+QString Layout::activeView() const
850+{
851+ Q_D(const Layout);
852+ return d->activeViewId;
853+}
854+
855+void Layout::setActiveView(const QString& activeViewId)
856+{
857+ Q_D(Layout);
858+ d->activeViewId = activeViewId;
859+}
860+
861 void Layout::setImageDirectory(const QString &directory)
862 {
863 Q_D(Layout);
864
865=== modified file 'maliit-keyboard/lib/models/layout.h'
866--- maliit-keyboard/lib/models/layout.h 2013-06-05 14:58:50 +0000
867+++ maliit-keyboard/lib/models/layout.h 2013-08-08 14:28:50 +0000
868@@ -78,6 +78,10 @@
869 Q_PROPERTY(int invisible_toucharea_height READ invisibleTouchAreaHeight
870 NOTIFY invisibleTouchAreaHeightChanged)
871
872+ Q_PROPERTY(QString activeView READ activeView WRITE setActiveView
873+ NOTIFY activeViewChanged)
874+
875+
876 public:
877 enum Roles {
878 RoleKeyRectangle = Qt::UserRole + 1,
879@@ -133,6 +137,10 @@
880 Q_SLOT int invisibleTouchAreaHeight() const;
881 Q_SIGNAL void invisibleTouchAreaHeightChanged(int &changed);
882
883+ Q_SLOT QString activeView() const;
884+ Q_SLOT void setActiveView(const QString& activeViewId);
885+ Q_SIGNAL void activeViewChanged(const QString &activeViewId);
886+
887 virtual QHash<int, QByteArray> roleNames() const;
888 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
889 virtual QVariant data(const QModelIndex &index,
890
891=== modified file 'maliit-keyboard/maliit-keyboard.pro'
892--- maliit-keyboard/maliit-keyboard.pro 2013-07-29 13:51:23 +0000
893+++ maliit-keyboard/maliit-keyboard.pro 2013-08-08 14:28:50 +0000
894@@ -9,7 +9,6 @@
895 tests \
896 benchmark \
897
898-
899 !notests {
900 SUBDIRS += tests
901 }
902
903=== modified file 'maliit-keyboard/plugin/inputmethod.cpp'
904--- maliit-keyboard/plugin/inputmethod.cpp 2013-07-30 16:16:14 +0000
905+++ maliit-keyboard/plugin/inputmethod.cpp 2013-08-08 14:28:50 +0000
906@@ -62,7 +62,7 @@
907 #include <maliit/plugins/abstractpluginsetting.h>
908 #include <maliit/plugins/updateevent.h>
909 #include <maliit/plugins/abstractinputmethodhost.h>
910-
911+#include <maliit/namespace.h>
912
913 #include <QApplication>
914 #include <QWidget>
915@@ -169,6 +169,8 @@
916 QQuickView* view;
917
918 bool predictionEnabled;
919+ Maliit::TextContentType contentType;
920+ QString activeLanguageId;
921
922 explicit InputMethodPrivate(InputMethod * const q,
923 MAbstractInputMethodHost *host);
924@@ -176,6 +178,7 @@
925 void updateKeyboardOrientation();
926 void updateWordRibbon();
927
928+ void setActiveKeyboardId(const QString& id);
929 void connectToNotifier();
930 void setContextProperties(QQmlContext *qml_context);
931 };
932@@ -204,6 +207,8 @@
933 , host(host)
934 , view(0)
935 , predictionEnabled(false)
936+ , contentType(Maliit::FreeTextContentType)
937+ , activeLanguageId("en_us")
938 {
939 view = createWindow(host);
940
941@@ -359,6 +364,20 @@
942 setLayoutOrientation(QGuiApplication::primaryScreen()->orientation());
943 }
944
945+/*
946+ * changes keyboard layout
947+ * called directly to show URL or num layout for special contentTypes,
948+ * does not change the current language id / activeView
949+ */
950+
951+void InputMethodPrivate::setActiveKeyboardId(const QString &id)
952+{
953+ // FIXME: Perhaps better to let both LayoutUpdater share the same KeyboardLoader instance?
954+ layout.updater.setActiveKeyboardId(id);
955+ extended_layout.updater.setActiveKeyboardId(id);
956+ layout.model.setActiveView(id);
957+}
958+
959 void InputMethodPrivate::connectToNotifier()
960 {
961 #ifdef TEMP_DISABLED
962@@ -436,6 +455,7 @@
963 connect(this, SIGNAL(wordRibbonEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool)));
964
965 connect(this, SIGNAL(predictionEnabledChanged()), this, SLOT(updateWordEngine()));
966+ connect(this, SIGNAL(contentTypeChanged(Maliit::TextContentType)), this, SLOT(onContentTypeChanged(Maliit::TextContentType)));
967
968 registerStyleSetting(host);
969
970@@ -457,13 +477,9 @@
971 void InputMethod::show()
972 {
973 Q_D(InputMethod);
974- bool valid = true;
975
976 d->view->setVisible(true);
977
978- if (d->host->contentType(valid) == Maliit::UrlContentType)
979- setActiveSubView("url");
980-
981 #ifdef EXTENDED_SURFACE_TEMP_DISABLED
982 d->surface->show();
983 d->extended_surface->show();
984@@ -551,15 +567,17 @@
985 return views;
986 }
987
988+// called by settings change/language change
989 void InputMethod::setActiveSubView(const QString &id,
990 Maliit::HandlerState state)
991 {
992 Q_UNUSED(state)
993 Q_D(InputMethod);
994
995- // FIXME: Perhaps better to let both LayoutUpdater share the same KeyboardLoader instance?
996- d->layout.updater.setActiveKeyboardId(id);
997- d->extended_layout.updater.setActiveKeyboardId(id);
998+ // store language id, so we can switch back to current active view
999+ // after showing special layouts as e.g. URL or Num layouts
1000+ d->activeLanguageId = id;
1001+ d->setActiveKeyboardId(id);
1002 }
1003
1004 QString InputMethod::activeSubView(Maliit::HandlerState state) const
1005@@ -610,7 +628,6 @@
1006 return true;
1007 }
1008
1009-
1010 void InputMethod::registerStyleSetting(MAbstractInputMethodHost *host)
1011 {
1012 Q_D(InputMethod);
1013@@ -899,6 +916,8 @@
1014 bool valid;
1015
1016 bool emitPredictionEnabled = false;
1017+ bool emitContentType = false;
1018+
1019 bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid);
1020
1021 if (!valid)
1022@@ -908,9 +927,24 @@
1023 d->predictionEnabled = newPredictionEnabled;
1024 emitPredictionEnabled = true;
1025 }
1026+
1027+ Maliit::TextContentType newContentType = static_cast<Maliit::TextContentType>( inputMethodHost()->contentType(valid) );
1028+ if (!valid) {
1029+ newContentType = Maliit::FreeTextContentType;
1030+ }
1031+
1032+ if (newContentType != d->contentType) {
1033+ d->contentType = newContentType;
1034+ emitContentType = true;
1035+ }
1036+
1037+
1038 if (emitPredictionEnabled)
1039 Q_EMIT predictionEnabledChanged();
1040
1041+ if (emitContentType)
1042+ Q_EMIT contentTypeChanged(d->contentType);
1043+
1044 }
1045
1046 void InputMethod::updateWordEngine()
1047@@ -931,6 +965,32 @@
1048 return d->predictionEnabled;
1049 }
1050
1051+Maliit::TextContentType InputMethod::contentType()
1052+{
1053+ Q_D(InputMethod);
1054+ return d->contentType;
1055+}
1056+
1057+void InputMethod::onContentTypeChanged(Maliit::TextContentType contentType)
1058+{
1059+ Q_D(InputMethod);
1060+
1061+ if (contentType == Maliit::FreeTextContentType)
1062+ d->setActiveKeyboardId( d->activeLanguageId );
1063+
1064+ if (contentType == Maliit::NumberContentType)
1065+ d->setActiveKeyboardId( "number" );
1066+
1067+ if (contentType == Maliit::PhoneNumberContentType)
1068+ d->setActiveKeyboardId( "phonenumber" );
1069+
1070+ if (contentType == Maliit::EmailContentType)
1071+ d->setActiveKeyboardId( "email" );
1072+
1073+ if (contentType == Maliit::UrlContentType)
1074+ d->setActiveKeyboardId("url");
1075+}
1076+
1077 void InputMethod::onQQuickViewStatusChanged(QQuickView::Status status)
1078 {
1079 Q_D(InputMethod);
1080
1081=== modified file 'maliit-keyboard/plugin/inputmethod.h'
1082--- maliit-keyboard/plugin/inputmethod.h 2013-07-30 11:04:20 +0000
1083+++ maliit-keyboard/plugin/inputmethod.h 2013-08-08 14:28:50 +0000
1084@@ -80,12 +80,16 @@
1085 Q_SLOT void onQQuickViewStatusChanged(QQuickView::Status status);
1086
1087 Q_PROPERTY(bool predictionEnabled READ predictionEnabled NOTIFY predictionEnabledChanged)
1088+ Q_PROPERTY(Maliit::TextContentType contentType READ contentType NOTIFY contentTypeChanged)
1089
1090 bool predictionEnabled();
1091+ Maliit::TextContentType contentType();
1092+
1093 void update();
1094
1095 Q_SIGNALS:
1096 void predictionEnabledChanged();
1097+ void contentTypeChanged(Maliit::TextContentType contentType);
1098
1099 private:
1100 void registerStyleSetting(MAbstractInputMethodHost *host);
1101@@ -115,6 +119,8 @@
1102 Q_SLOT void onMagnifierLayoutOriginChanged(const QPoint &origin);
1103 #endif
1104
1105+ Q_SLOT void onContentTypeChanged(Maliit::TextContentType contentType);
1106+
1107 Q_SLOT void onHideAnimationFinished();
1108 Q_SIGNAL void wordEngineEnabledChanged(bool wordEngineEnabled);
1109 Q_SIGNAL void wordRibbonEnabledChanged(bool wordRibbonEnabled);
1110
1111=== modified file 'maliit-keyboard/tests/common/common.pro'
1112--- maliit-keyboard/tests/common/common.pro 2012-11-21 15:19:50 +0000
1113+++ maliit-keyboard/tests/common/common.pro 2013-08-08 14:28:50 +0000
1114@@ -29,3 +29,6 @@
1115 check.target = check
1116 check.command = $$system(true)
1117 check.depends += libtests-common.a
1118+
1119+OTHER_FILES += \
1120+ helper.js
1121
1122=== added file 'maliit-keyboard/tests/common/helper.js'
1123--- maliit-keyboard/tests/common/helper.js 1970-01-01 00:00:00 +0000
1124+++ maliit-keyboard/tests/common/helper.js 2013-08-08 14:28:50 +0000
1125@@ -0,0 +1,13 @@
1126+.pragma library
1127+
1128+// Find an object with the given name recursively, starting
1129+// at the given object "obj"
1130+function findChild(obj,objectName) {
1131+ for (var i in obj.children) {
1132+ var child = obj.children[i];
1133+ if (child.objectName === objectName) return child;
1134+ var subChild = findChild(child,objectName);
1135+ if (subChild !== undefined) return subChild;
1136+ }
1137+ return undefined;
1138+}
1139
1140=== modified file 'maliit-keyboard/tests/language-layout-switching/main.cpp'
1141--- maliit-keyboard/tests/language-layout-switching/main.cpp 2013-03-22 16:40:29 +0000
1142+++ maliit-keyboard/tests/language-layout-switching/main.cpp 2013-08-08 14:28:50 +0000
1143@@ -87,6 +87,8 @@
1144 QCOMPARE(layout.activeKeyArea().keys().count(), expected_key_count);
1145 }
1146
1147+ // Note: this feature is not important in Ubuntu UX
1148+
1149 // This test is very trivial. It's required however because none of the
1150 // current mainline layouts feature layout switch keys, thus making
1151 // regressions impossible to spot.
1152
1153=== added directory 'maliit-keyboard/tests/qml-api-tests'
1154=== added directory 'maliit-keyboard/tests/qml-api-tests/imports'
1155=== added directory 'maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport'
1156=== added file 'maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir'
1157--- maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir 1970-01-01 00:00:00 +0000
1158+++ maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir 2013-08-08 14:28:50 +0000
1159@@ -0,0 +1,2 @@
1160+module MaliitTestSupport
1161+plugin maliitqmlhelperplugin
1162
1163=== added file 'maliit-keyboard/tests/qml-api-tests/plugin.cpp'
1164--- maliit-keyboard/tests/qml-api-tests/plugin.cpp 1970-01-01 00:00:00 +0000
1165+++ maliit-keyboard/tests/qml-api-tests/plugin.cpp 2013-08-08 14:28:50 +0000
1166@@ -0,0 +1,55 @@
1167+#include <QtQml/QQmlExtensionPlugin>
1168+#include <QtQml/qqml.h>
1169+#include <qdebug.h>
1170+#include <qcoreapplication.h>
1171+
1172+#include <QStringList>
1173+#include <QUrl>
1174+#include <QFile>
1175+
1176+class MaliitTestHelper : public QObject
1177+{
1178+ Q_OBJECT
1179+
1180+public:
1181+ MaliitTestHelper(QObject *parent=0) : QObject(parent)
1182+ {
1183+ }
1184+
1185+ ~MaliitTestHelper()
1186+ {
1187+ }
1188+
1189+ Q_INVOKABLE QStringList localeUiLanguages(QVariant value) {
1190+ QLocale locale = value.toLocale();
1191+ return locale.uiLanguages();
1192+ }
1193+
1194+ Q_INVOKABLE QString localeName(QVariant value) {
1195+ QLocale locale = value.toLocale();
1196+ return locale.name();
1197+ }
1198+
1199+signals:
1200+private:
1201+};
1202+
1203+
1204+class MaliitQmlHelperPlugin : public QQmlExtensionPlugin
1205+{
1206+ Q_OBJECT
1207+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
1208+
1209+public:
1210+
1211+ void registerTypes(const char *uri)
1212+ {
1213+ Q_ASSERT(uri == QLatin1String("MaliitTestSupport"));
1214+ qmlRegisterType<MaliitTestHelper>(uri, 1, 0, "MaliitTestHelper");
1215+ }
1216+};
1217+
1218+
1219+#include "plugin.moc"
1220+
1221+
1222
1223=== added file 'maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro'
1224--- maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro 1970-01-01 00:00:00 +0000
1225+++ maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro 2013-08-08 14:28:50 +0000
1226@@ -0,0 +1,20 @@
1227+include(../../config-plugin.pri)
1228+
1229+TARGET = maliitqmlhelperplugin
1230+DESTDIR = imports/MaliitTestSupport
1231+TEMPLATE = lib
1232+CONFIG += qt plugin
1233+
1234+SOURCES += \
1235+ plugin.cpp
1236+
1237+QT = core gui qml quick qml-private
1238+
1239+INCLUDEPATH += ../../lib ../../
1240+
1241+pluginfiles.files += \
1242+ imports/MaliitTestSupport/qmldir \
1243+
1244+OTHER_FILES += \
1245+ tst_inputMethodHints.qml
1246+
1247
1248=== added file 'maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml'
1249--- maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml 1970-01-01 00:00:00 +0000
1250+++ maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml 2013-08-08 14:28:50 +0000
1251@@ -0,0 +1,124 @@
1252+
1253+import QtQuick 2.0
1254+import QtTest 1.0 // for TestCase
1255+import Ubuntu.Components 0.1
1256+import MaliitTestSupport 1.0
1257+
1258+/*
1259+ * qmltestrunner -import maliit-keyboard/tests/qml-api-tests/imports/ -input maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml
1260+ *
1261+ * Note: if tests fail, try to increase asyncDelay
1262+ */
1263+
1264+Item {
1265+ id: mainWindow
1266+
1267+ width: 1280
1268+ height: 720
1269+
1270+ anchors.margins: 60
1271+
1272+ /**
1273+ maliitTestHelper.localeName(Qt.inputMethod.locale)
1274+ maliitTestHelper.localeUiLanguages(Qt.inputMethod.locale)
1275+ */
1276+
1277+ MaliitTestHelper {
1278+ id: maliitTestHelper
1279+ }
1280+
1281+ Rectangle
1282+ {
1283+ anchors.fill: parent
1284+ color: "red"
1285+ }
1286+
1287+ TextField {
1288+ id: unusedTextField
1289+ anchors {
1290+ top: mainWindow.top
1291+ horizontalCenter: parent.horizontalCenter
1292+ topMargin: 50
1293+ }
1294+ inputMethodHints: Qt.ImhUrlCharactersOnly
1295+ }
1296+
1297+ TextField {
1298+ id: textField
1299+ anchors {
1300+ top: unusedTextField.bottom
1301+ horizontalCenter: parent.horizontalCenter
1302+ topMargin: 50
1303+ }
1304+ inputMethodHints: Qt.ImhUrlCharactersOnly
1305+ }
1306+
1307+ TextField {
1308+ id: noPredictiveTextField
1309+ anchors {
1310+ top: textField.bottom
1311+ horizontalCenter: parent.horizontalCenter
1312+ topMargin: 50
1313+ }
1314+ inputMethodHints: Qt.ImhNoPredictiveText
1315+ }
1316+
1317+ TestCase {
1318+ id: inputMethodHintsTest
1319+ name: "inputMethodHints"
1320+
1321+ // We must wait until the window is shown because we're going to do mouse interaction
1322+ when: windowShown
1323+
1324+ function initTestCase() {
1325+ }
1326+
1327+ function test_1_oskShownHide()
1328+ {
1329+ compare(Qt.inputMethod.visible, false)
1330+
1331+ click(textField)
1332+
1333+ tryCompare(Qt.inputMethod, "visible", true)
1334+
1335+ wait(500)
1336+
1337+ // TODO get actual values from MaliitTestHelper, e.g height 608
1338+ verify(Qt.inputMethod.keyboardRectangle.height > 0)
1339+
1340+ textField.focus = false
1341+ compare(textField.focus, false)
1342+
1343+ wait(500)
1344+
1345+ tryCompare(Qt.inputMethod, "visible", false)
1346+ tryCompare(Qt.inputMethod.keyboardRectangle, "height", 0)
1347+ }
1348+
1349+ function test_2_noPredictiveText()
1350+ {
1351+ textField.focus = true
1352+
1353+ click(textField)
1354+
1355+ tryCompare(Qt.inputMethod, "visible", true)
1356+ wait(500)
1357+ verify(Qt.inputMethod.keyboardRectangle.height > 0)
1358+ tryCompare(Qt.inputMethod.keyboardRectangle, "height", 796)
1359+
1360+ textField.focus = false
1361+ noPredictiveTextField.focus = true
1362+
1363+ tryCompare(Qt.inputMethod.keyboardRectangle, "height", 608)
1364+ }
1365+
1366+ /* helper */
1367+
1368+ function click(target) {
1369+ mouseClick(target, (target).width / 2, (target).height / 2)
1370+ keyClick(Qt.Key_5)
1371+ }
1372+
1373+ }
1374+
1375+}
1376
1377=== added file 'maliit-keyboard/tests/qml-test-app/layout-test.qml'
1378--- maliit-keyboard/tests/qml-test-app/layout-test.qml 1970-01-01 00:00:00 +0000
1379+++ maliit-keyboard/tests/qml-test-app/layout-test.qml 2013-08-08 14:28:50 +0000
1380@@ -0,0 +1,202 @@
1381+import QtQuick 2.0
1382+
1383+
1384+
1385+import QtQuick 2.0
1386+import Ubuntu.Components 0.1
1387+
1388+MainView {
1389+ id: root
1390+
1391+ automaticOrientation: true
1392+
1393+ Rectangle {
1394+ anchors.fill: parent
1395+ color: "lightblue"
1396+ }
1397+
1398+ Column {
1399+
1400+ y: units.gu(3)
1401+ width: parent.width
1402+ anchors.horizontalCenter: parent.horizontalCenter
1403+ spacing: units.gu(1)
1404+
1405+ anchors.margins: units.gu(1)
1406+
1407+ Text {
1408+ id: label
1409+ text: "OSK Layout Test"
1410+ anchors.horizontalCenter: parent.horizontalCenter
1411+ font.pixelSize: units.gu(2)
1412+ font.bold: true
1413+ }
1414+
1415+ Rectangle {
1416+ anchors.horizontalCenter: parent.horizontalCenter
1417+ width: units.gu(18);
1418+ height: units.gu(6);
1419+
1420+ anchors.leftMargin: units.gu(1)
1421+
1422+ color: "white"
1423+
1424+ TextInput {
1425+ id: input;
1426+ anchors.fill: parent
1427+ color: "black"; selectionColor: "red"
1428+
1429+ // Qt.ImhPreferNumbers
1430+ inputMethodHints: Qt.ImhUrlCharactersOnly
1431+ font.pixelSize: units.gu(3)
1432+ font.bold: true
1433+ }
1434+ }
1435+
1436+ Rectangle {
1437+ anchors.horizontalCenter: parent.horizontalCenter;
1438+ width: units.gu(18);
1439+ height: units.gu(6);
1440+
1441+ color: "white"
1442+
1443+ TextInput {
1444+ id: secondInput;
1445+ anchors.fill: parent
1446+ font.pixelSize: units.gu(3)
1447+ inputMethodHints: Qt.ImhNone
1448+ }
1449+ }
1450+
1451+ Rectangle {
1452+ anchors.horizontalCenter: parent.horizontalCenter;
1453+ width: units.gu(18);
1454+ height: units.gu(6);
1455+
1456+ color: "white"
1457+
1458+ TextInput {
1459+ anchors.fill: parent
1460+ font.pixelSize: units.gu(3)
1461+ inputMethodHints: Qt.ImhDigitsOnly
1462+ }
1463+ }
1464+
1465+ Rectangle {
1466+ anchors.horizontalCenter: parent.horizontalCenter;
1467+ width: units.gu(18);
1468+ height: units.gu(6);
1469+
1470+ color: "white"
1471+
1472+ TextInput {
1473+ anchors.fill: parent
1474+ font.pixelSize: units.gu(3)
1475+ inputMethodHints: Qt.ImhDialableCharactersOnly
1476+ }
1477+ }
1478+
1479+
1480+ Row {
1481+ anchors.horizontalCenter: parent.horizontalCenter;
1482+
1483+ Text {
1484+ id: textRectangle
1485+
1486+ font.pixelSize: units.gu(1)
1487+ text: Qt.inputMethod.keyboardRectangle + " "
1488+ }
1489+
1490+ Rectangle {
1491+ id: clickBehindOSKDetectedIndicator
1492+
1493+ width: units.gu(18)
1494+ height: units.gu(3)
1495+ state: "default"
1496+
1497+ Text {
1498+ id: clickBehindOSKDetectedIndicatorText
1499+ anchors.centerIn: parent
1500+ text: "clicked"
1501+ font.pixelSize: units.gu(2)
1502+ font.bold: true
1503+ }
1504+
1505+ states: [
1506+ State {
1507+ name: "default"
1508+ PropertyChanges {
1509+ target: clickBehindOSKDetectedIndicator
1510+ color: "gray"
1511+ }
1512+ PropertyChanges {
1513+ target: clickBehindOSKDetectedIndicatorText
1514+ color: "gray"
1515+ }
1516+ },
1517+ State {
1518+ name: "highlight"
1519+ PropertyChanges {
1520+ target: clickBehindOSKDetectedIndicator
1521+ color: "red"
1522+ }
1523+ PropertyChanges {
1524+ target: clickBehindOSKDetectedIndicatorText
1525+ color: "white"
1526+ }
1527+ }
1528+ ]
1529+ }
1530+
1531+ }
1532+
1533+ Text {
1534+ id: textVisible
1535+
1536+ anchors.horizontalCenter: parent.horizontalCenter;
1537+
1538+ font.pixelSize: units.gu(2)
1539+ text: "keyboard reports visible: " + Qt.inputMethod.visible
1540+ }
1541+
1542+ } // column
1543+
1544+ Rectangle {
1545+ id: fakeBrowserUrlBar
1546+ width: keyboardRect.width
1547+ height: units.gu(4)
1548+ color: "orange"
1549+ anchors.bottom: keyboardRect.top
1550+
1551+ Text {
1552+ visible: Qt.inputMethod.visible
1553+ anchors.centerIn: parent
1554+ font.pixelSize: units.gu(1)
1555+ text: "browser url bar"
1556+ }
1557+ }
1558+
1559+ Rectangle {
1560+ id: keyboardRect
1561+
1562+ width: Qt.inputMethod.keyboardRectangle.width
1563+ height: Qt.inputMethod.keyboardRectangle.height
1564+
1565+ anchors.bottom: parent.bottom
1566+ color: " green"
1567+
1568+ Text {
1569+ visible: Qt.inputMethod.visible
1570+ anchors.centerIn: parent
1571+ font.pointSize: 24
1572+ text: Qt.inputMethod.keyboardRectangle + " "
1573+ }
1574+
1575+ MouseArea {
1576+ anchors.fill: parent
1577+ onClicked: clickBehindOSKDetectedIndicator.visible = true
1578+ onPressed: clickBehindOSKDetectedIndicator.state = "highlight"
1579+ onReleased: clickBehindOSKDetectedIndicator.state = "default"
1580+ }
1581+ }
1582+}
1583
1584=== modified file 'maliit-keyboard/tests/qml-test-app/qml-test-app.pro'
1585--- maliit-keyboard/tests/qml-test-app/qml-test-app.pro 2013-05-15 14:35:21 +0000
1586+++ maliit-keyboard/tests/qml-test-app/qml-test-app.pro 2013-08-08 14:28:50 +0000
1587@@ -6,5 +6,6 @@
1588
1589 INSTALLS += qml
1590 OTHER_FILES += \
1591- keyboard-test.qml
1592+ keyboard-test.qml \
1593+ layout-test.qml
1594
1595
1596=== modified file 'maliit-keyboard/tests/tests.pro'
1597--- maliit-keyboard/tests/tests.pro 2013-07-29 13:51:23 +0000
1598+++ maliit-keyboard/tests/tests.pro 2013-08-08 14:28:50 +0000
1599@@ -8,6 +8,7 @@
1600 word-candidates \
1601 language-layout-loading \
1602 qml-test-app \
1603+ qml-api-tests \
1604 wordengine \
1605
1606 CONFIG += ordered
1607
1608=== modified file 'unittests.sh'
1609--- unittests.sh 2013-07-29 13:51:23 +0000
1610+++ unittests.sh 2013-08-08 14:28:50 +0000
1611@@ -1,11 +1,11 @@
1612
1613-
1614-adb push maliit-keyboard/plugin/libmaliit-keyboard-plugin.so /data/ubuntu/usr/lib/maliit/plugins/libmaliit-keyboard-plugin.so
1615-adb push maliit-keyboard/tests/wordengine/ut_wordengine /data/ubuntu/usr/bin
1616-adb push maliit-keyboard/tests/editor/ut_editor /data/ubuntu/usr/bin
1617-
1618-adb shell QT_QPA_PLATFORM=minimal LD_LIBRARY_PATH=/usr/lib/maliit/plugins:$_LD_LIBRARY_PATH /usr/bin/ut_editor
1619-adb shell QT_QPA_PLATFORM=minimal LD_LIBRARY_PATH=/usr/lib/maliit/plugins:$_LD_LIBRARY_PATH /usr/bin/ut_wordengine
1620-
1621+# to be run on the device
1622+
1623+LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/editor/ut_editor
1624+LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/wordengine/ut_wordengine
1625+LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/dynamic-layout/ut_dynamiclayout
1626+LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/language-layout-switching/language-layout-switching
1627+
1628+qmltestrunner -import maliit-keyboard/tests/qml-api-tests/imports/ -input maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml
1629
1630

Subscribers

People subscribed via source and target branches