From 08e94616113921dbbbf3bcfe2ec4cee7e28eaf1b Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 25 Nov 2020 17:38:06 +0100 Subject: [PATCH] Fix input focus when pressing reply button --- resources/qml/ImageButton.qml | 1 + resources/qml/MatrixText.qml | 1 + resources/qml/MessageInput.qml | 1 + resources/qml/TimelineView.qml | 1 + src/timeline/TimelineViewManager.cpp | 1 + 5 files changed, 5 insertions(+) diff --git a/resources/qml/ImageButton.qml b/resources/qml/ImageButton.qml index 49ddf671..4ebda680 100644 --- a/resources/qml/ImageButton.qml +++ b/resources/qml/ImageButton.qml @@ -8,6 +8,7 @@ AbstractButton { property color highlightColor: colors.highlight property color buttonTextColor: colors.buttonText + focusPolicy: Qt.NoFocus width: 16 height: 16 diff --git a/resources/qml/MatrixText.qml b/resources/qml/MatrixText.qml index a5781c73..bb3b4296 100644 --- a/resources/qml/MatrixText.qml +++ b/resources/qml/MatrixText.qml @@ -5,6 +5,7 @@ import im.nheko 1.0 TextEdit { textFormat: TextEdit.RichText readOnly: true + focus: false wrapMode: Text.Wrap selectByMouse: !Settings.mobileMode color: colors.text diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index 812c450e..c221cf3e 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -79,6 +79,7 @@ Rectangle { placeholderTextColor: colors.buttonText color: colors.text wrapMode: TextEdit.Wrap + focus: true onTextChanged: TimelineManager.timeline.input.updateState(selectionStart, selectionEnd, cursorPosition, text) onCursorPositionChanged: { TimelineManager.timeline.input.updateState(selectionStart, selectionEnd, cursorPosition, text); diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index ac998a81..4234bb6d 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -97,6 +97,7 @@ Page { } MenuItem { + // TODO(Nico): Fix this still being iterated over, when using keyboard to select options visible: messageContextMenu.isEncrypted height: visible ? implicitHeight : 0 text: qsTr("View decrypted raw message") diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 866e7c51..d0356e15 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -336,6 +336,7 @@ TimelineViewManager::setHistoryView(const QString &room_id) if (room != models.end()) { timeline_ = room.value().data(); emit activeTimelineChanged(timeline_); + container->setFocus(); nhlog::ui()->info("Activated room {}", room_id.toStdString()); } }