sw/source/ui/index/swuiidxmrk.cxx |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 869acd8315af695ff79594fc6a498abb8371103a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Apr 14 15:07:33 2021 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Apr 14 16:17:50 2021 +0200

    sw define bibliography entry dialog: set browse button visibility based on 
type
    
    Show the browse button exactly when the biblio entry type is a local
    file. This needs to always weld the browse button, just not showing it
    initially in the non-local-file-type case.
    
    Change-Id: I8965bb87d0d7c362695b27d5278c0e7b03158e73
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114094
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index 464614f7eeb3..a8c8df620753 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1629,6 +1629,11 @@ 
SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
             pEdits[nIndex]->set_text(pFields[aCurInfo.nToxField]);
             pEdits[nIndex]->show();
             pEdits[nIndex]->set_help_id(aCurInfo.pHelpId);
+            if (aCurInfo.nToxField == AUTH_FIELD_URL)
+            {
+                m_xBrowseButton = m_aBuilders.back()->weld_button("browse");
+                m_xBrowseButton->connect_clicked(LINK(this, 
SwCreateAuthEntryDlg_Impl, BrowseHdl));
+            }
             if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
             {
                 pEdits[nIndex]->connect_changed(LINK(this, 
SwCreateAuthEntryDlg_Impl, ShortNameHdl));
@@ -1642,8 +1647,6 @@ 
SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
             else if (aCurInfo.nToxField == AUTH_FIELD_URL
                      && IsFileUrl(rWrtSh, pFields[aCurInfo.nToxField]))
             {
-                m_xBrowseButton = m_aBuilders.back()->weld_button("browse");
-                m_xBrowseButton->connect_clicked(LINK(this, 
SwCreateAuthEntryDlg_Impl, BrowseHdl));
                 m_xBrowseButton->show();
             }
 
@@ -1729,6 +1732,18 @@ IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, 
weld::Entry&, rEdit, void)
 IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, weld::ComboBox&, rBox, void)
 {
     m_xOKBT->set_sensitive(m_bNameAllowed && rBox.get_active() != -1);
+
+    int nType = m_xTypeListBox->get_active();
+    if (nType == AUTH_TYPE_END && !m_xBrowseButton->is_visible())
+    {
+        // File URL -> show the browse button.
+        m_xBrowseButton->show();
+    }
+    else if (nType != AUTH_TYPE_END && m_xBrowseButton->is_visible())
+    {
+        // Not a file URL -> hide the browse button.
+        m_xBrowseButton->hide();
+    }
 };
 
 IMPL_LINK_NOARG(SwCreateAuthEntryDlg_Impl, BrowseHdl, weld::Button&, void)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to