From 298663c36bdb64cf05bc80abb7d212ed1091b6a9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 13 Dec 2020 20:08:09 +0000 Subject: tdf#138874 restore sort on first column of paths treeview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7cd831de30523a61631be5cc2f1f3b8a001d9e4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107663 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- 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(-) (limited to 'cui') 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 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 @@ True 6 Type + True + True @@ -100,7 +102,6 @@ True 6 User Paths - True @@ -115,7 +116,6 @@ True 6 Internal Paths - True -- cgit