summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-10-20 11:01:41 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2022-01-24 09:43:53 +0100
commit71a8bad4b96627fd965b23288dea14aae3f0f468 (patch)
treec35ae6a88cdccd6d695364ecaab6b64b7c923230 /xmlsecurity
parent0c3b8792b712e939d2ad524d554f96616b4844be (diff)
jsdialog: enable Digital Signatures dialog
In LOK case run it in the readonly mode. In readonly mode we can run it asynchronously. Change-Id: I721dd14fa23d4e30255dd976e0cc2a4f30470a3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124058 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128838 Tested-by: Jenkins
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/inc/digitalsignaturesdialog.hxx1
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx19
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx14
3 files changed, 27 insertions, 7 deletions
diff --git a/xmlsecurity/inc/digitalsignaturesdialog.hxx b/xmlsecurity/inc/digitalsignaturesdialog.hxx
index 4c668c9399f2..f8a59adaf9b5 100644
--- a/xmlsecurity/inc/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/digitalsignaturesdialog.hxx
@@ -112,6 +112,7 @@ public:
void SetSignatureStream( const css::uno::Reference < css::io::XStream >& rxStream );
// Execute the dialog...
+ void beforeRun();
short run() override;
// Did signatures change?
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index ec43d5087885..9f20a58fd23f 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -433,19 +433,26 @@ bool DocumentDigitalSignatures::ImplViewSignatures(
DocumentSignatureMode eMode, bool bReadOnly )
{
bool bChanges = false;
- DigitalSignaturesDialog aSignaturesDialog(
+ auto xSignaturesDialog = std::make_shared<DigitalSignaturesDialog>(
Application::GetFrameWeld(mxParentWindow), mxCtx, eMode, bReadOnly, m_sODFVersion,
m_bHasDocumentSignature);
- bool bInit = aSignaturesDialog.Init();
+ bool bInit = xSignaturesDialog->Init();
SAL_WARN_IF( !bInit, "xmlsecurity.comp", "Error initializing security context!" );
if ( bInit )
{
- aSignaturesDialog.SetStorage(rxStorage);
+ xSignaturesDialog->SetStorage(rxStorage);
- aSignaturesDialog.SetSignatureStream( xSignStream );
- if (aSignaturesDialog.run() == RET_OK)
+ xSignaturesDialog->SetSignatureStream( xSignStream );
+
+ if (bReadOnly)
+ {
+ xSignaturesDialog->beforeRun();
+ weld::DialogController::runAsync(xSignaturesDialog, [] (sal_Int32) {});
+ return false;
+ }
+ else if (xSignaturesDialog->run() == RET_OK)
{
- if (aSignaturesDialog.SignaturesChanged())
+ if (xSignaturesDialog->SignaturesChanged())
{
bChanges = true;
// If we have a storage and no stream, we are responsible for commit
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 7ffe14da6649..621ea4170649 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -56,6 +56,7 @@
#include <bitmaps.hlst>
#include <strings.hrc>
#include <resourcemanager.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/xmlsechelper.hxx>
#include <comphelper/processfactory.hxx>
@@ -192,6 +193,13 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
m_xHintPackageFT->show();
break;
}
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ m_xAddBtn->hide();
+ m_xRemoveBtn->hide();
+ m_xStartCertMgrBtn->hide();
+ }
}
DigitalSignaturesDialog::~DigitalSignaturesDialog()
@@ -312,7 +320,7 @@ bool DigitalSignaturesDialog::canRemove()
return (bRet && canAddRemove());
}
-short DigitalSignaturesDialog::run()
+void DigitalSignaturesDialog::beforeRun()
{
// Verify Signatures and add certificates to ListBox...
mbVerifySignatures = true;
@@ -337,7 +345,11 @@ short DigitalSignaturesDialog::run()
// Only verify once, content will not change.
// But for refreshing signature information, StartVerifySignatureHdl will be called after each add/remove
mbVerifySignatures = false;
+}
+short DigitalSignaturesDialog::run()
+{
+ beforeRun();
return GenericDialogController::run();
}