Samstag, 1. November 2014
Pfeiltasten auf dem Jolla Phone
Ich wollte unbedingt Pfeiltasten auf meinem Jolla Phone haben, so wie ich es von menem N900 gewohnt bin. Ausserdem hat mich die Backspace Taste auf der untersten Buchstabenreihe genervt - ich will die (da wo sie hingehört) auf der obersten Reihe haben.

Also, ran an die Bouletten:
Das Verzeichnis /usr/share/maliit/plugins/com/jolla enthält die Definitionen für die Keyboards. Hier habe ich zwei neue Definitionen erzeugt:

-rw-r--r-- 1 root root 196 2014-10-21 21:57 LeftKey.qml
-rw-r--r-- 1 root root 199 2014-10-21 21:57 RightKey.qml

Der Inhalt von RightKey.qml:

// Right arrow key
FunctionKey {
icon.source: "image://theme/icon-l-right" + (pressed ? ("?" + Theme.highlightColor) : "")
repeat: true
key: Qt.Key_Right
width: punctuationKeyWidth
}


Ein Verzeichnis tiefer in /usr/share/maliit/plugins/com/jolla/layouts werden diese Tastendefinitionen verwendet. Die Datei -rw-r--r-- 1 root root 8935 2014-10-22 19:15 dexWArrows.qml ist von mir leicht abgewandelt, unter anderem gibt es eine Smileytaste statt der Umlaute (diese sind als Accent über die normalen Vokale erreichbar). Credits vom ursprünglichen Ersteller sind noch erhalten:

// 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" }
BackspaceKey {}
}

KeyboardRow {
CharacterKey { caption: "a"; captionShifted: "A"; symView: "*"; symView2: "`"; accents: "aäàáãâåæ"; accentsShifted: "AÄÀÁÃÂÅÆ"}
CharacterKey { caption: "s"; captionShifted: "S"; symView: "#"; symView2: "^"; accents: "sß&#351;$"; accentsShifted: "S&#350;$" }
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&#287;"; accentsShifted: "G&#286;" }
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: ":-D"; symView: "%"; symView2: "‰"; accents: "¿¡"; accentsShifted: "¿¡" }
}

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: "×" }
LeftKey {}
RightKey {}
}

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: ";"
symView: "?"
symView2: "\\"
width: punctuationKeyWidth-10
fixedWidth: true
separator: false
}


SpacebarKey {
fixedWidth: true
}

CharacterKey {
caption: "."
captionShifted: ":"
symView: "!"
symView2: "/"
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 : "&#36755;&#20837;" // <= "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.
*
*/


Nun muss das Layout noch geladen werden.
Da von maliiit alle *.conf dateien in /usr/share/maliit/plugins/com/jolla/layouts eingelesen werden, reicht es eine weitere config-datei hinzuzufügen:

-rw-r--r-- 1 root root 75 2014-10-21 21:10 layouts_arrow.conf

Mit Inhalt:

[dexWArrows.qml]
name=DE-Arrow
languageCode=DE
handler=Xt9InputHandler.qml


Das wars.
Damit die Änderungen wirksam werden, muss noch der Keyboard-Service neu gestartet werden (damit dieser die Dateien neu einliest):

systemctl --user restart maliit-server.service

... comment