diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 6f5eb42b..9730422d 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -300,7 +300,7 @@ Item { ToolTip.visible: closeReplyButton.hovered ToolTip.text: qsTr("Close") - onClicked: timelineManager.updateReplyingEvent(undefined) + onClicked: timelineManager.closeReply() } } } diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index e54892a6..d5e3113d 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -524,6 +524,7 @@ ChatPage::ChatPage(QSharedPointer userSettings, QWidget *parent) connect(this, &ChatPage::messageReply, this, [this](const RelatedInfo &related) { view_manager_->updateReplyingEvent(QString::fromStdString(related.related_event)); }); + connect(view_manager_, &TimelineViewManager::replyClosed, text_input_, &TextInputWidget::closeReplyPopup); instance_ = this; } diff --git a/src/TextInputWidget.h b/src/TextInputWidget.h index ac79be8b..77d77e44 100644 --- a/src/TextInputWidget.h +++ b/src/TextInputWidget.h @@ -164,6 +164,7 @@ public slots: void hideUploadSpinner(); void focusLineEdit() { input_->setFocus(); } void addReply(const RelatedInfo &related); + void closeReplyPopup() { input_->closeReply(); } private slots: void addSelectedEmoji(const QString &emoji); diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 8552d6b3..625999c9 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -47,6 +47,7 @@ signals: void activeTimelineChanged(TimelineModel *timeline); void initialSyncChanged(bool isInitialSync); void replyingEventChanged(QString replyingEvent); + void replyClosed(); public slots: void updateReplyingEvent(const QString &replyingEvent) @@ -56,6 +57,11 @@ public slots: emit replyingEventChanged(replyingEvent_); } } + void closeReply() + { + this->updateReplyingEvent(nullptr); + emit replyClosed(); + } QString getReplyingEvent() const { return replyingEvent_; } void updateReadReceipts(const QString &room_id, const std::vector &event_ids); void initWithMessages(const std::map &msgs);