sfx2/inc/recentdocsview.hxx            |    2 +-
 sfx2/source/control/recentdocsview.cxx |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit bda87ece5bd8755384213aa6b01524324c153893
Author:     Mike Kaganski <[email protected]>
AuthorDate: Wed Dec 15 09:22:13 2021 +0300
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Dec 16 12:12:09 2021 +0100

    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 <[email protected]>
    (cherry picked from commit 2f848eb5dc6f6f9344f250ac9860065130aaf436)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126869
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>
    (cherry picked from commit 214364584d3a247a70eed42ca7101b675125bf43)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126871
    Reviewed-by: Michael Stahl <[email protected]>

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());

Reply via email to