summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-12-15 09:22:13 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-12-15 08:17:25 +0100
commit2f848eb5dc6f6f9344f250ac9860065130aaf436 (patch)
treeec553a44a94a152e37cefca6798852545f0412fd /sfx2
parentddd675c5a79b26d23da8d4affeeb888ac3664635 (diff)
tdf#131850: avoid encryption check for recent docs overlay
Change-Id: I673de978c39492bf9be78945ece95ade2a943ffc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126849 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/recentdocsview.hxx2
-rw-r--r--sfx2/source/control/recentdocsview.cxx8
2 files changed, 6 insertions, 4 deletions
diff --git a/sfx2/inc/recentdocsview.hxx b/sfx2/inc/recentdocsview.hxx
index b87a0cce679c..b347fc25029a 100644
--- a/sfx2/inc/recentdocsview.hxx
+++ b/sfx2/inc/recentdocsview.hxx
@@ -65,7 +65,7 @@ public:
void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId);
static bool typeMatchesExtension(ApplicationType type, std::u16string_view rExt);
- static BitmapEx getDefaultThumbnail(const OUString &rURL);
+ static BitmapEx getDefaultThumbnail(const OUString &rURL, bool bCheckEncrypted = true);
ApplicationType mnFileTypes;
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index f942b1ffbb15..0957cabbdc6f 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -206,13 +206,15 @@ bool RecentDocsView::isAcceptedFile(const OUString &rURL) const
(mnFileTypes & ApplicationType::TYPE_OTHER && typeMatchesExtension(ApplicationType::TYPE_OTHER, aExt));
}
-BitmapEx RecentDocsView::getDefaultThumbnail(const OUString &rURL)
+BitmapEx RecentDocsView::getDefaultThumbnail(const OUString &rURL, bool bCheckEncrypted)
{
BitmapEx aImg;
INetURLObject aUrl(rURL);
OUString aExt = aUrl.getExtension();
- const std::map<ApplicationType,OUString>& rWhichMap = IsDocEncrypted( rURL) ?
+ // tdf#131850: avoid reading the file to check if it's encrypted,
+ // if we only need its generic "module" thumbnail
+ const std::map<ApplicationType,OUString>& rWhichMap = bCheckEncrypted && IsDocEncrypted(rURL) ?
EncryptedBitmapForExtension : BitmapForExtension;
std::map<ApplicationType,OUString>::const_iterator mIt =
@@ -269,7 +271,7 @@ void RecentDocsView::Reload()
}
}
- aModule = getDefaultThumbnail(aURL);
+ aModule = getDefaultThumbnail(aURL, false); // We don't need an "encrypted" icon here
if (!aModule.IsEmpty() && !aThumbnail.IsEmpty()) {
ScopedVclPtr<VirtualDevice> m_pVirDev(VclPtr<VirtualDevice>::Create());
Size aSize(aThumbnail.GetSizePixel());