desktop/source/deployment/gui/dp_gui_dialog2.cxx |   33 ++++++++++++++++++++---
 desktop/source/deployment/gui/dp_gui_dialog2.hxx |    3 ++
 desktop/uiconfig/ui/extensionmanager.ui          |   18 ++++++++++--
 3 files changed, 47 insertions(+), 7 deletions(-)

New commits:
commit 3bbc4581b9af37dbc5adbc355633641d60575c30
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Apr 25 14:00:47 2022 +0200
Commit:     Samuel Mehrbrodt <[email protected]>
CommitDate: Mon Apr 25 16:57:20 2022 +0200

    tdf#126672 Add search field to extension manager
    
    Change-Id: Ie5c44e79cff236c5d306c34492a5c6c789d6fb60
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133381
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <[email protected]>

diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx 
b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 3169904aa4a6..9d06ebbc9916 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -436,6 +436,7 @@ ExtMgrDialog::ExtMgrDialog(weld::Window *pParent, 
TheExtensionManager *pManager)
     , m_xProgressText(m_xBuilder->weld_label("progressft"))
     , m_xProgressBar(m_xBuilder->weld_progress_bar("progressbar"))
     , m_xCancelBtn(m_xBuilder->weld_button("cancel"))
+    , m_xSearchEntry(m_xBuilder->weld_entry("search"))
 {
     m_xExtensionBox->InitFromDialog(this);
 
@@ -453,6 +454,8 @@ ExtMgrDialog::ExtMgrDialog(weld::Window *pParent, 
TheExtensionManager *pManager)
     m_xSharedCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx 
) );
     m_xUserCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) 
);
 
+    m_xSearchEntry->connect_changed( LINK( this, ExtMgrDialog, HandleSearch ) 
);
+
     m_xBundledCbx->set_active(true);
     m_xSharedCbx->set_active(true);
     m_xUserCbx->set_active(true);
@@ -497,6 +500,18 @@ void ExtMgrDialog::addPackageToList( const uno::Reference< 
deployment::XPackage
     const SolarMutexGuard aGuard;
     m_xUpdateBtn->set_sensitive(true);
 
+    bool bSearchMatch = m_xSearchEntry->get_text().isEmpty();
+    if (!m_xSearchEntry->get_text().isEmpty()
+        && xPackage->getDisplayName().toAsciiLowerCase().indexOf(
+               m_xSearchEntry->get_text().toAsciiLowerCase())
+               >= 0)
+    {
+        bSearchMatch = true;
+    }
+
+    if (!bSearchMatch)
+        return;
+
     if (m_xBundledCbx->get_active() && (xPackage->getRepositoryName() == 
BUNDLED_PACKAGE_MANAGER) )
     {
         m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
@@ -511,6 +526,14 @@ void ExtMgrDialog::addPackageToList( const uno::Reference< 
deployment::XPackage
     }
 }
 
+void ExtMgrDialog::updateList()
+{
+    // re-creates the list of packages with addEntry selecting the packages
+    prepareChecking();
+    m_pManager->createPackageList();
+    checkEntries();
+}
+
 void ExtMgrDialog::prepareChecking()
 {
     m_xExtensionBox->prepareChecking();
@@ -903,10 +926,12 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleEnableBtn, 
weld::Button&, void)
 
 IMPL_LINK_NOARG(ExtMgrDialog, HandleExtTypeCbx, weld::Toggleable&, void)
 {
-    // re-creates the list of packages with addEntry selecting the packages
-    prepareChecking();
-    m_pManager->createPackageList();
-    checkEntries();
+    updateList();
+}
+
+IMPL_LINK_NOARG(ExtMgrDialog, HandleSearch, weld::Entry&, void)
+{
+    updateList();
 }
 
 IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn, weld::Button&, void)
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx 
b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index 2a90d1ca060c..0e9818156bd2 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -122,6 +122,7 @@ class ExtMgrDialog : public weld::GenericDialogController
     std::unique_ptr<weld::Label> m_xProgressText;
     std::unique_ptr<weld::ProgressBar> m_xProgressBar;
     std::unique_ptr<weld::Button> m_xCancelBtn;
+    std::unique_ptr<weld::Entry> m_xSearchEntry;
 
     bool removeExtensionWarn(std::u16string_view rExtensionTitle);
 
@@ -133,6 +134,7 @@ class ExtMgrDialog : public weld::GenericDialogController
     DECL_LINK( HandleCancelBtn, weld::Button&, void );
     DECL_LINK( HandleCloseBtn, weld::Button&, void );
     DECL_LINK( HandleExtTypeCbx, weld::Toggleable&, void );
+    DECL_LINK( HandleSearch, weld::Entry&, void );
     DECL_LINK( TimeOutHdl, Timer *, void );
     DECL_LINK( startProgress, void *, void );
 
@@ -160,6 +162,7 @@ public:
 
     TheExtensionManager*    getExtensionManager() const { return m_pManager; }
 
+    virtual void    updateList();
     virtual void    prepareChecking() override;
     virtual void    checkEntries() override;
 
diff --git a/desktop/uiconfig/ui/extensionmanager.ui 
b/desktop/uiconfig/ui/extensionmanager.ui
index 1a4e4e4ba2cb..a7b2b951e75f 100644
--- a/desktop/uiconfig/ui/extensionmanager.ui
+++ b/desktop/uiconfig/ui/extensionmanager.ui
@@ -154,6 +154,18 @@
                 <property name="position">0</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkEntry" id="search">
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="placeholder-text" translatable="yes" 
context="extensionmanager|search">Search ...</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkScrolledWindow" id="scroll">
                 <property name="visible">True</property>
@@ -186,7 +198,7 @@
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -295,7 +307,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
@@ -365,7 +377,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
           </object>

Reply via email to