Add a default filename for clipboard pastes again

This commit is contained in:
Nicolas Werner 2022-03-22 18:28:35 +01:00
parent 447a3d4cb9
commit 922c63ef27
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -1050,7 +1050,12 @@ InputBar::startUploadFromMimeData(const QMimeData &source, const QString &format
return; return;
} }
startUpload(std::move(file), {}, format); QMimeDatabase db;
auto mime = db.mimeTypeForName(format);
auto suffix = mime.preferredSuffix();
QString filename = QStringLiteral("clipboard");
startUpload(std::move(file), suffix.isEmpty() ? filename : (filename + "." + suffix), format);
} }
void void
InputBar::startUpload(std::unique_ptr<QIODevice> dev, const QString &orgPath, const QString &format) InputBar::startUpload(std::unique_ptr<QIODevice> dev, const QString &orgPath, const QString &format)