sw/source/uibase/utlui/content.cxx | 26 +++++++++++++++++-------- sw/uiconfig/swriter/ui/navigatorcontextmenu.ui | 8 +++---- 2 files changed, 22 insertions(+), 12 deletions(-)
New commits: commit 194adf065e572699e0d77d359e6625c1713c31c1 Author: Sujatro Bhadra <sujatrobha...@gmail.com> AuthorDate: Tue Apr 23 18:53:25 2024 +0530 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Fri Jun 14 22:13:10 2024 +0200 tdf#147864 Replace 'Show All' and 'Hide All' in the Comments category context menu of Writer Navigator with togglable commands 'Show Comments' and 'Show Resolved Comments' Change-Id: I7ac00c5366327f8d245ca49595eca2fd1fac472c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166539 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 a43b75de6477..367f05367b2d 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1978,7 +1978,12 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) && pType->GetMemberCount() > 0) { if (nContentType == ContentTypeId::POSTIT) + { + const SwViewOption* m_pViewOpt = m_pActiveShell->GetViewOptions(); + xPop->set_active("showcomments", m_pViewOpt->IsPostIts()); + xPop->set_active("showresolvedcomments", m_pViewOpt->IsResolvedPostIts()); bRemovePostItEntries = false; + } else if (nContentType == ContentTypeId::FOOTNOTE) bRemoveDeleteAllFootnotesEntry = false; else if (nContentType == ContentTypeId::ENDNOTE) @@ -2009,8 +2014,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) if (bRemovePostItEntries) { - xPop->remove(OUString::number(600)); - xPop->remove(OUString::number(601)); + xPop->remove("showcomments"); + xPop->remove("showresolvedcomments"); xPop->remove(OUString::number(602)); } @@ -5032,6 +5037,17 @@ IMPL_LINK(SwContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUStrin void SwContentTree::ExecuteContextMenuAction(const OUString& rSelectedPopupEntry) { + + if(rSelectedPopupEntry == "showcomments") + { + m_pActiveShell->GetView().GetViewFrame().GetDispatcher()->Execute(SID_TOGGLE_NOTES); + return; + } + if(rSelectedPopupEntry == "showresolvedcomments") + { + m_pActiveShell->GetView().GetViewFrame().GetDispatcher()->Execute(SID_TOGGLE_RESOLVED_NOTES); + return; + } if (rSelectedPopupEntry == "copy") { CopyOutlineSelections(); @@ -5286,12 +5302,6 @@ void SwContentTree::ExecuteContextMenuAction(const OUString& rSelectedPopupEntry case 502 : EditEntry(*xFirst, EditEntryMode::RENAME); break; - case 600: - m_pActiveShell->GetView().GetPostItMgr()->Show(); - break; - case 601: - m_pActiveShell->GetView().GetPostItMgr()->Hide(); - break; case 602: { m_pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(nullptr); diff --git a/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui b/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui index 88583e0d90b0..3cbbb2bd23ff 100644 --- a/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui +++ b/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui @@ -297,18 +297,18 @@ </object> </child> <child> - <object class="GtkMenuItem" id="600"> + <object class="GtkCheckMenuItem" id="showcomments"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="label" translatable="yes" context="navigatorcontextmenu|STR_POSTIT_SHOW">Show All</property> + <property name="label" translatable="yes" context="navigatorcontextmenu|STR_POSTIT_SHOW">Show Comments</property> <property name="use-underline">True</property> </object> </child> <child> - <object class="GtkMenuItem" id="601"> + <object class="GtkCheckMenuItem" id="showresolvedcomments"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="label" translatable="yes" context="navigatorcontextmenu|STR_POSTIT_HIDE">Hide All</property> + <property name="label" translatable="yes" context="navigatorcontextmenu|STR_POSTIT_SHOW_RESOLVED">Show Resolved Comments</property> <property name="use-underline">True</property> </object> </child>