Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/noReadOnlyClearance into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1269
Merged at revision: 1271
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/noReadOnlyClearance
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 33 lines (+4/-1)
2 files modified
modules/Ubuntu/Components/TextField.qml (+2/-1)
tests/unit_x11/tst_components/tst_textfield.qml (+2/-0)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/noReadOnlyClearance
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zsombor Egri Approve
Review via email: mp+236686@code.launchpad.net

Commit message

Read-only text fields mustn't have a clear button

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1269. By Cris Dywan

Unit test that the clear button is hidden when the textField is readOnly

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Nice'n'clear fix, thank you!

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/Ubuntu/Components/TextField.qml'
--- modules/Ubuntu/Components/TextField.qml 2014-09-18 15:27:16 +0000
+++ modules/Ubuntu/Components/TextField.qml 2014-10-01 15:11:07 +0000
@@ -914,6 +914,7 @@
914 }914 }
915 width: visible ? icon.width : 0915 width: visible ? icon.width : 0
916 visible: control.hasClearButton &&916 visible: control.hasClearButton &&
917 !control.readOnly &&
917 (control.activeFocus && ((editor.text != "") || editor.inputMethodComposing))918 (control.activeFocus && ((editor.text != "") || editor.inputMethodComposing))
918919
919 Icon {920 Icon {
@@ -922,7 +923,7 @@
922 width: units.gu(2.5)923 width: units.gu(2.5)
923 height: width924 height: width
924 // use icon from icon-theme925 // use icon from icon-theme
925 name: control.hasClearButton ? "clear-search" : ""926 name: control.hasClearButton && !control.readOnly ? "clear-search" : ""
926 }927 }
927928
928 onClicked: editor.text = ""929 onClicked: editor.text = ""
929930
=== modified file 'tests/unit_x11/tst_components/tst_textfield.qml'
--- tests/unit_x11/tst_components/tst_textfield.qml 2014-08-31 19:24:19 +0000
+++ tests/unit_x11/tst_components/tst_textfield.qml 2014-10-01 15:11:07 +0000
@@ -260,6 +260,8 @@
260 compare(textField.readOnly, false, "readOnly is false by default")260 compare(textField.readOnly, false, "readOnly is false by default")
261 textField.readOnly = true261 textField.readOnly = true
262 compare(textField.readOnly, true, "set/get")262 compare(textField.readOnly, true, "set/get")
263 var clearButton = findChild(textField, "clear_button")
264 compare(clearButton.visible, false, "readOnly must not provide a clear button")
263 }265 }
264266
265 function test_0_secondaryItem() {267 function test_0_secondaryItem() {

Subscribers

People subscribed via source and target branches