mirror of https://github.com/procxx/kepka.git
Fix paste of image from Firefox.
It sometimes adds a strange path to empty temp file to mime data.
This commit is contained in:
parent
9515520088
commit
099a3c4642
|
@ -4050,16 +4050,6 @@ bool HistoryWidget::confirmSendingFiles(const QMimeData *data) {
|
|||
return confirmSendingFiles(data, CompressConfirm::Auto);
|
||||
}
|
||||
|
||||
bool HistoryWidget::confirmSendingFiles(
|
||||
const QList<QUrl> &files,
|
||||
CompressConfirm compressed,
|
||||
const QString &insertTextOnCancel) {
|
||||
return confirmSendingFiles(
|
||||
Storage::PrepareMediaList(files, st::sendMediaPreviewSize),
|
||||
compressed,
|
||||
insertTextOnCancel);
|
||||
}
|
||||
|
||||
bool HistoryWidget::confirmSendingFiles(
|
||||
const QStringList &files,
|
||||
CompressConfirm compressed,
|
||||
|
@ -4145,17 +4135,26 @@ bool HistoryWidget::confirmSendingFiles(
|
|||
return false;
|
||||
}
|
||||
|
||||
const auto urls = data->urls();
|
||||
for (const auto &url : urls) {
|
||||
if (url.isLocalFile()) {
|
||||
// Don't insert list of filenames on cancel.
|
||||
const auto emptyTextOnCancel = QString();
|
||||
confirmSendingFiles(urls, compressed, emptyTextOnCancel);
|
||||
return true;
|
||||
const auto hasImage = data->hasImage();
|
||||
|
||||
if (const auto urls = data->urls(); !urls.empty()) {
|
||||
auto list = Storage::PrepareMediaList(
|
||||
urls,
|
||||
st::sendMediaPreviewSize);
|
||||
if (list.error != Storage::PreparedList::Error::NonLocalUrl) {
|
||||
if (list.error == Storage::PreparedList::Error::None
|
||||
|| !hasImage) {
|
||||
const auto emptyTextOnCancel = QString();
|
||||
confirmSendingFiles(
|
||||
std::move(list),
|
||||
compressed,
|
||||
emptyTextOnCancel);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data->hasImage()) {
|
||||
if (hasImage) {
|
||||
auto image = qvariant_cast<QImage>(data->imageData());
|
||||
if (!image.isNull()) {
|
||||
confirmSendingFiles(
|
||||
|
|
|
@ -489,10 +489,6 @@ private:
|
|||
void unreadMentionsAnimationFinish();
|
||||
void sendButtonClicked();
|
||||
|
||||
bool confirmSendingFiles(
|
||||
const QList<QUrl> &files,
|
||||
CompressConfirm compressed,
|
||||
const QString &insertTextOnCancel = QString());
|
||||
bool confirmSendingFiles(
|
||||
const QStringList &files,
|
||||
CompressConfirm compressed,
|
||||
|
|
Loading…
Reference in New Issue