Start cleaning up RemoteKeyboard QML code

Summary:
The code for visually disabling the input field is not needed any more since the field is completely hidden when not needed. Also drop the custom available property from the text field.

More cleanups will follow. My long-term goal is to reuse the code in the app to enable remote keyboard input on non-Plasma DEs

Test Plan: (De)activate the remote keyboard on Android.

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: apol, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D12669
This commit is contained in:
Nicolas Fella 2018-05-09 01:15:03 +02:00
parent 1ad59b231c
commit 4d8863bacc

View file

@ -34,10 +34,6 @@ PlasmaComponents.ListItem
id: remoteKeyboard
device: root.device
onRemoteStateChanged: {
remoteKeyboardInput.available = remoteKeyboard.remoteState;
}
onKeyPressReceived: {
// console.log("XXX received keypress key=" + key + " special=" + specialKey + " shift=" + shift + " ctrl=" + ctrl + " text=" + remoteKeyboardInput.text + " cursorPos=" + remoteKeyboardInput.cursorPosition);
// interpret some special keys:
@ -89,7 +85,7 @@ PlasmaComponents.ListItem
Column {
width: parent.width
RowLayout
{
Item {
@ -101,7 +97,7 @@ PlasmaComponents.ListItem
id: battery
device: root.device
}
PlasmaComponents.Label {
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
@ -152,7 +148,7 @@ PlasmaComponents.ListItem
//RemoteKeyboard
PlasmaComponents.ListItem {
visible: remoteKeyboardInput.available
visible: remoteKeyboard.remoteState
width: parent.width
Row {
@ -167,21 +163,15 @@ PlasmaComponents.ListItem
PlasmaComponents.TextField {
id: remoteKeyboardInput
property bool available: remoteKeyboard.remoteState
textColor: "black"
height: parent.height
width: parent.width - 5 - remoteKeyboardLabel.width
verticalAlignment: TextInput.AlignVCenter
readOnly: !available
enabled: available
style: TextFieldStyle {
textColor: "black"
background: Rectangle {
radius: 2
border.color: "gray"
border.width: 1
color: remoteKeyboardInput.available ? "white" : "lightgray"
color: "white"
}
}