Kaydet (Commit) bb9481a4 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld DigitalSignaturesDialog

Change-Id: I197f4805558b07aeb9e66734d0fb5c250c41ad3e
Reviewed-on: https://gerrit.libreoffice.org/67796
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 3157a3a8
...@@ -58,6 +58,11 @@ class SfxFrame; ...@@ -58,6 +58,11 @@ class SfxFrame;
class Timer; class Timer;
class DateTime; class DateTime;
namespace weld
{
class Window;
}
class SFX2_DLLPUBLIC SfxMedium : public SvRefBase class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
{ {
std::unique_ptr< SfxMedium_Impl > pImpl; std::unique_ptr< SfxMedium_Impl > pImpl;
...@@ -263,7 +268,8 @@ public: ...@@ -263,7 +268,8 @@ public:
const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv ); const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv );
SAL_DLLPRIVATE bool SAL_DLLPRIVATE bool
SignContents_Impl(bool bSignScriptingContent, bool bHasValidDocumentSignature, SignContents_Impl(weld::Window* pDialogParent,
bool bSignScriptingContent, bool bHasValidDocumentSignature,
const OUString& aSignatureLineId = OUString(), const OUString& aSignatureLineId = OUString(),
const css::uno::Reference<css::security::XCertificate>& xCert const css::uno::Reference<css::security::XCertificate>& xCert
= css::uno::Reference<css::security::XCertificate>(), = css::uno::Reference<css::security::XCertificate>(),
......
...@@ -129,6 +129,7 @@ ...@@ -129,6 +129,7 @@
#include <openflag.hxx> #include <openflag.hxx>
#include <officecfg/Office/Common.hxx> #include <officecfg/Office/Common.hxx>
#include <comphelper/propertysequence.hxx> #include <comphelper/propertysequence.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/io/WrongFormatException.hpp> #include <com/sun/star/io/WrongFormatException.hpp>
...@@ -3888,7 +3889,9 @@ bool SfxMedium::SignDocumentContentUsingCertificate(bool bHasValidDocumentSignat ...@@ -3888,7 +3889,9 @@ bool SfxMedium::SignDocumentContentUsingCertificate(bool bHasValidDocumentSignat
return bChanges; return bChanges;
} }
bool SfxMedium::SignContents_Impl(bool bSignScriptingContent, bool bHasValidDocumentSignature, bool SfxMedium::SignContents_Impl(weld::Window* pDialogParent,
bool bSignScriptingContent,
bool bHasValidDocumentSignature,
const OUString& aSignatureLineId, const OUString& aSignatureLineId,
const Reference<XCertificate>& xCert, const Reference<XCertificate>& xCert,
const Reference<XGraphic>& xValidGraphic, const Reference<XGraphic>& xValidGraphic,
...@@ -3909,6 +3912,8 @@ bool SfxMedium::SignContents_Impl(bool bSignScriptingContent, bool bHasValidDocu ...@@ -3909,6 +3912,8 @@ bool SfxMedium::SignContents_Impl(bool bSignScriptingContent, bool bHasValidDocu
uno::Reference< security::XDocumentDigitalSignatures > xSigner( uno::Reference< security::XDocumentDigitalSignatures > xSigner(
security::DocumentDigitalSignatures::createWithVersionAndValidSignature( security::DocumentDigitalSignatures::createWithVersionAndValidSignature(
comphelper::getProcessComponentContext(), aODFVersion, bHasValidDocumentSignature ) ); comphelper::getProcessComponentContext(), aODFVersion, bHasValidDocumentSignature ) );
if (pDialogParent)
xSigner->setParentWindow(pDialogParent->GetXWindow());
uno::Reference< embed::XStorage > xWriteableZipStor; uno::Reference< embed::XStorage > xWriteableZipStor;
......
...@@ -1740,7 +1740,7 @@ void SfxObjectShell::SignDocumentContent(weld::Window* pDialogParent) ...@@ -1740,7 +1740,7 @@ void SfxObjectShell::SignDocumentContent(weld::Window* pDialogParent)
if (CheckIsReadonly(false)) if (CheckIsReadonly(false))
return; return;
bool bSignSuccess = GetMedium()->SignContents_Impl(false, HasValidSignatures()); bool bSignSuccess = GetMedium()->SignContents_Impl(pDialogParent, false, HasValidSignatures());
AfterSigning(bSignSuccess, false); AfterSigning(bSignSuccess, false);
} }
...@@ -1836,7 +1836,7 @@ void SfxObjectShell::SignSignatureLine(weld::Window* pDialogParent, ...@@ -1836,7 +1836,7 @@ void SfxObjectShell::SignSignatureLine(weld::Window* pDialogParent,
if (CheckIsReadonly(false)) if (CheckIsReadonly(false))
return; return;
bool bSignSuccess = GetMedium()->SignContents_Impl( bool bSignSuccess = GetMedium()->SignContents_Impl(pDialogParent,
false, HasValidSignatures(), aSignatureLineId, xCert, xValidGraphic, xInvalidGraphic, aComment); false, HasValidSignatures(), aSignatureLineId, xCert, xValidGraphic, xInvalidGraphic, aComment);
AfterSigning(bSignSuccess, false); AfterSigning(bSignSuccess, false);
...@@ -1861,7 +1861,7 @@ void SfxObjectShell::SignScriptingContent(weld::Window* pDialogParent) ...@@ -1861,7 +1861,7 @@ void SfxObjectShell::SignScriptingContent(weld::Window* pDialogParent)
if (CheckIsReadonly(true)) if (CheckIsReadonly(true))
return; return;
bool bSignSuccess = GetMedium()->SignContents_Impl(true, HasValidSignatures()); bool bSignSuccess = GetMedium()->SignContents_Impl(pDialogParent, true, HasValidSignatures());
AfterSigning(bSignSuccess, true); AfterSigning(bSignSuccess, true);
} }
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
#define BMP_CERT_OK "xmlsecurity/res/certificate_16.png" #define BMP_CERT_OK "xmlsecurity/res/certificate_16.png"
#define BMP_CERT_NOT_OK "xmlsecurity/res/notcertificate_16.png" #define BMP_CERT_NOT_OK "xmlsecurity/res/notcertificate_16.png"
#define BMP_SIG_VALID "xmlsecurity/res/signet_11x16.png"
#define BMP_SIG_INVALID "svx/res/caution_11x16.png"
#define BMP_SIG_NOT_VALIDATED "xmlsecurity/res/notcertificate_16.png"
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
...@@ -20,10 +20,7 @@ ...@@ -20,10 +20,7 @@
#ifndef INCLUDED_XMLSECURITY_INC_DIGITALSIGNATURESDIALOG_HXX #ifndef INCLUDED_XMLSECURITY_INC_DIGITALSIGNATURESDIALOG_HXX
#define INCLUDED_XMLSECURITY_INC_DIGITALSIGNATURESDIALOG_HXX #define INCLUDED_XMLSECURITY_INC_DIGITALSIGNATURESDIALOG_HXX
#include <vcl/dialog.hxx> #include <vcl/weld.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <svtools/simptabl.hxx>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include "documentsignaturehelper.hxx" #include "documentsignaturehelper.hxx"
...@@ -48,7 +45,7 @@ namespace xml { namespace dom { ...@@ -48,7 +45,7 @@ namespace xml { namespace dom {
class HeaderBar; class HeaderBar;
class DigitalSignaturesDialog : public ModalDialog class DigitalSignaturesDialog : public weld::GenericDialogController
{ {
private: private:
css::uno::Reference< css::uno::XComponentContext >& mxCtx; css::uno::Reference< css::uno::XComponentContext >& mxCtx;
...@@ -57,28 +54,6 @@ private: ...@@ -57,28 +54,6 @@ private:
bool mbVerifySignatures; bool mbVerifySignatures;
bool mbSignaturesChanged; bool mbSignaturesChanged;
VclPtr<FixedText> m_pHintDocFT;
VclPtr<FixedText> m_pHintBasicFT;
VclPtr<FixedText> m_pHintPackageFT;
VclPtr<SvSimpleTable> m_pSignaturesLB;
VclPtr<FixedImage> m_pSigsValidImg;
VclPtr<FixedText> m_pSigsValidFI;
VclPtr<FixedImage> m_pSigsInvalidImg;
VclPtr<FixedText> m_pSigsInvalidFI;
VclPtr<FixedImage> m_pSigsNotvalidatedImg;
VclPtr<FixedText> m_pSigsNotvalidatedFI;
VclPtr<FixedImage> m_pSigsOldSignatureImg;
VclPtr<FixedText> m_pSigsOldSignatureFI;
VclPtr<CheckBox> m_pAdESCompliantCB;
VclPtr<PushButton> m_pViewBtn;
VclPtr<PushButton> m_pAddBtn;
VclPtr<PushButton> m_pRemoveBtn;
VclPtr<PushButton> m_pStartCertMgrBtn;
VclPtr<CloseButton> m_pCloseBtn;
OUString const m_sODFVersion; OUString const m_sODFVersion;
//Signals if the document contains already a document signature. This is only //Signals if the document contains already a document signature. This is only
//important when we are signing macros and if the value is true. //important when we are signing macros and if the value is true.
...@@ -87,15 +62,34 @@ private: ...@@ -87,15 +62,34 @@ private:
bool m_bAdESCompliant; bool m_bAdESCompliant;
DECL_LINK(AdESCompliantCheckBoxHdl, CheckBox&, void); std::unique_ptr<weld::Label> m_xHintDocFT;
DECL_LINK(ViewButtonHdl, Button*, void); std::unique_ptr<weld::Label> m_xHintBasicFT;
DECL_LINK(AddButtonHdl, Button*, void); std::unique_ptr<weld::Label> m_xHintPackageFT;
DECL_LINK(RemoveButtonHdl, Button*, void); std::unique_ptr<weld::TreeView> m_xSignaturesLB;
DECL_LINK(SignatureHighlightHdl, SvTreeListBox*, void ); std::unique_ptr<weld::Image> m_xSigsValidImg;
DECL_LINK(SignatureSelectHdl, SvTreeListBox*, bool ); std::unique_ptr<weld::Label> m_xSigsValidFI;
DECL_LINK(StartVerifySignatureHdl, LinkParamNone*, bool ); std::unique_ptr<weld::Image> m_xSigsInvalidImg;
DECL_LINK(OKButtonHdl, Button*, void ); std::unique_ptr<weld::Label> m_xSigsInvalidFI;
DECL_STATIC_LINK(DigitalSignaturesDialog, CertMgrButtonHdl, Button*, void ); std::unique_ptr<weld::Image> m_xSigsNotvalidatedImg;
std::unique_ptr<weld::Label> m_xSigsNotvalidatedFI;
std::unique_ptr<weld::Image> m_xSigsOldSignatureImg;
std::unique_ptr<weld::Label> m_xSigsOldSignatureFI;
std::unique_ptr<weld::CheckButton> m_xAdESCompliantCB;
std::unique_ptr<weld::Button> m_xViewBtn;
std::unique_ptr<weld::Button> m_xAddBtn;
std::unique_ptr<weld::Button> m_xRemoveBtn;
std::unique_ptr<weld::Button> m_xStartCertMgrBtn;
std::unique_ptr<weld::Button> m_xCloseBtn;
DECL_LINK(AdESCompliantCheckBoxHdl, weld::ToggleButton&, void);
DECL_LINK(ViewButtonHdl, weld::Button&, void);
DECL_LINK(AddButtonHdl, weld::Button&, void);
DECL_LINK(RemoveButtonHdl, weld::Button&, void);
DECL_LINK(SignatureHighlightHdl, weld::TreeView&, void);
DECL_LINK(SignatureSelectHdl, weld::TreeView&, void);
DECL_LINK(StartVerifySignatureHdl, LinkParamNone*, bool);
DECL_LINK(OKButtonHdl, weld::Button&, void);
DECL_LINK(CertMgrButtonHdl, weld::Button&, void);
void ImplGetSignatureInformations(bool bUseTempStream, bool bCacheLastSignature); void ImplGetSignatureInformations(bool bUseTempStream, bool bCacheLastSignature);
void ImplFillSignaturesBox(); void ImplFillSignaturesBox();
...@@ -114,11 +108,10 @@ private: ...@@ -114,11 +108,10 @@ private:
bool canAddRemove(); bool canAddRemove();
public: public:
DigitalSignaturesDialog( vcl::Window* pParent, css::uno::Reference< DigitalSignaturesDialog(weld::Window* pParent, css::uno::Reference<
css::uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode, css::uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
bool bReadOnly, const OUString& sODFVersion, bool bHasDocumentSignature); bool bReadOnly, const OUString& sODFVersion, bool bHasDocumentSignature);
virtual ~DigitalSignaturesDialog() override; virtual ~DigitalSignaturesDialog() override;
virtual void dispose() override;
// Initialize the dialog and the security environment, returns TRUE on success // Initialize the dialog and the security environment, returns TRUE on success
bool Init(); bool Init();
...@@ -127,8 +120,8 @@ public: ...@@ -127,8 +120,8 @@ public:
void SetStorage( const css::uno::Reference < css::embed::XStorage >& rxStore ); void SetStorage( const css::uno::Reference < css::embed::XStorage >& rxStore );
void SetSignatureStream( const css::uno::Reference < css::io::XStream >& rxStream ); void SetSignatureStream( const css::uno::Reference < css::io::XStream >& rxStream );
// Execute the dialog... // Execute the dialog...
short Execute() override; short run() override;
// Did signatures change? // Did signatures change?
bool SignaturesChanged() const { return mbSignaturesChanged; } bool SignaturesChanged() const { return mbSignaturesChanged; }
......
...@@ -398,19 +398,19 @@ bool DocumentDigitalSignatures::ImplViewSignatures( ...@@ -398,19 +398,19 @@ bool DocumentDigitalSignatures::ImplViewSignatures(
DocumentSignatureMode eMode, bool bReadOnly ) DocumentSignatureMode eMode, bool bReadOnly )
{ {
bool bChanges = false; bool bChanges = false;
ScopedVclPtrInstance<DigitalSignaturesDialog> aSignaturesDialog( DigitalSignaturesDialog aSignaturesDialog(
nullptr, mxCtx, eMode, bReadOnly, m_sODFVersion, Application::GetFrameWeld(mxParentWindow), mxCtx, eMode, bReadOnly, m_sODFVersion,
m_bHasDocumentSignature); m_bHasDocumentSignature);
bool bInit = aSignaturesDialog->Init(); bool bInit = aSignaturesDialog.Init();
SAL_WARN_IF( !bInit, "xmlsecurity.comp", "Error initializing security context!" ); SAL_WARN_IF( !bInit, "xmlsecurity.comp", "Error initializing security context!" );
if ( bInit ) if ( bInit )
{ {
aSignaturesDialog->SetStorage(rxStorage); aSignaturesDialog.SetStorage(rxStorage);
aSignaturesDialog->SetSignatureStream( xSignStream ); aSignaturesDialog.SetSignatureStream( xSignStream );
if ( aSignaturesDialog->Execute() ) if (aSignaturesDialog.run() == RET_OK)
{ {
if ( aSignaturesDialog->SignaturesChanged() ) if (aSignaturesDialog.SignaturesChanged())
{ {
bChanges = true; bChanges = true;
// If we have a storage and no stream, we are responsible for commit // If we have a storage and no stream, we are responsible for commit
......
...@@ -138,6 +138,7 @@ ...@@ -138,6 +138,7 @@
<property name="model">liststore3</property> <property name="model">liststore3</property>
<property name="search_column">0</property> <property name="search_column">0</property>
<property name="show_expanders">False</property> <property name="show_expanders">False</property>
<property name="headers_visible">True</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="Macro Library List-selection2"/> <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
</child> </child>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment