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

Proposed by Zsombor Egri
Status: Merged
Approved by: Cris Dywan
Approved revision: 1024
Merged at revision: 1025
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/textinputs-rightclick
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~zsombi/ubuntu-ui-toolkit/popover-dismiss-buttons
Diff against target: 245 lines (+103/-13)
7 files modified
modules/Ubuntu/Components/InputHandler.qml (+19/-7)
modules/Ubuntu/Components/TextArea.qml (+2/-1)
modules/Ubuntu/Components/TextCursor.qml (+1/-1)
modules/Ubuntu/Components/TextField.qml (+3/-2)
modules/Ubuntu/Components/TextInputPopover.qml (+1/-1)
tests/unit_x11/tst_components/tst_textarea.qml (+38/-1)
tests/unit_x11/tst_components/tst_textfield.qml (+39/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/textinputs-rightclick
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+216008@code.launchpad.net

This proposal supersedes a proposal from 2014-04-09.

Commit message

Text inputs show context menu when right-clicked on desktop.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1011
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/2/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/161
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4720
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/2
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/2
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/2/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/2
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/156
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4303
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4303/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5877
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4073
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4849
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4849/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/2/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote : Posted in a previous version of this proposal

Problems found while testing:
- Right-click whilst menu is visible shows another menu without closing the previous one(s). It should always close the first menu and then behave exactly as if there was none.
- Select, right-click, selection is lost. Selection should remain before and after showing the menu - unless it's modified due to menu items obviously.

These apply to both components.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1012
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/4/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/165
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4727
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/4
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/4
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/4/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/4
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/158
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4310
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4310/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5882
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4080
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4856
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4856/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/4/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote : Posted in a previous version of this proposal

> Problems found while testing:
> - Right-click whilst menu is visible shows another menu without closing the
> previous one(s). It should always close the first menu and then behave exactly
> as if there was none.
> - Select, right-click, selection is lost. Selection should remain before and
> after showing the menu - unless it's modified due to menu items obviously.
>
> These apply to both components.

The second one should be fixed now. The first one requires changes in the Popover mouse handling as that doe snot listen on right mouse events at all.

Revision history for this message
Cris Dywan (kalikiana) wrote : Posted in a previous version of this proposal

Selection is working indeed.

- Multiple right-clicks still accumulate menus. I can see that it spans over different entries so I see how it's a Popover issue. Though to be honest it's a pretty serious bug.
- I can't get a menu if I right-click somewhere with no text - all the "Single line" entries in the gallery only work if you pay attention to aim at the text or respectively type something first and then click that.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote : Posted in a previous version of this proposal

> Selection is working indeed.
>
> - Multiple right-clicks still accumulate menus. I can see that it spans over
> different entries so I see how it's a Popover issue. Though to be honest it's
> a pretty serious bug.

It is a popover issue. Popovers get dismissed only on left-clicks. Right click do not have any effect on them. The same reason is that right clicks are not handled by a mouse area which does not accept right buttons.
It is a one-liner after all, but needs test cases, which makes it bigger and would be better to solve it in a separate MR rather than in this one. The question is whether we do it after this MR or before?

> - I can't get a menu if I right-click somewhere with no text - all the "Single
> line" entries in the gallery only work if you pay attention to aim at the text
> or respectively type something first and then click that.

The same happens with TextArea, if you right-click on the frame or on the gap between the frame and the text. The MouseArea that takes care of the frame does not handle/forward right clicks.

Revision history for this message
Zsombor Egri (zsombi) wrote :

re-submitted with a different prerequisite.

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

staging merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

In the latest revision the selection is cleared when right-clicking outside of the selected text

1. Select some text
2. Right-click somewhere in the unselected area
3. Should be able to cut the selected text

review: Needs Fixing
1021. By Zsombor Egri

prereq merge

Revision history for this message
Zsombor Egri (zsombi) wrote :

> In the latest revision the selection is cleared when right-clicking outside of
> the selected text
>
> 1. Select some text
> 2. Right-click somewhere in the unselected area
> 3. Should be able to cut the selected text

One of the requirements in the bug was that right click must work in the same way as the pressAndHold does. pressAndHold works in this way even in the prerequisite.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1021
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/90/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/416
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5040
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/90
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/90
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/90/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/90
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/377
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4662
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4662/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6381
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4338
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5229
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5229/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/90/rebuild

review: Approve (continuous-integration)
1022. By Zsombor Egri

prereq merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1022
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/99/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/432
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5056
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/99
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/99
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/99/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/99
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/388
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4679
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4679/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6399
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4350
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5245
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5245/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/99/rebuild

review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> > In the latest revision the selection is cleared when right-clicking outside
> of
> > the selected text
> >
> > 1. Select some text
> > 2. Right-click somewhere in the unselected area
> > 3. Should be able to cut the selected text
>
> One of the requirements in the bug was that right click must work in the same
> way as the pressAndHold does. pressAndHold works in this way even in the
> prerequisite.

The bug literally says "right-click should trigger long press". It has no description at all. My best guess is that any menu you will trigger via long press should also be invoked via right-click. This is what I would expect. I'm doubtful it implies deviating from correct right-click behavior on GTK+ apps.

The behavior is as it was in my last test run, so I'm afraid this is still wrong until we reach a conclusion.

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

> > > In the latest revision the selection is cleared when right-clicking
> outside
> > of
> > > the selected text
> > >
> > > 1. Select some text
> > > 2. Right-click somewhere in the unselected area
> > > 3. Should be able to cut the selected text
> >
> > One of the requirements in the bug was that right click must work in the
> same
> > way as the pressAndHold does. pressAndHold works in this way even in the
> > prerequisite.
>
> The bug literally says "right-click should trigger long press". It has no
> description at all. My best guess is that any menu you will trigger via long
> press should also be invoked via right-click. This is what I would expect. I'm
> doubtful it implies deviating from correct right-click behavior on GTK+ apps.
>
> The behavior is as it was in my last test run, so I'm afraid this is still
> wrong until we reach a conclusion.

Right click on desktop in QML/toolkit apps should behave like their GTK equivalent unless a strong case against it can be made.
I would even say that the long press on device should mimic what the right click does.

Revision history for this message
Zsombor Egri (zsombi) wrote :

> > > > In the latest revision the selection is cleared when right-clicking
> > outside
> > > of
> > > > the selected text
> > > >
> > > > 1. Select some text
> > > > 2. Right-click somewhere in the unselected area
> > > > 3. Should be able to cut the selected text
> > >
> > > One of the requirements in the bug was that right click must work in the
> > same
> > > way as the pressAndHold does. pressAndHold works in this way even in the
> > > prerequisite.
> >
> > The bug literally says "right-click should trigger long press". It has no
> > description at all. My best guess is that any menu you will trigger via long
> > press should also be invoked via right-click. This is what I would expect.
> I'm
> > doubtful it implies deviating from correct right-click behavior on GTK+
> apps.
> >
> > The behavior is as it was in my last test run, so I'm afraid this is still
> > wrong until we reach a conclusion.
>
> Right click on desktop in QML/toolkit apps should behave like their GTK
> equivalent unless a strong case against it can be made.
> I would even say that the long press on device should mimic what the right
> click does.

I can make it so right click behaves like other GTK+ apps do, however I need to know which one to consider. I tried two apps, gedit and LibreOffice, they both behave differently.

gedit:
- rigth click over text opens the context menu, does not move the cursor
- right click over area where there's no text works the same as previous
- right click over selected text opens context menu
- rigth click anywhere else but selected text opens context menu, preserves selection

LibreOffice write:
- right click over a text selects the word and opens the context menu
- rigth click over area with no text moves the cursor to the closest position in the line, opens context menu
- rigth click over selected text opens context menu
- rigth click anywhere else but selected text clears selection, moves the cursor to the closest place to the click and opens popover

Our logic behaves as LibreOffice. On touch devices it also behaves like this. If I do both desktop and touch to behave the same way, I will introduce a regression, as pressAndHold so far moved the cursor and opened the context menu in place.

Now what?

Revision history for this message
Zsombor Egri (zsombi) wrote :

> > > In the latest revision the selection is cleared when right-clicking
> outside
> > of
> > > the selected text
> > >
> > > 1. Select some text
> > > 2. Right-click somewhere in the unselected area
> > > 3. Should be able to cut the selected text
> >
> > One of the requirements in the bug was that right click must work in the
> same
> > way as the pressAndHold does. pressAndHold works in this way even in the
> > prerequisite.
>
> The bug literally says "right-click should trigger long press". It has no
> description at all. My best guess is that any menu you will trigger via long
> press should also be invoked via right-click. This is what I would expect. I'm
> doubtful it implies deviating from correct right-click behavior on GTK+ apps.
>
> The behavior is as it was in my last test run, so I'm afraid this is still
> wrong until we reach a conclusion.

That's what actually does: the right click invokes whatever functionality the pressAndHold has.

If I'd do the same way as GTK+ app does, that would mean I would need to have a huge change on the Popovers as those cannot be opened on a free (x,y) coordinate, they can be opened attached to a caller. So the caller must be positioned prior to open the popover.

OTOH, the direction on pressAndHold was to follow Android/iOS. They do it as we do with pressAndHold.

Revision history for this message
Zoltan Balogh (bzoltan) wrote :

> Right click on desktop in QML/toolkit apps should behave like their GTK equivalent unless a strong case against it can be made.

I would be happy to hear a properly explained verion of that statement :) In my view the GTK is an obsolate technology on Desktop and I would keep only those UX and User Input paradigms that make sense. The GTK heritage should not limit our design and UX plans we have for the converged UITK.

I would vote on that right click on the desktop does the same as long press on the touch device

1023. By Zsombor Egri

staging merge

1024. By Zsombor Egri

import version fix

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1024
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/111/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/461
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5085
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/111
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/111
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/111/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/111
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/411
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4718
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4718/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6444
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4374
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5278
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5278/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/111/rebuild

review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> GTK heritage should not limit our design

I've thought about that over a cup of tea. The toolkit menu is actually positioning itself more predictably than legacy desktop menus. My biggest concern in an unbiased point of view amounts to cases where directly hitting the selection is hard a) missing grid units on the desktop b) having a small selection - the legacy behavior hides those issues without adressing them.
So, let's proceed without prejudice.

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
1=== modified file 'modules/Ubuntu/Components/InputHandler.qml'
2--- modules/Ubuntu/Components/InputHandler.qml 2014-04-15 15:25:09 +0000
3+++ modules/Ubuntu/Components/InputHandler.qml 2014-04-28 06:48:59 +0000
4@@ -15,7 +15,7 @@
5 */
6
7 import QtQuick 2.0
8-import Ubuntu.Components 0.1 as Ubuntu
9+import Ubuntu.Components 1.1
10
11 /*
12 This component is a unified text selection and scrolling handler for both
13@@ -259,8 +259,8 @@
14 }
15
16 // Mouse handling
17- Ubuntu.Mouse.forwardTo: [main]
18- Ubuntu.Mouse.onPressed: {
19+ Mouse.forwardTo: [main]
20+ Mouse.onPressed: {
21 if (input.activeFocus) {
22 // start selection timeout
23 selectionTimeout.restart();
24@@ -270,7 +270,7 @@
25 // consume event so it does not get forwarded to the input
26 mouse.accepted = true;
27 }
28- Ubuntu.Mouse.onReleased: {
29+ Mouse.onReleased: {
30 if (!main.focus && !main.activeFocusOnPress) {
31 return;
32 }
33@@ -283,8 +283,13 @@
34 }
35 moveStarts = moveEnds = -1;
36 state = "";
37+ // check if we get right-click from the frame or the area that has no text
38+ if (mouse.button === Qt.RightButton) {
39+ // open the popover
40+ inputHandler.pressAndHold(input.cursorPosition);
41+ }
42 }
43- Ubuntu.Mouse.onPositionChanged: {
44+ Mouse.onPositionChanged: {
45 // leave if not focus, not the left button or not in select state
46 if (!input.activeFocus || (mouse.button !== Qt.LeftButton) || (state !== "select") || !main.selectByMouse) {
47 return;
48@@ -293,13 +298,20 @@
49 selectionTimeout.running = false;
50 selectText(mouse);
51 }
52- Ubuntu.Mouse.onDoubleClicked: {
53+ Mouse.onDoubleClicked: {
54 if (main.selectByMouse) {
55 input.selectWord();
56 // turn selection state temporarily so the selection is not cleared on release
57 state = "selection";
58 }
59 }
60- Ubuntu.Mouse.onPressAndHold: openContextMenu(mouse)
61+ Mouse.onPressAndHold: openContextMenu(mouse)
62
63+ // right button handling
64+ MouseArea {
65+ anchors.fill: parent
66+ acceptedButtons: Qt.RightButton
67+ // trigger pressAndHold
68+ onReleased: openContextMenu(mouse)
69+ }
70 }
71
72=== modified file 'modules/Ubuntu/Components/TextArea.qml'
73--- modules/Ubuntu/Components/TextArea.qml 2014-04-25 12:53:58 +0000
74+++ modules/Ubuntu/Components/TextArea.qml 2014-04-28 06:48:59 +0000
75@@ -15,7 +15,7 @@
76 */
77
78 import QtQuick 2.0
79-import Ubuntu.Components 0.1 as Ubuntu
80+import Ubuntu.Components 1.1 as Ubuntu
81 import "mathUtils.js" as MathUtils
82
83 /*!
84@@ -740,6 +740,7 @@
85 MouseArea {
86 anchors.fill: parent
87 enabled: internal.frameSpacing > 0
88+ acceptedButtons: Qt.LeftButton | Qt.RightButton
89 // activate input when pressed on the frame
90 preventStealing: false
91 Ubuntu.Mouse.forwardTo: [inputHandler]
92
93=== modified file 'modules/Ubuntu/Components/TextCursor.qml'
94--- modules/Ubuntu/Components/TextCursor.qml 2014-04-09 12:05:49 +0000
95+++ modules/Ubuntu/Components/TextCursor.qml 2014-04-28 06:48:59 +0000
96@@ -15,7 +15,7 @@
97 */
98
99 import QtQuick 2.0
100-import "Popups" 0.1
101+import Ubuntu.Components.Popups 1.0
102
103 StyledItem {
104 id: cursorItem
105
106=== modified file 'modules/Ubuntu/Components/TextField.qml'
107--- modules/Ubuntu/Components/TextField.qml 2014-04-25 12:53:58 +0000
108+++ modules/Ubuntu/Components/TextField.qml 2014-04-28 06:48:59 +0000
109@@ -16,7 +16,7 @@
110
111 import QtQuick 2.0
112 import Ubuntu.Unity.Action 1.1 as UnityActions
113-import Ubuntu.Components 0.1 as Ubuntu
114+import Ubuntu.Components 1.1 as Ubuntu
115
116 /*!
117 \qmltype TextField
118@@ -840,7 +840,8 @@
119 // grab clicks from the area between the frame and the input
120 MouseArea {
121 anchors.fill: parent
122- // us it only when there is space between the frame and input
123+ acceptedButtons: Qt.LeftButton | Qt.RightButton
124+ // use it only when there is space between the frame and input
125 enabled: internal.spacing > 0
126 preventStealing: false
127 // forward mouse events to input so we can handle those uniformly
128
129=== modified file 'modules/Ubuntu/Components/TextInputPopover.qml'
130--- modules/Ubuntu/Components/TextInputPopover.qml 2014-04-23 08:50:20 +0000
131+++ modules/Ubuntu/Components/TextInputPopover.qml 2014-04-28 06:48:59 +0000
132@@ -16,7 +16,7 @@
133
134 import QtQuick 2.0
135 import Ubuntu.Components 1.1 as Toolkit
136-import "Popups" 0.1
137+import Ubuntu.Components.Popups 1.0
138
139 ActionSelectionPopover {
140 objectName: "text_input_popover"
141
142=== modified file 'tests/unit_x11/tst_components/tst_textarea.qml'
143--- tests/unit_x11/tst_components/tst_textarea.qml 2014-04-25 12:53:58 +0000
144+++ tests/unit_x11/tst_components/tst_textarea.qml 2014-04-28 06:48:59 +0000
145@@ -481,7 +481,6 @@
146 compare(Qt.inputMethod.visible, true, "OSK shown");
147 }
148
149- // make it to b ethe last test case executed
150 function test_TextareaInListItem_RichTextEnterCaptured() {
151 textArea.text = "a<br />b";
152 textArea.textFormat = TextEdit.RichText;
153@@ -719,5 +718,43 @@
154 mouseClick(longText, units.gu(10), y);
155 verify(longText.selectedText === "", "There is still selected text");
156 }
157+
158+ function test_rightclick_opens_popover_when_not_focused() {
159+ var handler = findChild(longText, "input_handler");
160+ var x = longText.width / 2;
161+ var y = longText.height / 2;
162+ popoverSpy.target = handler;
163+ popoverSpy.clear();
164+
165+ // rclick should bring popover in
166+ mouseClick(longText, x, y, Qt.RightButton);
167+ waitForRendering(longText);
168+ popoverSpy.wait();
169+ compare(longText.focus, true, "The input was not focused");
170+ compare(handler.state, "", "The input is not in default state.");
171+
172+ // take the popover away, that should bring the handler back to default state
173+ mouseClick(main, 0, 0);
174+ compare(handler.state, "", "The input has not returned to default state.");
175+ }
176+
177+ function test_rightclick_opens_popover_when_focused() {
178+ longText.focus = true;
179+ var handler = findChild(longText, "input_handler");
180+ var x = longText.width / 2;
181+ var y = longText.height / 2;
182+ popoverSpy.target = handler;
183+ popoverSpy.clear();
184+
185+ // rclick should bring popover in
186+ mouseClick(longText, x, y, Qt.RightButton);
187+ waitForRendering(longText);
188+ popoverSpy.wait();
189+ compare(handler.state, "", "The input is not in default state.");
190+
191+ // take the popover away, that should bring the handler back to default state
192+ mouseClick(main, 0, 0);
193+ compare(handler.state, "", "The input has not returned to default state.");
194+ }
195 }
196 }
197
198=== modified file 'tests/unit_x11/tst_components/tst_textfield.qml'
199--- tests/unit_x11/tst_components/tst_textfield.qml 2014-04-25 12:53:58 +0000
200+++ tests/unit_x11/tst_components/tst_textfield.qml 2014-04-28 06:48:59 +0000
201@@ -732,5 +732,44 @@
202 mouseClick(longText, units.gu(10), y);
203 verify(longText.selectedText === "");
204 }
205+
206+ function test_rightclick_opens_popover_when_not_focused() {
207+ var handler = findChild(longText, "input_handler");
208+ var x = longText.width / 2;
209+ var y = longText.height / 2;
210+ popoverSpy.target = handler;
211+ popoverSpy.clear();
212+
213+ // rclick should bring popover in
214+ mouseClick(longText, x, y, Qt.RightButton);
215+ waitForRendering(longText);
216+ popoverSpy.wait();
217+ // and also set the focus
218+ compare(longText.focus, true, "Component haven't got focused");
219+ compare(handler.state, "", "The input is not in inactive state.");
220+
221+ // take the popover away, that should bring the handler back to default state
222+ mouseClick(textItem, 0, 0);
223+ compare(handler.state, "", "The input has not returned to default state.");
224+ }
225+
226+ function test_rightclick_opens_popover_when_focused() {
227+ longText.focus = true;
228+ var handler = findChild(longText, "input_handler");
229+ var x = longText.width / 2;
230+ var y = longText.height / 2;
231+ popoverSpy.target = handler;
232+ popoverSpy.clear();
233+
234+ // rclick should bring popover in
235+ mouseClick(longText, x, y, Qt.RightButton);
236+ waitForRendering(longText);
237+ popoverSpy.wait();
238+ compare(handler.state, "", "The input is not in default state.");
239+
240+ // take the popover away, that should bring the handler back to default state
241+ mouseClick(textItem, 0, 0);
242+ compare(handler.state, "", "The input has not returned to default state.");
243+ }
244 }
245 }

Subscribers

People subscribed via source and target branches