Merge lp:~ken-vandine/ubuntu-ui-toolkit/raring.0.1.43 into lp:ubuntu-ui-toolkit/raring

Proposed by Ken VanDine
Status: Merged
Merged at revision: 418
Proposed branch: lp:~ken-vandine/ubuntu-ui-toolkit/raring.0.1.43
Merge into: lp:ubuntu-ui-toolkit/raring
Diff against target: 552 lines (+312/-55)
9 files modified
debian/changelog (+14/-0)
demos/ListItems.qml (+9/-0)
modules/Ubuntu/Components/TextArea.qml (+17/-10)
modules/Ubuntu/Components/TextField.qml (+0/-10)
modules/Ubuntu/Components/plugin/quickutils.cpp (+28/-0)
modules/Ubuntu/Components/plugin/quickutils.h (+5/-0)
tests/unit/tst_components/tst_textarea.qml (+125/-3)
tests/unit/tst_components/tst_textfield.qml (+90/-13)
themes/Ambiance/qmltheme/TextAreaDelegate.qml (+24/-19)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-ui-toolkit/raring.0.1.43
Reviewer Review Type Date Requested Status
Timo Jyrinki Approve
Review via email: mp+159638@code.launchpad.net

Commit message

  * Fix for text inputs staying disabled after being re-enabled. The previous
    workaround for removing input panel was blocking re-enabling a
    previously enabled input. (LP: #1164634)
  * Fixing disabled text input delegate background color theming when userValue
    is set to TextField or TextArea color property. (LP: #1169601)
  * Workaround for TextArea and TextField removing OSK when active focus is
    transferred from one instance to another using focus property (LP: #1163371)
  * Fix for TextArea Enter/Return keys being stolen when embedded in
    ListItems.Empty. (LP: #1166840)

Description of the change

cherrypicked important bug fixes from trunk that are safe to upload to raring and prepared an update for raring.

To post a comment you must log in.
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-04-12 12:04:33 +0000
+++ debian/changelog 2013-04-18 14:13:29 +0000
@@ -1,3 +1,17 @@
1ubuntu-ui-toolkit (0.1.43) UNRELEASED; urgency=low
2
3 * Fix for text inputs staying disabled after being re-enabled. The previous
4 workaround for removing input panel was blocking re-enabling a
5 previously enabled input. (LP: #1164634)
6 * Fixing disabled text input delegate background color theming when userValue
7 is set to TextField or TextArea color property. (LP: #1169601)
8 * Workaround for TextArea and TextField removing OSK when active focus is
9 transferred from one instance to another using focus property (LP: #1163371)
10 * Fix for TextArea Enter/Return keys being stolen when embedded in
11 ListItems.Empty. (LP: #1166840)
12
13 -- Ken VanDine <ken.vandine@canonical.com> Thu, 18 Apr 2013 10:01:45 -0400
14
1ubuntu-ui-toolkit (0.1.42) raring; urgency=low15ubuntu-ui-toolkit (0.1.42) raring; urgency=low
216
3 [ Loïc Minier ]17 [ Loïc Minier ]
418
=== modified file 'demos/ListItems.qml'
--- demos/ListItems.qml 2013-03-25 20:01:52 +0000
+++ demos/ListItems.qml 2013-04-18 14:13:29 +0000
@@ -356,6 +356,15 @@
356 }356 }
357 }357 }
358 }358 }
359 ListItem.Empty {
360 TextArea {
361 text: i18n.tr("text")
362 anchors {
363 margins: units.gu(1)
364 fill: parent
365 }
366 }
367 }
359 }368 }
360 }369 }
361 FadingRectangle {370 FadingRectangle {
362371
=== modified file 'modules/Ubuntu/Components/TextArea.qml'
--- modules/Ubuntu/Components/TextArea.qml 2013-03-13 15:11:28 +0000
+++ modules/Ubuntu/Components/TextArea.qml 2013-04-18 14:13:29 +0000
@@ -795,6 +795,23 @@
795 }795 }
796 }796 }
797797
798 // grab Enter/Return keys which may be stolen from parent components of TextArea
799 // due to forwarded keys from TextEdit
800 Keys.onPressed: {
801 if ((event.key === Qt.Key_Enter) || (event.key === Qt.Key_Return)) {
802 if (editor.textFormat === TextEdit.RichText) {
803 // FIXME: use control.paste("<br />") instead when paste() gets sich text support
804 editor.insert(editor.cursorPosition, "<br />");
805 } else {
806 control.paste("\n");
807 }
808 event.accepted = true;
809 } else {
810 event.accepted = false;
811 }
812 }
813 Keys.onReleased: event.accepted = (event.key === Qt.Key_Enter) || (event.key === Qt.Key_Return)
814
798 // cursor is FIXME: move in a separate element and align with TextField815 // cursor is FIXME: move in a separate element and align with TextField
799 Component {816 Component {
800 id: cursor817 id: cursor
@@ -902,16 +919,6 @@
902 // autosize handling919 // autosize handling
903 onLineCountChanged: internal.frameSize()920 onLineCountChanged: internal.frameSize()
904921
905 // virtual keyboard handling
906 activeFocusOnPress: false
907 onActiveFocusChanged: {
908 if (activeFocus) {
909 internal.showInputPanel();
910 } else {
911 internal.hideInputPanel();
912 }
913 }
914
915 // remove selection when typing starts or input method start entering text922 // remove selection when typing starts or input method start entering text
916 onInputMethodComposingChanged: {923 onInputMethodComposingChanged: {
917 if (inputMethodComposing)924 if (inputMethodComposing)
918925
=== modified file 'modules/Ubuntu/Components/TextField.qml'
--- modules/Ubuntu/Components/TextField.qml 2013-03-27 08:15:42 +0000
+++ modules/Ubuntu/Components/TextField.qml 2013-04-18 14:13:29 +0000
@@ -617,16 +617,6 @@
617 // forward keys to the root element so it can be captured outside of it617 // forward keys to the root element so it can be captured outside of it
618 Keys.forwardTo: [control]618 Keys.forwardTo: [control]
619619
620 // virtual keyboard/software input panel handling
621 activeFocusOnPress: false
622 onActiveFocusChanged: {
623 if (activeFocus) {
624 internal.showInputPanel();
625 } else {
626 internal.hideInputPanel();
627 }
628 }
629
630 // handle virtual keyboard and cursor positioning, as the MouseArea overrides620 // handle virtual keyboard and cursor positioning, as the MouseArea overrides
631 // those functionalities of the TextInput621 // those functionalities of the TextInput
632 MouseArea {622 MouseArea {
633623
=== modified file 'modules/Ubuntu/Components/plugin/quickutils.cpp'
--- modules/Ubuntu/Components/plugin/quickutils.cpp 2013-03-07 12:40:45 +0000
+++ modules/Ubuntu/Components/plugin/quickutils.cpp 2013-04-18 14:13:29 +0000
@@ -25,10 +25,15 @@
25#include <QtCore/QAbstractProxyModel>25#include <QtCore/QAbstractProxyModel>
26#include <QtQml/QQmlPropertyMap>26#include <QtQml/QQmlPropertyMap>
2727
28#include <private/qquicktextinput_p.h>
29#include <private/qquicktextedit_p.h>
30
28QuickUtils::QuickUtils(QObject *parent) :31QuickUtils::QuickUtils(QObject *parent) :
29 QObject(parent)32 QObject(parent)
30{33{
31 QGuiApplication::instance()->installEventFilter(this);34 QGuiApplication::instance()->installEventFilter(this);
35 // connect to focusObjectChanged() to get the latest active focus object
36 QObject::connect(QGuiApplication::instance(), SIGNAL(focusObjectChanged(QObject*)), this, SLOT(activeFocus(QObject*)));
32}37}
3338
34/*!39/*!
@@ -45,6 +50,23 @@
45 return QObject::eventFilter(obj, event);50 return QObject::eventFilter(obj, event);
46}51}
4752
53/*!
54 * \internal
55 * Catch active focus object change to detecte whether we need to remove OSK or not.
56 */
57void QuickUtils::activeFocus(QObject *active)
58{
59 // FIXME: workaround for bug https://bugreports.qt-project.org/browse/QTBUG-30729
60 // input panel does not get removed when no input is active
61 // remove input panel if there's no more active object or the new active object
62 // is not a text input
63 // workaround for bug https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1163371
64 if (QGuiApplication::inputMethod()->isVisible() && (!active || (active &&
65 !qobject_cast<QQuickTextInput*>(active) &&
66 !qobject_cast<QQuickTextEdit*>(active)))) {
67 QGuiApplication::inputMethod()->hide();
68 }
69}
4870
49/*!71/*!
50 * \internal72 * \internal
@@ -57,6 +79,12 @@
57 return (m_rootView) ? m_rootView->rootObject() : 0;79 return (m_rootView) ? m_rootView->rootObject() : 0;
58}80}
5981
82QString QuickUtils::inputMethodProvider() const
83{
84 return QString(getenv("QT_IM_MODULE"));
85}
86
87
60/*!88/*!
61 * \internal89 * \internal
62 * Creates an instance out of a delegate using the roles specified in the90 * Creates an instance out of a delegate using the roles specified in the
6391
=== modified file 'modules/Ubuntu/Components/plugin/quickutils.h'
--- modules/Ubuntu/Components/plugin/quickutils.h 2013-03-07 12:40:45 +0000
+++ modules/Ubuntu/Components/plugin/quickutils.h 2013-04-18 14:13:29 +0000
@@ -29,6 +29,7 @@
29{29{
30 Q_OBJECT30 Q_OBJECT
31 Q_PROPERTY(QQuickItem *rootObject READ rootObject NOTIFY rootObjectChanged)31 Q_PROPERTY(QQuickItem *rootObject READ rootObject NOTIFY rootObjectChanged)
32 Q_PROPERTY(QString inputMethodProvider READ inputMethodProvider)
32public:33public:
33 static QuickUtils& instance()34 static QuickUtils& instance()
34 {35 {
@@ -37,6 +38,7 @@
37 }38 }
3839
39 QQuickItem *rootObject();40 QQuickItem *rootObject();
41 QString inputMethodProvider() const;
4042
41 Q_INVOKABLE qreal modelDelegateHeight(QQmlComponent *delegate, const QVariant &model);43 Q_INVOKABLE qreal modelDelegateHeight(QQmlComponent *delegate, const QVariant &model);
42 Q_INVOKABLE QString className(QQuickItem *item);44 Q_INVOKABLE QString className(QQuickItem *item);
@@ -47,6 +49,9 @@
47protected:49protected:
48 bool eventFilter(QObject *, QEvent *);50 bool eventFilter(QObject *, QEvent *);
4951
52private Q_SLOTS:
53 void activeFocus(QObject*);
54
50private:55private:
51 explicit QuickUtils(QObject *parent = 0);56 explicit QuickUtils(QObject *parent = 0);
52 QQuickView *m_rootView;57 QQuickView *m_rootView;
5358
=== modified file 'tests/unit/tst_components/tst_textarea.qml'
--- tests/unit/tst_components/tst_textarea.qml 2013-02-13 09:36:45 +0000
+++ tests/unit/tst_components/tst_textarea.qml 2013-04-18 14:13:29 +0000
@@ -17,10 +17,13 @@
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import Ubuntu.Components 0.119import Ubuntu.Components 0.1
20import Ubuntu.Components.ListItems 0.1 as ListItem
2021
21Item {22Item {
22 width: 200; height: 20023 width: 200; height: 200
2324
25 property bool hasOSK: QuickUtils.inputMethodProvider !== ""
26
24 TextArea {27 TextArea {
25 id: textArea28 id: textArea
26 SignalSpy {29 SignalSpy {
@@ -34,10 +37,45 @@
34 Keys.onReleased: keyReleaseData = event.key37 Keys.onReleased: keyReleaseData = event.key
35 }38 }
3639
40 TextArea {
41 id: colorTest
42 color: colorTest.text.length < 4 ? "#0000ff" : "#00ff00"
43 }
44
37 TextEdit {45 TextEdit {
38 id: textEdit46 id: textEdit
39 }47 }
4048
49 ListItem.Empty {
50 id: listItem
51 height: 200
52 anchors.left: parent.left
53
54 anchors.right: parent.right
55 SignalSpy {
56 id: listItemSpy
57 signalName: "clicked"
58 target: listItem
59 }
60
61 TextArea {
62 id: input
63 anchors.fill: parent
64 Component.onCompleted: forceActiveFocus()
65 }
66 }
67
68 Item {
69 TextArea {
70 id: t1
71 objectName: "t1"
72 }
73 TextArea {
74 id: t2
75 objectName: "t2"
76 }
77 }
78
41 TestCase {79 TestCase {
42 name: "TextAreaAPI"80 name: "TextAreaAPI"
43 when: windowShown81 when: windowShown
@@ -335,9 +373,93 @@
335 textArea.readOnly = false;373 textArea.readOnly = false;
336 textArea.keyPressData = 0;374 textArea.keyPressData = 0;
337 textArea.keyReleaseData = 0;375 textArea.keyReleaseData = 0;
338 keyClick(Qt.Key_Control, Qt.NoModifier, 100);376 keyClick(Qt.Key_T, Qt.NoModifier, 100);
339 compare(textArea.keyPressData, Qt.Key_Control, "Key press filtered");377 compare(textArea.keyPressData, Qt.Key_T, "Key press filtered");
340 compare(textArea.keyReleaseData, Qt.Key_Control, "Key release filtered");378 compare(textArea.keyReleaseData, Qt.Key_T, "Key release filtered");
379 }
380
381 function test_TextAreaInListItem_EnterCaptured() {
382 input.forceActiveFocus();
383 input.textFormat = TextEdit.PlainText;
384 input.text = "";
385 keyClick(Qt.Key_T);
386 keyClick(Qt.Key_E);
387 keyClick(Qt.Key_S);
388 keyClick(Qt.Key_T);
389 keyClick(Qt.Key_Enter);
390 compare(input.text, "test\n", "Keys");
391 }
392 function test_TextAreaInListItem_EnterDoesNotProduceClick() {
393 input.forceActiveFocus();
394 input.textFormat = TextEdit.PlainText;
395 input.text = "";
396 listItemSpy.clear();
397 keyClick(Qt.Key_Enter);
398 tryCompare(listItemSpy, "count", 0, 100);
399 }
400
401 function test_colorCollisionOnDelegate() {
402 // fixes bug lp:1169601
403 colorTest.text = "abc";
404 compare(colorTest.color, "#0000ff", "Color when text length < 4");
405 colorTest.text = "abcd";
406 compare(colorTest.color, "#00ff00", "Color when text length >= 4");
407 }
408
409 function test_OneActiveFocus() {
410 t1.focus = true;
411 compare(t1.activeFocus, true, "T1 has activeFocus");
412 compare(t2.activeFocus, false, "T1 has activeFocus");
413 t2.focus = true;
414 compare(t1.activeFocus, false, "T1 has activeFocus");
415 compare(t2.activeFocus, true, "T1 has activeFocus");
416 }
417
418 function test_OSK_ShownWhenNextTextAreaIsFocused() {
419 if (!hasOSK)
420 expectFail("", "OSK can be tested only when present");
421 t1.focus = true;
422 compare(Qt.inputMethod.visible, true, "OSK is shown for the first TextArea");
423 t2.focus = true;
424 compare(Qt.inputMethod.visible, true, "OSK is shown for the second TextArea");
425 }
426
427 function test_RemoveOSKWhenFocusLost() {
428 if (!hasOSK)
429 expectFail("", "OSK can be tested only when present");
430 t1.focus = true;
431 compare(Qt.inputMethod.visible, true, "OSK is shown when TextArea gains focus");
432 t1.focus = false;
433 compare(Qt.inputMethod.visible, false, "OSK is hidden when TextArea looses focus");
434 }
435
436 function test_ReEnabledInput() {
437 textArea.forceActiveFocus();
438 textArea.enabled = false;
439 compare(textArea.enabled, false, "textArea is disabled");
440 compare(textArea.focus, true, "textArea is focused");
441 compare(textArea.activeFocus, false, "textArea is not active focus");
442 compare(Qt.inputMethod.visible, false, "OSK removed");
443
444 textArea.enabled = true;
445 compare(textArea.enabled, true, "textArea is enabled");
446 compare(textArea.focus, true, "textArea is focused");
447 compare(textArea.activeFocus, true, "textArea is active focus");
448 if (!hasOSK)
449 expectFail("", "OSK can be tested only when present");
450 compare(Qt.inputMethod.visible, true, "OSK shown");
451 }
452
453 // make it to b ethe last test case executed
454 function test_zz_TextareaInListItem_RichTextEnterCaptured() {
455 textArea.text = "a<br />b";
456 textArea.textFormat = TextEdit.RichText;
457 input.forceActiveFocus();
458 input.textFormat = TextEdit.RichText;
459 input.text = "ab";
460 input.cursorPosition = 1;
461 keyClick(Qt.Key_Return);
462 compare(input.text, textArea.text, "Formatted text split");
341 }463 }
342 }464 }
343}465}
344466
=== modified file 'tests/unit/tst_components/tst_textfield.qml'
--- tests/unit/tst_components/tst_textfield.qml 2013-02-13 10:52:46 +0000
+++ tests/unit/tst_components/tst_textfield.qml 2013-04-18 14:13:29 +0000
@@ -21,23 +21,47 @@
21Item {21Item {
22 id: textItem22 id: textItem
23 width: 200; height: 20023 width: 200; height: 200
24
25 property bool hasOSK: QuickUtils.inputMethodProvider !== ""
26
27 function reset() {
28 colorTest.focus = false;
29 textField.focus = false;
30 t1.focus = false;
31 t2.focus = false;
32 }
33
34 TextField {
35 id: colorTest
36 color: colorTest.text.length < 4 ? "#0000ff" : "#00ff00"
37 }
38
39 TextField {
40 id: textField
41 SignalSpy {
42 id: signalSpy
43 target: parent
44 }
45
46 property int keyPressData
47 property int keyReleaseData
48 Keys.onPressed: keyPressData = event.key
49 Keys.onReleased: keyReleaseData = event.key
50 }
51
52 Item {
53 TextField {
54 id: t1
55 }
56 TextField {
57 id: t2
58 }
59 }
60
24 TestCase {61 TestCase {
25 name: "TextFieldAPI"62 name: "TextFieldAPI"
26 when: windowShown63 when: windowShown
2764
28 TextField {
29 id: textField
30 SignalSpy {
31 id: signalSpy
32 target: parent
33 }
34
35 property int keyPressData
36 property int keyReleaseData
37 Keys.onPressed: keyPressData = event.key
38 Keys.onReleased: keyReleaseData = event.key
39 }
40
41 function initTestCase() {65 function initTestCase() {
42 textField.forceActiveFocus();66 textField.forceActiveFocus();
43 compare(textField.focus, true, "TextField is focused");67 compare(textField.focus, true, "TextField is focused");
@@ -195,6 +219,59 @@
195 compare(textField.text, "test text", "Data pasted");219 compare(textField.text, "test text", "Data pasted");
196 }220 }
197221
222 function test_colorCollisionOnDelegate() {
223 // fixes bug lp:1169601
224 colorTest.text = "abc";
225 compare(colorTest.color, "#0000ff", "Color when text length < 4");
226 colorTest.text = "abcd";
227 compare(colorTest.color, "#00ff00", "Color when text length >= 4");
228 }
229
230 function test_OneActiveFocus() {
231 t1.focus = true;
232 compare(t1.activeFocus, true, "T1 has activeFocus");
233 compare(t2.activeFocus, false, "T1 has activeFocus");
234 t2.focus = true;
235 compare(t1.activeFocus, false, "T1 has activeFocus");
236 compare(t2.activeFocus, true, "T1 has activeFocus");
237 }
238
239 // need to make the very first test case, otherwise OSK detection fails on phablet
240 function test_zz_OSK_ShownWhenNextTextFieldIsFocused() {
241 if (!hasOSK)
242 expectFail("", "OSK can be tested only when present");
243 t1.focus = true;
244 compare(Qt.inputMethod.visible, true, "OSK is shown for the first TextField");
245 t2.focus = true;
246 compare(Qt.inputMethod.visible, true, "OSK is shown for the second TextField");
247 }
248
249 function test_zz_RemoveOSKWhenFocusLost() {
250 if (!hasOSK)
251 expectFail("", "OSK can be tested only when present");
252 t1.focus = true;
253 compare(Qt.inputMethod.visible, true, "OSK is shown when TextField gains focus");
254 t1.focus = false;
255 compare(Qt.inputMethod.visible, false, "OSK is hidden when TextField looses focus");
256 }
257
258 function test_zz_ReEnabledInput() {
259 textField.forceActiveFocus();
260 textField.enabled = false;
261 compare(textField.enabled, false, "textField is disabled");
262 compare(textField.focus, true, "textField is focused");
263 compare(textField.activeFocus, false, "textField is not active focus");
264 compare(Qt.inputMethod.visible, false, "OSK removed");
265
266 textField.enabled = true;
267 compare(textField.enabled, true, "textField is enabled");
268 compare(textField.focus, true, "textField is focused");
269 compare(textField.activeFocus, true, "textField is active focus");
270 if (!hasOSK)
271 expectFail("", "OSK can be tested only when present");
272 compare(Qt.inputMethod.visible, true, "OSK shown");
273 }
274
198 RegExpValidator {275 RegExpValidator {
199 id: regExpValidator276 id: regExpValidator
200 regExp: /[a-z]*/277 regExp: /[a-z]*/
201278
=== modified file 'themes/Ambiance/qmltheme/TextAreaDelegate.qml'
--- themes/Ambiance/qmltheme/TextAreaDelegate.qml 2013-03-27 07:51:04 +0000
+++ themes/Ambiance/qmltheme/TextAreaDelegate.qml 2013-04-18 14:13:29 +0000
@@ -18,15 +18,16 @@
18import Ubuntu.Components 0.118import Ubuntu.Components 0.1
1919
20// frame20// frame
21UbuntuShape {21Item {
22 id: shape22 id: visuals
23
24 // style properties23 // style properties
25 /*!
26 Background fill color
27 */
28 // FIXME: needs type checking in themes to define the proper type to be used24 // FIXME: needs type checking in themes to define the proper type to be used
29 // if color type is used, alpha value gets lost25 // if color type is used, alpha value gets lost
26
27 property color color
28 /*!
29 Background fill color
30 */
30 property color backgroundColor: Qt.rgba(0, 0, 0, 0.1)31 property color backgroundColor: Qt.rgba(0, 0, 0, 0.1)
31 property color errorColor: "red"32 property color errorColor: "red"
32 property real backgroundOpacity33 property real backgroundOpacity
@@ -37,27 +38,31 @@
37 property var frameSpacing38 property var frameSpacing
38 property real overlaySpacing39 property real overlaySpacing
3940
40 // visuals
41 z: -1
42 property bool error: (item.hasOwnProperty("errorHighlight") && item.errorHighlight && !item.acceptableInput)
43 onErrorChanged: color = (error) ? errorColor : backgroundColor;
44 color: backgroundColor
45 anchors.fill: parent41 anchors.fill: parent
46 opacity: backgroundOpacity
47
48 MouseArea {
49 anchors.fill: parent
50 onPressed: if (!item.activeFocus && item.activeFocusOnPress) item.forceActiveFocus()
51 }
5242
53 Binding {43 Binding {
54 target: item.__internal44 target: item.__internal
55 property: "frameSpacing"45 property: "frameSpacing"
56 value: shape.frameSpacing46 value: visuals.frameSpacing
57 }47 }
58 Binding {48 Binding {
59 target: item.__internal49 target: item.__internal
60 property: "spacing"50 property: "spacing"
61 value: overlaySpacing51 value: visuals.overlaySpacing
52 }
53
54 z: -1
55 UbuntuShape {
56 id: shape
57 property bool error: (item.hasOwnProperty("errorHighlight") && item.errorHighlight && !item.acceptableInput)
58 onErrorChanged: (error) ? visuals.errorColor : visuals.backgroundColor;
59 color: visuals.backgroundColor;
60 anchors.fill: parent
61 opacity: visuals.backgroundOpacity
62
63 MouseArea {
64 anchors.fill: parent
65 onPressed: if (!item.activeFocus && item.activeFocusOnPress) item.forceActiveFocus()
66 }
62 }67 }
63}68}

Subscribers

People subscribed via source and target branches

to all changes: