sw/qa/uitest/navigator/tdf114724.py | 5 +++++ sw/source/uibase/utlui/navipi.cxx | 25 +++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-)
New commits: commit 11d3ff1b64424d4f2c660539872f981ab3ed80c8 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Wed Oct 27 21:43:10 2021 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Thu Nov 11 06:59:56 2021 +0100 SwNavigator: use stored root-type setting for both Navigator types Currently the RootType setting stored in Navigator configuration is used only by the floating Navigator to restore the root type setting on program start to the setting at the end of the previous session. This patch makes the sidebar Navigator use this stored setting. Change-Id: I654f4eb4890351196e64796e4a48031424259a5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124456 Tested-by: Jenkins Reviewed-by: Jim Raykowski <rayk...@gmail.com> diff --git a/sw/qa/uitest/navigator/tdf114724.py b/sw/qa/uitest/navigator/tdf114724.py index ebb354bf37b2..ee1f572d38ed 100644 --- a/sw/qa/uitest/navigator/tdf114724.py +++ b/sw/qa/uitest/navigator/tdf114724.py @@ -45,6 +45,11 @@ class tdf114724(UITestCase): self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1") self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") + # tdf#124456 makes the sidebar navigator consistent with the floating navigator's use + # of the stored root mode setting. This requires the root mode button to be clicked + # here to change the content navigation view back to all categories view for subsequent + # tests that expect the navigator tree to not be in root mode. + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button self.xUITest.executeCommand(".uno:Sidebar") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index feee92814c34..f964a86957c8 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -538,6 +538,19 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xContentTree->SetFieldTracking(m_pConfig->IsFieldTracking()); m_xContentTree->SetFootnoteTracking(m_pConfig->IsFootnoteTracking()); + if (const ContentTypeId nRootType = m_pConfig->GetRootType(); + nRootType != ContentTypeId::UNKNOWN) + { + m_xContentTree->SetRootType(nRootType); + m_xContent5ToolBox->set_item_active("root", true); + if (nRootType == ContentTypeId::OUTLINE || nRootType == ContentTypeId::DRAWOBJECT) + m_xContentTree->set_selection_mode(SelectionMode::Multiple); + else + m_xContentTree->set_selection_mode(SelectionMode::Single); + } + else + m_xContentTree->set_selection_mode(SelectionMode::Single); + UpdateInitShow(); GetCreateView(); @@ -592,7 +605,6 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, SetRegionDropMode(m_pConfig->GetRegionMode()); - m_xContentTree->set_selection_mode(SelectionMode::Single); m_xContentTree->ShowTree(); m_xContent6ToolBox->set_item_active("listbox", true); m_xContent6ToolBox->set_item_sensitive("listbox", bFloatingNavigator); @@ -1137,17 +1149,6 @@ SwNavigatorWin::SwNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig(); - const ContentTypeId nRootType = pNaviConfig->GetRootType(); - if( nRootType != ContentTypeId::UNKNOWN ) - { - m_xNavi->m_xContentTree->SetRootType(nRootType); - m_xNavi->m_xContent5ToolBox->set_item_active("root", true); - if (nRootType == ContentTypeId::OUTLINE || nRootType == ContentTypeId::DRAWOBJECT) - { - m_xNavi->m_xContentTree->set_selection_mode(SelectionMode::Multiple); - } - } - SetMinOutputSizePixel(GetOptimalSize()); if (pNaviConfig->IsSmall()) m_xNavi->ZoomIn();