cui/source/options/optsave.cxx | 32 -------------------------------- include/unotools/optionsdlg.hxx | 3 --- unotools/source/config/optionsdlg.cxx | 22 ++-------------------- 3 files changed, 2 insertions(+), 55 deletions(-)
New commits: commit 09f6ad451156cdc5c2d0f398237a72b99598f32f Author: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> AuthorDate: Wed Jan 17 17:31:47 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Mon Jan 22 08:30:54 2024 +0100 Remove DetectHiddenControls method of locking down UI It is used only on the Load/Save - General page, and it's redundant with using officecfg methods and setting UI elements representing locked down keys as insensitive + showing a lock icon Change-Id: I689e7925198f8aac60b5711bf1c349c45a5ab62a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162267 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index 4c292a75ac3a..3a05d369beea 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -40,7 +40,6 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <sfx2/sfxsids.hrc> #include <sfx2/docfilt.hxx> -#include <unotools/optionsdlg.hxx> #include <osl/diagnose.h> #include <comphelper/diagnose_ex.hxx> #include <officecfg/Office/Recovery.hxx> @@ -55,8 +54,6 @@ using namespace com::sun::star::beans; using namespace com::sun::star::container; using namespace comphelper; -#define CFG_PAGE_AND_GROUP u"General", u"LoadSave" - struct SvxSaveTabPage_Impl { @@ -210,8 +207,6 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p aLink = LINK( this, SvxSaveTabPage, FilterHdl_Impl ); m_xDocTypeLB->connect_changed( aLink ); m_xSaveAsLB->connect_changed( aLink ); - - DetectHiddenControls(); } SvxSaveTabPage::~SvxSaveTabPage() @@ -224,33 +219,6 @@ std::unique_ptr<SfxTabPage> SvxSaveTabPage::Create(weld::Container* pPage, weld: return std::make_unique<SvxSaveTabPage>(pPage, pController, *rAttrSet); } -void SvxSaveTabPage::DetectHiddenControls() -{ - SvtOptionsDialogOptions aOptionsDlgOpt; - - if ( aOptionsDlgOpt.IsOptionHidden( u"Backup", CFG_PAGE_AND_GROUP ) ) - { - // hide controls of "Backup" - m_xBackupCB->hide(); - m_xBackupIntoDocumentFolderCB->hide(); - } - - if ( aOptionsDlgOpt.IsOptionHidden( u"AutoSave", CFG_PAGE_AND_GROUP ) ) - { - // hide controls of "AutoSave" - m_xAutoSaveCB->hide(); - m_xAutoSaveEdit->hide(); - m_xMinuteFT->hide(); - } - - if ( aOptionsDlgOpt.IsOptionHidden( u"UserAutoSave", CFG_PAGE_AND_GROUP ) ) - { - // hide controls of "UserAutoSave" - m_xUserAutoSaveCB->hide(); - } - -} - OUString SvxSaveTabPage::GetAllStrings() { OUString sAllStrings; diff --git a/include/unotools/optionsdlg.hxx b/include/unotools/optionsdlg.hxx index 4e0d78245b65..0be3fa149522 100644 --- a/include/unotools/optionsdlg.hxx +++ b/include/unotools/optionsdlg.hxx @@ -36,9 +36,6 @@ public: bool IsGroupHidden ( std::u16string_view _rGroup ) const; bool IsPageHidden ( std::u16string_view _rPage, std::u16string_view _rGroup ) const; - bool IsOptionHidden ( std::u16string_view _rOption, - std::u16string_view _rPage, - std::u16string_view _rGroup ) const; private: bool IsHidden( const OUString& _rPath ) const; diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx index c88bd095106c..35e964afbf08 100644 --- a/unotools/source/config/optionsdlg.cxx +++ b/unotools/source/config/optionsdlg.cxx @@ -30,10 +30,9 @@ using namespace com::sun::star::uno; constexpr OUString ROOT_NODE = u"OptionsDialogGroups"_ustr; constexpr OUString PAGES_NODE = u"Pages"_ustr; -constexpr OUString OPTIONS_NODE = u"Options"_ustr; namespace { - enum NodeType{ NT_Group, NT_Page, NT_Option }; + enum NodeType{ NT_Group, NT_Option }; } constexpr OUString g_sPathDelimiter = u"/"_ustr; static void ReadNode( @@ -72,13 +71,6 @@ static void ReadNode( break; } - case NT_Page : - { - sSet = OPTIONS_NODE; - nLen = 2; - break; - } - case NT_Option : { nLen = 1; @@ -106,7 +98,7 @@ static void ReadNode( for ( const auto& rNode : aNodes ) { OUString sSubNodeName( sNodes + g_sPathDelimiter + rNode ); - ReadNode( xHierarchyAccess, aOptionNodeList, sSubNodeName, _eType == NT_Group ? NT_Page : NT_Option ); + ReadNode( xHierarchyAccess, aOptionNodeList, sSubNodeName, NT_Option ); } } } @@ -119,10 +111,6 @@ static OUString getPagePath( std::u16string_view _rPage ) { return OUString( OUString::Concat(PAGES_NODE) + "/" + _rPage + "/" ); } -static OUString getOptionPath( std::u16string_view _rOption ) -{ - return OUString( OUString::Concat(OPTIONS_NODE) + "/" + _rOption + "/" ); -} bool SvtOptionsDialogOptions::IsHidden( const OUString& _rPath ) const { @@ -143,10 +131,4 @@ bool SvtOptionsDialogOptions::IsPageHidden( std::u16string_view _rPage, std::u16 return IsHidden( getGroupPath( _rGroup ) + getPagePath( _rPage ) ); } -bool SvtOptionsDialogOptions::IsOptionHidden( - std::u16string_view _rOption, std::u16string_view _rPage, std::u16string_view _rGroup ) const -{ - return IsHidden( getGroupPath( _rGroup ) + getPagePath( _rPage ) + getOptionPath( _rOption ) ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */