kioslave: sync thumbnail name code with kdelibs

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-03-13 10:08:44 +02:00
parent 3cc7924be3
commit f46cea0ed1

View file

@ -56,6 +56,7 @@
#include <config-workspace.h> // For HAVE_NICE
#include <kio/thumbcreator.h>
#include <kio/thumbsequencecreator.h>
#include <kio/netaccess.h>
#include <kconfiggroup.h>
#include <iostream>
@ -593,7 +594,10 @@ bool ThumbnailProtocol::createSubThumbnail(QImage& thumbnail, const QString& fil
int cacheSize = 0;
// NOTE: make sure the algorithm and name match those used in kdelibs/kio/kio/previewjob.cpp
const QByteArray hash = QFile::encodeName(fileName.url()).toHex();
const QString thumbName = hash + thumbExt;
KIO::UDSEntry thumbEntry;
KIO::NetAccess::stat(fileName, thumbEntry, nullptr);
const QString modTime = QString::number(thumbEntry.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME));
const QString thumbName = hash + modTime + thumbExt;
if (m_thumbBasePath.isEmpty()) {
m_thumbBasePath = QDir::homePath() + "/.thumbnails/";
KStandardDirs::makeDir(m_thumbBasePath + "normal/", 0700);