diff --git a/src/chatview.cpp b/src/chatview.cpp index 0bc3f20d2c06c25cae9dfa6a4f8baaf41ee180d3..4daba7f3010e57861c296cda726055c8254d781e 100644 --- a/src/chatview.cpp +++ b/src/chatview.cpp @@ -41,7 +41,7 @@ getTranslatedStrings(bool qwebview) {"Accept", QObject::tr("Accept")}, {"Refuse", QObject::tr("Refuse")}, {"Block", QObject::tr("Block")}, - {"Type a message", QObject::tr("Type a message")}, + {"Write to {0}", QObject::tr("Write to {0}")}, {"Note: an interaction will create a new contact.", QObject::tr("Note: an interaction will create a new contact.")}, {"is not in your contacts", QObject::tr("is not in your contacts")}, diff --git a/src/web-chatview/chatview.html b/src/web-chatview/chatview.html index a51fe07c3e19e958490f94adb7378e3475a95dae..1bd4d90549b628e760355934bb19741c90d944b7 100644 --- a/src/web-chatview/chatview.html +++ b/src/web-chatview/chatview.html @@ -112,7 +112,7 @@ <path d="M0 0h24v24H0z" fill="none"/> </svg> </div> - <textarea id="message" autofocus placeholder="Type a message" onkeyup="grow_text_area()" onkeydown="process_messagebar_keydown()" + <textarea id="message" autofocus onkeyup="grow_text_area()" onkeydown="process_messagebar_keydown()" dir="auto" rows="1"></textarea> <div id="sendButton" class="nav-button action-button" onclick="sendMessage();"> <svg class="svgicon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> diff --git a/src/web-chatview/chatview.js b/src/web-chatview/chatview.js index c6d1dbf12b771c046ffd163ea4fbdbd0c19b4d9c..e0b4d573cbb5798d5f9ad043ae6e5d1f5b283d66 100644 --- a/src/web-chatview/chatview.js +++ b/src/web-chatview/chatview.js @@ -133,7 +133,7 @@ function init_i18n(data) { if (use_qt) { window.jsbridge.parseI18nData(function(stringData) { i18nStringData = stringData - reset_message_bar_input() + reset_message_bar_input("") set_titles() }) } else { @@ -151,7 +151,7 @@ function init_i18n(data) { } i18n = new Jed({ locale_data: { "messages": domain } }) } - reset_message_bar_input() + reset_message_bar_input("") set_titles() } } @@ -190,9 +190,10 @@ function set_titles() { } } -function reset_message_bar_input() { +function reset_message_bar_input(name) { messageBarInput.placeholder = use_qt ? - i18nStringData["Type a message"] : i18n.gettext("Type a message") + i18nStringData["Write to {0}"].format(name) : + i18n.gettext("Write to {0}").format(name) } function onScrolled_() { @@ -300,7 +301,7 @@ function update_chatview_frame(accountEnabled, banned, temporary, alias, bestid) if (isAccountEnabled !== accountEnabled) { isAccountEnabled = accountEnabled hideMessageBar(!accountEnabled) - hideControls(accountEnabled) + hideControls(!accountEnabled) } if (isBanned !== banned) { @@ -322,10 +323,13 @@ function update_chatview_frame(accountEnabled, banned, temporary, alias, bestid) i18n.gettext("Note: an interaction will create a new contact.") } else { addToConvButton.style.display = "" - reset_message_bar_input() } } + if (!temporary) { + reset_message_bar_input(alias ? alias : bestid) + } + navbar.style.display = "" } @@ -406,11 +410,11 @@ function displayRecordControls(isVisible) { /** * Hide or show message bar, and update body bottom padding accordingly. * - * @param isHidden whether message bar should be displayed or not + * @param hide whether message bar should be displayed or not */ /* exported hideMessageBar */ -function hideMessageBar(isHidden) { - if (isHidden) { +function hideMessageBar(hide) { + if (hide) { messageBar.classList.add("hiddenState") document.body.style.setProperty("--messagebar-size", "0") } else { @@ -419,6 +423,19 @@ function hideMessageBar(isHidden) { } } +/** + * Hide or show add to conversations/calls + * + * @param hide whether the buttons should be hidden + */ +function hideControls(hide) { + if (hide) { + callButtons.style.display = "none" + } else { + callButtons.style.display = "" + } +} + /* exported setDisplayLinks */ function setDisplayLinks(display) { displayLinksEnabled = display @@ -818,18 +835,6 @@ function humanFileSize(bytes) { return bytes.toFixed(1) + " " + units[u] } -/** - * Hide or show add to conversations/calls whether the account is enabled - * @param accountEnabled true if account is enabled - */ -function hideControls(accountEnabled) { - if (!accountEnabled) { - callButtons.style.display = "none" - } else { - callButtons.style.display = "" - } -} - /** * Change the value of the progress bar. *