sw/source/uibase/misc/redlndlg.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit fb8531323f9646ce8c60b42f79452525e882a3dd
Author:     Mike Kaganski <[email protected]>
AuthorDate: Tue Feb 10 12:18:06 2026 +0500
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Feb 10 14:44:58 2026 +0100

    tdf#170701: only enable [Accept]/[Reject] for top-level changes
    
    Regression after commit 6fe35fdbd39cee17cb1f4fc9494520e2bdcabcba
    (tdf#167128: SwRedlineAcceptDlg: move enabling controls after
    selection, 2025-06-20). The previous code, that enabled these
    controls in GotoHdl, only set bSel to true for top-level items.
    
    This change implements the same logic in EnableControls.
    
    Change-Id: I70414ece801312d1b5e873db0440c0e28b76ef02
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199019
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199039

diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index 3f7fd3a5cde8..bbe55c85fc9c 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -380,10 +380,14 @@ void SwRedlineAcceptDlg::EnableControls(const SwView* 
pView)
     bool const bEnable = isAcceptRejectCommandsEnabled(*pView)
         && rTreeView.n_children() != 0
         && 
!pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
-    bool bSel = rTreeView.get_selected(nullptr);
 
+    bool bAcceptReject = false;
     bool bIsNotFormated = false;
-    rTreeView.selected_foreach([this, pSh, &bIsNotFormated](weld::TreeIter& 
rEntry){
+    rTreeView.selected_foreach([this, pSh, &bIsNotFormated, 
&bAcceptReject](weld::TreeIter& rEntry){
+        // Only enable these controls for top-level redlines
+        if (m_pTable->GetWidget().get_iter_depth(rEntry) == 0)
+            bAcceptReject = true;
+
         // find the selected redline
         // (fdo#57874: ignore, if the redline is already gone)
         SwRedlineTable::size_type nPos = GetRedlinePos(rEntry);
@@ -396,9 +400,9 @@ void SwRedlineAcceptDlg::EnableControls(const SwView* pView)
         return false;
     });
 
-    m_pTPView->EnableAccept( bEnable && bSel );
-    m_pTPView->EnableReject( bEnable && bSel );
-    m_pTPView->EnableClearFormat( bEnable && !bIsNotFormated && bSel );
+    m_pTPView->EnableAccept( bEnable && bAcceptReject );
+    m_pTPView->EnableReject( bEnable && bAcceptReject );
+    m_pTPView->EnableClearFormat( bEnable && !bIsNotFormated && bAcceptReject 
);
     m_pTPView->EnableAcceptAll( bEnable );
     m_pTPView->EnableRejectAll( bEnable );
     m_pTPView->EnableClearFormatAll( bEnable &&

Reply via email to