sw/source/uibase/sidebar/CommentsPanel.cxx |    8 ++++----
 sw/source/uibase/sidebar/CommentsPanel.hxx |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9fca60fb13a7ac30bf763e630c5fdaed2e98b119
Author:     Mohit Marathe <mohitmara...@proton.me>
AuthorDate: Sat Oct 19 13:25:38 2024 +0530
Commit:     Sarper Akdemir <sarper.akde...@allotropia.de>
CommitDate: Mon Oct 21 13:30:59 2024 +0200

    tdf#163551 fix filter comments by author bug
    
    This patch fixes the bug in which you have to reset the date filter
    for filter by author to work i.e. when switching the filter from one
    author to another
    
    Change-Id: Ib5d3bebf587c0e940d4984dd78f9d4a94f5cbb06
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175189
    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 0b8fdb6d52c0..33f656409caf 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.cxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.cxx
@@ -682,7 +682,7 @@ IMPL_LINK_NOARG(CommentsPanel, FilterByAuthor, 
weld::ComboBox&, void)
     {
         for (auto & [ nId, pComment ] : mpCommentsMap)
         {
-            if (!mbResetDate && mxFilterDate->get_date() != 
pComment->GetDate())
+            if (mbDateSelected && mxFilterDate->get_date() != 
pComment->GetDate())
                 continue;
             pComment->get_widget()->set_visible(true);
         }
@@ -693,7 +693,7 @@ IMPL_LINK_NOARG(CommentsPanel, FilterByAuthor, 
weld::ComboBox&, void)
         {
             if (sAuthor == pComment->GetAuthor())
             {
-                if (!mbResetDate && mxFilterDate->get_date() != 
pComment->GetDate())
+                if (mbDateSelected && mxFilterDate->get_date() != 
pComment->GetDate())
                     continue;
                 pComment->get_widget()->set_visible(true);
             }
@@ -707,6 +707,7 @@ IMPL_LINK_NOARG(CommentsPanel, FilterByAuthor, 
weld::ComboBox&, void)
 
 IMPL_LINK_NOARG(CommentsPanel, FilterByDate, SvtCalendarBox&, void)
 {
+    mbDateSelected = true;
     Date aDate(mxFilterDate->get_date());
     for (auto & [ nId, pComment ] : mpCommentsMap)
     {
@@ -724,9 +725,8 @@ IMPL_LINK_NOARG(CommentsPanel, FilterByDate, 
SvtCalendarBox&, void)
 
 IMPL_LINK_NOARG(CommentsPanel, ResetDate, weld::Button&, void)
 {
-    mbResetDate = true;
+    mbDateSelected = false;
     FilterByAuthor(*mxFilterAuthor);
-    mbResetDate = false;
 }
 
 IMPL_LINK_NOARG(CommentsPanel, ShowTimeHdl, weld::Toggleable&, void)
diff --git a/sw/source/uibase/sidebar/CommentsPanel.hxx 
b/sw/source/uibase/sidebar/CommentsPanel.hxx
index 48f63b9dc01a..832633b08a7e 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.hxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.hxx
@@ -169,7 +169,7 @@ private:
     std::unique_ptr<weld::Box> mxThreadsContainer;
 
     sal_uInt16 mnThreads = 0;
-    bool mbResetDate = false;
+    bool mbDateSelected = false;
 
     // utility functions
     sw::annotation::SwAnnotationWin* getRootCommentWin(const SwFormatField* 
pField);

Reply via email to