Commit b6705f8d authored by Martin Flöser's avatar Martin Flöser
Browse files

[lookandfeel] Add virtual keyboard to the LockScreen

Summary:
This change integrates QtVirtualKeyboard into the Lock screen UI.

A new button is added to the bottom row to toggle the appearance of the
virtual keyboard. The actual keyboard is integrated through a Loader so
that not having qtvirtualkeyboard plugin installed results in a graceful
error instead of a failing lock screen.

When the virtual keyboard is shown the remaining UI shifts upwards. This
is done through adding the stack view into a ColumnLayout. Unfortunately
this can result in an overlap with the clock. This needs some general
improvement as on e.g. my system the clock is never really visible.

To have the virtual keyboard working in the lock screen one also needs
another change to kscreenlocker_greet.

Test Plan: See screenshots

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4870
parent 1ce5ed3b
......@@ -66,7 +66,7 @@ Item {
UserList {
id: userListView
visible: showUserList
visible: showUserList && y > 0
anchors {
bottom: parent.verticalCenter
left: parent.left
......
......@@ -132,56 +132,75 @@ PlasmaCore.ColorScope {
}
}
StackView {
id: mainStack
ColumnLayout {
anchors.fill: parent
focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it
StackView {
id: mainStack
Layout.fillWidth: true
Layout.fillHeight: true
focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it
initialItem: MainBlock {
id: mainBlock
initialItem: MainBlock {
id: mainBlock
Stack.onStatusChanged: {
// prepare for presenting again to the user
if (Stack.status == Stack.Activating) {
mainPasswordBox.remove(0, mainPasswordBox.length)
mainPasswordBox.focus = true
Stack.onStatusChanged: {
// prepare for presenting again to the user
if (Stack.status == Stack.Activating) {
mainPasswordBox.remove(0, mainPasswordBox.length)
mainPasswordBox.focus = true
}
}
}
userListModel: users
notificationMessage: {
var text = ""
if (keystateSource.data["Caps Lock"]["Locked"]) {
text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on")
if (root.notification) {
text += ""
userListModel: users
notificationMessage: {
var text = ""
if (keystateSource.data["Caps Lock"]["Locked"]) {
text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on")
if (root.notification) {
text += ""
}
}
text += root.notification
return text
}
text += root.notification
return text
}
onLoginRequest: {
root.notification = ""
authenticator.tryUnlock(password)
}
actionItems: [
ActionButton {
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch User")
iconSource: "system-switch-user"
onClicked: mainStack.push(switchSessionPage)
// the current session isn't listed in the model, hence a check for greater than zero, not one
visible: (sessionsModel.count > 0 || sessionsModel.canStartNewSession) && sessionsModel.canSwitchUser
onLoginRequest: {
root.notification = ""
authenticator.tryUnlock(password)
}
]
Loader {
Layout.fillWidth: true
Layout.preferredHeight: item ? item.implicitHeight : 0
active: true // TODO configurable
source: "MediaControls.qml"
actionItems: [
ActionButton {
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch User")
iconSource: "system-switch-user"
onClicked: mainStack.push(switchSessionPage)
// the current session isn't listed in the model, hence a check for greater than zero, not one
visible: (sessionsModel.count > 0 || sessionsModel.canStartNewSession) && sessionsModel.canSwitchUser
}
]
Loader {
Layout.fillWidth: true
Layout.preferredHeight: item ? item.implicitHeight : 0
active: true // TODO configurable
source: "MediaControls.qml"
}
}
}
Loader {
id: inputPanel
property bool keyboardActive: item ? item.active : false
Layout.fillWidth: true
Layout.preferredHeight: item ? (item.active ? item.implicitHeight : 0) : 0
function showHide() {
if (Qt.inputMethod.visible) {
Qt.inputMethod.hide();
} else {
item.activated = true;
Qt.inputMethod.show();
}
}
Component.onCompleted: inputPanel.source = "VirtualKeyboard.qml"
}
}
Component {
......@@ -250,6 +269,12 @@ PlasmaCore.ColorScope {
margins: units.smallSpacing
}
PlasmaComponents.ToolButton {
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to show/hide virtual keyboard", "Virtual Keyboard")
iconName: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off"
onClicked: inputPanel.showHide()
}
KeyboardLayoutButton {
}
......
/********************************************************************
This file is part of the KDE project.
Copyright (C) 2017 Martin Gräßlin <mgraesslin@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.5
import QtQuick.VirtualKeyboard 2.1
InputPanel {
id: inputPanel
property bool activated: false
active: activated && Qt.inputMethod.visible
visible: active
width: parent.width
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment