[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Tue Jan 31 12:42:58 UTC 2017


 include/sfx2/sfx.hrc         |    2 ++
 sfx2/source/view/view.src    |   10 ++++++++++
 sfx2/source/view/viewfrm.cxx |   27 ++++++++++++++++++++++++---
 3 files changed, 36 insertions(+), 3 deletions(-)

New commits:
commit 2499ecc4050a308dd52df0ca32e2d97dff9e40df
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Tue Jan 31 10:47:47 2017 +0100

    tdf#105566 Show InfoBar also for signed docs with warnings
    
    gpg4libre
    
    Change-Id: Ia3df9d9d8121539fd1c6b77f8872287b0b432d8e
    Reviewed-on: https://gerrit.libreoffice.org/33744
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc
index 25e8355..2cd1da9 100644
--- a/include/sfx2/sfx.hrc
+++ b/include/sfx2/sfx.hrc
@@ -122,6 +122,8 @@
 #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_ACCTITLE_PRODUCTIVITYTOOLS      (RID_SFX_START+157)
 
 #define SFX_THUMBNAIL_TEXT                  (RID_SFX_START+158)
diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src
index 56b7fba..9507e0b 100644
--- a/sfx2/source/view/view.src
+++ b/sfx2/source/view/view.src
@@ -145,6 +145,16 @@ String STR_SIGNATURE_BROKEN
     Text[ en-US ] = "Document has an invalid signature.";
 };
 
+String STR_SIGNATURE_NOTVALIDATED
+{
+    Text[ en-US ] = "Signature is ok, but the certificate could not be validated.";
+};
+
+String STR_SIGNATURE_PARTIAL_OK
+{
+    Text[ en-US ] = "Signature is ok, but the document is only partially signed.";
+};
+
 String STR_SIGNATURE_SHOW
 {
     Text[ en-US ] = "Show signatures";
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index a7f1d6a..dd6e317 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1180,9 +1180,30 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
                 rBind.Invalidate( SID_EDITDOC );
 
                 SignatureState nSignatureState = GetObjectShell()->GetDocumentSignatureState();
-                if (nSignatureState == SignatureState::BROKEN) {
-                    basegfx::BColor aBackgroundColor = SfxInfoBarWindow::getWarningColor();
-                    auto pInfoBar = AppendInfoBar("signature", SfxResId(STR_SIGNATURE_BROKEN), &aBackgroundColor);
+                basegfx::BColor aBackgroundColor;
+                OUString sMessage("");
+
+                switch (nSignatureState)
+                {
+                case SignatureState::BROKEN:
+                    sMessage = SfxResId(STR_SIGNATURE_BROKEN);
+                    aBackgroundColor = SfxInfoBarWindow::getDangerColor();
+                    break;
+                case SignatureState::NOTVALIDATED:
+                    sMessage = SfxResId(STR_SIGNATURE_NOTVALIDATED);
+                    aBackgroundColor = SfxInfoBarWindow::getWarningColor();
+                    break;
+                case SignatureState::PARTIAL_OK:
+                    sMessage = SfxResId(STR_SIGNATURE_PARTIAL_OK);
+                    aBackgroundColor = SfxInfoBarWindow::getWarningColor();
+                    break;
+                default:
+                    break;
+                }
+
+                if (!sMessage.isEmpty())
+                {
+                    auto pInfoBar = AppendInfoBar("signature", sMessage, &aBackgroundColor);
                     VclPtrInstance<PushButton> xBtn(&GetWindow());
                     xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW));
                     xBtn->SetSizePixel(xBtn->GetOptimalSize());


More information about the Libreoffice-commits mailing list