cui/source/dialogs/AdditionsDialog.cxx |   20 +++++++--------
 cui/source/inc/AdditionsDialog.hxx     |    4 +--
 cui/uiconfig/ui/additionsdialog.ui     |   44 +++++++++++++++++++++++++++------
 cui/uiconfig/ui/additionsfragment.ui   |   18 -------------
 4 files changed, 49 insertions(+), 37 deletions(-)

New commits:
commit 9a2662447c1cfebd591fa28e3064879bc04c9b8d
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Oct 6 15:56:53 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Oct 6 19:08:00 2025 +0200

    additions dialog: Move "Show More" button from items to dialog
    
    The "Show More Extensions" button is shown when
    PAGE_COUNT (currently 30) extensions are shown,
    but there may be more, in order to load/show
    the next PAGE_COUNT extensions.
    
    So far, the button was set for each item
    in the dialog, and always hidden for all
    items except the last one (for which it was
    shown when the max was reached).
    
    Instead, move the button to the dialog ancestor,
    right below the list of the items.
    
    That's where it semantically belongs, and one button
    is enough.
    
    In a quick test, user-visible behavior hasn't
    changed in a quick test as follows:
    
    * reduce PAGE_SIZE to 1, so the button shows up
      when there are fewer extensions, rebuild
    
        diff --git a/cui/source/dialogs/AdditionsDialog.cxx 
b/cui/source/dialogs/AdditionsDialog.cxx
        index 45a388769527..fa8e39d362ea 100644
        --- a/cui/source/dialogs/AdditionsDialog.cxx
        +++ b/cui/source/dialogs/AdditionsDialog.cxx
        @@ -55,7 +55,7 @@
    
         #include <bitmaps.hlst>
    
        -#define PAGE_SIZE 30
        +#define PAGE_SIZE 1
    
         using namespace css;
         using ::com::sun::star::uno::Reference;
    
    * start Writer
    * "Format" -> "Page Style"
    * in the "Area" tab, enable "Color"
    * click on the "Add color palettes via extension"
      button in the "Colors" section to open the dialog
    * click the "Show More Extensions" button a few times
    
    Change-Id: If7c2cad3a2b57e69d84b77d353d769142bb8418e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191971
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/cui/source/dialogs/AdditionsDialog.cxx 
b/cui/source/dialogs/AdditionsDialog.cxx
index d5d6d5c338b7..45a388769527 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -310,7 +310,7 @@ void SearchAndParseThread::Append(AdditionInfo& 
additionInfo)
     {
         if (m_pAdditionsDialog->m_nCurrentListItemCount
             != m_pAdditionsDialog->m_aAllExtensionsVector.size())
-            rCurrentItem.m_xButtonShowMore->set_visible(true);
+            m_pAdditionsDialog->m_xButtonShowMore->set_visible(true);
     }
 }
 
@@ -432,6 +432,7 @@ AdditionsDialog::AdditionsDialog(weld::Window* pParent, 
const OUString& sAdditio
     , m_xButtonClose(m_xBuilder->weld_button(u"buttonClose"_ustr))
     , m_xContentWindow(m_xBuilder->weld_scrolled_window(u"contentWindow"_ustr))
     , m_xContentGrid(m_xBuilder->weld_grid(u"contentGrid"_ustr))
+    , m_xButtonShowMore(m_xBuilder->weld_button(u"buttonShowMore"_ustr))
     , m_xLabelProgress(m_xBuilder->weld_label(u"labelProgress"_ustr))
     , m_xGearBtn(m_xBuilder->weld_menu_button(u"buttonGear"_ustr))
 {
@@ -443,6 +444,7 @@ AdditionsDialog::AdditionsDialog(weld::Window* pParent, 
const OUString& sAdditio
 
     m_xEntrySearch->connect_changed(LINK(this, AdditionsDialog, 
SearchUpdateHdl));
     m_xEntrySearch->connect_focus_out(LINK(this, AdditionsDialog, 
FocusOut_Impl));
+    m_xButtonShowMore->connect_clicked(LINK(this, AdditionsDialog, 
ShowMoreHdl));
     m_xButtonClose->connect_clicked(LINK(this, AdditionsDialog, 
CloseButtonHdl));
 
     m_sTag = sAdditionsTag;
@@ -619,7 +621,6 @@ AdditionsItem::AdditionsItem(weld::Grid* pParentGrid, 
AdditionsDialog* pParentDi
     , m_xImageVoting4(m_xBuilder->weld_image(u"imageVoting4"_ustr))
     , m_xImageVoting5(m_xBuilder->weld_image(u"imageVoting5"_ustr))
     , 
m_xLabelDownloadNumber(m_xBuilder->weld_label(u"labelDownloadNumber"_ustr))
-    , m_xButtonShowMore(m_xBuilder->weld_button(u"buttonShowMore"_ustr))
     , m_pParentDialog(pParentDialog)
     , m_sDownloadURL(u""_ustr)
     , m_sExtensionID(u""_ustr)
@@ -682,7 +683,6 @@ AdditionsItem::AdditionsItem(weld::Grid* pParentGrid, 
AdditionsDialog* pParentDi
     m_sDownloadURL = additionInfo.sDownloadURL;
     m_sExtensionID = additionInfo.sExtensionID;
 
-    m_xButtonShowMore->connect_clicked(LINK(this, AdditionsItem, ShowMoreHdl));
     m_xButtonInstall->connect_clicked(LINK(this, AdditionsItem, InstallHdl));
 }
 
@@ -738,14 +738,14 @@ IMPL_LINK_NOARG(AdditionsDialog, CloseButtonHdl, 
weld::Button&, void)
     this->response(RET_CLOSE);
 }
 
-IMPL_LINK_NOARG(AdditionsItem, ShowMoreHdl, weld::Button&, void)
+IMPL_LINK_NOARG(AdditionsDialog, ShowMoreHdl, weld::Button&, void)
 {
-    this->m_xButtonShowMore->set_visible(false);
-    m_pParentDialog->m_nMaxItemCount += PAGE_SIZE;
-    if (m_pParentDialog->m_pSearchThread.is())
-        m_pParentDialog->m_pSearchThread->StopExecution();
-    m_pParentDialog->m_pSearchThread = new 
SearchAndParseThread(m_pParentDialog, false);
-    m_pParentDialog->m_pSearchThread->launch();
+    m_xButtonShowMore->set_visible(false);
+    m_nMaxItemCount += PAGE_SIZE;
+    if (m_pSearchThread.is())
+        m_pSearchThread->StopExecution();
+    m_pSearchThread = new SearchAndParseThread(this, false);
+    m_pSearchThread->launch();
 }
 
 IMPL_LINK_NOARG(AdditionsItem, InstallHdl, weld::Button&, void)
diff --git a/cui/source/inc/AdditionsDialog.hxx 
b/cui/source/inc/AdditionsDialog.hxx
index e323669ee7b5..406cf8255f61 100644
--- a/cui/source/inc/AdditionsDialog.hxx
+++ b/cui/source/inc/AdditionsDialog.hxx
@@ -62,6 +62,7 @@ private:
     DECL_LINK(ImplUpdateDataHdl, Timer*, void);
     DECL_LINK(FocusOut_Impl, weld::Widget&, void);
     DECL_LINK(CloseButtonHdl, weld::Button&, void);
+    DECL_LINK(ShowMoreHdl, weld::Button&, void);
 
 public:
     css::uno::Reference<css::deployment::XExtensionManager> 
m_xExtensionManager;
@@ -72,6 +73,7 @@ public:
 
     std::unique_ptr<weld::ScrolledWindow> m_xContentWindow;
     std::unique_ptr<weld::Grid> m_xContentGrid;
+    std::unique_ptr<weld::Button> m_xButtonShowMore;
 
     std::unique_ptr<weld::Label> m_xLabelProgress;
     std::unique_ptr<weld::MenuButton> m_xGearBtn;
@@ -105,7 +107,6 @@ public:
                   const AdditionInfo& additionInfo);
     bool getExtensionFile(OUString& sExtensionFile);
 
-    DECL_LINK(ShowMoreHdl, weld::Button&, void);
     DECL_LINK(InstallHdl, weld::Button&, void);
 
     std::unique_ptr<weld::Builder> m_xBuilder;
@@ -125,7 +126,6 @@ public:
     std::unique_ptr<weld::Image> m_xImageVoting4;
     std::unique_ptr<weld::Image> m_xImageVoting5;
     std::unique_ptr<weld::Label> m_xLabelDownloadNumber;
-    std::unique_ptr<weld::Button> m_xButtonShowMore;
     AdditionsDialog* m_pParentDialog;
     OUString m_sDownloadURL;
     OUString m_sExtensionID;
diff --git a/cui/uiconfig/ui/additionsdialog.ui 
b/cui/uiconfig/ui/additionsdialog.ui
index 901a1f5cd635..8540ddb562de 100644
--- a/cui/uiconfig/ui/additionsdialog.ui
+++ b/cui/uiconfig/ui/additionsdialog.ui
@@ -236,16 +236,46 @@
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
                     <child>
-                      <!-- n-columns=1 n-rows=1 -->
-                      <object class="GtkGrid" id="contentGrid">
+                      <object class="GtkBox">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
-                        <property name="valign">start</property>
-                        <property name="hexpand">True</property>
-                        <property name="row-spacing">6</property>
-                        <property name="column-spacing">12</property>
+                        <property name="orientation">vertical</property>
                         <child>
-                          <placeholder/>
+                          <!-- n-columns=1 n-rows=1 -->
+                          <object class="GtkGrid" id="contentGrid">
+                            <property name="visible">True</property>
+                            <property name="can-focus">False</property>
+                            <property name="valign">start</property>
+                            <property name="hexpand">True</property>
+                            <property name="row-spacing">6</property>
+                            <property name="column-spacing">12</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="buttonShowMore">
+                            <property name="label" translatable="yes" 
context="additionsDialog|buttonShowMore">Show More Extensions</property>
+                            <property name="can-focus">True</property>
+                            <property name="receives-default">True</property>
+                            <child internal-child="accessible">
+                              <object class="AtkObject" 
id="buttonShowMore-atkobject">
+                                <property name="AtkObject::accessible-name" 
translatable="yes" context="additionsDialog|buttonShowMore">Button "Show 
more"</property>
+                                <property 
name="AtkObject::accessible-description" translatable="yes" 
context="additionsDialog|buttonShowMore">This button shows more 
extensions.</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
                         </child>
                       </object>
                     </child>
diff --git a/cui/uiconfig/ui/additionsfragment.ui 
b/cui/uiconfig/ui/additionsfragment.ui
index 539b5875dd82..b6ed46e38b6f 100644
--- a/cui/uiconfig/ui/additionsfragment.ui
+++ b/cui/uiconfig/ui/additionsfragment.ui
@@ -11,24 +11,6 @@
     <property name="border-width">6</property>
     <property name="row-spacing">24</property>
     <property name="column-spacing">12</property>
-    <child>
-      <object class="GtkButton" id="buttonShowMore">
-        <property name="label" translatable="yes" 
context="additionsDialog|buttonShowMore">Show More Extensions</property>
-        <property name="can-focus">True</property>
-        <property name="receives-default">True</property>
-        <child internal-child="accessible">
-          <object class="AtkObject" id="buttonShowMore-atkobject">
-            <property name="AtkObject::accessible-name" translatable="yes" 
context="additionsDialog|buttonShowMore">Button "Show more"</property>
-            <property name="AtkObject::accessible-description" 
translatable="yes" context="additionsDialog|buttonShowMore">This button shows 
more extensions.</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="left-attach">0</property>
-        <property name="top-attach">1</property>
-        <property name="width">2</property>
-      </packing>
-    </child>
     <child>
       <!-- n-columns=3 n-rows=8 -->
       <object class="GtkGrid">

Reply via email to