Warning, /plasma/plasma-bigscreen/kcms/plasma-settings-shell/+mediacenter/VirtualKeyboardLoader.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 
0006 */
0007 
0008 import QtQuick 2.14
0009 import org.kde.kirigami 2.12 as Kirigami
0010 
0011 Loader {
0012         id: inputPanel
0013         z: 1000
0014         state: "hidden"
0015         readonly property bool keyboardActive: item ? item.active : false
0016         anchors {
0017             left: parent.left
0018             right: parent.right
0019             bottom: parent.bottom
0020             //HACK since the screen real estate is so small, enlarge the keyboard to remove all its internal padding
0021             margins: -Kirigami.Units.gridUnit
0022         }
0023         function showHide() {
0024             state = state == "hidden" ? "visible" : "hidden";
0025         }
0026         Component.onCompleted: inputPanel.source = "./VirtualKeyboard.qml"
0027         onKeyboardActiveChanged: {
0028             if (keyboardActive) {
0029                 state = "visible";
0030             } else {
0031                 state = "hidden";
0032             }
0033         }
0034         height: Math.min(parent.height / 2, Math.max(parent.height/3, Kirigami.Units.gridUnit * 15))
0035         states: [
0036             State {
0037                 name: "visible"
0038                 PropertyChanges {
0039                     target: inputPanel
0040                     y: inputPanel.parent.height - inputPanel.height +  Kirigami.Units.gridUnit
0041                     opacity: 1
0042                 }
0043             },
0044             State {
0045                 name: "hidden"
0046                 PropertyChanges {
0047                     target: inputPanel
0048                     y: inputPanel.parent.height - inputPanel.parent.height/4
0049                     opacity: 0
0050                 }
0051             }
0052         ]
0053         transitions: [
0054             Transition {
0055                 from: "hidden"
0056                 to: "visible"
0057                 SequentialAnimation {
0058                     ScriptAction {
0059                         script: {
0060                             Qt.inputMethod.show();
0061                         }
0062                     }
0063                     ParallelAnimation {
0064                         NumberAnimation {
0065                             target: inputPanel
0066                             property: "y"
0067                             duration: units.longDuration
0068                             easing.type: Easing.OutQuad
0069                         }
0070                         OpacityAnimator {
0071                             target: inputPanel
0072                             duration: units.longDuration
0073                             easing.type: Easing.OutQuad
0074                         }
0075                     }
0076                 }
0077             },
0078             Transition {
0079                 from: "visible"
0080                 to: "hidden"
0081                 SequentialAnimation {
0082                     ParallelAnimation {
0083                         NumberAnimation {
0084                             target: inputPanel
0085                             property: "y"
0086                             duration: units.longDuration
0087                             easing.type: Easing.InQuad
0088                         }
0089                         OpacityAnimator {
0090                             target: inputPanel
0091                             duration: units.longDuration
0092                             easing.type: Easing.InQuad
0093                         }
0094                     }
0095                     ScriptAction {
0096                         script: {
0097                             Qt.inputMethod.hide();
0098                         }
0099                     }
0100                 }
0101             }
0102         ]
0103     }