sfx2/source/dialog/filedlghelper.cxx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
New commits: commit 86276a0ae8ae86fdafcf2af48df1054f8d8ad3c4 Author: Moritz Duge <moritz.d...@allotropia.de> AuthorDate: Thu May 23 18:10:00 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Mon Jul 15 20:43:38 2024 +0200 Simplify boolean logic locally for mbIsPwdEnabled. Change-Id: I2b2611e51ce0fdffdd25a75b211ce06b5bfd6b43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167999 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Tested-by: Jenkins diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 08cdccc65a83..70199c8dffd0 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -512,7 +512,8 @@ void FileDialogHelper_Impl::enablePasswordBox( bool bInit ) if ( ! mbHasPassword ) return; - bool bWasEnabled = mbIsPwdEnabled; + // in case of initialization assume previous state to be false + bool bWasEnabled = !bInit && mbIsPwdEnabled; std::shared_ptr<const SfxFilter> pCurrentFilter = getCurrentSfxFilter(); mbIsPwdEnabled = updateExtendedControl( @@ -520,17 +521,7 @@ void FileDialogHelper_Impl::enablePasswordBox( bool bInit ) pCurrentFilter && ( pCurrentFilter->GetFilterFlags() & SfxFilterFlags::ENCRYPTION ) ); - if( bInit ) - { - // in case of initialization previous state is not interesting - if( mbIsPwdEnabled ) - { - uno::Reference< XFilePickerControlAccess > xCtrlAccess( mxFileDlg, UNO_QUERY ); - if( mbPwdCheckBoxState ) - xCtrlAccess->setValue( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, 0, Any( true ) ); - } - } - else if( !bWasEnabled && mbIsPwdEnabled ) + if( !bWasEnabled && mbIsPwdEnabled ) { uno::Reference< XFilePickerControlAccess > xCtrlAccess( mxFileDlg, UNO_QUERY ); if( mbPwdCheckBoxState )