[Libreoffice-commits] core.git: extensions/Library_bib.mk extensions/source extensions/uiconfig
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 14 15:39:19 UTC 2021
extensions/Library_bib.mk | 1
extensions/source/bibliography/general.cxx | 25 ++++++++++++++
extensions/source/bibliography/general.hxx | 2 +
extensions/uiconfig/sbibliography/ui/generalpage.ui | 34 +++++++++++++++++---
4 files changed, 57 insertions(+), 5 deletions(-)
New commits:
commit 3be01c11e87f6989f75cc5d000afb3c4fe50b3ab
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Jul 14 16:44:08 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jul 14 17:38:43 2021 +0200
extensions: bibliography database window: add browse button for URLs
To be consistent with the Define Bibliography Entry dialog which already
had this.
Change-Id: I1f2eda189ae594dbef9c7fd4f0f1a1d12dc6ad5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118939
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/extensions/Library_bib.mk b/extensions/Library_bib.mk
index 1f04de241c23..04787f16058e 100644
--- a/extensions/Library_bib.mk
+++ b/extensions/Library_bib.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_Library_add_exception_objects,bib,\
$(eval $(call gb_Library_use_libraries,bib,\
dbtools \
+ sfx \
sot \
svt \
svl \
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index f2517ed95515..07fda81fc69f 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -25,6 +25,8 @@
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+
#include <toolkit/helper/vclunohelper.hxx>
#include <cppuhelper/implbase.hxx>
#include <vcl/event.hxx>
@@ -42,6 +44,7 @@
#include <vcl/i18nhelp.hxx>
#include <algorithm>
#include <tools/urlobj.hxx>
+#include <sfx2/filedlghelper.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -121,6 +124,7 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan)
, xNoteED(m_xBuilder->weld_entry("notecontrol"))
, xURLFT(m_xBuilder->weld_label("url"))
, xURLED(m_xBuilder->weld_entry("urlcontrol"))
+ , m_xBrowseButton(m_xBuilder->weld_button("browse"))
, xCustom1FT(m_xBuilder->weld_label("custom1"))
, xCustom1ED(m_xBuilder->weld_entry("custom1control"))
, xCustom2FT(m_xBuilder->weld_label("custom2"))
@@ -248,6 +252,8 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan)
xURLFT->get_label(), *xURLED,
sTableErrorString, HID_BIB_URL_POS);
+ m_xBrowseButton->connect_clicked(LINK(this, BibGeneralPage, BrowseHdl));
+
AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM1_POS),
xCustom1FT->get_label(), *xCustom1ED,
sTableErrorString, HID_BIB_CUSTOM1_POS);
@@ -279,6 +285,24 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan)
set_height_request(aSize.Height());
}
+IMPL_LINK_NOARG(BibGeneralPage, BrowseHdl, weld::Button&, void)
+{
+ sfx2::FileDialogHelper aFileDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ FileDialogFlags::NONE, GetFrameWeld());
+ OUString aPath = xURLED->get_text();
+ if (!aPath.isEmpty())
+ {
+ aFileDlg.SetDisplayDirectory(aPath);
+ }
+
+ if (aFileDlg.Execute() != ERRCODE_NONE)
+ {
+ return;
+ }
+
+ xURLED->set_text(aFileDlg.GetPath());
+};
+
IMPL_LINK(BibGeneralPage, FirstElementKeyInputHdl, const KeyEvent&, rKeyEvent, bool)
{
sal_uInt16 nCode = rKeyEvent.GetKeyCode().GetCode();
@@ -586,6 +610,7 @@ void BibGeneralPage::dispose()
xNoteED.reset();
xURLFT.reset();
xURLED.reset();
+ m_xBrowseButton.reset();
xCustom1FT.reset();
xCustom1ED.reset();
xCustom2FT.reset();
diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx
index 3c897bfbeb4c..acf996a52a25 100644
--- a/extensions/source/bibliography/general.hxx
+++ b/extensions/source/bibliography/general.hxx
@@ -107,6 +107,7 @@ class BibGeneralPage : public InterimItemWindow
std::unique_ptr<weld::Entry> xNoteED;
std::unique_ptr<weld::Label> xURLFT;
std::unique_ptr<weld::Entry> xURLED;
+ std::unique_ptr<weld::Button> m_xBrowseButton;
std::unique_ptr<weld::Label> xCustom1FT;
std::unique_ptr<weld::Entry> xCustom1ED;
@@ -137,6 +138,7 @@ class BibGeneralPage : public InterimItemWindow
DECL_LINK(FirstElementKeyInputHdl, const KeyEvent&, bool);
DECL_LINK(LastElementKeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(BrowseHdl, weld::Button&, void);
public:
BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan);
diff --git a/extensions/uiconfig/sbibliography/ui/generalpage.ui b/extensions/uiconfig/sbibliography/ui/generalpage.ui
index 2d16427fb6f8..8baf5fb0aa00 100644
--- a/extensions/uiconfig/sbibliography/ui/generalpage.ui
+++ b/extensions/uiconfig/sbibliography/ui/generalpage.ui
@@ -762,11 +762,35 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="urlcontrol">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="truncate-multiline">True</property>
- <property name="hexpand">True</property>
+ <object class="GtkBox" id="hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkEntry" id="urlcontrol">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="truncate-multiline">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="browse">
+ <property name="label" translatable="yes" context="generalpage|browse">Browse...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left-attach">5</property>
More information about the Libreoffice-commits
mailing list