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
1=== modified file 'src/Ubuntu/Components/plugin/ucbottomedgehint.cpp'
2--- src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2015-11-19 10:04:40 +0000
3+++ src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2015-11-19 10:04:40 +0000
4@@ -160,15 +160,20 @@
5 {
6 if (contains(event->localPos()) && (m_status >= Active)) {
7 m_pressed = true;
8+ event->accept();
9+ // also call requestFocus
10+ requestFocus(Qt::MouseFocusReason);
11 } else {
12 UCActionItem::mousePressEvent(event);
13 }
14 }
15 void UCBottomEdgeHint::mouseReleaseEvent(QMouseEvent *event)
16 {
17- UCActionItem::mouseReleaseEvent(event);
18 if (m_pressed && (m_status >= Active)) {
19 Q_EMIT clicked();
20+ event->accept();
21+ } else {
22+ UCActionItem::mouseReleaseEvent(event);
23 }
24 }
25
26
27=== modified file 'tests/unit_x11/tst_components/tst_bottomedgehint.qml'
28--- tests/unit_x11/tst_components/tst_bottomedgehint.qml 2015-11-19 10:04:40 +0000
29+++ tests/unit_x11/tst_components/tst_bottomedgehint.qml 2015-11-19 10:04:40 +0000
30@@ -105,6 +105,7 @@
31 }
32
33 function cleanup() {
34+ mainView.forceActiveFocus();
35 listView.positionViewAtBeginning();
36 bottomEdgeHint.visible = true;
37 bottomEdgeHint.iconName = "";
38@@ -223,5 +224,18 @@
39 clickSpy.wait(500);
40 compare(bottomEdgeHint.triggerCount, prevCount + 1, "Overloaded trigger not called");
41 }
42+
43+ function test_active_focus_on_press_bug1517777() {
44+ var testItem = bottomEdgeHint;
45+ testItem.status = BottomEdgeHint.Active;
46+ testItem.activeFocusOnPress = true;
47+ // make sure the test item is not active focus
48+ floatingHint.forceActiveFocus();
49+ verify(testItem.status >= BottomEdgeHint.Active);
50+ compare(testItem.activeFocus, false, "BottomEdgeHint is focus before the test!");
51+
52+ mouseClick(testItem, centerOf(testItem).x, centerOf(testItem).y);
53+ compare(testItem.activeFocus, true, "BottomEdgeHint is not focus");
54+ }
55 }
56 }

Subscribers

People subscribed via source and target branches