focus message input on adding emoji/reacting to a message

This commit is contained in:
Jedi18 2021-02-05 22:42:08 +05:30
parent f02342fe22
commit 4aefac08a4
4 changed files with 15 additions and 0 deletions

View file

@ -270,6 +270,11 @@ Rectangle {
target: TimelineManager.timeline
}
Connections {
target: TimelineManager
onFocusInput: messageInput.forceActiveFocus()
}
MouseArea {
// workaround for wrong cursor shape on some platforms
anchors.fill: parent
@ -297,6 +302,7 @@ Rectangle {
ToolTip.text: qsTr("Emoji")
onClicked: emojiPopup.visible ? emojiPopup.close() : emojiPopup.show(emojiButton, function(emoji) {
messageInput.insert(messageInput.cursorPosition, emoji);
TimelineManager.focusMessageInput()
})
}

View file

@ -14,5 +14,6 @@ ImageButton {
image: ":/icons/icons/ui/smile.png"
onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, function(emoji) {
TimelineManager.queueReactionMessage(event_id, emoji);
TimelineManager.focusMessageInput()
})
}

View file

@ -545,3 +545,9 @@ TimelineViewManager::queueCallMessage(const QString &roomid,
{
models.value(roomid)->sendMessageEvent(callHangUp, mtx::events::EventType::CallHangUp);
}
void
TimelineViewManager::focusMessageInput()
{
emit focusInput();
}

View file

@ -66,6 +66,7 @@ public:
Q_INVOKABLE void openLink(QString link) const;
Q_INVOKABLE void focusMessageInput();
Q_INVOKABLE void openInviteUsersDialog();
Q_INVOKABLE void openMemberListDialog() const;
Q_INVOKABLE void openLeaveRoomDialog() const;
@ -87,6 +88,7 @@ signals:
void showRoomList();
void narrowViewChanged();
void focusChanged();
void focusInput();
public slots:
void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids);