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@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Samuel Mehrbrodt 2017-01-31 10:47:47 +01:00
parent 0cd819b68c
commit 2499ecc405
3 changed files with 36 additions and 3 deletions

View File

@ -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)

View File

@ -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";

View File

@ -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());