Debian Codegraph @

plugins/ja/qml6/keys/CommitKey.qml

raw
1 /*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 import QtQuick
18 import keys
19
20 ActionKey {
21 property var actionKeyOverride: maliit_input_method.actionKeyOverride
22 property string overrideIconName: actionKeyOverride && actionKeyOverride.icon ? actionKeyOverride.icon : ""
23 property string overrideLabel: actionKeyOverride && actionKeyOverride.label ? actionKeyOverride.label : ""
24
25 enabled: actionKeyOverride ? actionKeyOverride.enabled : true
26 // overrideIcon has high priority over label
27 label: overrideIconName == "" ? overrideLabel : ""
28 // Scale the font so the label fits if a long word is set
29 keyFont.pixelSize: units.gu(UI.symbolShiftKeyFontSize) * (4 / (label.length >= 4 ? (label.length <= 6 ? label.length : 6) : 4));
30 shifted: label
31
32 iconNormal: (overrideIconName == "") && (overrideLabel == "") ? "keyboard-return" : overrideIconName
33 iconShifted: iconNormal
34 iconCapsLock: iconNormal
35
36 action: maliit_input_method.preedit != "" ? "commit" : "return"
37 switchBackFromSymbols: true
38 // TODO: input_method.actionKeyOverride.highlighted
39 }