From 9313b6c02cc40633edfaadfc7941cbb5640368b2 Mon Sep 17 00:00:00 2001 From: Andreas Heinisch Date: Mon, 2 May 2022 19:31:26 +0200 Subject: tdf#62776 - Add tooltip for folder location shortcuts Change-Id: I326fd3c3695e5467a49688fc2164fe591aef2397 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133709 Tested-by: Jenkins Reviewed-by: Andreas Heinisch --- fpicker/source/office/PlacesListBox.cxx | 12 ++++++++++++ fpicker/source/office/PlacesListBox.hxx | 1 + fpicker/uiconfig/ui/explorerfiledialog.ui | 2 ++ 3 files changed, 15 insertions(+) (limited to 'fpicker') diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index 050cee39c113..86bd505179a3 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -29,6 +29,7 @@ PlacesListBox::PlacesListBox(std::unique_ptr xControl, mxImpl->connect_changed( LINK( this, PlacesListBox, Selection ) ); mxImpl->connect_row_activated( LINK( this, PlacesListBox, DoubleClick ) ) ; + mxImpl->connect_query_tooltip(LINK(this, PlacesListBox, QueryTooltipHdl)); } PlacesListBox::~PlacesListBox( ) @@ -136,6 +137,17 @@ IMPL_LINK_NOARG( PlacesListBox, DoubleClick, weld::TreeView&, bool ) return true; } +IMPL_LINK(PlacesListBox, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString) +{ + const OUString sText = mxImpl->get_text(rIter); + for (const auto& pPlace : maPlaces) + { + if (pPlace->GetName() == sText) + return pPlace->GetUrlObject().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous); + } + return OUString(); +} + void PlacesListBox::updateView( ) { sal_uInt32 nSelected = mxImpl->get_cursor_index(); diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx index ca507e06ae3a..ed3a0798e9e7 100644 --- a/fpicker/source/office/PlacesListBox.hxx +++ b/fpicker/source/office/PlacesListBox.hxx @@ -60,6 +60,7 @@ private: DECL_LINK( Selection, weld::TreeView&, void ); DECL_LINK( DoubleClick, weld::TreeView&, bool ); + DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/uiconfig/ui/explorerfiledialog.ui b/fpicker/uiconfig/ui/explorerfiledialog.ui index 1817d785c814..84a50b05d91c 100644 --- a/fpicker/uiconfig/ui/explorerfiledialog.ui +++ b/fpicker/uiconfig/ui/explorerfiledialog.ui @@ -293,6 +293,7 @@ True True True + Add shortcut image1 True @@ -307,6 +308,7 @@ True True True + Delete shortcut image2 True -- cgit