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 @@ -125,55 +125,73 @@ } } - 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 (!inputPanel.item) { + inputPanel.source = "VirtualKeyboard.qml" + } else { + item.active = !item.active + } } + Component.onCompleted: inputPanel.source = "VirtualKeyboard.qml" } } @@ -243,6 +261,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/VirtualKeyboard.qml b/lookandfeel/contents/lockscreen/VirtualKeyboard.qml new file mode 100644 --- /dev/null +++ b/lookandfeel/contents/lockscreen/VirtualKeyboard.qml @@ -0,0 +1,27 @@ +/******************************************************************** + 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 + active: false + visible: active + width: parent.width +}