cui/source/inc/optpath.hxx      |    1 +
 cui/source/options/optpath.cxx  |   10 ++++++++++
 cui/uiconfig/ui/optpathspage.ui |    4 ++--
 3 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 298663c36bdb64cf05bc80abb7d212ed1091b6a9
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Dec 13 20:08:09 2020 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Dec 14 09:38:29 2020 +0100

    tdf#138874 restore sort on first column of paths treeview
    
    Change-Id: I7cd831de30523a61631be5cc2f1f3b8a001d9e4d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107663
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
index d4eca9c83413..c3b9aafbbae5 100644
--- a/cui/source/inc/optpath.hxx
+++ b/cui/source/inc/optpath.hxx
@@ -49,6 +49,7 @@ private:
     DECL_LINK(StandardHdl_Impl, weld::Button&, void);
 
     DECL_LINK(PathSelect_Impl, weld::TreeView&, void);
+    DECL_LINK(HeaderBarClick, int, void);
 
     DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
 
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index b5cf2dc2378b..77432e0b7764 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -195,12 +195,20 @@ SvxPathTabPage::SvxPathTabPage(weld::Container* pPage, 
weld::DialogController* p
                                  m_xPathBox->get_height_rows(20));
 
     m_xPathBox->connect_row_activated( LINK( this, SvxPathTabPage, 
DoubleClickPathHdl_Impl ) );
+    m_xPathBox->connect_column_clicked(LINK(this, SvxPathTabPage, 
HeaderBarClick));
     m_xPathBox->connect_changed( LINK( this, SvxPathTabPage, PathSelect_Impl ) 
);
     m_xPathBox->set_selection_mode(SelectionMode::Multiple);
 
     xDialogListener->SetDialogClosedLink( LINK( this, SvxPathTabPage, 
DialogClosedHdl ) );
 }
 
+IMPL_LINK(SvxPathTabPage, HeaderBarClick, int, nColumn, void)
+{
+    bool bSortAtoZ = !m_xPathBox->get_sort_order();
+    m_xPathBox->set_sort_order(bSortAtoZ);
+    m_xPathBox->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, 
nColumn);
+}
+
 SvxPathTabPage::~SvxPathTabPage()
 {
     for (int i = 0, nEntryCount = m_xPathBox->n_children(); i < nEntryCount; 
++i)
@@ -228,6 +236,7 @@ bool SvxPathTabPage::FillItemSet( SfxItemSet* )
 void SvxPathTabPage::Reset( const SfxItemSet* )
 {
     m_xPathBox->clear();
+    m_xPathBox->make_unsorted();
 
     std::unique_ptr<weld::TreeIter> xIter = m_xPathBox->make_iterator();
     for( sal_uInt16 i = 0; i <= 
sal_uInt16(SvtPathOptions::Paths::Classification); ++i )
@@ -320,6 +329,7 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
     }
 
     m_xPathBox->columns_autosize();
+    m_xPathBox->make_sorted();
     PathSelect_Impl(*m_xPathBox);
 }
 
diff --git a/cui/uiconfig/ui/optpathspage.ui b/cui/uiconfig/ui/optpathspage.ui
index 7b436abaed43..b469c0bd98fc 100644
--- a/cui/uiconfig/ui/optpathspage.ui
+++ b/cui/uiconfig/ui/optpathspage.ui
@@ -80,6 +80,8 @@
                             <property name="resizable">True</property>
                             <property name="spacing">6</property>
                             <property name="title" translatable="yes" 
context="optpathspage|type">Type</property>
+                            <property name="clickable">True</property>
+                            <property name="sort-indicator">True</property>
                             <child>
                               <object class="GtkCellRendererPixbuf" 
id="cellrenderertext1"/>
                               <attributes>
@@ -100,7 +102,6 @@
                             <property name="resizable">True</property>
                             <property name="spacing">6</property>
                             <property name="title" translatable="yes" 
context="optpathspage|user_paths">User Paths</property>
-                            <property name="clickable">True</property>
                             <child>
                               <object class="GtkCellRendererText" 
id="cellrenderer9"/>
                               <attributes>
@@ -115,7 +116,6 @@
                             <property name="resizable">True</property>
                             <property name="spacing">6</property>
                             <property name="title" translatable="yes" 
context="optpathspage|internal_paths">Internal Paths</property>
-                            <property name="clickable">True</property>
                             <child>
                               <object class="GtkCellRendererText" 
id="cellrenderer1"/>
                               <attributes>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to