sw/source/uibase/sidebar/CommentsPanel.cxx | 24 ++++++++++++++++++++++++ sw/source/uibase/sidebar/CommentsPanel.hxx | 4 ++++ sw/uiconfig/swriter/ui/commentspanel.ui | 3 +++ 3 files changed, 31 insertions(+)
New commits: commit b8d6171ddee0c7c2b8d7377d311482ed41a65bd0 Author: Mohit Marathe <mohitmara...@proton.me> AuthorDate: Sun Aug 25 11:29:44 2024 +0530 Commit: Sarper Akdemir <sarper.akde...@allotropia.de> CommitDate: Thu Sep 19 13:57:45 2024 +0200 sw: make show option work in comments panel Change-Id: I49e5feb7c6585c14d22a57715329290029cbadcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172379 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akde...@allotropia.de> diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx b/sw/source/uibase/sidebar/CommentsPanel.cxx index ee502b0ee39d..cf4f624cb048 100644 --- a/sw/source/uibase/sidebar/CommentsPanel.cxx +++ b/sw/source/uibase/sidebar/CommentsPanel.cxx @@ -164,6 +164,7 @@ IMPL_LINK_NOARG(Comment, OnFocusOut, weld::Widget&, void) IMPL_LINK_NOARG(Comment, ResolveClicked, weld::Toggleable&, void) { mrCommentsPanel.ToggleResolved(this); + mrCommentsPanel.ShowResolvedHdl(mrCommentsPanel.getShowResolved()); } IMPL_LINK_NOARG(Comment, ReplyClicked, weld::Button&, void) { mrCommentsPanel.ReplyComment(this); } @@ -204,6 +205,8 @@ CommentsPanel::CommentsPanel(weld::Widget* pParent) mxFilterAuthor->connect_changed(LINK(this, CommentsPanel, FilterByAuthor)); mxFilterDate->connect_activated(LINK(this, CommentsPanel, FilterByDate)); mxResetDate->connect_clicked(LINK(this, CommentsPanel, ResetDate)); + mxShowTime->connect_toggled(LINK(this, CommentsPanel, ShowTimeHdl)); + mxShowResolved->connect_toggled(LINK(this, CommentsPanel, ShowResolvedHdl)); mxSortbyPosition->connect_toggled(LINK(this, CommentsPanel, SortHdl)); mxSortbyTime->connect_toggled(LINK(this, CommentsPanel, SortHdl)); @@ -719,6 +722,27 @@ IMPL_LINK_NOARG(CommentsPanel, ResetDate, weld::Button&, void) mbResetDate = false; } +IMPL_LINK_NOARG(CommentsPanel, ShowTimeHdl, weld::Toggleable&, void) +{ + bool bShowTime = mxShowTime->get_active(); + for (auto & [ rId, pComment ] : mpCommentsMap) + { + pComment->mxTime->set_visible(bShowTime); + } +} + +IMPL_LINK_NOARG(CommentsPanel, ShowResolvedHdl, weld::Toggleable&, void) +{ + bool bShowResolved = mxShowResolved->get_active(); + for (auto & [ rId, pComment ] : mpCommentsMap) + { + if (pComment->mxResolve->get_active()) + { + pComment->get_widget()->set_visible(bShowResolved); + } + } +} + CommentsPanel::~CommentsPanel() {} void CommentsPanel::NotifyItemUpdate(const sal_uInt16 /*nSid*/, const SfxItemState /* eState */, diff --git a/sw/source/uibase/sidebar/CommentsPanel.hxx b/sw/source/uibase/sidebar/CommentsPanel.hxx index 9bb2d2828783..348388ab21e1 100644 --- a/sw/source/uibase/sidebar/CommentsPanel.hxx +++ b/sw/source/uibase/sidebar/CommentsPanel.hxx @@ -142,12 +142,16 @@ public: DECL_LINK(FilterByAuthor, weld::ComboBox&, void); DECL_LINK(FilterByDate, SvtCalendarBox&, void); DECL_LINK(ResetDate, weld::Button&, void); + DECL_LINK(ShowTimeHdl, weld::Toggleable&, void); + DECL_LINK(ShowResolvedHdl, weld::Toggleable&, void); DECL_LINK(SortHdl, weld::Toggleable&, void); // utility functions static OUString FormatDate(Date& rDate); static OUString FormatTime(tools::Time& rTime); + weld::Toggleable& getShowResolved() { return *mxShowResolved; } + private: SwDoc* mpDoc; SwPostItMgr* mpPostItMgr; diff --git a/sw/uiconfig/swriter/ui/commentspanel.ui b/sw/uiconfig/swriter/ui/commentspanel.ui index 005ecd47f5cf..5f7c7314a1e0 100644 --- a/sw/uiconfig/swriter/ui/commentspanel.ui +++ b/sw/uiconfig/swriter/ui/commentspanel.ui @@ -119,6 +119,7 @@ <property name="halign">center</property> <property name="hexpand">True</property> <property name="use-underline">True</property> + <property name="active">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -135,6 +136,7 @@ <property name="halign">center</property> <property name="hexpand">True</property> <property name="use-underline">True</property> + <property name="active">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -151,6 +153,7 @@ <property name="halign">center</property> <property name="hexpand">True</property> <property name="use-underline">True</property> + <property name="active">True</property> <property name="draw-indicator">True</property> </object> <packing>