sw/source/uibase/utlui/content.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 802bc63be79f5622d794345dbbc577b6c603b61b
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Sat Apr 20 09:52:16 2024 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Wed Apr 24 21:37:44 2024 +0200

    SwContentTree: Don't show 'Delete' menu item when read-only
    
    Change-Id: Ib3a1ec5635937b2dcb26144f621ee0bf4a0101d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166413
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 25186110de86..a7e3ff3c9289 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1823,10 +1823,12 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
             const bool bProtected = 
weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry))->IsProtect();
             const bool bProtectBM = (ContentTypeId::BOOKMARK == nContentType)
                     && 
m_pActiveShell->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_BOOKMARKS);
-            const bool bEditable = pType->IsEditable() &&
-                    ((bVisible && !bProtected) || ContentTypeId::REGION == 
nContentType);
-            const bool bDeletable = pType->IsDeletable()
-                    && ((bVisible && !bProtected && !bProtectBM) || 
ContentTypeId::REGION == nContentType);
+            const bool bEditable
+                = !bReadonly && pType->IsEditable()
+                  && ((bVisible && !bProtected) || ContentTypeId::REGION == 
nContentType);
+            const bool bDeletable = !bReadonly && pType->IsDeletable()
+                                    && ((bVisible && !bProtected && 
!bProtectBM)
+                                        || ContentTypeId::REGION == 
nContentType);
             const bool bRenamable
                 = !bReadonly
                   && (pType->IsRenamable()
@@ -1899,7 +1901,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
                 }
                 bRemoveCopyEntry = false;
             }
-            else if (!bReadonly && bEditable)
+            else if (bEditable)
             {
                 if(ContentTypeId::INDEX == nContentType)
                 {

Reply via email to