[Libreoffice-commits] core.git: sfx2/source

Vert D (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 16 08:18:21 UTC 2020


 sfx2/source/control/templatesearchview.cxx |   13 +++++++++++++
 sfx2/source/doc/templatedlg.cxx            |   19 ++++++++++++++++---
 sfx2/source/inc/templatesearchview.hxx     |    2 ++
 3 files changed, 31 insertions(+), 3 deletions(-)

New commits:
commit 76836910aedee94c1361ddd912544822316b9e0c
Author:     Vert D <devoptmsoi at gmx.com>
AuthorDate: Thu Nov 5 21:01:56 2020 -0500
Commit:     Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Mon Nov 16 09:17:41 2020 +0100

    tdf#138024 Default Icons not refreshing in template manger search view
    
    *added missing funtion to searchview
    *call searchupdate when refreshing
    
    Change-Id: I576b2e2de37e3f34b7499a914f0707586687643e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105387
    Tested-by: Jenkins
    Tested-by: Heiko Tietze <heiko.tietze at documentfoundation.org>
    Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>

diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index 25e62fd27384..41c318ecf75e 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -240,6 +240,19 @@ BitmapEx TemplateSearchView::getDefaultThumbnail( const OUString& rPath )
     return aImg;
 }
 
+void TemplateSearchView::RemoveDefaultTemplateIcon(const OUString& rPath)
+{
+    for (const std::unique_ptr<ThumbnailViewItem>& pItem : mItemList)
+    {
+        TemplateViewItem* pViewItem = dynamic_cast<TemplateViewItem*>(pItem.get());
+        if (pViewItem && pViewItem->getPath().match(rPath))
+        {
+            pViewItem->showDefaultIcon(false);
+            Invalidate();
+            return;
+        }
+    }
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 
 
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index aaed4e7f7cbe..313bf591862a 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -475,7 +475,11 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OString&, rIdent, void)
     else if (rIdent == MNI_ACTION_DELETE_FOLDER)
         OnCategoryDelete();
     else if (rIdent == MNI_ACTION_REFRESH)
+    {
         mxLocalView->reload();
+        if(mxSearchView->IsVisible())
+            SearchUpdateHdl(*mxSearchFilter);
+    }
     else if (rIdent != MNI_ACTION_DEFAULT)
         DefaultTemplateMenuSelectHdl(rIdent);
 }
@@ -486,7 +490,12 @@ void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(const OString& rIdent)
 
     OUString sPrevDefault = SfxObjectFactory::GetStandardTemplate( aServiceName );
     if(!sPrevDefault.isEmpty())
-        mxLocalView->RemoveDefaultTemplateIcon(sPrevDefault);
+    {
+        if(mxSearchView->IsVisible())
+            mxSearchView->RemoveDefaultTemplateIcon(sPrevDefault);
+        else
+            mxLocalView->RemoveDefaultTemplateIcon(sPrevDefault);
+    }
 
     SfxObjectFactory::SetStandardTemplate( aServiceName, OUString() );
 
@@ -702,8 +711,12 @@ IMPL_LINK(SfxTemplateManagerDlg, DefaultTemplateHdl, ThumbnailViewItem*, pItem,
         {
             OUString sPrevDefault = SfxObjectFactory::GetStandardTemplate( aServiceName );
             if(!sPrevDefault.isEmpty())
-                mxLocalView->RemoveDefaultTemplateIcon(sPrevDefault);
-
+            {
+                if(mxSearchView->IsVisible())
+                    mxSearchView->RemoveDefaultTemplateIcon(sPrevDefault);
+                else
+                    mxLocalView->RemoveDefaultTemplateIcon(sPrevDefault);
+            }
             SfxObjectFactory::SetStandardTemplate(aServiceName,pViewItem->getPath());
             pViewItem->showDefaultIcon(true);
         }
diff --git a/sfx2/source/inc/templatesearchview.hxx b/sfx2/source/inc/templatesearchview.hxx
index 5dc23adfd8b4..d5a1dc32ceda 100644
--- a/sfx2/source/inc/templatesearchview.hxx
+++ b/sfx2/source/inc/templatesearchview.hxx
@@ -43,6 +43,8 @@ public:
 
     static BitmapEx getDefaultThumbnail( const OUString& rPath );
 
+    void RemoveDefaultTemplateIcon(const OUString& rPath);
+
 private:
     virtual void OnItemDblClicked(ThumbnailViewItem *pItem) override;
 


More information about the Libreoffice-commits mailing list