diff --git a/lookandfeel/contents/components/SessionManagementScreen.qml b/lookandfeel/contents/components/SessionManagementScreen.qml --- a/lookandfeel/contents/components/SessionManagementScreen.qml +++ b/lookandfeel/contents/components/SessionManagementScreen.qml @@ -66,7 +66,7 @@ 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 --- a/lookandfeel/contents/lockscreen/LockScreenUi.qml +++ b/lookandfeel/contents/lockscreen/LockScreenUi.qml @@ -68,7 +68,7 @@ visible: false } - Item { + MouseArea { id: lockScreenRoot x: parent.x @@ -78,6 +78,8 @@ Component.onCompleted: PropertyAnimation { id: launchAnimation; target: lockScreenRoot; property: "opacity"; from: 0; to: 1; duration: 1000 } + onClicked: inputPanel.state = "hidden"; + states: [ State { name: "onOtherSession" @@ -108,7 +110,7 @@ } Clock { - anchors.bottom: parent.verticalCenter + anchors.bottom: mainStack.verticalCenter anchors.bottomMargin: units.gridUnit * 13 anchors.horizontalCenter: parent.horizontalCenter } @@ -125,9 +127,14 @@ } } + StackView { id: mainStack - anchors.fill: parent + anchors { + left: parent.left + right: parent.right + } + height: lockScreenRoot.height focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it initialItem: MainBlock { @@ -177,6 +184,111 @@ } } + Loader { + id: inputPanel + state: "hidden" + readonly property bool keyboardActive: item ? item.active : false + anchors { + left: parent.left + right: parent.right + } + function showHide() { + state = state == "hidden" ? "visible" : "hidden"; + } + Component.onCompleted: inputPanel.source = "VirtualKeyboard.qml" + + states: [ + State { + name: "visible" + PropertyChanges { + target: mainStack + y: Math.min(0, lockScreenRoot.height - inputPanel.height - mainBlock.visibleBoundary) + } + PropertyChanges { + target: inputPanel + y: lockScreenRoot.height - inputPanel.height + opacity: 1 + } + }, + State { + name: "hidden" + PropertyChanges { + target: mainStack + y: 0 + } + PropertyChanges { + target: inputPanel + y: lockScreenRoot.height - units.gridUnit * 10 + opacity: 0 + } + } + ] + transitions: [ + Transition { + from: "hidden" + to: "visible" + SequentialAnimation { + ScriptAction { + script: { + inputPanel.item.active = true; + Qt.inputMethod.show(); + } + } + ParallelAnimation { + NumberAnimation { + target: mainStack + property: "y" + duration: units.longDuration + easing.type: Easing.InOutQuad + } + NumberAnimation { + target: inputPanel + property: "y" + duration: units.longDuration + easing.type: Easing.OutQuad + } + OpacityAnimator { + target: inputPanel + duration: units.longDuration + easing.type: Easing.OutQuad + } + } + } + }, + Transition { + from: "visible" + to: "hidden" + SequentialAnimation { + ParallelAnimation { + NumberAnimation { + target: mainStack + property: "y" + duration: units.longDuration + easing.type: Easing.InOutQuad + } + NumberAnimation { + target: inputPanel + property: "y" + duration: units.longDuration + easing.type: Easing.InQuad + } + OpacityAnimator { + target: inputPanel + duration: units.longDuration + easing.type: Easing.InQuad + } + } + ScriptAction { + script: { + Qt.inputMethod.hide(); + inputPanel.item.active = false; + } + } + } + } + ] + } + Component { id: switchSessionPage SessionManagementScreen { @@ -243,6 +355,12 @@ 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/MainBlock.qml b/lookandfeel/contents/lockscreen/MainBlock.qml --- a/lookandfeel/contents/lockscreen/MainBlock.qml +++ b/lookandfeel/contents/lockscreen/MainBlock.qml @@ -30,6 +30,10 @@ SessionManagementScreen { property Item mainPasswordBox: passwordBox + + //the y position that should be ensured visible when the on screen keyboard is visible + property int visibleBoundary: mapFromItem(loginButton, 0, 0).y + onHeightChanged: visibleBoundary = mapFromItem(loginButton, 0, 0).y + loginButton.height + units.smallSpacing /* * Login has been requested with the following username and password * If username field is visible, it will be taken from that, otherwise from the "name" property of the currentIndex diff --git a/lookandfeel/contents/lockscreen/VirtualKeyboard.qml b/lookandfeel/contents/lockscreen/VirtualKeyboard.qml new file mode 100644 --- /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 + +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 . +*********************************************************************/ +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 +}