uui/inc/strings.hrc             |    1 +
 uui/source/secmacrowarnings.cxx |   16 +++++++++++++---
 uui/source/secmacrowarnings.hxx |    1 +
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit db8d97a1906870f8b83415ef8335822da0179a64
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Thu Dec 14 08:30:15 2023 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Dec 14 16:12:45 2023 +0100

    tdf#158576 Explain why OK btn is disabled
    
    User needs to view (verify) the cert first
    
    Change-Id: I52ce64678abc3b9f95a384e4082eaee1abf0549a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160755
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/uui/inc/strings.hrc b/uui/inc/strings.hrc
index db6c83e777fb..6a26f10ac69b 100644
--- a/uui/inc/strings.hrc
+++ b/uui/inc/strings.hrc
@@ -79,5 +79,6 @@
 #define STR_RELOADEDITABLE_MSG                  NC_("STR_RELOADEDITABLE_MSG", 
"Document file '$(ARG1)' is now editable \n\nReload this document for editing?")
 #define STR_RELOADEDITABLE_BTN                  NC_("STR_RELOADEDITABLE_BTN", 
"~Reload")
 #define STR_LOADREADONLY_MSG                    NC_("STR_LOADREADONLY_MSG", 
"The author would like you to open '$(ARG1)' as read-only unless you need to 
make changes. Open as read-only?")
+#define STR_VERIFIY_CERT                        NC_("STR_VERIFIY_CERT", "You 
need to view the certificate first.")
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index eb93c9d13815..f1cddb11cb9f 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -26,11 +26,14 @@
 #include <tools/datetime.hxx>
 #include <tools/debug.hxx>
 #include <unotools/datetime.hxx>
+#include <unotools/resmgr.hxx>
 #include <unotools/securityoptions.hxx>
 #include <tools/urlobj.hxx>
 
 #include "secmacrowarnings.hxx"
 
+#include <strings.hrc>
+
 using namespace ::com::sun::star::security;
 using namespace ::com::sun::star;
 
@@ -116,7 +119,7 @@ IMPL_LINK_NOARG(MacroWarning, ViewSignsBtnHdl, 
weld::Button&, void)
         return;
 
     mxAlwaysTrustCB->set_sensitive(true);
-    mxEnableBtn->set_sensitive(true);
+    EnableOkBtn(true);
 }
 
 IMPL_LINK_NOARG(MacroWarning, EnableBtnHdl, weld::Button&, void)
@@ -148,7 +151,7 @@ IMPL_LINK_NOARG(MacroWarning, DisableBtnHdl, weld::Button&, 
void)
 IMPL_LINK_NOARG(MacroWarning, AlwaysTrustCheckHdl, weld::Toggleable&, void)
 {
     const bool bEnable = (mnActSecLevel < 3 || mxAlwaysTrustCB->get_active());
-    mxEnableBtn->set_sensitive(bEnable);
+    EnableOkBtn(bEnable);
     mxDisableBtn->set_sensitive(!mxAlwaysTrustCB->get_active());
 }
 
@@ -166,7 +169,7 @@ void MacroWarning::InitControls()
 
         mnActSecLevel = SvtSecurityOptions::GetMacroSecurityLevel();
         if ( mnActSecLevel >= 2 )
-            mxEnableBtn->set_sensitive(false);
+            EnableOkBtn(false);
     }
     else
     {
@@ -174,6 +177,13 @@ void MacroWarning::InitControls()
     }
 }
 
+void MacroWarning::EnableOkBtn(bool bEnable)
+{
+    mxEnableBtn->set_sensitive(bEnable);
+    std::locale aResLocale(Translate::Create("uui"));
+    mxEnableBtn->set_tooltip_text(bEnable ? "" : 
Translate::get(STR_VERIFIY_CERT, aResLocale));
+}
+
 void MacroWarning::SetStorage( const css::uno::Reference < 
css::embed::XStorage >& rxStore,
                                const OUString& aODFVersion,
                                const css::uno::Sequence< 
security::DocumentSignatureInformation >& rInfos )
diff --git a/uui/source/secmacrowarnings.hxx b/uui/source/secmacrowarnings.hxx
index 80f1fb76599e..463ccf1d9091 100644
--- a/uui/source/secmacrowarnings.hxx
+++ b/uui/source/secmacrowarnings.hxx
@@ -55,6 +55,7 @@ private:
     DECL_STATIC_LINK(MacroWarning, InstallLOKNotifierHdl, void*, 
vcl::ILibreOfficeKitNotifier*);
 
     void                InitControls();
+    void EnableOkBtn(bool bEnable);
 
 public:
     MacroWarning(weld::Window* pParent, bool _bShowSignatures);

Reply via email to