mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 06:35:08 -04:00
Support for preedit text on predictive keyboards
This commit is contained in:
parent
161bd4c227
commit
0a17cbefec
1 changed files with 27 additions and 4 deletions
|
@ -229,11 +229,13 @@ Item
|
||||||
|
|
||||||
onTextChanged:
|
onTextChanged:
|
||||||
{
|
{
|
||||||
if (msgField.length == 0)
|
var msgLenght = (msgField.preeditText)? msgField.preeditText.length : msgField.length
|
||||||
|
|
||||||
|
if (msgLenght == 0)
|
||||||
{
|
{
|
||||||
sendButton.state = ""
|
sendButton.state = ""
|
||||||
}
|
}
|
||||||
else if (msgField.length > 0)
|
else if (msgLenght > 0 )
|
||||||
{
|
{
|
||||||
sendButton.state = "SENDBTN"
|
sendButton.state = "SENDBTN"
|
||||||
}
|
}
|
||||||
|
@ -263,6 +265,10 @@ Item
|
||||||
shiftPressed = false
|
shiftPressed = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function reset ()
|
||||||
|
{
|
||||||
|
Qt.inputMethod.reset()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,9 +371,26 @@ Item
|
||||||
function sendMessage ()
|
function sendMessage ()
|
||||||
{
|
{
|
||||||
if (emojiPicker.state == "EMOJI_SHOWN") emojiPicker.state = "EMOJI_HIDDEN"
|
if (emojiPicker.state == "EMOJI_SHOWN") emojiPicker.state = "EMOJI_HIDDEN"
|
||||||
var jsonData = {"chat_id":chatView.chatId, "msg":msgField.text}
|
|
||||||
|
var msgText = getCompleteMessageText()
|
||||||
|
|
||||||
|
var jsonData = {"chat_id":chatView.chatId, "msg":msgText}
|
||||||
rsApi.request( "/chat/send_message", JSON.stringify(jsonData),
|
rsApi.request( "/chat/send_message", JSON.stringify(jsonData),
|
||||||
function(par) { msgField.text = ""; } )
|
function(par)
|
||||||
|
{
|
||||||
|
msgField.text = ""
|
||||||
|
msgField.reset();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function is needed for the compatibility with auto predictive keyboards
|
||||||
|
function getCompleteMessageText (){
|
||||||
|
var completeMsg
|
||||||
|
if (msgField.preeditText) completeMsg = msgField.text + msgField.preeditText
|
||||||
|
else completeMsg = msgField.text
|
||||||
|
return completeMsg
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue