// Copyright (C) 2013 Jolla Ltd. // Adapted: Johannes Graubner, 2014-01-30 // Using software copyrighted as noted below // Also needed: Adaption to /usr/share/maliit/plugins/com/jolla//InputHandler.qml, change // // MInputMethodQuick.sendKey(Qt.Key_Backspace, 0, "\b", Maliit.KeyClick) // } else if (pressedKey.key === Qt.Key_Paste) { // MInputMethodQuick.sendCommit(Silica.Clipboard.text) // } else { // resetShift = false // } // } // // to (to allow also for left/right/up/down cursors) // // MInputMethodQuick.sendKey(Qt.Key_Backspace, 0, "\b", Maliit.KeyClick) // } else if (pressedKey.key === Qt.Key_Up) { // MInputMethodQuick.sendKey(Qt.Key_Up, 0, "", Maliit.KeyClick) // } else if (pressedKey.key === Qt.Key_Down) { // MInputMethodQuick.sendKey(Qt.Key_Down, 0, "", Maliit.KeyClick) // } else if (pressedKey.key === Qt.Key_Left) { // MInputMethodQuick.sendKey(Qt.Key_Left, 0, "", Maliit.KeyClick) // } else if (pressedKey.key === Qt.Key_Right) { // MInputMethodQuick.sendKey(Qt.Key_Right, 0, "", Maliit.KeyClick) // } else if (pressedKey.key === Qt.Key_Paste) { // MInputMethodQuick.sendCommit(Silica.Clipboard.text) // } else { // resetShift = false // } import QtQuick 2.0 import com.jolla.keyboard 1.0 import Sailfish.Silica 1.0 import com.meego.maliitquick 1.0 import ".." KeyboardLayout { KeyboardRow { CharacterKey { caption: "q"; captionShifted: "Q"; symView: "1"; symView2: "€"; accents: "1q"; accentsShifted: "1Q" } CharacterKey { caption: "w"; captionShifted: "W"; symView: "2"; symView2: "£"; accents: "2w"; accentsShifted: "2W" } CharacterKey { caption: "e"; captionShifted: "E"; symView: "3"; symView2: "$"; accents: "3eèéëê€"; accentsShifted: "3EÈÉÊË€" } CharacterKey { caption: "r"; captionShifted: "R"; symView: "4"; symView2: "¥"; accents: "4r"; accentsShifted: "4R" } CharacterKey { caption: "t"; captionShifted: "T"; symView: "5"; symView2: "₹"; accents: "5t"; accentsShifted: "5T" } CharacterKey { caption: "z"; captionShifted: "Z"; symView: "6"; symView2: "¤"; accents: "6z"; accentsShifted: "6Z" } CharacterKey { caption: "u"; captionShifted: "U"; symView: "7"; symView2: "<"; accents: "7uüùúû"; accentsShifted: "7UÜÙÚÛ" } CharacterKey { caption: "i"; captionShifted: "I"; symView: "8"; symView2: ">"; accents: "8iîïìí"; accentsShifted: "8IÎÏÌÍ" } CharacterKey { caption: "o"; captionShifted: "O"; symView: "9"; symView2: "["; accents: "9oöòóôõø"; accentsShifted: "9OÖÒÓÔÕØ" } CharacterKey { caption: "p"; captionShifted: "P"; symView: "0"; symView2: "]"; accents: "p0"; accentsShifted: "0P" } CharacterKey { caption: "ü"; captionShifted: "Ü"; symView: "%"; symView2: "‰"; accents: "ü-–+@()!?"; accentsShifted: "Ü-–+@()!?" } } KeyboardRow { CharacterKey { caption: "a"; captionShifted: "A"; symView: "*"; symView2: "`"; accents: "aäàáãâåæ"; accentsShifted: "AÄÀÁÃÂÅÆ"} CharacterKey { caption: "s"; captionShifted: "S"; symView: "#"; symView2: "^"; accents: "sßş$"; accentsShifted: "SŞ$" } CharacterKey { caption: "d"; captionShifted: "D"; symView: "+"; symView2: "|"; accents: "dð"; accentsShifted: "DÐ" } CharacterKey { caption: "f"; captionShifted: "F"; symView: "-"; symView2: "_" } CharacterKey { caption: "g"; captionShifted: "G"; symView: "="; symView2: "§"; accents: "gğ"; accentsShifted: "GĞ" } CharacterKey { caption: "h"; captionShifted: "H"; symView: "("; symView2: "{" } CharacterKey { caption: "j"; captionShifted: "J"; symView: ")"; symView2: "}" } CharacterKey { caption: "k"; captionShifted: "K"; symView: "\""; symView2: "°" } CharacterKey { caption: "l"; captionShifted: "L"; symView: "~"; symView2: "·" } CharacterKey { caption: "ö"; captionShifted: "Ö"; symView: "!"; symView2: "¡" } CharacterKey { caption: "ä"; captionShifted: "Ä"; symView: "?"; symView2: "¿" } } KeyboardRow { ShiftKey {} CharacterKey { caption: "y"; captionShifted: "Y"; symView: "@"; symView2: "«"; accents: "yý¥"; accentsShifted: "YÝ¥" } CharacterKey { caption: "x"; captionShifted: "X"; symView: "&"; symView2: "»" } CharacterKey { caption: "c"; captionShifted: "C"; symView: "/"; symView2: "÷"; accents: "cç"; accentsShifted: "CÇ" } CharacterKey { caption: "v"; captionShifted: "V"; symView: "\\"; symView2: "“" } CharacterKey { caption: "b"; captionShifted: "B"; symView: "'"; symView2: "”" } CharacterKey { caption: "n"; captionShifted: "N"; symView: ";"; symView2: "„"; accents: "nñ"; accentsShifted: "NÑ" } CharacterKey { caption: "m"; captionShifted: "M"; symView: ":"; symView2: "×" } BackspaceKey {} } KeyboardRow { // Symbol Key with shortened length FunctionKey { id: symbolKey property int _charactersWhenPressed property bool _quickPicking caption: attributes.inSymView ? "ABC" : "?123" width: functionKeyWidth-20 keyType: KeyType.SymbolKey onPressedChanged: { if (pressed && !keyboard.inSymView && keyboard.lastInitialKey === symbolKey) { keyboard.deadKeyAccent = "" keyboard.toggleSymbolMode() _quickPicking = true } else { _quickPicking = false } _charactersWhenPressed = keyboard.characterKeyCounter } onClicked: { if (!_quickPicking || keyboard.characterKeyCounter > _charactersWhenPressed) { keyboard.toggleSymbolMode() } } Rectangle { color: parent.pressed ? Theme.highlightBackgroundColor : Theme.primaryColor opacity: parent.pressed ? 0.6 : 0.17 radius: geometry.keyRadius anchors.fill: parent anchors.margins: Theme.paddingMedium } } // ContextAwareCommaKey {} CharacterKey { caption: MInputMethodQuick.contentType === Maliit.UrlContentType ? "/" : MInputMethodQuick.contentType === Maliit.EmailContentType ? "@" : "," captionShifted: caption symView: "," symView2: "," width: punctuationKeyWidth-10 fixedWidth: true separator: false } // Left arrow key FunctionKey { icon.source: "image://theme/icon-l-left" + (pressed ? ("?" + Theme.highlightColor) : "") repeat: true key: Qt.Key_Left //width: punctuationKeyWidth width: 42 } SpacebarKey { fixedWidth: true } // Right arrow key FunctionKey { icon.source: "image://theme/icon-l-right" + (pressed ? ("?" + Theme.highlightColor) : "") repeat: true key: Qt.Key_Right width: 42 } CharacterKey { caption: "." captionShifted: ";" width: punctuationKeyWidth-10 fixedWidth: true separator: false } // Enter key with shortened length FunctionKey { property bool chineseOverride: keyboard.chineseOverrideForEnter icon.source: !chineseOverride ? MInputMethodQuick.actionKeyOverride.icon : "" caption: !chineseOverride ? MInputMethodQuick.actionKeyOverride.label : "输入" // <= "enter" key: Qt.Key_Return enabled: !chineseOverride ? MInputMethodQuick.actionKeyOverride.enabled : true width: functionKeyWidth-30 Rectangle { color: parent.pressed ? Theme.highlightBackgroundColor : Theme.primaryColor opacity: parent.pressed ? 0.6 : MInputMethodQuick.actionKeyOverride.highlighted ? 0.4 : 0.17 radius: geometry.keyRadius anchors.fill: parent anchors.margins: Theme.paddingMedium } } } } /* * Copyright (C) 2013 Jolla ltd. and/or its subsidiary(-ies). All rights reserved. * * Contact: Pekka Vuorela * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * Neither the name of Jolla ltd nor the names of its contributors may be * used to endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */