fpicker/source/office/PlacesListBox.cxx   |   12 ++++++++++++
 fpicker/source/office/PlacesListBox.hxx   |    1 +
 fpicker/uiconfig/ui/explorerfiledialog.ui |    2 ++
 3 files changed, 15 insertions(+)

New commits:
commit 9313b6c02cc40633edfaadfc7941cbb5640368b2
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Mon May 2 19:31:26 2022 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Sat May 7 11:09:32 2022 +0200

    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 <andreas.heini...@yahoo.de>

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<weld::TreeView> 
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 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property 
name="receives_default">True</property>
+                                    <property name="tooltip_text" 
translatable="yes" context="explorerfiledialog|add">Add shortcut</property>
                                     <property name="image">image1</property>
                                     <property 
name="always_show_image">True</property>
                                   </object>
@@ -307,6 +308,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property 
name="receives_default">True</property>
+                                    <property name="tooltip_text" 
translatable="yes" context="explorerfiledialog|add">Delete shortcut</property>
                                     <property name="image">image2</property>
                                     <property 
name="always_show_image">True</property>
                                   </object>

Reply via email to