Merge lp:~renatofilho/ubuntu-keyboard/fix-1231445 into lp:ubuntu-keyboard

Proposed by Renato Araujo Oliveira Filho
Status: Superseded
Proposed branch: lp:~renatofilho/ubuntu-keyboard/fix-1231445
Merge into: lp:ubuntu-keyboard
Diff against target: 706 lines (+432/-64)
18 files modified
debian/control (+7/-0)
debian/qtdeclarative5-ubuntu-keyboard-extensions0.1.install (+1/-0)
qml/keys/ActionKey.qml (+22/-14)
qml/keys/CharKey.qml (+6/-1)
qml/keys/ReturnKey.qml (+14/-3)
src/imports/Ubuntu/Keyboard/Keyboard.pro (+29/-0)
src/imports/Ubuntu/Keyboard/inputmethodextensions.cpp (+121/-0)
src/imports/Ubuntu/Keyboard/inputmethodextensions.h (+74/-0)
src/imports/Ubuntu/Keyboard/plugin.cpp (+46/-0)
src/imports/Ubuntu/Keyboard/plugin.h (+50/-0)
src/imports/Ubuntu/Keyboard/qmldir (+2/-0)
src/imports/Ubuntu/Ubuntu.pro (+7/-0)
src/imports/imports.pro (+9/-0)
src/plugin/inputmethod.cpp (+37/-41)
src/plugin/inputmethod.h (+4/-2)
src/plugin/inputmethod_p.h (+1/-2)
src/src.pro (+1/-0)
ubuntu-keyboard.pro (+1/-1)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-keyboard/fix-1231445
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Michael Sheldon (community) Approve
Łukasz Zemczak Pending
Review via email: mp+216316@code.launchpad.net

This proposal has been superseded by a proposal from 2014-05-01.

Commit message

Added support to override the action key.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
160. By Renato Araujo Oliveira Filho

Fixed icon change during the runtime.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
161. By Renato Araujo Oliveira Filho

Created qml plugin.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
162. By Renato Araujo Oliveira Filho

Adding missing file.

163. By Renato Araujo Oliveira Filho

Added documentation.

164. By Renato Araujo Oliveira Filho

Fixed new package dependency.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
165. By Renato Araujo Oliveira Filho

Added missing install file.

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: Approve (continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Looks good overall, only small issue I can see is a slight typo: "UbubntuKeyboardInputMethodExtensionPlugin" should be "UbuntuKeyboardInputMethodExtensionPlugin" in both src/imports/Ubuntu/Keyboard/plugin.h and src/imports/Ubuntu/Keyboard/plugin.cpp.

166. By Renato Araujo Oliveira Filho

Fixed typo.

167. By Renato Araujo Oliveira Filho

Rename package qtdeclarative5-ubuntu-keyboard-extensions to qtdeclarative5-ubuntu-keyboard-extensions0.1

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
168. By Renato Araujo Oliveira Filho

Used namespace Ubuntu.Keyboard for qml plugin.

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

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

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes) YES
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator? YES

Did you successfully run all tests found in your component's Test Plan on device or emulator? YES

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

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

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

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

 * Yes

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

 * Yes

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

 * Yes

Revision history for this message
Michael Sheldon (michael-sheldon) :
review: Approve
169. By Renato Araujo Oliveira Filho

Fixed filename typo.

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

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-01-22 20:31:47 +0000
3+++ debian/control 2014-04-30 15:35:05 +0000
4@@ -228,3 +228,10 @@
5 ${shlibs:Depends},
6 Description: Ubuntu on-screen keyboard data files - Swedish
7 Data files for the Ubuntu virtual keyboard - Swedish
8+
9+Package: qtdeclarative5-ubuntu-keyboard-extensions0.1
10+Architecture: any
11+Depends: ${misc:Depends},
12+ ${shlibs:Depends},
13+Description: Ubuntu on-screen keyboard data files - QML plugin
14+ QMl extension for the Ubuntu virtual keyboard
15
16=== added file 'debian/qtdeclarative5-ubuntu-keyboard-extensions0.1.install'
17--- debian/qtdeclarative5-ubuntu-keyboard-extensions0.1.install 1970-01-01 00:00:00 +0000
18+++ debian/qtdeclarative5-ubuntu-keyboard-extensions0.1.install 2014-04-30 15:35:05 +0000
19@@ -0,0 +1,1 @@
20+usr/lib/*/qt5/qml/Ubuntu/Keyboard/*
21
22=== modified file 'qml/keys/ActionKey.qml'
23--- qml/keys/ActionKey.qml 2013-10-31 14:24:31 +0000
24+++ qml/keys/ActionKey.qml 2014-04-30 15:35:05 +0000
25@@ -36,8 +36,6 @@
26 imgNormal: UI.imageActionKey
27 imgPressed: UI.imageActionKeyPressed
28
29- property string __icon: iconNormal
30-
31 // can be overwritten by keys
32 property color colorNormal: "transparent"
33 property color colorShifted: "transparent"
34@@ -45,23 +43,33 @@
35
36 Icon {
37 id: iconImage
38- name: __icon
39+ name: actionKeyRoot.iconNormal
40+ color: actionKeyRoot.colorNormal
41 anchors.centerIn: parent
42 visible: (label == "")
43 width: units.gu(2.5)
44 height: units.gu(2.5)
45+
46 }
47
48- onOskStateChanged: {
49- if (panel.activeKeypadState == "NORMAL") {
50- __icon = iconNormal;
51- iconImage.color = colorNormal;
52- } else if (panel.activeKeypadState == "SHIFTED") {
53- __icon = iconShifted;
54- iconImage.color = colorShifted;
55- } else if (panel.activeKeypadState == "CAPSLOCK") {
56- __icon = iconCapsLock;
57- iconImage.color = colorCapsLock;
58+ // make sure the icon changes even if the property icon* change on runtime
59+ state: panel.activeKeypadState
60+ states: [
61+ State {
62+ name: "SHIFTED"
63+ PropertyChanges {
64+ target: iconImage
65+ name: actionKeyRoot.iconShifted
66+ color: actionKeyRoot.colorShifted
67+ }
68+ },
69+ State {
70+ name: "CAPSLOCK"
71+ PropertyChanges {
72+ target: iconImage
73+ name: actionKeyRoot.iconCapsLock
74+ color: actionKeyRoot.colorCapsLock
75+ }
76 }
77- }
78+ ]
79 }
80
81=== modified file 'qml/keys/CharKey.qml'
82--- qml/keys/CharKey.qml 2014-04-07 12:20:08 +0000
83+++ qml/keys/CharKey.qml 2014-04-30 15:35:05 +0000
84@@ -99,11 +99,16 @@
85 Text {
86 id: keyLabel
87 text: (panel.activeKeypadState === "NORMAL") ? label : shifted;
88- anchors.centerIn: parent
89 font.family: UI.fontFamily
90 font.pixelSize: fontSize
91 font.bold: UI.fontBold
92 color: UI.fontColor
93+ anchors.right: parent.right
94+ anchors.left: parent.left
95+ anchors.verticalCenter: parent.verticalCenter
96+ anchors.margins: units.gu( UI.annotationMargins )
97+ horizontalAlignment: Text.AlignHCenter
98+ elide: Text.ElideRight
99 }
100
101 /// shows an annotation
102
103=== modified file 'qml/keys/ReturnKey.qml'
104--- qml/keys/ReturnKey.qml 2013-10-09 13:51:12 +0000
105+++ qml/keys/ReturnKey.qml 2014-04-30 15:35:05 +0000
106@@ -17,8 +17,19 @@
107 import QtQuick 2.0
108
109 ActionKey {
110- iconNormal: "keyboard-return"
111- iconShifted: "keyboard-return";
112- iconCapsLock: "keyboard-return";
113+ property var actionKeyOverride: maliit_input_method.actionKeyOverride
114+ property string overrideIconName: actionKeyOverride && actionKeyOverride.icon ? actionKeyOverride.icon : ""
115+ property string overrideLabel: actionKeyOverride && actionKeyOverride.label ? actionKeyOverride.label : ""
116+
117+ enabled: actionKeyOverride ? actionKeyOverride.enabled : true
118+ // overrideIcon has high priority over label
119+ label: overrideIconName == "" ? overrideLabel : ""
120+ shifted: label
121+
122+ iconNormal: (overrideIconName == "") && (overrideLabel == "") ? "keyboard-return" : overrideIconName
123+ iconShifted: iconNormal
124+ iconCapsLock: iconNormal
125+
126 action: "return"
127+ // TODO: input_method.actionKeyOverride.highlighted
128 }
129
130=== added directory 'src/imports'
131=== added directory 'src/imports/Ubuntu'
132=== added directory 'src/imports/Ubuntu/Keyboard'
133=== added file 'src/imports/Ubuntu/Keyboard/Keyboard.pro'
134--- src/imports/Ubuntu/Keyboard/Keyboard.pro 1970-01-01 00:00:00 +0000
135+++ src/imports/Ubuntu/Keyboard/Keyboard.pro 2014-04-30 15:35:05 +0000
136@@ -0,0 +1,29 @@
137+TEMPLATE = lib
138+QT += qml quick
139+CONFIG += qt plugin no_keywords
140+TARGET = ubuntu-keyboard-qml
141+
142+HEADERS += \
143+ plugin.h \
144+ inputmethodextensions.h \
145+
146+SOURCES += \
147+ plugin.cpp \
148+ inputmethodextensions.cpp \
149+
150+QMLDIR_FILE = qmldir
151+
152+# deployment rules for the plugin
153+installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)Ubuntu/Keyboard
154+target.path = $$installPath
155+
156+qmldir_file.path = $$installPath
157+qmldir_file.files = $$QMLDIR_FILE
158+
159+INSTALLS += target qmldir_file
160+
161+QMAKE_EXTRA_TARGETS += check
162+check.target = check
163+check.CONFIG = recursive
164+
165+
166
167=== added file 'src/imports/Ubuntu/Keyboard/inputmethodextensions.cpp'
168--- src/imports/Ubuntu/Keyboard/inputmethodextensions.cpp 1970-01-01 00:00:00 +0000
169+++ src/imports/Ubuntu/Keyboard/inputmethodextensions.cpp 2014-04-30 15:35:05 +0000
170@@ -0,0 +1,121 @@
171+/*
172+ * This file is part of Maliit Plugins
173+ *
174+ * Copyright (C) 2014 Canonical Ltda
175+ *
176+ * Redistribution and use in source and binary forms, with or without modification,
177+ * are permitted provided that the following conditions are met:
178+ *
179+ * Redistributions of source code must retain the above copyright notice, this list
180+ * of conditions and the following disclaimer.
181+ * Redistributions in binary form must reproduce the above copyright notice, this list
182+ * of conditions and the following disclaimer in the documentation and/or other materials
183+ * provided with the distribution.
184+ * Neither the name of Nokia Corporation nor the names of its contributors may be
185+ * used to endorse or promote products derived from this software without specific
186+ * prior written permission.
187+ *
188+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
189+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
190+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
191+ * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
192+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
193+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
194+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
195+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
196+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
197+ *
198+ */
199+
200+#include "inputmethodextensions.h"
201+
202+#include <QtCore>
203+
204+namespace Ubuntu {
205+namespace Keyboard {
206+
207+/*!
208+ \qmltype InputMethod
209+ \inqmlmodule Ubuntu.Keyboard 0.1
210+ \brief The InputMethod is a helper class used to attach properties used by Ubuntu Keyboard into input fields
211+
212+ Example:
213+ \qml
214+ Item {
215+ TextField {
216+ id: field
217+ InputMethod.extensions: {
218+ 'enterKeyText': 'My Enter',
219+ 'enterKeyEnabled': true,
220+ 'enterKeyHighlighted': true,
221+ }
222+ }
223+ }
224+ \endqml
225+*/
226+
227+InputMethodExtension::InputMethodExtension(QObject *parent)
228+ : QObject(parent),
229+ m_inputText(0)
230+{
231+ m_inputText = findInput(parent);
232+}
233+
234+/*!
235+ Allow to change the default visual of the action Key, the value is a dictonary,
236+ and the valid keys for the dictionary are:
237+ \list
238+ \li - enterKeyText (string) - The text to be displayed in the "Enter" key of the virtual keyboard
239+ \li - enterKeyEnabled (boolean) - If the "Enter" key of the virtual keyboard should be enabled or not
240+ \li - enterKeyHighlighted (boolean) - If the "Enter" key of the virtual keyboard should be highlighted or not
241+ \endlist
242+
243+ \qmlproperty var extensions
244+*/
245+QVariantMap InputMethodExtension::inputMethodExtensions() const
246+{
247+ return m_extensions;
248+}
249+
250+void InputMethodExtension::setInputMethodExtensions(const QVariantMap &map)
251+{
252+ if (m_extensions != map) {
253+ m_extensions = map;
254+ if (m_inputText) {
255+ m_inputText->setProperty("__inputMethodExtensions", m_extensions);
256+ }
257+ Q_EMIT inputMethodExtensionsChanged();
258+ }
259+}
260+
261+QObject *InputMethodExtension::findInput(QObject *parent)
262+{
263+ static QStringList inputClasses;
264+ if (inputClasses.isEmpty()) {
265+ inputClasses << "QQuickTextInput"
266+ << "QQuickTextEdit";
267+ }
268+ Q_FOREACH(QObject *c, parent->children()) {
269+ if (inputClasses.contains(c->metaObject()->className())) {
270+ return c;
271+ }
272+ QObject *cc = findInput(c);
273+ if (cc) {
274+ return cc;
275+ }
276+ }
277+ return 0;
278+}
279+
280+InputMethod::InputMethod(QObject *parent)
281+ : QObject(parent)
282+{
283+}
284+
285+InputMethodExtension *InputMethod::qmlAttachedProperties(QObject *obj)
286+{
287+ return new InputMethodExtension(obj);
288+}
289+
290+} // namespace Ubuntu
291+} // namespace Keyboard
292
293=== added file 'src/imports/Ubuntu/Keyboard/inputmethodextensions.h'
294--- src/imports/Ubuntu/Keyboard/inputmethodextensions.h 1970-01-01 00:00:00 +0000
295+++ src/imports/Ubuntu/Keyboard/inputmethodextensions.h 2014-04-30 15:35:05 +0000
296@@ -0,0 +1,74 @@
297+/*
298+ * This file is part of Maliit Plugins
299+ *
300+ * Copyright (C) 2014 Canonical Ltda
301+ *
302+ * Redistribution and use in source and binary forms, with or without modification,
303+ * are permitted provided that the following conditions are met:
304+ *
305+ * Redistributions of source code must retain the above copyright notice, this list
306+ * of conditions and the following disclaimer.
307+ * Redistributions in binary form must reproduce the above copyright notice, this list
308+ * of conditions and the following disclaimer in the documentation and/or other materials
309+ * provided with the distribution.
310+ * Neither the name of Nokia Corporation nor the names of its contributors may be
311+ * used to endorse or promote products derived from this software without specific
312+ * prior written permission.
313+ *
314+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
315+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
316+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
317+ * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
318+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
319+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
320+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
321+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
322+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
323+ *
324+ */
325+
326+#ifndef UBUNTU_KEYBOARD_EXTENSION_H
327+#define UBUNTU_KEYBOARD_EXTENSION_H
328+
329+#include <QtCore>
330+#include <QtQuick>
331+
332+namespace Ubuntu {
333+namespace Keyboard {
334+
335+class InputMethodExtension : public QObject
336+{
337+ Q_OBJECT
338+ Q_PROPERTY(QVariantMap extensions READ inputMethodExtensions WRITE setInputMethodExtensions NOTIFY inputMethodExtensionsChanged)
339+public:
340+ InputMethodExtension(QObject *parent = 0);
341+
342+ QVariantMap inputMethodExtensions() const;
343+ void setInputMethodExtensions(const QVariantMap &map);
344+
345+Q_SIGNALS:
346+ void inputMethodExtensionsChanged();
347+
348+private:
349+ QVariantMap m_extensions;
350+ QObject *m_inputText;
351+
352+ QObject *findInput(QObject *parent);
353+};
354+
355+class InputMethod : public QObject
356+{
357+ Q_OBJECT
358+
359+public:
360+ InputMethod(QObject *parent = 0);
361+
362+ static InputMethodExtension *qmlAttachedProperties(QObject *obj);
363+};
364+
365+} // namespace Ubuntu
366+} // namespace Keyboard
367+
368+QML_DECLARE_TYPEINFO(Ubuntu::Keyboard::InputMethod, QML_HAS_ATTACHED_PROPERTIES)
369+
370+#endif
371
372=== added file 'src/imports/Ubuntu/Keyboard/plugin.cpp'
373--- src/imports/Ubuntu/Keyboard/plugin.cpp 1970-01-01 00:00:00 +0000
374+++ src/imports/Ubuntu/Keyboard/plugin.cpp 2014-04-30 15:35:05 +0000
375@@ -0,0 +1,46 @@
376+/*
377+ * This file is part of Maliit Plugins
378+ *
379+ * Copyright (C) 2014 Canonical Ltda
380+ *
381+ * Redistribution and use in source and binary forms, with or without modification,
382+ * are permitted provided that the following conditions are met:
383+ *
384+ * Redistributions of source code must retain the above copyright notice, this list
385+ * of conditions and the following disclaimer.
386+ * Redistributions in binary form must reproduce the above copyright notice, this list
387+ * of conditions and the following disclaimer in the documentation and/or other materials
388+ * provided with the distribution.
389+ * Neither the name of Nokia Corporation nor the names of its contributors may be
390+ * used to endorse or promote products derived from this software without specific
391+ * prior written permission.
392+ *
393+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
394+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
395+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
396+ * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
397+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
398+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
399+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
400+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
401+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
402+ *
403+ */
404+
405+#include "plugin.h"
406+#include "inputmethodextensions.h"
407+
408+#include <QQmlEngine>
409+
410+namespace Ubuntu {
411+namespace Keyboard {
412+
413+void InputMethodExtensionPlugin::registerTypes(const char *uri)
414+{
415+ // @uri Ubuntu.Maliit
416+ qmlRegisterType<InputMethodExtension>();
417+ qmlRegisterType<InputMethod>(uri, 0, 1, "InputMethod");
418+}
419+
420+} // namespace Ubuntu
421+} // namespace Keyboard
422
423=== added file 'src/imports/Ubuntu/Keyboard/plugin.h'
424--- src/imports/Ubuntu/Keyboard/plugin.h 1970-01-01 00:00:00 +0000
425+++ src/imports/Ubuntu/Keyboard/plugin.h 2014-04-30 15:35:05 +0000
426@@ -0,0 +1,50 @@
427+/*
428+ * This file is part of Maliit Plugins
429+ *
430+ * Copyright (C) 2014 Canonical Ltda
431+ *
432+ * Redistribution and use in source and binary forms, with or without modification,
433+ * are permitted provided that the following conditions are met:
434+ *
435+ * Redistributions of source code must retain the above copyright notice, this list
436+ * of conditions and the following disclaimer.
437+ * Redistributions in binary form must reproduce the above copyright notice, this list
438+ * of conditions and the following disclaimer in the documentation and/or other materials
439+ * provided with the distribution.
440+ * Neither the name of Nokia Corporation nor the names of its contributors may be
441+ * used to endorse or promote products derived from this software without specific
442+ * prior written permission.
443+ *
444+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
445+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
446+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
447+ * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
448+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
449+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
450+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
451+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
452+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
453+ *
454+ */
455+
456+#ifndef UBUNTU_KEYBOARD_INPUTMETHOD_EXTENSION_PLUGIN_H
457+#define UBUNTU_KEYBOARD_INPUTMETHOD_EXTENSION_PLUGIN_H
458+
459+#include <QQmlExtensionPlugin>
460+
461+namespace Ubuntu {
462+namespace Keyboard {
463+
464+class InputMethodExtensionPlugin : public QQmlExtensionPlugin
465+{
466+ Q_OBJECT
467+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
468+
469+public:
470+ void registerTypes(const char *uri);
471+};
472+
473+} // namespace Ubuntu
474+} // namespace Keyboard
475+
476+#endif //UBUNTU_KEYBOARD_INPUTMETHOD_EXTENSION_PLUGIN_H
477
478=== added file 'src/imports/Ubuntu/Keyboard/qmldir'
479--- src/imports/Ubuntu/Keyboard/qmldir 1970-01-01 00:00:00 +0000
480+++ src/imports/Ubuntu/Keyboard/qmldir 2014-04-30 15:35:05 +0000
481@@ -0,0 +1,2 @@
482+module Ubuntu.Keyboard
483+plugin ubuntu-keyboard-qml
484
485=== added file 'src/imports/Ubuntu/Ubuntu.pro'
486--- src/imports/Ubuntu/Ubuntu.pro 1970-01-01 00:00:00 +0000
487+++ src/imports/Ubuntu/Ubuntu.pro 2014-04-30 15:35:05 +0000
488@@ -0,0 +1,7 @@
489+CONFIG += ordered
490+TEMPLATE = subdirs
491+SUBDIRS = Keyboard
492+
493+QMAKE_EXTRA_TARGETS += check
494+check.target = check
495+check.CONFIG = recursive
496
497=== added file 'src/imports/imports.pro'
498--- src/imports/imports.pro 1970-01-01 00:00:00 +0000
499+++ src/imports/imports.pro 2014-04-30 15:35:05 +0000
500@@ -0,0 +1,9 @@
501+CONFIG += ordered
502+TEMPLATE = subdirs
503+SUBDIRS = Ubuntu
504+
505+
506+
507+QMAKE_EXTRA_TARGETS += check
508+check.target = check
509+check.CONFIG = recursive
510
511=== modified file 'src/plugin/inputmethod.cpp'
512--- src/plugin/inputmethod.cpp 2014-04-15 12:18:47 +0000
513+++ src/plugin/inputmethod.cpp 2014-04-30 15:35:05 +0000
514@@ -58,6 +58,8 @@
515
516 namespace {
517
518+const char * const actionKeyName = "actionKey";
519+
520 Qt::ScreenOrientation rotationAngleToScreenOrientation(int angle)
521 {
522 bool portraitIsPrimary = QGuiApplication::primaryScreen()->primaryOrientation()
523@@ -263,50 +265,35 @@
524 d->truncateEnabledLanguageLocales(d->m_settings.enabledLanguages());
525 Q_EMIT enabledLanguagesChanged(d->enabledLanguages);
526 }
527-// todo remove
528+
529 void InputMethod::setKeyOverrides(const QMap<QString, QSharedPointer<MKeyOverride> > &overrides)
530 {
531 Q_D(InputMethod);
532
533- for (OverridesIterator i(d->key_overrides.begin()), e(d->key_overrides.end()); i != e; ++i) {
534- const SharedOverride &override(i.value());
535-
536- if (override) {
537- disconnect(override.data(), SIGNAL(keyAttributesChanged(const QString &, const MKeyOverride::KeyOverrideAttributes)),
538- this, SLOT(updateKey(const QString &, const MKeyOverride::KeyOverrideAttributes)));
539- }
540- }
541-
542- d->key_overrides.clear();
543- QMap<QString, Key> overriden_keys;
544-
545- for (OverridesIterator i(overrides.begin()), e(overrides.end()); i != e; ++i) {
546- const SharedOverride &override(i.value());
547-
548- if (override) {
549- d->key_overrides.insert(i.key(), override);
550- connect(override.data(), SIGNAL(keyAttributesChanged(const QString &, const MKeyOverride::KeyOverrideAttributes)),
551- this, SLOT(updateKey(const QString &, const MKeyOverride::KeyOverrideAttributes)));
552- overriden_keys.insert(i.key(), overrideToKey(override));
553- }
554- }
555-
556-}
557-// todo remove
558-void InputMethod::updateKey(const QString &key_id,
559- const MKeyOverride::KeyOverrideAttributes changed_attributes)
560-{
561- Q_D(InputMethod);
562-
563- Q_UNUSED(changed_attributes);
564-
565- QMap<QString, SharedOverride>::iterator iter(d->key_overrides.find(key_id));
566-
567- if (iter != d->key_overrides.end()) {
568- const Key &override_key(overrideToKey(iter.value()));
569- Logic::KeyOverrides overrides_update;
570-
571- overrides_update.insert(key_id, override_key);
572+ // we only care about actionKey override by now
573+ const QMap<QString, SharedOverride >::const_iterator iter(overrides.find(actionKeyName));
574+ bool actionKeyChanged = false;
575+
576+ if (d->actionKeyOverrider) {
577+ disconnect(d->actionKeyOverrider.data(), SIGNAL(keyAttributesChanged(const QString &, const MKeyOverride::KeyOverrideAttributes)),
578+ this, SIGNAL(actionKeyOverrideChanged()));
579+ d->actionKeyOverrider.clear();
580+ actionKeyChanged = true;
581+ }
582+
583+ if (iter != overrides.end()) {
584+ QSharedPointer<MKeyOverride> actionKeyOverrider(*iter);
585+
586+ if (actionKeyOverrider) {
587+ d->actionKeyOverrider = actionKeyOverrider;
588+ connect(d->actionKeyOverrider.data(), SIGNAL(keyAttributesChanged(const QString &, const MKeyOverride::KeyOverrideAttributes)),
589+ this, SIGNAL(actionKeyOverrideChanged()));
590+ }
591+ actionKeyChanged = true;
592+ }
593+
594+ if (actionKeyChanged) {
595+ Q_EMIT actionKeyOverrideChanged();
596 }
597 }
598
599@@ -342,7 +329,7 @@
600
601 bool emitPredictionEnabled = false;
602
603- bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid)
604+ bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid)
605 || d->editor.wordEngine()->languageFeature()->alwaysShowSuggestions();
606
607 if (!valid)
608@@ -451,6 +438,15 @@
609 return d->m_settings.keyPressFeedback();
610 }
611
612+//! \brief InputMethod::actionKeyOverride returns any override information about
613+//! the action key
614+//! \return
615+QObject *InputMethod::actionKeyOverride() const
616+{
617+ Q_D(const InputMethod);
618+ return d->actionKeyOverrider.data();
619+}
620+
621 //! \brief InputMethod::setActiveLanguage
622 //! Sets the currently active/used language
623 //! \param newLanguage id of the new language. For example "en" or "es"
624
625=== modified file 'src/plugin/inputmethod.h'
626--- src/plugin/inputmethod.h 2014-03-12 02:48:29 +0000
627+++ src/plugin/inputmethod.h 2014-04-30 15:35:05 +0000
628@@ -52,6 +52,7 @@
629 Q_PROPERTY(QStringList enabledLanguages READ enabledLanguages NOTIFY enabledLanguagesChanged)
630 Q_PROPERTY(QString activeLanguage READ activeLanguage WRITE setActiveLanguage NOTIFY activeLanguageChanged)
631 Q_PROPERTY(bool useAudioFeedback READ useAudioFeedback NOTIFY useAudioFeedbackChanged)
632+ Q_PROPERTY(QObject* actionKeyOverride READ actionKeyOverride NOTIFY actionKeyOverrideChanged)
633
634 Q_ENUMS(TextContentType)
635
636@@ -106,6 +107,8 @@
637 Q_SLOT void onVisibleRectChanged();
638 bool useAudioFeedback() const;
639
640+ QObject* actionKeyOverride() const;
641+
642 Q_SIGNALS:
643 void contentTypeChanged(TextContentType contentType);
644 void activateAutocaps();
645@@ -115,14 +118,13 @@
646 void wordEngineEnabledChanged(bool wordEngineEnabled);
647 void wordRibbonEnabledChanged(bool wordRibbonEnabled);
648 void windowGeometryRectChanged(QRect rect);
649+ void actionKeyOverrideChanged();
650
651 private:
652 Q_SLOT void onAutoCorrectSettingChanged();
653 Q_SLOT void onEnabledLanguageSettingsChanged();
654 Q_SLOT void updateAutoCaps();
655
656- Q_SLOT void updateKey(const QString &key_id,
657- const MKeyOverride::KeyOverrideAttributes changed_attributes);
658 Q_SLOT void onKeyboardClosed();
659
660 Q_SLOT void onLayoutWidthChanged(int width);
661
662=== modified file 'src/plugin/inputmethod_p.h'
663--- src/plugin/inputmethod_p.h 2014-01-23 16:42:33 +0000
664+++ src/plugin/inputmethod_p.h 2014-04-30 15:35:05 +0000
665@@ -44,7 +44,7 @@
666 public:
667 InputMethod* q;
668 Editor editor;
669- QMap<QString, SharedOverride> key_overrides;
670+ SharedOverride actionKeyOverrider;
671 Logic::EventHandler event_handler;
672 MAbstractInputMethodHost* host;
673 QQuickView* view;
674@@ -66,7 +66,6 @@
675 MAbstractInputMethodHost *host)
676 : q(_q)
677 , editor(EditorOptions(), new Model::Text, new Logic::WordEngine)
678- , key_overrides()
679 , event_handler()
680 , host(host)
681 , view(0)
682
683=== modified file 'src/src.pro'
684--- src/src.pro 2013-07-19 12:05:07 +0000
685+++ src/src.pro 2014-04-30 15:35:05 +0000
686@@ -4,6 +4,7 @@
687 lib \
688 view \
689 plugin \
690+ imports \
691 # benchmark \
692
693
694
695=== modified file 'ubuntu-keyboard.pro'
696--- ubuntu-keyboard.pro 2013-12-19 16:03:15 +0000
697+++ ubuntu-keyboard.pro 2014-04-30 15:35:05 +0000
698@@ -30,7 +30,7 @@
699 !build_pass:system(echo -e \"$$config_string\")
700 }
701
702-CONFIG += ordered
703+CONFIG += ordered
704 TEMPLATE = subdirs
705
706 DIST_NAME = $$UBUNTU_KEYBOARD_PACKAGENAME-$$UBUNTU_KEYBOARD_VERSION

Subscribers

People subscribed via source and target branches