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@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc
index 0cab808..c9de431 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 edebf6a..6b5374a 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 307e214..94f8a5e 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.";