include/sfx2/dinfdlg.hxx | 5 +++- sfx2/source/dialog/dinfdlg.cxx | 20 ++++++++++++---- sfx2/uiconfig/ui/documentinfopage.ui | 42 ++++++++++++++++++++++------------- 3 files changed, 46 insertions(+), 21 deletions(-)
New commits: commit 2bed6c66107382c2f139fd7ea0a3ea39bbd242d8 Author: Heiko Tietze <[email protected]> AuthorDate: Wed Dec 10 12:20:12 2025 +0100 Commit: Heiko Tietze <[email protected]> CommitDate: Thu Dec 11 10:04:39 2025 +0100 Resolves tdf#169909 - Make file URL copyable in document properties Link button replaced by Label/Button Change-Id: I24e7298e770d56a122e3abe06fee0e7f40ba521f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195373 Reviewed-by: Heiko Tietze <[email protected]> Tested-by: Jenkins (cherry picked from commit ea37a0ab8f25b3946429d7f3ac3ebefa33da7a4b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195401 diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 17ec9d15dc39..056a4badd507 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -188,6 +188,7 @@ class SfxDocumentPage final : public SfxTabPage private: OUString m_aUnknownSize; OUString m_aMultiSignedStr; + OUString m_sFileURL; bool bEnableUseUserData : 1, bHandleDelete : 1; @@ -197,7 +198,8 @@ private: std::unique_ptr<weld::Button> m_xChangePassBtn; std::unique_ptr<weld::Label> m_xShowTypeFT; - std::unique_ptr<weld::LinkButton> m_xFileValEd; + std::unique_ptr<weld::Label> m_xFileValEd; + std::unique_ptr<weld::Button> m_xFileValBtn; std::unique_ptr<weld::Label> m_xShowSizeFT; std::unique_ptr<weld::Label> m_xCreateValFt; @@ -217,6 +219,7 @@ private: std::unique_ptr<weld::CheckButton> m_xImagePreferredDpiCheckButton; std::unique_ptr<weld::ComboBox> m_xImagePreferredDpiComboBox; + DECL_LINK(FileValHdl, weld::Button&, void); DECL_LINK(DeleteHdl, weld::Button&, void); DECL_LINK(SignatureHdl, weld::Button&, void); DECL_LINK(ChangePassHdl, weld::Button&, void); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index cd5ebf6cb4f8..e1dd1bc3b6eb 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -39,6 +39,7 @@ #include <sal/log.hxx> #include <osl/diagnose.h> #include <osl/file.hxx> +#include <openuriexternally.hxx> #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <tools/json_writer.hxx> @@ -801,7 +802,8 @@ SfxDocumentPage::SfxDocumentPage(weld::Container* pPage, weld::DialogController* , m_xNameED(m_xBuilder->weld_label(u"nameed"_ustr)) , m_xChangePassBtn(m_xBuilder->weld_button(u"changepass"_ustr)) , m_xShowTypeFT(m_xBuilder->weld_label(u"showtype"_ustr)) - , m_xFileValEd(m_xBuilder->weld_link_button(u"showlocation"_ustr)) + , m_xFileValEd(m_xBuilder->weld_label(u"showlocation"_ustr)) + , m_xFileValBtn(m_xBuilder->weld_button(u"btnShowLocation"_ustr)) , m_xShowSizeFT(m_xBuilder->weld_label(u"showsize"_ustr)) , m_xCreateValFt(m_xBuilder->weld_label(u"showcreate"_ustr)) , m_xChangeValFt(m_xBuilder->weld_label(u"showmodify"_ustr)) @@ -852,6 +854,11 @@ SfxDocumentPage::~SfxDocumentPage() } } +IMPL_LINK_NOARG(SfxDocumentPage, FileValHdl, weld::Button&, void) +{ + sfx2::openUriExternally(m_sFileURL, false, GetFrameWeld()); +} + IMPL_LINK_NOARG(SfxDocumentPage, DeleteHdl, weld::Button&, void) { OUString aName; @@ -1137,12 +1144,13 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) aDescription = SfxResId( STR_SFX_NEWOFFICEDOC ); m_xShowTypeFT->set_label( aDescription ); + m_sFileURL.clear(); // determine location // online we don't know file location so we just set it as the name if (comphelper::LibreOfficeKit::isActive()) { m_xFileValEd->set_label(aName); - m_xFileValEd->set_uri(aName); + m_sFileURL = aName; // Disable setting/changing password on text files. // Perhaps this needs to be done for both Online and Desktop. @@ -1168,15 +1176,17 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) m_xFileValEd->set_label(aText); OUString aURLStr; osl::FileBase::getFileURLFromSystemPath(aText, aURLStr); - m_xFileValEd->set_uri(aURLStr); + m_sFileURL = aURLStr; } else if (aURL.GetProtocol() != INetProtocol::PrivSoffice) { m_xFileValEd->set_label(aURL.GetPartBeforeLastName()); - m_xFileValEd->set_uri(m_xFileValEd->get_label()); + m_sFileURL = m_xFileValEd->get_label(); } } - + m_xFileValBtn->connect_clicked( LINK( this, SfxDocumentPage, FileValHdl ) ); + if (m_sFileURL.isEmpty()) + m_xFileValBtn->set_sensitive(false); // handle access data bool bUseUserData = rInfoItem.IsUseUserData(); diff --git a/sfx2/uiconfig/ui/documentinfopage.ui b/sfx2/uiconfig/ui/documentinfopage.ui index 18616177287a..b3aab1c301b4 100644 --- a/sfx2/uiconfig/ui/documentinfopage.ui +++ b/sfx2/uiconfig/ui/documentinfopage.ui @@ -378,20 +378,6 @@ <property name="top-attach">0</property> </packing> </child> - <child> - <object class="GtkLinkButton" id="showlocation"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="relief">none</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">2</property> - <property name="width">2</property> - </packing> - </child> <child> <object class="GtkCheckButton" id="thumbnailsavecb"> <property name="label" translatable="yes" context="documentinfopage|thumbnailsavecb">Save preview image with this document</property> @@ -443,8 +429,8 @@ </items> <child internal-child="entry"> <object class="GtkEntry"> - <property name="truncate-multiline">True</property> <property name="can-focus">False</property> + <property name="truncate-multiline">True</property> </object> </child> <accessibility> @@ -477,6 +463,32 @@ <property name="top-attach">13</property> </packing> </child> + <child> + <object class="GtkButton" id="btnShowLocation"> + <property name="label" translatable="yes" context="documentinfopage|btnShowLocation">Open</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="showlocation"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">center</property> + <property name="selectable">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">2</property> + </packing> + </child> <child> <placeholder/> </child>
