Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/lockscreen/LockScreenUi.qml
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 39 | Connections { | |||
---|---|---|---|---|---|
52 | } | 52 | } | ||
53 | onError: { | 53 | onError: { | ||
54 | root.notification = err; | 54 | root.notification = err; | ||
55 | } | 55 | } | ||
56 | } | 56 | } | ||
57 | 57 | | |||
58 | SessionsModel { | 58 | SessionsModel { | ||
59 | id: sessionsModel | 59 | id: sessionsModel | ||
60 | showNewSessionEntry: true | 60 | showNewSessionEntry: false | ||
61 | } | 61 | } | ||
62 | 62 | | |||
63 | PlasmaCore.DataSource { | 63 | PlasmaCore.DataSource { | ||
64 | id: keystateSource | 64 | id: keystateSource | ||
65 | engine: "keystate" | 65 | engine: "keystate" | ||
66 | connectedSources: "Caps Lock" | 66 | connectedSources: "Caps Lock" | ||
67 | } | 67 | } | ||
68 | 68 | | |||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Line(s) | 243 | onLoginRequest: { | |||
244 | root.notification = "" | 244 | root.notification = "" | ||
245 | authenticator.tryUnlock(password) | 245 | authenticator.tryUnlock(password) | ||
246 | } | 246 | } | ||
247 | 247 | | |||
248 | actionItems: [ | 248 | actionItems: [ | ||
249 | ActionButton { | 249 | ActionButton { | ||
250 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch User") | 250 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch User") | ||
251 | iconSource: "system-switch-user" | 251 | iconSource: "system-switch-user" | ||
252 | onClicked: mainStack.push(switchSessionPage) | 252 | onClicked: { | ||
253 | // If there are no existing sessions to switch to, create a new one instead | ||||
254 | if (((sessionsModel.showNewSessionEntry && sessionsModel.count === 1) || | ||||
255 | (!sessionsModel.showNewSessionEntry && sessionsModel.count === 0)) && | ||||
256 | sessionsModel.canSwitchUser) { | ||||
257 | mainStack.pop({immediate:true}) | ||||
258 | sessionsModel.startNewSession(true /* lock the screen too */) | ||||
259 | lockScreenRoot.state = '' | ||||
260 | } else { | ||||
261 | mainStack.push(switchSessionPage) | ||||
262 | } | ||||
263 | } | ||||
253 | visible: sessionsModel.canStartNewSession && sessionsModel.canSwitchUser | 264 | visible: sessionsModel.canStartNewSession && sessionsModel.canSwitchUser | ||
254 | } | 265 | } | ||
255 | ] | 266 | ] | ||
256 | 267 | | |||
257 | Loader { | 268 | Loader { | ||
258 | Layout.fillWidth: true | 269 | Layout.fillWidth: true | ||
259 | Layout.preferredHeight: item ? item.implicitHeight : 0 | 270 | Layout.preferredHeight: item ? item.implicitHeight : 0 | ||
260 | active: config.showMediaControls | 271 | active: config.showMediaControls | ||
261 | source: "MediaControls.qml" | 272 | source: "MediaControls.qml" | ||
262 | } | 273 | } | ||
263 | } | 274 | } | ||
264 | 275 | | |||
265 | Component.onCompleted: { | 276 | Component.onCompleted: { | ||
266 | if (defaultToSwitchUser) { //context property | 277 | if (defaultToSwitchUser) { //context property | ||
278 | // If we are in the only session, then going to the session switcher is | ||||
279 | // a pointless extra step; instead create a new session immediately | ||||
280 | if (((sessionsModel.showNewSessionEntry && sessionsModel.count === 1) || | ||||
281 | (!sessionsModel.showNewSessionEntry && sessionsModel.count === 0)) && | ||||
282 | sessionsModel.canStartNewSession) { | ||||
283 | sessionsModel.startNewSession(true /* lock the screen too */) | ||||
284 | } else { | ||||
267 | mainStack.push({ | 285 | mainStack.push({ | ||
268 | item: switchSessionPage, | 286 | item: switchSessionPage, | ||
269 | immediate: true}); | 287 | immediate: true}); | ||
270 | } | 288 | } | ||
271 | } | 289 | } | ||
272 | } | 290 | } | ||
291 | } | ||||
273 | 292 | | |||
274 | Loader { | 293 | Loader { | ||
275 | id: inputPanel | 294 | id: inputPanel | ||
276 | state: "hidden" | 295 | state: "hidden" | ||
277 | readonly property bool keyboardActive: item ? item.active : false | 296 | readonly property bool keyboardActive: item ? item.active : false | ||
278 | anchors { | 297 | anchors { | ||
279 | left: parent.left | 298 | left: parent.left | ||
280 | right: parent.right | 299 | right: parent.right | ||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | 407 | SessionManagementScreen { | |||
409 | } | 428 | } | ||
410 | 429 | | |||
411 | Keys.onLeftPressed: userList.decrementCurrentIndex() | 430 | Keys.onLeftPressed: userList.decrementCurrentIndex() | ||
412 | Keys.onRightPressed: userList.incrementCurrentIndex() | 431 | Keys.onRightPressed: userList.incrementCurrentIndex() | ||
413 | Keys.onEnterPressed: initSwitchSession() | 432 | Keys.onEnterPressed: initSwitchSession() | ||
414 | Keys.onReturnPressed: initSwitchSession() | 433 | Keys.onReturnPressed: initSwitchSession() | ||
415 | Keys.onEscapePressed: mainStack.pop() | 434 | Keys.onEscapePressed: mainStack.pop() | ||
416 | 435 | | |||
436 | ColumnLayout { | ||||
437 | Layout.fillWidth: true | ||||
438 | spacing: units.largeSpacing | ||||
439 | | ||||
417 | PlasmaComponents.Button { | 440 | PlasmaComponents.Button { | ||
418 | Layout.fillWidth: true | 441 | Layout.fillWidth: true | ||
419 | font.pointSize: theme.defaultFont.pointSize + 1 | 442 | font.pointSize: theme.defaultFont.pointSize + 1 | ||
420 | // the magic "-1" vtNumber indicates the "New Session" entry | 443 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch to This Session") | ||
GB_2: "Switch to Session" or "Switch to This Session" | |||||
421 | text: userListCurrentModelData.vtNumber === -1 ? i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Start New Session") : i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch Session") | | |||
422 | onClicked: initSwitchSession() | 444 | onClicked: initSwitchSession() | ||
445 | visible: sessionsModel.count > 0 | ||||
423 | } | 446 | } | ||
424 | 447 | | |||
448 | PlasmaComponents.Button { | ||||
449 | Layout.fillWidth: true | ||||
450 | font.pointSize: theme.defaultFont.pointSize + 1 | ||||
451 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Start New Session") | ||||
452 | onClicked: { | ||||
453 | mainStack.pop({immediate:true}) | ||||
454 | sessionsModel.startNewSession(true /* lock the screen too */) | ||||
455 | lockScreenRoot.state = '' | ||||
456 | } | ||||
457 | } | ||||
458 | } | ||||
459 | | ||||
460 | | ||||
425 | actionItems: [ | 461 | actionItems: [ | ||
426 | ActionButton { | 462 | ActionButton { | ||
427 | iconSource: "go-previous" | 463 | iconSource: "go-previous" | ||
428 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Back") | 464 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Back") | ||
429 | onClicked: mainStack.pop() | 465 | onClicked: mainStack.pop() | ||
430 | } | 466 | } | ||
431 | ] | 467 | ] | ||
432 | } | 468 | } | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |
"Switch to Session" or "Switch to This Session"