[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - include/sfx2 sfx2/source

Katarina Behrens Katarina.Behrens at cib.de
Fri Jun 16 14:01:06 UTC 2017


 include/sfx2/sfx.hrc        |    9 +++++----
 sfx2/source/doc/objserv.cxx |   36 +++++++++++++++++-------------------
 sfx2/source/view/view.src   |    5 +++++
 3 files changed, 27 insertions(+), 23 deletions(-)

New commits:
commit 9c48f130ed3d5ed8e1e76231052df28553d399cd
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed May 31 18:26:07 2017 +0200

    tdf#105566: Account for 'signature used to be ok but isn't anymore'
    
    because the user has modified the document
    
    Change-Id: Ib32ea2ff41f41a81c9a382585f6afbec12fe6a35
    Reviewed-on: https://gerrit.libreoffice.org/38284
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 2e11bbd288ec59d0ff3368cc5c5ef83e2f5133a2)
    Reviewed-on: https://gerrit.libreoffice.org/38876

diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc
index 0cab808bd06e..c9de431bd10a 100644
--- a/include/sfx2/sfx.hrc
+++ b/include/sfx2/sfx.hrc
@@ -117,10 +117,11 @@
 #define STR_READONLY_SIGN                   (RID_SFX_START+137)
 #define STR_READONLY_PDF                    (RID_SFX_START+138)
 #define STR_SIGNATURE_BROKEN                (RID_SFX_START+139)
-#define STR_SIGNATURE_SHOW                  (RID_SFX_START+140)
-#define STR_SIGNATURE_NOTVALIDATED          (RID_SFX_START+141)
-#define STR_SIGNATURE_PARTIAL_OK            (RID_SFX_START+142)
-#define STR_SIGNATURE_OK                    (RID_SFX_START+143)
+#define STR_SIGNATURE_INVALID               (RID_SFX_START+140)
+#define STR_SIGNATURE_SHOW                  (RID_SFX_START+141)
+#define STR_SIGNATURE_NOTVALIDATED          (RID_SFX_START+142)
+#define STR_SIGNATURE_PARTIAL_OK            (RID_SFX_START+143)
+#define STR_SIGNATURE_OK                    (RID_SFX_START+144)
 
 // group ids
 
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index edebf6a3cae5..6b5374a694b0 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1048,6 +1048,11 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
                         sMessage = SfxResId(STR_SIGNATURE_BROKEN);
                         aInfoBarType = InfoBarType::Danger;
                         break;
+                    case SignatureState::INVALID:
+                        sMessage = SfxResId(STR_SIGNATURE_INVALID);
+                        // Warning only, I've tried Danger and it looked too scary
+                        aInfoBarType = InfoBarType::Warning;
+                        break;
                     case SignatureState::NOTVALIDATED:
                         sMessage = SfxResId(STR_SIGNATURE_NOTVALIDATED);
                         aInfoBarType = InfoBarType::Warning;
@@ -1060,31 +1065,24 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
                         sMessage = SfxResId(STR_SIGNATURE_OK);
                         aInfoBarType = InfoBarType::Info;
                         break;
+                    //FIXME SignatureState::Unknown, own message?
                     default:
                         break;
                     }
 
-                    // new info bar
-                    if ( !pFrame->HasInfoBarWithID("signature") )
-                    {
+                    if ( pFrame->HasInfoBarWithID("signature") )
+                        pFrame->RemoveInfoBar("signature");
 
-                        if (!sMessage.isEmpty())
-                        {
-                            auto pInfoBar = pFrame->AppendInfoBar("signature", sMessage, aInfoBarType);
-                            if (pInfoBar == nullptr)
-                                return;
-                            VclPtrInstance<PushButton> xBtn(&(pFrame->GetWindow()));
-                            xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW));
-                            xBtn->SetSizePixel(xBtn->GetOptimalSize());
-                            xBtn->SetClickHdl(LINK(this, SfxObjectShell, SignDocumentHandler));
-                            pInfoBar->addButton(xBtn);
-                        }
-                    }
-                    else // signature info bar exists already
+                    if ( eState != SignatureState::NOSIGNATURES )
                     {
-                        if (eState == SignatureState::NOSIGNATURES )
-                             pFrame->RemoveInfoBar("signature");
-                        //FIXME: Update existing info bar
+                        auto pInfoBar = pFrame->AppendInfoBar("signature", sMessage, aInfoBarType);
+                        if (pInfoBar == nullptr)
+                            return;
+                        VclPtrInstance<PushButton> xBtn(&(pFrame->GetWindow()));
+                        xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW));
+                        xBtn->SetSizePixel(xBtn->GetOptimalSize());
+                        xBtn->SetClickHdl(LINK(this, SfxObjectShell, SignDocumentHandler));
+                        pInfoBar->addButton(xBtn);
                     }
 
                 }
diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src
index 307e21415784..94f8a5ecbd1f 100644
--- a/sfx2/source/view/view.src
+++ b/sfx2/source/view/view.src
@@ -137,6 +137,11 @@ String STR_SIGNATURE_BROKEN
     Text[ en-US ] = "This document has an invalid signature.";
 };
 
+String STR_SIGNATURE_INVALID
+{
+    Text[ en-US ] = "The signature was valid, but the document has been modified";
+};
+
 String STR_SIGNATURE_NOTVALIDATED
 {
     Text[ en-US ] = "The signature is OK, but the certificate could not be validated.";


More information about the Libreoffice-commits mailing list