Commit 1eeaf1a6 authored by Stefan Brüns's avatar Stefan Brüns
Browse files

Add mandatory metadata to thumbnail

According to the spec, at least Thumb::URI and Thumb::MTime are required.

KIO::PreviewJob discards any thumbnails without these and recreates
the thumbnails.
parent bf486c01
......@@ -734,6 +734,11 @@ bool ThumbnailProtocol::createSubThumbnail(QImage& thumbnail, const QString& fil
// The thumbnail has been created successfully. Store the thumbnail
// to the cache for future access.
if (thumbnailfile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
QFileInfo fi(filePath);
thumbnail.setText(QStringLiteral("Thumb::URI"), QString::fromUtf8(fileUrl.toEncoded()));
thumbnail.setText(QStringLiteral("Thumb::MTime"), QString::number(fi.lastModified().toSecsSinceEpoch()));
thumbnail.setText(QStringLiteral("Thumb::Size"), QString::number(fi.size()));
savedCorrectly = thumbnail.save(&thumbnailfile, "PNG");
}
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment