Merge lp:~zsombi/ubuntu-ui-toolkit/bottomedgehint_activefocus into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Cris Dywan
Approved revision: 1723
Merged at revision: 1723
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/bottomedgehint_activefocus
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~zsombi/ubuntu-ui-toolkit/bottomedgehint_with_swipearea
Diff against target: 56 lines (+20/-1)
2 files modified
src/Ubuntu/Components/plugin/ucbottomedgehint.cpp (+6/-1)
tests/unit_x11/tst_components/tst_bottomedgehint.qml (+14/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/bottomedgehint_activefocus
Reviewer Review Type Date Requested Status
Cris Dywan Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+277957@code.launchpad.net

Commit message

Fix BottomEdgeHint consumes activeFocusOnPress handling.

To post a comment you must log in.
1723. By Zsombor Egri

prereq sync

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)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Makes sense. Although it's a little unfortunate it's not testable/visible just using the gallery (sorry, I can't help being picky).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/plugin/ucbottomedgehint.cpp'
--- src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2015-11-19 10:04:40 +0000
+++ src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2015-11-19 10:04:40 +0000
@@ -160,15 +160,20 @@
160{160{
161 if (contains(event->localPos()) && (m_status >= Active)) {161 if (contains(event->localPos()) && (m_status >= Active)) {
162 m_pressed = true;162 m_pressed = true;
163 event->accept();
164 // also call requestFocus
165 requestFocus(Qt::MouseFocusReason);
163 } else {166 } else {
164 UCActionItem::mousePressEvent(event);167 UCActionItem::mousePressEvent(event);
165 }168 }
166}169}
167void UCBottomEdgeHint::mouseReleaseEvent(QMouseEvent *event)170void UCBottomEdgeHint::mouseReleaseEvent(QMouseEvent *event)
168{171{
169 UCActionItem::mouseReleaseEvent(event);
170 if (m_pressed && (m_status >= Active)) {172 if (m_pressed && (m_status >= Active)) {
171 Q_EMIT clicked();173 Q_EMIT clicked();
174 event->accept();
175 } else {
176 UCActionItem::mouseReleaseEvent(event);
172 }177 }
173}178}
174179
175180
=== modified file 'tests/unit_x11/tst_components/tst_bottomedgehint.qml'
--- tests/unit_x11/tst_components/tst_bottomedgehint.qml 2015-11-19 10:04:40 +0000
+++ tests/unit_x11/tst_components/tst_bottomedgehint.qml 2015-11-19 10:04:40 +0000
@@ -105,6 +105,7 @@
105 }105 }
106106
107 function cleanup() {107 function cleanup() {
108 mainView.forceActiveFocus();
108 listView.positionViewAtBeginning();109 listView.positionViewAtBeginning();
109 bottomEdgeHint.visible = true;110 bottomEdgeHint.visible = true;
110 bottomEdgeHint.iconName = "";111 bottomEdgeHint.iconName = "";
@@ -223,5 +224,18 @@
223 clickSpy.wait(500);224 clickSpy.wait(500);
224 compare(bottomEdgeHint.triggerCount, prevCount + 1, "Overloaded trigger not called");225 compare(bottomEdgeHint.triggerCount, prevCount + 1, "Overloaded trigger not called");
225 }226 }
227
228 function test_active_focus_on_press_bug1517777() {
229 var testItem = bottomEdgeHint;
230 testItem.status = BottomEdgeHint.Active;
231 testItem.activeFocusOnPress = true;
232 // make sure the test item is not active focus
233 floatingHint.forceActiveFocus();
234 verify(testItem.status >= BottomEdgeHint.Active);
235 compare(testItem.activeFocus, false, "BottomEdgeHint is focus before the test!");
236
237 mouseClick(testItem, centerOf(testItem).x, centerOf(testItem).y);
238 compare(testItem.activeFocus, true, "BottomEdgeHint is not focus");
239 }
226 }240 }
227}241}

Subscribers

People subscribed via source and target branches