sw/source/uibase/misc/redlndlg.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
New commits: commit 6f672373ecb30565261395bb6ebed334c0649b7f Author: Mike Kaganski <[email protected]> AuthorDate: Tue Feb 10 12:18:06 2026 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Tue Feb 10 10:13:52 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 diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index e9d3acb689c5..4bd546c1f973 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -379,10 +379,14 @@ void SwRedlineAcceptDlg::EnableControls(const SwView* pView) bool const bEnable = isAcceptRejectCommandsEnabled(*pView) && rTreeView.n_children() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); - std::unique_ptr<weld::TreeIter> pSelectedEntry = rTreeView.get_selected(); + 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); @@ -395,9 +399,9 @@ void SwRedlineAcceptDlg::EnableControls(const SwView* pView) return false; }); - m_rTPView.EnableAccept(bEnable && pSelectedEntry); - m_rTPView.EnableReject(bEnable && pSelectedEntry); - m_rTPView.EnableClearFormat(bEnable && !bIsNotFormated && pSelectedEntry); + m_rTPView.EnableAccept(bEnable && bAcceptReject); + m_rTPView.EnableReject(bEnable && bAcceptReject); + m_rTPView.EnableClearFormat(bEnable && !bIsNotFormated && bAcceptReject); m_rTPView.EnableAcceptAll(bEnable); m_rTPView.EnableRejectAll(bEnable); m_rTPView.EnableClearFormatAll(bEnable && m_bOnlyFormatedRedlines);
