[Libreoffice-commits] core.git: xmlsecurity/source

Katarina Behrens Katarina.Behrens at cib.de
Fri Jun 23 07:15:50 UTC 2017


 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   13 ++++++++++++-
 xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc |    1 +
 xmlsecurity/source/dialogs/digitalsignaturesdialog.src |    5 +++++
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 7be0d5490517d41c20f99a006edb9fa651ce3d85
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Mon Jun 19 15:08:20 2017 +0200

    gpg4libre: Warn before removing document signatures
    
    simple version, no "do not show this message again" checkbox
    
    Change-Id: Iba8ac8cda51acac748174c864aa5c205f2efcc8f
    Reviewed-on: https://gerrit.libreoffice.org/38962
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index f52b65dc9917..5f4464b8b957 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -263,6 +263,8 @@ void DigitalSignaturesDialog::SetSignatureStream( const css::uno::Reference < cs
 
 bool DigitalSignaturesDialog::canAddRemove()
 {
+    //FIXME: this func needs some cleanup, such as real split between
+    //'canAdd' and 'canRemove' case
     bool ret = true;
 
     if (!maSignatureManager.mxStore.is())
@@ -317,7 +319,16 @@ bool DigitalSignaturesDialog::canAdd()
 
 bool DigitalSignaturesDialog::canRemove()
 {
-    return canAddRemove();
+    bool bRet = true;
+
+    if ( maSignatureManager.meSignatureMode == DocumentSignatureMode::Content )
+    {
+        short nDlgRet = ScopedVclPtrInstance<MessageDialog>(
+              nullptr, XsResId(STR_XMLSECDLG_QUERY_REALLYREMOVE), VclMessageType::Question, VclButtonsType::YesNo)->Execute();
+        bRet = ( nDlgRet == RET_YES );
+    }
+
+    return (bRet && canAddRemove());
 }
 
 short DigitalSignaturesDialog::Execute()
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc b/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc
index 25aa5cc6a6ea..5409029f4033 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc
@@ -25,6 +25,7 @@
 
 #define STR_XMLSECDLG_OLD_ODF_FORMAT     RID_DIGITALSIGNATUREDLG_START
 #define STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN (RID_DIGITALSIGNATUREDLG_START + 1)
+#define STR_XMLSECDLG_QUERY_REALLYREMOVE (RID_DIGITALSIGNATUREDLG_START + 2)
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.src b/xmlsecurity/source/dialogs/digitalsignaturesdialog.src
index 11af1e18aac2..448d297d72e3 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.src
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.src
@@ -35,4 +35,9 @@ String STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN
         "Do you really want to continue?";
 };
 
+String STR_XMLSECDLG_QUERY_REALLYREMOVE
+{
+    Text [ en-US ] = "Document signature cannot be restored, once removed.\n"
+        "Do you really want to remove selected signature?";
+};
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list