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
=== modified file 'qml/Components/Dialogs.qml'
--- qml/Components/Dialogs.qml 2017-01-09 15:58:33 +0000
+++ qml/Components/Dialogs.qml 2017-01-09 15:58:33 +0000
@@ -149,6 +149,25 @@
149 objectName: "dialogLoader"149 objectName: "dialogLoader"
150 anchors.fill: parent150 anchors.fill: parent
151 active: false151 active: false
152 onActiveChanged: {
153 if (!active) {
154 if (previousFocusedItem) {
155 previousFocusedItem.forceActiveFocus(Qt.OtherFocusReason);
156 previousFocusedItem = undefined;
157 }
158 previousSourceComponent = undefined;
159 sourceComponent = undefined;
160 }
161 }
162 onSourceComponentChanged: {
163 if (previousSourceComponent !== sourceComponent) {
164 previousSourceComponent = sourceComponent;
165 previousFocusedItem = window.activeFocusItem;
166 }
167 }
168
169 property var previousSourceComponent: undefined
170 property var previousFocusedItem: undefined
152 }171 }
153172
154 Component {173 Component {
155174
=== modified file 'tests/qmltests/tst_OrientedShell.qml'
--- tests/qmltests/tst_OrientedShell.qml 2017-01-09 15:58:33 +0000
+++ tests/qmltests/tst_OrientedShell.qml 2017-01-09 15:58:33 +0000
@@ -1596,5 +1596,40 @@
15961596
1597 tryCompare(dialogLoader, "item", null);1597 tryCompare(dialogLoader, "item", null);
1598 }1598 }
1599
1600 function test_focusOnShutdownDialogClose() {
1601 loadShell("manta");
1602 usageModeSelector.selectWindowed();
1603
1604 var surfaceId = topLevelSurfaceList.nextId;
1605 var app = ApplicationManager.startApplication("twitter-webapp");
1606 waitUntilAppWindowIsFullyLoaded(surfaceId);
1607
1608 var primaryAppWindow = findAppWindowForSurfaceId(surfaceId);
1609 var surface = app.surfaceList.get(0);
1610 var surfaceItem = findSurfaceItem(primaryAppWindow, surface);
1611
1612 compare(window.activeFocusItem, surfaceItem);
1613
1614 testCase.showPowerDialog();
1615
1616 var dialogLoader = findChild(orientedShell, "dialogLoader");
1617 tryCompareFunction(function() { return dialogLoader.item !== null }, true);
1618
1619 keyClick(Qt.Key_Escape);
1620
1621 tryCompare(dialogLoader, "item", null);
1622 compare(window.activeFocusItem, surfaceItem);
1623
1624 // Do it twice, our previous solution failed the second time ^_^
1625 testCase.showPowerDialog();
1626
1627 tryCompareFunction(function() { return dialogLoader.item !== null }, true);
1628
1629 keyClick(Qt.Key_Escape);
1630
1631 tryCompare(dialogLoader, "item", null);
1632 compare(window.activeFocusItem, surfaceItem);
1633 }
1599 }1634 }
1600}1635}

Subscribers

People subscribed via source and target branches