Warning, /plasma/plasma-workspace/lookandfeel/components/VirtualKeyboardLoader.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2016 David Edmundson <davidedmundson@kde.org> 0003 SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0004 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 import QtQuick 0010 import QtQuick.Controls as QQC2 0011 import QtQuick.Layouts 0012 import QtQuick.Templates as T 0013 import org.kde.kirigami as Kirigami 0014 0015 Loader { 0016 id: loader 0017 0018 required property Item screenRoot 0019 required property T.StackView mainStack 0020 required property /* MainBlock | Login */ Item mainBlock 0021 required property T.TextField passwordField 0022 0023 readonly property bool keyboardActive: item?.active ?? false 0024 0025 function showHide() { 0026 state = state === "hidden" ? "visible" : "hidden"; 0027 } 0028 0029 source: Qt.platform.pluginName.includes("wayland") 0030 ? Qt.resolvedUrl("./VirtualKeyboard_wayland.qml") 0031 : Qt.resolvedUrl("./VirtualKeyboard.qml") 0032 0033 onKeyboardActiveChanged: { 0034 if (keyboardActive) { 0035 state = "visible"; 0036 // Otherwise the password field loses focus and virtual keyboard 0037 // keystrokes get eaten 0038 passwordField.forceActiveFocus(); 0039 } else { 0040 state = "hidden"; 0041 } 0042 } 0043 0044 // Usually, anchors on a top-level component is a bad idea, but this is a 0045 // tightly integrated component shared only between lock screen and SDDM 0046 anchors { 0047 left: parent.left 0048 right: parent.right 0049 } 0050 0051 state: "hidden" 0052 0053 states: [ 0054 State { 0055 name: "visible" 0056 PropertyChanges { 0057 target: mainStack 0058 y: Math.min(0, screenRoot.height - loader.height - mainBlock.visibleBoundary) 0059 } 0060 PropertyChanges { 0061 target: loader 0062 y: screenRoot.height - loader.height 0063 } 0064 }, 0065 State { 0066 name: "hidden" 0067 PropertyChanges { 0068 target: mainStack 0069 y: 0 0070 } 0071 PropertyChanges { 0072 target: loader 0073 y: screenRoot.height * 0.75 0074 } 0075 } 0076 ] 0077 0078 transitions: [ 0079 Transition { 0080 from: "hidden" 0081 to: "visible" 0082 SequentialAnimation { 0083 ScriptAction { 0084 script: { 0085 loader.item.activated = true; 0086 Qt.inputMethod.show(); 0087 } 0088 } 0089 ParallelAnimation { 0090 NumberAnimation { 0091 target: mainStack 0092 property: "y" 0093 duration: Kirigami.Units.longDuration 0094 easing.type: Easing.InOutQuad 0095 } 0096 NumberAnimation { 0097 target: loader 0098 property: "y" 0099 duration: Kirigami.Units.longDuration 0100 easing.type: Easing.OutQuad 0101 } 0102 } 0103 } 0104 }, 0105 Transition { 0106 from: "visible" 0107 to: "hidden" 0108 SequentialAnimation { 0109 ParallelAnimation { 0110 NumberAnimation { 0111 target: mainStack 0112 property: "y" 0113 duration: Kirigami.Units.longDuration 0114 easing.type: Easing.InOutQuad 0115 } 0116 NumberAnimation { 0117 target: loader 0118 property: "y" 0119 duration: Kirigami.Units.longDuration 0120 easing.type: Easing.InQuad 0121 } 0122 } 0123 ScriptAction { 0124 script: { 0125 loader.item.activated = false; 0126 Qt.inputMethod.hide(); 0127 } 0128 } 0129 } 0130 } 0131 ] 0132 }