Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KIO Extras
Commits
5571dd56
Commit
5571dd56
authored
Jun 05, 2021
by
Marcin Gurtowski
Committed by
David Faure
Jun 05, 2021
Browse files
Skipping thumbnail caching for encrypted storages
parent
98520e6c
Pipeline
#64335
passed with stage
in 4 minutes and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
thumbnail/CMakeLists.txt
View file @
5571dd56
...
@@ -41,7 +41,7 @@ target_link_libraries(kio_thumbnail
...
@@ -41,7 +41,7 @@ target_link_libraries(kio_thumbnail
KF5::CoreAddons
KF5::CoreAddons
KF5::KIOCore
KF5::KIOCore
KF5::KIOWidgets
KF5::KIOWidgets
KF5::I18n
KF5::I18n
)
)
set_target_properties
(
kio_thumbnail PROPERTIES OUTPUT_NAME
"thumbnail"
)
set_target_properties
(
kio_thumbnail PROPERTIES OUTPUT_NAME
"thumbnail"
)
...
...
thumbnail/thumbnail.cpp
View file @
5571dd56
...
@@ -690,19 +690,28 @@ bool ThumbnailProtocol::createSubThumbnail(QImage &thumbnail, const QString &fil
...
@@ -690,19 +690,28 @@ 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.
QSaveFile
thumbnailfile
(
thumbPath
.
absoluteFilePath
(
thumbName
));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 83, 0)
if
(
thumbnailfile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
{
if
(
metaData
(
"cache"
).
toInt
())
{
QFileInfo
fi
(
filePath
);
#else
thumbnail
.
setText
(
QStringLiteral
(
"Thumb::URI"
),
QString
::
fromUtf8
(
fileUrl
));
{
thumbnail
.
setText
(
QStringLiteral
(
"Thumb::MTime"
),
QString
::
number
(
fi
.
lastModified
().
toSecsSinceEpoch
()));
#endif
thumbnail
.
setText
(
QStringLiteral
(
"Thumb::Size"
),
QString
::
number
(
fi
.
size
()));
// Save the cache
QSaveFile
thumbnailfile
(
thumbPath
.
absoluteFilePath
(
thumbName
));
if
(
thumbnail
.
save
(
&
thumbnailfile
,
"png"
))
{
thumbnailfile
.
commit
();
if
(
thumbnailfile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
{
QFileInfo
fi
(
filePath
);
thumbnail
.
setText
(
QStringLiteral
(
"Thumb::URI"
),
QString
::
fromUtf8
(
fileUrl
));
thumbnail
.
setText
(
QStringLiteral
(
"Thumb::MTime"
),
QString
::
number
(
fi
.
lastModified
().
toSecsSinceEpoch
()));
thumbnail
.
setText
(
QStringLiteral
(
"Thumb::Size"
),
QString
::
number
(
fi
.
size
()));
if
(
thumbnail
.
save
(
&
thumbnailfile
,
"png"
))
{
thumbnailfile
.
commit
();
}
}
}
}
}
}
else
{
}
else
{
return
false
;
return
false
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment