Fix field bar cancel button visibility.

Fixes #4913.
This commit is contained in:
John Preston 2018-07-10 12:30:50 +03:00
parent 661de0c326
commit 2661f81fd1
1 changed files with 3 additions and 12 deletions

View File

@ -5784,10 +5784,8 @@ void HistoryWidget::setFieldText(
_textUpdateEvents = TextUpdateEvent::SaveDraft _textUpdateEvents = TextUpdateEvent::SaveDraft
| TextUpdateEvent::SendTyping; | TextUpdateEvent::SendTyping;
previewCancel();
_previewCancelled = false; _previewCancelled = false;
_previewData = nullptr;
MTP::cancel(base::take(_previewRequest));
_previewLinks.clear();
} }
void HistoryWidget::clearFieldText( void HistoryWidget::clearFieldText(
@ -6126,10 +6124,6 @@ void HistoryWidget::previewCancel() {
_previewData = nullptr; _previewData = nullptr;
_previewLinks.clear(); _previewLinks.clear();
updatePreview(); updatePreview();
if (!_editMsgId && !_replyToId && !readyToForward() && !_kbReplyTo) {
_fieldBarCancel->hide();
updateMouseTracking();
}
} }
void HistoryWidget::checkPreview() { void HistoryWidget::checkPreview() {
@ -6142,10 +6136,7 @@ void HistoryWidget::checkPreview() {
return false; return false;
}; };
if (_previewCancelled || previewRestricted()) { if (_previewCancelled || previewRestricted()) {
MTP::cancel(base::take(_previewRequest)); previewCancel();
_previewData = nullptr;
_previewLinks.clear();
update();
return; return;
} }
const auto newLinks = _parsedLinks.join(' '); const auto newLinks = _parsedLinks.join(' ');
@ -6210,7 +6201,7 @@ void HistoryWidget::gotPreview(QString links, const MTPMessageMedia &result, mtp
} else if (result.type() == mtpc_messageMediaEmpty) { } else if (result.type() == mtpc_messageMediaEmpty) {
_previewCache.insert(links, 0); _previewCache.insert(links, 0);
if (links == _previewLinks && !_previewCancelled) { if (links == _previewLinks && !_previewCancelled) {
_previewData = 0; _previewData = nullptr;
updatePreview(); updatePreview();
} }
} }