summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-12-15 09:22:13 +0300
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-17 10:35:41 +0100
commitea5c9ca9950a23860daaccb658bdbed76a038a2a (patch)
tree1d85ee456797e5b6ccc5694414c4d15bd68407fc /sfx2
parent0b54949053bea786e5543ed87ab6dc9a99c00876 (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> (cherry picked from commit 2f848eb5dc6f6f9344f250ac9860065130aaf436) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126869 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> (cherry picked from commit 214364584d3a247a70eed42ca7101b675125bf43) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126871 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit bda87ece5bd8755384213aa6b01524324c153893) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126928 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
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 a80af10d1e7d..64cd0c981bf2 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -209,13 +209,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 =
@@ -280,7 +282,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());