summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-04-14 15:07:33 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-04-14 16:17:50 +0200
commit869acd8315af695ff79594fc6a498abb8371103a (patch)
treeca85679d02819535015ce5d261dd6b0d023529ce /sw
parenta199e4ea389c934d169a178433f4b94033e60f93 (diff)
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 <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx19
1 files changed, 17 insertions, 2 deletions
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)