include/sfx2/passwd.hxx       |    5 ++-
 sfx2/source/dialog/passwd.cxx |   46 ++++++++++++++------------------
 vcl/unx/gtk3/gtkinst.cxx      |   60 ++++++++++++++----------------------------
 3 files changed, 44 insertions(+), 67 deletions(-)

New commits:
commit 12b57a17ef58568c9d6a4bb99a7da4798cf1f4dd
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri Jan 23 11:24:03 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Jan 23 22:04:17 2026 +0100

    gtk weld: Deduplicate weld::ItemView::n_children impls
    
    GtkInstanceTreeView and GtkInstanceIconView implement
    the same logic.
    Deduplicate by moving it to the shared
    GtkInstanceItemView base class.
    
    Change-Id: I120a7f4fbc8879dfec3614df94104d26e4a88768
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197939
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 0649ada4f3c6..5b8afb7004f5 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -13943,6 +13943,11 @@ public:
 
         return {};
     }
+
+    virtual int n_children() const override
+    {
+        return gtk_tree_model_iter_n_children(m_pTreeModel, nullptr);
+    }
 };
 
 class GtkInstanceTreeView : public GtkInstanceItemView, public virtual 
weld::TreeView
@@ -15191,11 +15196,6 @@ public:
         enable_notify_events();
     }
 
-    virtual int n_children() const override
-    {
-        return gtk_tree_model_iter_n_children(m_pTreeModel, nullptr);
-    }
-
     virtual int iter_n_children(const weld::TreeIter& rIter) const override
     {
         const GtkInstanceTreeIter& rGtkIter = static_cast<const 
GtkInstanceTreeIter&>(rIter);
@@ -16909,11 +16909,6 @@ public:
         enable_notify_events();
     }
 
-    virtual int n_children() const override
-    {
-        return gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_pTreeStore), 
nullptr);
-    }
-
     virtual OUString get_id(const weld::TreeIter& rIter) const override
     {
         const GtkInstanceTreeIter& rGtkIter = static_cast<const 
GtkInstanceTreeIter&>(rIter);
commit a691da9579d0638fb69df1022bbcb8c70e040a5f
Author:     Xisco Fauli <[email protected]>
AuthorDate: Fri Jan 23 19:04:11 2026 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Jan 23 22:04:14 2026 +0100

    sfx2: simplify code a bit
    
    * No need to use an array
    * No need to call set_from_icon_name in the constructor.
    all the toggles are not active at that point and
    the .ui file already uses
    <property name="icon-name">res/hidepass.png</property>
    for all of them
    
    Change-Id: I0709d9afdee4ab53b91f721e1e91b97e93c1698f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198020
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx
index e5879dc485d5..82053ed428a5 100644
--- a/include/sfx2/passwd.hxx
+++ b/include/sfx2/passwd.hxx
@@ -69,7 +69,10 @@ private:
 
     std::unique_ptr<weld::Button> m_xOKBtn;
 
-    std::array<std::unique_ptr<weld::ToggleButton>, 4> m_xPass;
+    std::unique_ptr<weld::ToggleButton> m_xBtn1;
+    std::unique_ptr<weld::ToggleButton> m_xBtn2;
+    std::unique_ptr<weld::ToggleButton> m_xBtn3;
+    std::unique_ptr<weld::ToggleButton> m_xBtn4;
 
     std::shared_ptr<weld::MessageDialog> m_xConfirmFailedDialog;
 
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index cc00041fcb67..fdcb6a86d22a 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -148,62 +148,62 @@ IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl, weld::Button&, 
void)
 IMPL_LINK(SfxPasswordDialog, ShowHdl, weld::Toggleable&, rToggleable, void)
 {
     bool bChecked = rToggleable.get_active();
-    if (&rToggleable == m_xPass[0].get())
+    if (&rToggleable == m_xBtn1.get())
     {
         if (bChecked)
         {
-            m_xPass[0]->set_from_icon_name(RID_SVXBMP_SHOWPASS);
+            m_xBtn1->set_from_icon_name(RID_SVXBMP_SHOWPASS);
             m_xPassword1ED->set_visibility(true);
             m_xPassword1ED->grab_focus();
         }
         else
         {
-            m_xPass[0]->set_from_icon_name(RID_SVXBMP_HIDEPASS);
+            m_xBtn1->set_from_icon_name(RID_SVXBMP_HIDEPASS);
             m_xPassword1ED->set_visibility(false);
             m_xPassword1ED->grab_focus();
         }
     }
-    else if (&rToggleable == m_xPass[1].get())
+    else if (&rToggleable == m_xBtn2.get())
     {
         if (bChecked)
         {
-            m_xPass[1]->set_from_icon_name(RID_SVXBMP_SHOWPASS);
+            m_xBtn2->set_from_icon_name(RID_SVXBMP_SHOWPASS);
             m_xConfirm1ED->set_visibility(true);
             m_xConfirm1ED->grab_focus();
         }
         else
         {
-            m_xPass[1]->set_from_icon_name(RID_SVXBMP_HIDEPASS);
+            m_xBtn2->set_from_icon_name(RID_SVXBMP_HIDEPASS);
             m_xConfirm1ED->set_visibility(false);
             m_xConfirm1ED->grab_focus();
         }
     }
-    else if (&rToggleable == m_xPass[2].get())
+    else if (&rToggleable == m_xBtn3.get())
     {
         if (bChecked)
         {
-            m_xPass[2]->set_from_icon_name(RID_SVXBMP_SHOWPASS);
+            m_xBtn3->set_from_icon_name(RID_SVXBMP_SHOWPASS);
             m_xPassword2ED->set_visibility(true);
             m_xPassword2ED->grab_focus();
         }
         else
         {
-            m_xPass[2]->set_from_icon_name(RID_SVXBMP_HIDEPASS);
+            m_xBtn3->set_from_icon_name(RID_SVXBMP_HIDEPASS);
             m_xPassword2ED->set_visibility(false);
             m_xPassword2ED->grab_focus();
         }
     }
-    else if (&rToggleable == m_xPass[3].get())
+    else if (&rToggleable == m_xBtn4.get())
     {
         if (bChecked)
         {
-            m_xPass[3]->set_from_icon_name(RID_SVXBMP_SHOWPASS);
+            m_xBtn4->set_from_icon_name(RID_SVXBMP_SHOWPASS);
             m_xConfirm2ED->set_visibility(true);
             m_xConfirm2ED->grab_focus();
         }
         else
         {
-            m_xPass[3]->set_from_icon_name(RID_SVXBMP_HIDEPASS);
+            m_xBtn4->set_from_icon_name(RID_SVXBMP_HIDEPASS);
             m_xConfirm2ED->set_visibility(false);
             m_xConfirm2ED->grab_focus();
         }
@@ -236,6 +236,10 @@ SfxPasswordDialog::SfxPasswordDialog(weld::Widget* 
pParent, const OUString* pGro
     , m_xMinLengthFT(m_xBuilder->weld_label(u"minlenft"_ustr))
     , m_xOnlyAsciiFT(m_xBuilder->weld_label(u"onlyascii"_ustr))
     , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr))
+    , m_xBtn1(m_xBuilder->weld_toggle_button(u"togglebt1"_ustr))
+    , m_xBtn2(m_xBuilder->weld_toggle_button(u"togglebt2"_ustr))
+    , m_xBtn3(m_xBuilder->weld_toggle_button(u"togglebt3"_ustr))
+    , m_xBtn4(m_xBuilder->weld_toggle_button(u"togglebt4"_ustr))
     , maMinLenPwdStr(SfxResId(STR_PASSWD_MIN_LEN))
     , maMinLenPwdStr1(SfxResId(STR_PASSWD_MIN_LEN1))
     , maEmptyPwdStr(SfxResId(STR_PASSWD_EMPTY))
@@ -254,21 +258,11 @@ SfxPasswordDialog::SfxPasswordDialog(weld::Widget* 
pParent, const OUString* pGro
     m_xConfirm2ED->connect_insert_text(aLink2);
     m_xOKBtn->connect_clicked(LINK(this, SfxPasswordDialog, OKHdl));
 
-    m_xPass[0] = m_xBuilder->weld_toggle_button(u"togglebt1"_ustr);
-    m_xPass[1] = m_xBuilder->weld_toggle_button(u"togglebt2"_ustr);
-    m_xPass[2] = m_xBuilder->weld_toggle_button(u"togglebt3"_ustr);
-    m_xPass[3] = m_xBuilder->weld_toggle_button(u"togglebt4"_ustr);
-
     Link<weld::Toggleable&, void> aToggleLink = LINK(this, SfxPasswordDialog, 
ShowHdl);
-
-    for (auto& aPass : m_xPass)
-    {
-        if (aPass->get_active())
-            aPass->set_from_icon_name(RID_SVXBMP_SHOWPASS);
-        else
-            aPass->set_from_icon_name(RID_SVXBMP_HIDEPASS);
-        aPass->connect_toggled(aToggleLink);
-    }
+    m_xBtn1->connect_toggled(aToggleLink);
+    m_xBtn2->connect_toggled(aToggleLink);
+    m_xBtn3->connect_toggled(aToggleLink);
+    m_xBtn4->connect_toggled(aToggleLink);
 
     if(moPasswordPolicy)
     {
commit f248cf11eb35de204e10eac88c64ae6f99a5d0c0
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri Jan 23 11:16:37 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Jan 23 22:04:06 2026 +0100

    gtk weld: Deduplicate weld::ItemView::get_iter_index_in_parent impls
    
    GtkInstanceTreeView and GtkInstanceIconView implement
    the same logic.
    Deduplicate by moving it to the shared
    GtkInstanceItemView base class.
    
    Change-Id: I7091731b705fc9597cea3df6255669977beabdf8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197933
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 12dfbdc7eed5..0649ada4f3c6 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -13920,6 +13920,21 @@ public:
         return true;
     }
 
+    virtual int get_iter_index_in_parent(const weld::TreeIter& rIter) const 
override
+    {
+        const GtkInstanceTreeIter& rGtkIter = static_cast<const 
GtkInstanceTreeIter&>(rIter);
+
+        GtkTreePath* path = gtk_tree_model_get_path(m_pTreeModel, 
const_cast<GtkTreeIter*>(&rGtkIter.iter));
+
+        gint depth;
+        gint* indices = gtk_tree_path_get_indices_with_depth(path, &depth);
+        int nRet = indices[depth-1];
+
+        gtk_tree_path_free(path);
+
+        return nRet;
+    }
+
     virtual std::unique_ptr<weld::TreeIter> get_iterator(int nPos) const 
override
     {
         GtkTreeIter iter;
@@ -15446,21 +15461,6 @@ public:
         set_image(rGtkIter.iter, col, getPixbuf(rImage));
     }
 
-    virtual int get_iter_index_in_parent(const weld::TreeIter& rIter) const 
override
-    {
-        const GtkInstanceTreeIter& rGtkIter = static_cast<const 
GtkInstanceTreeIter&>(rIter);
-
-        GtkTreePath* path = gtk_tree_model_get_path(m_pTreeModel, 
const_cast<GtkTreeIter*>(&rGtkIter.iter));
-
-        gint depth;
-        gint* indices = gtk_tree_path_get_indices_with_depth(path, &depth);
-        int nRet = indices[depth-1];
-
-        gtk_tree_path_free(path);
-
-        return nRet;
-    }
-
     virtual int iter_compare(const weld::TreeIter& a, const weld::TreeIter& b) 
const override
     {
         const GtkInstanceTreeIter& rGtkIterA = static_cast<const 
GtkInstanceTreeIter&>(a);
@@ -16865,21 +16865,6 @@ public:
         enable_notify_events();
     }
 
-    virtual int get_iter_index_in_parent(const weld::TreeIter& rIter) const 
override
-    {
-        const GtkInstanceTreeIter& rGtkIter = static_cast<const 
GtkInstanceTreeIter&>(rIter);
-
-        GtkTreePath* path = 
gtk_tree_model_get_path(GTK_TREE_MODEL(m_pTreeStore), 
const_cast<GtkTreeIter*>(&rGtkIter.iter));
-
-        gint depth;
-        gint* indices = gtk_tree_path_get_indices_with_depth(path, &depth);
-        int nRet = indices[depth-1];
-
-        gtk_tree_path_free(path);
-
-        return nRet;
-    }
-
     virtual void do_scroll_to_item(const weld::TreeIter& rIter) override
     {
         assert(gtk_icon_view_get_model(m_pIconView) && "don't select when 
frozen, select after thaw. Note selection doesn't survive a freeze");

Reply via email to