Merge lp:~aacid/unity8/restoreFocusOnDialogClose into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 2685
Merged at revision: 2774
Proposed branch: lp:~aacid/unity8/restoreFocusOnDialogClose
Merge into: lp:unity8
Prerequisite: lp:~lukas-kde/unity8/shellDialogImprovements
Diff against target: 74 lines (+54/-0)
2 files modified
qml/Components/Dialogs.qml (+19/-0)
tests/qmltests/tst_OrientedShell.qml (+35/-0)
To merge this branch: bzr merge lp:~aacid/unity8/restoreFocusOnDialogClose
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+314132@code.launchpad.net

Commit message

Restore focus to where it was when our ShellDialogs get unloaded

UITK Dialogs want to have this feature but it seems to be broken, so i'm fixing it here first (since we use dialogs in a kind of special way)
I'll try to fix UITK next

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
Parent

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
2684. By Albert Astals Cid

Component -> Item

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2684
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2828/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3701
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2125
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2125
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3729
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3573
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3573/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3573
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3573/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3573
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3573/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3573
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3573/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3573
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3573/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3573
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3573/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2828/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

I tested it slightly differently:
- with make tryOrientedShell
- set manta
- login
- open message indicator
- start replying to the message (gets focus)
- open power dialog
- click cancel
- focus gets back to the message (good)
- open power dialog
- click cancel

focus is gone apparently. Is it supposed to behave like that? am I doing sth wrong?

review: Needs Information
Revision history for this message
Andrea Cimitan (cimi) wrote :

Tested on a real session, the focus is lost after second dialog appears

review: Needs Fixing
2685. By Albert Astals Cid

Make it work the second time

Revision history for this message
Andrea Cimitan (cimi) wrote :

Last revision fixes the bug, Waiting CI

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2685
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2853/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3731
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2149/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2149
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3759
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3603
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3603/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3603
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3603/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3603
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3603/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3603
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3603/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3603
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3603/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3603
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3603/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2853/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Ci failed on jenkins itself failing, i've retriggered a build

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2685
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2859/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3737
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2155
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2155
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3765
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3609
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3609/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3609
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3609/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3609
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3609/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3609
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3609/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3609
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3609/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3609
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3609/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2859/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
y
 * Did CI run pass? If not, please explain why.
y

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Components/Dialogs.qml'
2--- qml/Components/Dialogs.qml 2017-01-09 15:58:33 +0000
3+++ qml/Components/Dialogs.qml 2017-01-09 15:58:33 +0000
4@@ -149,6 +149,25 @@
5 objectName: "dialogLoader"
6 anchors.fill: parent
7 active: false
8+ onActiveChanged: {
9+ if (!active) {
10+ if (previousFocusedItem) {
11+ previousFocusedItem.forceActiveFocus(Qt.OtherFocusReason);
12+ previousFocusedItem = undefined;
13+ }
14+ previousSourceComponent = undefined;
15+ sourceComponent = undefined;
16+ }
17+ }
18+ onSourceComponentChanged: {
19+ if (previousSourceComponent !== sourceComponent) {
20+ previousSourceComponent = sourceComponent;
21+ previousFocusedItem = window.activeFocusItem;
22+ }
23+ }
24+
25+ property var previousSourceComponent: undefined
26+ property var previousFocusedItem: undefined
27 }
28
29 Component {
30
31=== modified file 'tests/qmltests/tst_OrientedShell.qml'
32--- tests/qmltests/tst_OrientedShell.qml 2017-01-09 15:58:33 +0000
33+++ tests/qmltests/tst_OrientedShell.qml 2017-01-09 15:58:33 +0000
34@@ -1596,5 +1596,40 @@
35
36 tryCompare(dialogLoader, "item", null);
37 }
38+
39+ function test_focusOnShutdownDialogClose() {
40+ loadShell("manta");
41+ usageModeSelector.selectWindowed();
42+
43+ var surfaceId = topLevelSurfaceList.nextId;
44+ var app = ApplicationManager.startApplication("twitter-webapp");
45+ waitUntilAppWindowIsFullyLoaded(surfaceId);
46+
47+ var primaryAppWindow = findAppWindowForSurfaceId(surfaceId);
48+ var surface = app.surfaceList.get(0);
49+ var surfaceItem = findSurfaceItem(primaryAppWindow, surface);
50+
51+ compare(window.activeFocusItem, surfaceItem);
52+
53+ testCase.showPowerDialog();
54+
55+ var dialogLoader = findChild(orientedShell, "dialogLoader");
56+ tryCompareFunction(function() { return dialogLoader.item !== null }, true);
57+
58+ keyClick(Qt.Key_Escape);
59+
60+ tryCompare(dialogLoader, "item", null);
61+ compare(window.activeFocusItem, surfaceItem);
62+
63+ // Do it twice, our previous solution failed the second time ^_^
64+ testCase.showPowerDialog();
65+
66+ tryCompareFunction(function() { return dialogLoader.item !== null }, true);
67+
68+ keyClick(Qt.Key_Escape);
69+
70+ tryCompare(dialogLoader, "item", null);
71+ compare(window.activeFocusItem, surfaceItem);
72+ }
73 }
74 }

Subscribers

People subscribed via source and target branches