~aacid/unity8/grid_rows_cols

« back to all changes in this revision

Viewing changes to qml/Shell.qml

  • Committer: CI bot
  • Author(s): Michael Terry
  • Date: 2014-10-13 15:41:29 UTC
  • mfrom: (1258.5.4 limit-emergencies)
  • Revision ID: ps-jenkins@lists.canonical.com-20141013154129-3bvtnf69zi4ivs85
Distinguish between incoming calls and other dialer-app opens.  (LP: #1378218)

We previously treated any dialer-app open/focus as an "emergency mode" use.  But now we'll be specific about it: just the emergency call button and any time there is an active call while the greeter is also active. Fixes: 1378218
Approved by: Michael Zanetti, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
        }
90
90
    }
91
91
 
92
 
    function setLockedApp(app) {
93
 
        if (shell.locked) {
94
 
            greeter.lockedApp = app
95
 
            lockscreen.hide()
 
92
    function startLockedApp(app) {
 
93
        if (!shell.locked) {
 
94
            console.warn("Called startLockedApp(%1) when not locked, ignoring".arg(app))
 
95
            return
96
96
        }
 
97
        greeter.lockedApp = app
 
98
        shell.activateApplication(app)
97
99
    }
98
100
 
99
101
    Binding {
172
174
            target: ApplicationManager
173
175
            onFocusRequested: {
174
176
                if (greeter.narrowMode) {
175
 
                    if (appId === "dialer-app") {
176
 
                        // Always let the dialer-app through.  Either user asked
177
 
                        // for an emergency call or accepted an incoming call.
178
 
                        setLockedApp(appId)
179
 
                    } else if (greeter.hasLockedApp && greeter.lockedApp !== appId) {
180
 
                        greeter.startUnlock()
 
177
                    if (appId === "dialer-app" && callManager.hasCalls) {
 
178
                        // If we are in the middle of a call, make dialer lockedApp and show it.
 
179
                        // This can happen if user backs out of dialer back to greeter, then
 
180
                        // launches dialer again.
 
181
                        greeter.lockedApp = appId;
 
182
                    }
 
183
                    if (greeter.hasLockedApp) {
 
184
                        if (appId === greeter.lockedApp) {
 
185
                            lockscreen.hide() // show locked app
 
186
                        } else {
 
187
                            greeter.startUnlock() // show lockscreen if necessary
 
188
                        }
181
189
                    }
182
190
                    greeter.hide();
183
191
                } else {
198
206
                if (greeter.shown && appId != "unity8-dash") {
199
207
                    greeter.startUnlock()
200
208
                }
201
 
                if (greeter.narrowMode && appId === "dialer-app") {
202
 
                    // Always let the dialer-app through.  Either user asked
203
 
                    // for an emergency call or accepted an incoming call.
204
 
                    setLockedApp(appId)
 
209
                if (greeter.narrowMode && greeter.hasLockedApp && appId === greeter.lockedApp) {
 
210
                    lockscreen.hide() // show locked app
205
211
                }
206
212
                launcher.hide();
207
213
            }
327
333
 
328
334
        onEntered: LightDM.Greeter.respond(passphrase);
329
335
        onCancel: greeter.show()
330
 
        onEmergencyCall: shell.activateApplication("dialer-app") // will automatically enter locked-app mode
 
336
        onEmergencyCall: startLockedApp("dialer-app")
331
337
 
332
338
        onShownChanged: if (shown) greeter.lockedApp = ""
333
339
 
565
571
    }
566
572
 
567
573
    Connections {
 
574
        id: callConnection
 
575
        target: callManager
 
576
 
 
577
        onHasCallsChanged: {
 
578
            if (shell.locked && callManager.hasCalls) {
 
579
                // We just received an incoming call while locked.  The
 
580
                // indicator will have already launched dialer-app for us, but
 
581
                // there is a race between "hasCalls" changing and the dialer
 
582
                // starting up.  So in case we lose that race, we'll start/
 
583
                // focus the dialer ourselves here too.  Even if the indicator
 
584
                // didn't launch the dialer for some reason (or maybe a call
 
585
                // started via some other means), if an active call is
 
586
                // happening, we want to be in the dialer.
 
587
                startLockedApp("dialer-app")
 
588
            }
 
589
        }
 
590
    }
 
591
 
 
592
    Connections {
568
593
        id: powerConnection
569
594
        target: Powerd
570
595