Commit 5571dd56 authored by Marcin Gurtowski's avatar Marcin Gurtowski Committed by David Faure
Browse files

Skipping thumbnail caching for encrypted storages

parent 98520e6c
Pipeline #64335 passed with stage
in 4 minutes and 2 seconds
...@@ -690,9 +690,16 @@ bool ThumbnailProtocol::createSubThumbnail(QImage &thumbnail, const QString &fil ...@@ -690,9 +690,16 @@ bool ThumbnailProtocol::createSubThumbnail(QImage &thumbnail, const QString &fil
if (subCreator && subCreator->create(filePath, cacheSize, cacheSize, thumbnail)) { if (subCreator && subCreator->create(filePath, cacheSize, cacheSize, thumbnail)) {
scaleDownImage(thumbnail, cacheSize, cacheSize); scaleDownImage(thumbnail, cacheSize, cacheSize);
// The thumbnail has been created successfully. Store the thumbnail // The thumbnail has been created successfully. Check if we can store
// to the cache for future access. // the thumbnail to the cache for future access.
#if KIO_VERSION >= QT_VERSION_CHECK(5, 83, 0)
if (metaData("cache").toInt()) {
#else
{
#endif
// Save the cache
QSaveFile thumbnailfile(thumbPath.absoluteFilePath(thumbName)); QSaveFile thumbnailfile(thumbPath.absoluteFilePath(thumbName));
if (thumbnailfile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { if (thumbnailfile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
QFileInfo fi(filePath); QFileInfo fi(filePath);
thumbnail.setText(QStringLiteral("Thumb::URI"), QString::fromUtf8(fileUrl)); thumbnail.setText(QStringLiteral("Thumb::URI"), QString::fromUtf8(fileUrl));
...@@ -703,6 +710,8 @@ bool ThumbnailProtocol::createSubThumbnail(QImage &thumbnail, const QString &fil ...@@ -703,6 +710,8 @@ bool ThumbnailProtocol::createSubThumbnail(QImage &thumbnail, const QString &fil
thumbnailfile.commit(); thumbnailfile.commit();
} }
} }
}
} else { } else {
return false; return false;
} }
......
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