Clear text box when sending media in replies.

This commit is contained in:
John Preston 2020-09-01 17:10:10 +04:00
parent 9fe82480e1
commit 95a579f25f
3 changed files with 18 additions and 15 deletions

View file

@ -119,6 +119,7 @@ public:
[[nodiscard]] TextWithTags getTextWithAppliedMarkdown() const; [[nodiscard]] TextWithTags getTextWithAppliedMarkdown() const;
[[nodiscard]] WebPageId webPageId() const; [[nodiscard]] WebPageId webPageId() const;
void setText(const TextWithTags &text);
void clear(); void clear();
void hidePanelsAnimated(); void hidePanelsAnimated();
@ -138,7 +139,6 @@ private:
void toggleTabbedSelectorMode(); void toggleTabbedSelectorMode();
void createTabbedPanel(); void createTabbedPanel();
void setTabbedPanel(std::unique_ptr<ChatHelpers::TabbedPanel> panel); void setTabbedPanel(std::unique_ptr<ChatHelpers::TabbedPanel> panel);
void setText(const TextWithTags &text);
void setTextFromEditingMessage(not_null<HistoryItem*> item); void setTextFromEditingMessage(not_null<HistoryItem*> item);

View file

@ -1344,7 +1344,7 @@ void Message::drawInfo(
} }
if (auto views = item->Get<HistoryMessageViews>()) { if (auto views = item->Get<HistoryMessageViews>()) {
const auto showReplies = (views->views < 0) && (views->replies > 0); const auto showReplies = /*(views->views < 0) && */(views->replies > 0);
auto icon = [&] { auto icon = [&] {
if (item->id > 0) { if (item->id > 0) {
if (outbg) { if (outbg) {

View file

@ -393,7 +393,7 @@ bool RepliesWidget::confirmSendingFiles(
_history->peer->slowmodeApplied() ? SendLimit::One : SendLimit::Many, _history->peer->slowmodeApplied() ? SendLimit::One : SendLimit::Many,
Api::SendType::Normal, Api::SendType::Normal,
SendMenu::Type::Disabled); // #TODO replies schedule SendMenu::Type::Disabled); // #TODO replies schedule
//_field->setTextWithTags({}); _composeControls->setText({});
const auto replyTo = replyToId(); const auto replyTo = replyToId();
box->setConfirmedCallback(crl::guard(this, [=]( box->setConfirmedCallback(crl::guard(this, [=](
@ -418,19 +418,22 @@ bool RepliesWidget::confirmSendingFiles(
replyTo, replyTo,
options, options,
album); album);
if (_composeControls->replyingToMessage().msg == replyTo) {
_composeControls->cancelReplyMessage();
}
}));
box->setCancelledCallback(crl::guard(this, [=] {
_composeControls->setText(text);
//auto cursor = _field->textCursor();
//cursor.setPosition(anchor);
//if (position != anchor) {
// cursor.setPosition(position, QTextCursor::KeepAnchor);
//}
//_field->setTextCursor(cursor);
//if (!insertTextOnCancel.isEmpty()) {
// _field->textCursor().insertText(insertTextOnCancel);
//}
})); }));
//box->setCancelledCallback(crl::guard(this, [=] {
// _field->setTextWithTags(text);
// auto cursor = _field->textCursor();
// cursor.setPosition(anchor);
// if (position != anchor) {
// cursor.setPosition(position, QTextCursor::KeepAnchor);
// }
// _field->setTextCursor(cursor);
// if (!insertTextOnCancel.isEmpty()) {
// _field->textCursor().insertText(insertTextOnCancel);
// }
//}));
//ActivateWindow(controller()); //ActivateWindow(controller());
const auto shown = Ui::show(std::move(box)); const auto shown = Ui::show(std::move(box));