~iamsylvie/ubuntu-keyboard/ubuntu-keyboard

« back to all changes in this revision

Viewing changes to plugins/ja/qml/keys/CommitKey.qml

  • Committer: CI Train Bot
  • Author(s): Mitsuya Shibata
  • Date: 2016-02-22 11:04:18 UTC
  • mfrom: (402.2.16 japanese-keyboard-rebooted)
  • Revision ID: ci-train-bot@canonical.com-20160222110418-1hn0utyw7pj0gsqf
Implement Japanese keyboard layout Fixes: #1290031
Approved by: Ken VanDine

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 2.4
 
18
import "key_constants.js" as UI
 
19
import keys 1.0
 
20
 
 
21
ActionKey {
 
22
    property var actionKeyOverride: maliit_input_method.actionKeyOverride
 
23
    property string overrideIconName: actionKeyOverride && actionKeyOverride.icon ? actionKeyOverride.icon : ""
 
24
    property string overrideLabel: actionKeyOverride && actionKeyOverride.label ? actionKeyOverride.label : ""
 
25
 
 
26
    enabled: actionKeyOverride ? actionKeyOverride.enabled : true
 
27
    // overrideIcon has high priority over label
 
28
    label: overrideIconName == "" ? overrideLabel : ""
 
29
    // Scale the font so the label fits if a long word is set
 
30
    fontSize: units.gu(UI.symbolShiftKeyFontSize) * (4 / (label.length >= 4 ? (label.length <= 6 ? label.length : 6) : 4));
 
31
    shifted: label
 
32
 
 
33
    iconNormal: (overrideIconName == "") && (overrideLabel == "") ? "keyboard-return" : overrideIconName
 
34
    iconShifted: iconNormal
 
35
    iconCapsLock: iconNormal
 
36
 
 
37
    action: maliit_input_method.preedit != "" ? "commit" : "return"
 
38
    switchBackFromSymbols: true
 
39
    // TODO: input_method.actionKeyOverride.highlighted
 
40
}