uui/source/secmacrowarnings.cxx | 13 +++++++++---- uui/source/secmacrowarnings.hxx | 1 + uui/uiconfig/ui/macrowarnmedium.ui | 19 ++++++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-)
New commits: commit 7bf02b035033c87ebd61742dbd3f71da0229114f Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Mon Dec 11 14:11:42 2023 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Thu Dec 14 16:12:26 2023 +0100 tdf#158576 This button shows a certificate when only one signature found "Show signatures" should only be shown when there are multiple signatures, otherwise the button label must be "Show certificate" Change-Id: Iaed2d10b8e94bf6decad937dafef4795b7ed40dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160596 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> (cherry picked from commit a383794fba07cb6a356274febd55968fb25f77e4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160754 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx index 6ccf48ba4945..eb93c9d13815 100644 --- a/uui/source/secmacrowarnings.cxx +++ b/uui/source/secmacrowarnings.cxx @@ -68,6 +68,7 @@ MacroWarning::MacroWarning(weld::Window* pParent, bool _bWithSignatures) , mxNotYetValid(m_xBuilder->weld_label("certNotYetValidLabel")) , mxNoLongerValid(m_xBuilder->weld_label("certNoLongerValidLabel")) , mxViewSignsBtn(m_xBuilder->weld_button("viewSignsButton")) + , mxViewCertBtn(m_xBuilder->weld_button("viewCertButton")) , mxAlwaysTrustCB(m_xBuilder->weld_check_button("alwaysTrustCheckbutton")) , mxEnableBtn(m_xBuilder->weld_button("ok")) , mxDisableBtn(m_xBuilder->weld_button("cancel")) @@ -156,10 +157,12 @@ void MacroWarning::InitControls() // show signature controls? if (mbShowSignatures) { + mxAlwaysTrustCB->connect_toggled(LINK(this, MacroWarning, AlwaysTrustCheckHdl)); mxAlwaysTrustCB->set_sensitive(false); mxViewSignsBtn->connect_clicked(LINK(this, MacroWarning, ViewSignsBtnHdl)); - mxViewSignsBtn->set_sensitive(false); - mxAlwaysTrustCB->connect_toggled(LINK(this, MacroWarning, AlwaysTrustCheckHdl)); + mxViewSignsBtn->set_visible(false); + mxViewCertBtn->connect_clicked(LINK(this, MacroWarning, ViewSignsBtnHdl)); + mxViewCertBtn->set_visible(false); mnActSecLevel = SvtSecurityOptions::GetMacroSecurityLevel(); if ( mnActSecLevel >= 2 ) @@ -192,7 +195,8 @@ void MacroWarning::SetStorage( const css::uno::Reference < css::embed::XStorage } mxSignsFI->set_label(s.makeStringAndClear()); - mxViewSignsBtn->set_sensitive(true); + mxViewSignsBtn->set_visible(true); + mxViewCertBtn->set_visible(false); } void MacroWarning::SetCertificate( const css::uno::Reference< css::security::XCertificate >& _rxCert ) @@ -210,7 +214,8 @@ void MacroWarning::SetCertificate( const css::uno::Reference< css::security::XCe utl::typeConvert( mxCert->getNotValidAfter(), aDateTimeEnd ); mxNotYetValid->set_visible(now < aDateTimeStart); mxNoLongerValid->set_visible(now > aDateTimeEnd); - mxViewSignsBtn->set_sensitive(true); + mxViewSignsBtn->set_visible(false); + mxViewCertBtn->set_visible(true); } } diff --git a/uui/source/secmacrowarnings.hxx b/uui/source/secmacrowarnings.hxx index 1a6e7f0b7380..80f1fb76599e 100644 --- a/uui/source/secmacrowarnings.hxx +++ b/uui/source/secmacrowarnings.hxx @@ -35,6 +35,7 @@ private: std::unique_ptr<weld::Label> mxNotYetValid; std::unique_ptr<weld::Label> mxNoLongerValid; std::unique_ptr<weld::Button> mxViewSignsBtn; + std::unique_ptr<weld::Button> mxViewCertBtn; std::unique_ptr<weld::CheckButton> mxAlwaysTrustCB; std::unique_ptr<weld::Button> mxEnableBtn; std::unique_ptr<weld::Button> mxDisableBtn; diff --git a/uui/uiconfig/ui/macrowarnmedium.ui b/uui/uiconfig/ui/macrowarnmedium.ui index 810fbbb6d12b..4d7a416e83e9 100644 --- a/uui/uiconfig/ui/macrowarnmedium.ui +++ b/uui/uiconfig/ui/macrowarnmedium.ui @@ -125,7 +125,7 @@ Macros may contain viruses. Disabling macros for a document is always safe. If y </child> <child> <object class="GtkButton" id="viewSignsButton"> - <property name="label" translatable="yes" context="macrowarnmedium|viewSignsButton">_View Signatures…</property> + <property name="label" translatable="yes" context="macrowarnmedium|viewSignsButton">_Show Signatures…</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">True</property> @@ -140,6 +140,23 @@ Macros may contain viruses. Disabling macros for a document is always safe. If y <property name="position">1</property> </packing> </child> + <child> + <object class="GtkButton" id="viewCertButton"> + <property name="label" translatable="yes" context="macrowarnmedium|viewCertButton">_Show Certificate…</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="halign">end</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> </object> <packing> <property name="left-attach">0</property>