Don't resolve the actual QImage on paste check.

This commit is contained in:
John Preston 2020-05-01 14:43:02 +04:00
parent cc463b07b1
commit db5d599052
2 changed files with 6 additions and 16 deletions

View File

@ -548,14 +548,9 @@ void EditCaptionBox::prepare() {
if (action == Ui::InputField::MimeAction::Check) {
if (!data->hasText() && !_isAllowedEditMedia) {
return false;
}
if (data->hasImage()) {
const auto image = qvariant_cast<QImage>(data->imageData());
if (!image.isNull()) {
return true;
}
}
if (const auto urls = data->urls(); !urls.empty()) {
} else if (data->hasImage()) {
return true;
} else if (const auto urls = data->urls(); !urls.empty()) {
if (ranges::find_if(
urls,
[](const QUrl &url) { return !url.isLocalFile(); }

View File

@ -4467,20 +4467,15 @@ bool HistoryWidget::confirmSendingFiles(
bool HistoryWidget::canSendFiles(not_null<const QMimeData*> data) const {
if (!canWriteMessage()) {
return false;
}
if (const auto urls = data->urls(); !urls.empty()) {
} else if (const auto urls = data->urls(); !urls.empty()) {
if (ranges::find_if(
urls,
[](const QUrl &url) { return !url.isLocalFile(); }
) == urls.end()) {
return true;
}
}
if (data->hasImage()) {
const auto image = qvariant_cast<QImage>(data->imageData());
if (!image.isNull()) {
return true;
}
} else if (data->hasImage()) {
return true;
}
return false;
}