From e125c6c6693d4540ab3aacb11151e05b511b8051 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 28 Apr 2020 16:53:57 +0200 Subject: replace hard-coded "1.2" ODF version strings Most of these are calls to DocumentDigitalSignatures::createWithVersion(), where it doesn't make a difference if "1.2" or "1.3" is passed in but maybe it will be different with "1.4". There is another ctor createDefault() which looks appropriate for non-ODF contexts and can also be used when no actual signing or verifying is done. In cases where there's an actual document its Storage has the version. Change-Id: Id636bbf965d9f96c7ed5f50774c509032525b2b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93091 Tested-by: Jenkins Reviewed-by: Michael Stahl --- cui/source/dialogs/SignSignatureLineDialog.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx index 9def0559183f..10f80f72983d 100644 --- a/cui/source/dialogs/SignSignatureLineDialog.cxx +++ b/cui/source/dialogs/SignSignatureLineDialog.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -166,8 +167,19 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void) if (!pShell->PrepareForSigning(m_xDialog.get())) return; - Reference xSigner(DocumentDigitalSignatures::createWithVersion( - comphelper::getProcessComponentContext(), "1.2")); + Reference xSigner; + if (pShell->GetMedium()->GetFilter()->IsAlienFormat()) + { + xSigner + = DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext()); + } + else + { + OUString const aODFVersion( + comphelper::OStorageHelper::GetODFVersionFromStorage(pShell->GetStorage())); + xSigner = DocumentDigitalSignatures::createWithVersion( + comphelper::getProcessComponentContext(), aODFVersion); + } xSigner->setParentWindow(m_xDialog->GetXWindow()); OUString aDescription; CertificateKind certificateKind = CertificateKind_NONE; -- cgit