/usr/share/maliit/plugins/com/ubuntu/keys/CharKey.qml is in ubuntu-keyboard-data 0.99.trunk.phablet2+14.04.20140415-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtMultimedia 5.0
import Ubuntu.Components 0.1
import Ubuntu.Components.Popups 0.1
import "key_constants.js" as UI
Item {
id: key
property int padding: 0
width: panel.keyWidth
height: panel.keyHeight
/* to be set in keyboard layouts */
property string label: ""
property string shifted: ""
property var extended; // list of extended keys
property var extendedShifted; // list of extended keys in shifted state
property alias valueToSubmit: keyLabel.text
property string action
property bool noMagnifier: false
property bool skipAutoCaps: false
/* design */
property string imgNormal: UI.imageCharKey
property string imgPressed: UI.imageCharKeyPressed
// fontSize can be overwritten when using the component, e.g. SymbolShiftKey uses smaller fontSize
property int fontSize: units.gu( UI.fontSize );
/// annotation shows a small label in the upper right corner
// if the annotiation property is set, it will be used. If not, the first position in extended[] list or extendedShifted[] list will
// be used, depending on the state. If no extended/extendedShifted arrays exist, no annotation is shown
property string annotation: ""
/*! indicates if te key is currently pressed/down*/
property alias pressed: keyMouseArea.pressed
/* internal */
property string __annotationLabelNormal
property string __annotationLabelShifted
/**
* this property specifies if the key can submit its value or not (e.g. when the popover is shown, it does not commit its value)
*/
property bool extendedKeysShown: extendedKeysSelector.enabled
/*
* label changes when keyboard is in shifted mode
* extended keys change as well when shifting keyboard, typically lower-uppercase: ê vs Ê
*/
property string oskState: panel.activeKeypadState
property var activeExtendedModel: (panel.activeKeypadState === "NORMAL") ? extended : extendedShifted
Component.onCompleted: {
if (annotation) {
__annotationLabelNormal = annotation
__annotationLabelShifted = annotation
} else {
if (extended)
__annotationLabelNormal = extended[0]
if (extendedShifted)
__annotationLabelShifted = extendedShifted[0]
}
}
BorderImage {
id: buttonImage
anchors.centerIn: parent
anchors.fill: key
anchors.margins: units.dp( UI.keyMargins );
source: key.pressed ? key.imgPressed : key.imgNormal
}
/// label of the key
// the label is also the value subitted to the app
Text {
id: keyLabel
text: (panel.activeKeypadState === "NORMAL") ? label : shifted;
anchors.centerIn: parent
font.family: UI.fontFamily
font.pixelSize: fontSize
font.bold: UI.fontBold
color: UI.fontColor
}
/// shows an annotation
// used e.g. for indicating the existence of extended keys
Text {
id: annotationLabel
text: (panel.activeKeypadState != "NORMAL") ? __annotationLabelShifted : __annotationLabelNormal
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: units.gu( UI.annotationMargins )
font.pixelSize: units.gu( UI.annotationFontSize )
font.bold: false
color: UI.annotationFontColor
}
PressArea {
id: keyMouseArea
anchors.fill: key
onPressAndHold: {
if (activeExtendedModel != undefined) {
extendedKeysSelector.enabled = true
extendedKeysSelector.extendedKeysModel = activeExtendedModel
extendedKeysSelector.currentlyAssignedKey = key
}
}
onReleased: {
if (!extendedKeysShown) {
event_handler.onKeyReleased(valueToSubmit, action);
if (!skipAutoCaps)
if (panel.activeKeypadState === "SHIFTED" && panel.state === "CHARACTERS")
panel.activeKeypadState = "NORMAL"
}
}
onPressed: {
if (maliit_input_method.useAudioFeedback)
audioFeedback.play();
event_handler.onKeyPressed(valueToSubmit, action);
}
}
Connections {
target: swipeArea.drag
onActiveChanged: {
if (swipeArea.drag.active)
keyMouseArea.cancelPress();
}
}
Magnifier {
anchors.horizontalCenter: buttonImage.horizontalCenter
anchors.bottom: buttonImage.top
width: key.width + units.gu(UI.magnifierHorizontalPadding)
height: key.height + units.gu(UI.magnifierVerticalPadding)
text: keyLabel.text
shown: key.pressed && !noMagnifier && !extendedKeysShown
}
}
|