Make closing the reply popup actually clear the reply message

This commit is contained in:
Joseph Donofry 2020-02-04 18:17:14 -05:00
parent 9d90467e6a
commit 096db389d1
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
4 changed files with 9 additions and 1 deletions

View file

@ -300,7 +300,7 @@ Item {
ToolTip.visible: closeReplyButton.hovered
ToolTip.text: qsTr("Close")
onClicked: timelineManager.updateReplyingEvent(undefined)
onClicked: timelineManager.closeReply()
}
}
}

View file

@ -524,6 +524,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> 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;
}

View file

@ -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);

View file

@ -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<QString> &event_ids);
void initWithMessages(const std::map<QString, mtx::responses::Timeline> &msgs);