summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <[email protected]>2017-03-01 17:01:39 +0100
committerMartin Gräßlin <[email protected]>2017-03-02 20:46:42 +0100
commitb6705f8d73bd0023e72ce2aafbe7526ae5fcfd2a (patch)
tree9f13cfc5513355489fd7f1e0ee7162dde8b198d2
parent1ce5ed3b7e0d12c6ff7b43647ff2949c2c1c8d99 (diff)
[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
-rw-r--r--lookandfeel/contents/components/SessionManagementScreen.qml2
-rw-r--r--lookandfeel/contents/lockscreen/LockScreenUi.qml103
-rw-r--r--lookandfeel/contents/lockscreen/VirtualKeyboard.qml28
3 files changed, 93 insertions, 40 deletions
diff --git a/lookandfeel/contents/components/SessionManagementScreen.qml b/lookandfeel/contents/components/SessionManagementScreen.qml
index a628df4..45b8315 100644
--- a/lookandfeel/contents/components/SessionManagementScreen.qml
+++ b/lookandfeel/contents/components/SessionManagementScreen.qml
@@ -66,7 +66,7 @@ Item {
UserList {
id: userListView
- visible: showUserList
+ visible: showUserList && y > 0
anchors {
bottom: parent.verticalCenter
left: parent.left
diff --git a/lookandfeel/contents/lockscreen/LockScreenUi.qml b/lookandfeel/contents/lockscreen/LockScreenUi.qml
index 8bfcbe8..26fb5ef 100644
--- a/lookandfeel/contents/lockscreen/LockScreenUi.qml
+++ b/lookandfeel/contents/lockscreen/LockScreenUi.qml
@@ -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 {
}
diff --git a/lookandfeel/contents/lockscreen/VirtualKeyboard.qml b/lookandfeel/contents/lockscreen/VirtualKeyboard.qml
new file mode 100644
index 0000000..7848b75
--- /dev/null
+++ b/lookandfeel/contents/lockscreen/VirtualKeyboard.qml
@@ -0,0 +1,28 @@
+/********************************************************************
+ This file is part of the KDE project.
+
+Copyright (C) 2017 Martin Gräßlin <[email protected]>
+
+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
+}