on xenial help sign in
Only call unlockAllModems once the wizard is done. (LP: #1425161) Fixes: #1425161

Approved by: Michał Sawicz, Daniel d'Andrada

commit355e344c969c7285096fd1d43f510045f111ffd4 authorMichael Terry <michael.terry@canonical.com> dateWed 18 Mar 2015, 10:16 (12 years ago) parentcd4dab677ffd43
4 files changed+34−6
qml/Greeter/Greeter.qml−5 qml/Shell.qml+11 qml/Wizard/Wizard.qml+6−1 tests/qmltests/tst_Shell.qml+17
qml/Greeter/Greeter.qml−5
@@ -19,7 +19,6 @@ import AccountsService 0.1
1919import LightDM 0.1 as LightDM
2020import Ubuntu.Components 1.1
2121import Ubuntu.SystemImage 0.1
22−import Unity.Connectivity 0.1
2322import Unity.Launcher 0.1
2423import "../Components"
2524
@@ -179,10 +178,6 @@ Showable {
179178 }
180179 }
181180
182− Component.onCompleted: {
183− Connectivity.unlockAllModems();
184− }
185−
186181 Timer {
187182 id: forcedDelayTimer
188183 interval: 1000 * 60
qml/Shell.qml+11
@@ -23,6 +23,7 @@ import Ubuntu.Components 0.1
2323import Ubuntu.Components.Popups 1.0
2424import Ubuntu.Gestures 0.1
2525import Ubuntu.Telephony 0.1 as Telephony
26+import Unity.Connectivity 0.1
2627import Unity.Launcher 0.1
2728import Utils 0.1
2829import LightDM 0.1 as LightDM
@@ -508,8 +509,18 @@ Item {
508509
509510 Wizard {
510511 id: wizard
512+ objectName: "wizard"
511513 anchors.fill: parent
512514 background: shell.background
515+
516+ function unlockWhenDoneWithWizard() {
517+ if (!active) {
518+ Connectivity.unlockAllModems();
519+ }
520+ }
521+
522+ Component.onCompleted: unlockWhenDoneWithWizard()
523+ onActiveChanged: unlockWhenDoneWithWizard()
513524 }
514525
515526 Rectangle {
qml/Wizard/Wizard.qml+6−1
@@ -25,7 +25,12 @@ Showable {
2525 // The background wallpaper to use
2626 property string background
2727
28− readonly property alias active: loader.active
28+ // This is a bool instead of an alias because Loader classes like to emit
29+ // changed signals for 'active' during startup even if they aren't actually
30+ // changing values. Having it cached as a proper Qml bool property prevents
31+ // unnecessary 'changed' emissions and provides consuming classes the
32+ // expected behavior of no emission on startup.
33+ readonly property bool active: loader.active
2934
3035 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
3136
tests/qmltests/tst_Shell.qml+17
@@ -31,6 +31,7 @@ import Unity.Indicators 0.1
3131import Unity.Notifications 1.0
3232import Unity.Test 0.1 as UT
3333import Powerd 0.1
34+import Wizard 0.1 as Wizard
3435
3536import "../../qml"
3637
@@ -288,6 +289,7 @@ Rectangle {
288289 setLightDMMockMode("single"); // back to the default value
289290
290291 AccountsService.demoEdges = false;
292+ Wizard.System.wizardEnabled = false;
291293
292294 // kill all (fake) running apps
293295 killApps(ApplicationManager);
@@ -940,6 +942,21 @@ Rectangle {
940942 tryCompare(unlockAllModemsSpy, "count", 1)
941943 }
942944
945+ function test_unlockAllModemsAfterWizard() {
946+ Wizard.System.wizardEnabled = true;
947+ loadShell("phone");
948+
949+ var wizard = findChild(shell, "wizard");
950+ compare(wizard.active, true);
951+ compare(Wizard.System.wizardEnabled, true);
952+ compare(unlockAllModemsSpy.count, 0);
953+
954+ wizard.hide();
955+ tryCompare(wizard, "active", false);
956+ compare(Wizard.System.wizardEnabled, false);
957+ compare(unlockAllModemsSpy.count, 1);
958+ }
959+
943960 function test_tapOnRightEdgeReachesApplicationSurface() {
944961 loadShell("phone");
945962 swipeAwayGreeter();