Warning, /graphics/kphotoalbum/AndroidRemoteControl/qml/Keyboard.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2014 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 import QtQuick 2.0
0007 
0008 Item {
0009     id: root
0010 
0011     signal letterSelected(string letter)
0012     signal letterDeselected(string letter)
0013     property var selected
0014 
0015     width: childrenRect.width
0016     height: childrenRect.height
0017     opacity: visible ? 1 : 0
0018     Behavior on opacity { NumberAnimation { duration: 200 } }
0019 
0020     Cell {
0021         anchors {
0022             left: grid.left
0023             right: grid.right
0024             bottom: grid.top
0025         }
0026         height: cellSize()
0027         text: "Select Token:"
0028     }
0029 
0030     Grid {
0031         id: grid
0032         columns: 5
0033         Repeater {
0034             model: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
0035 
0036             Cell {
0037                 width: cellSize()
0038                 height: cellSize()
0039                 text: modelData
0040                 isSelected: hasKey(root.selected, modelData)
0041                 onSelected: {
0042                     letterSelected(modelData)
0043                     root.visible = false
0044                 }
0045                 onDeselected: {
0046                     letterDeselected(modelData)
0047                     root.visible = false
0048                 }
0049             }
0050         }
0051     }
0052 
0053     Cell {
0054         anchors { right: grid.right; bottom: grid.bottom }
0055         height: cellSize()
0056         width: 4 * cellSize()
0057         text: "Cancel"
0058         onClicked: root.visible = false
0059     }
0060 
0061 
0062     function cellSize() {
0063         return Math.min(_screenInfo.viewWidth, _screenInfo.viewHeight) / 10
0064     }
0065 
0066     function hasKey(array, key) {
0067         for (var i = 0; i < array.length; i++) {
0068             if (array[i] === key) {
0069                 return true;
0070             }
0071         }
0072         return false;
0073     }
0074 }