diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-02-12 21:31:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-02-13 15:15:48 +0100 |
commit | b6de43a14a768e261d2233df57cf5fa46480d991 (patch) | |
tree | 464926ba6ae362c6aad904f9583dbecf527d9e39 /xmlsecurity/inc | |
parent | e31c2c03f9ff06df553e577a1d9149ce75e7ff7f (diff) |
weld CertificateViewer cluster
CertificateViewer, CertificateViewerGeneralTP,
CertificateViewerDetailsTP, CertificateViewerCertPathTP
Change-Id: I5792b673f17b3cd465ff17444776066139877ec1
Reviewed-on: https://gerrit.libreoffice.org/67756
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmlsecurity/inc')
-rw-r--r-- | xmlsecurity/inc/bitmaps.hlst | 3 | ||||
-rw-r--r-- | xmlsecurity/inc/certificateviewer.hxx | 146 | ||||
-rw-r--r-- | xmlsecurity/inc/strings.hrc | 1 |
3 files changed, 86 insertions, 64 deletions
diff --git a/xmlsecurity/inc/bitmaps.hlst b/xmlsecurity/inc/bitmaps.hlst index 0cfeb433bc1a..1af4ff3c6234 100644 --- a/xmlsecurity/inc/bitmaps.hlst +++ b/xmlsecurity/inc/bitmaps.hlst @@ -12,6 +12,9 @@ #define BMP_STATE_NOT_VALIDATED "xmlecurity/res/notcertificate_40x56.png" +#define BMP_CERT_OK "xmlsecurity/res/certificate_16.png" +#define BMP_CERT_NOT_OK "xmlsecurity/res/notcertificate_16.png" + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/xmlsecurity/inc/certificateviewer.hxx b/xmlsecurity/inc/certificateviewer.hxx index b439362f18ee..9f816c9a0671 100644 --- a/xmlsecurity/inc/certificateviewer.hxx +++ b/xmlsecurity/inc/certificateviewer.hxx @@ -37,111 +37,131 @@ namespace xml { namespace crypto { class XSecurityEnvironment; }} }}} -class CertificateViewer : public TabDialog +class CertificateViewerGeneralTP; +class CertificateViewerDetailsTP; +class CertificateViewerCertPathTP; + +class CertificateViewer : public weld::GenericDialogController { private: friend class CertificateViewerGeneralTP; friend class CertificateViewerDetailsTP; friend class CertificateViewerCertPathTP; - VclPtr<TabControl> mpTabCtrl; - sal_uInt16 mnGeneralId; - sal_uInt16 mnDetailsId; - sal_uInt16 mnPathId; - bool const mbCheckForPrivateKey; css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment; css::uno::Reference< css::security::XCertificate > mxCert; + + VclPtr<CertificateChooser> mpParentChooser; + + std::unique_ptr<weld::Notebook> mxTabCtrl; + + std::unique_ptr<CertificateViewerGeneralTP> mxGeneralPage; + std::unique_ptr<CertificateViewerDetailsTP> mxDetailsPage; + std::unique_ptr<CertificateViewerCertPathTP> mxPathId; + + DECL_LINK(ActivatePageHdl, const OString&, void); + public: - CertificateViewer( vcl::Window* pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& rXCert, bool bCheckForPrivateKey ); - virtual ~CertificateViewer() override; - virtual void dispose() override; + CertificateViewer(weld::Window* pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& rXCert, bool bCheckForPrivateKey, CertificateChooser* pParentChooser); + CertificateChooser* GetParentChooser() { return mpParentChooser; } }; - -class CertificateViewerTP : public TabPage +class CertificateViewerTP { protected: - VclPtr<CertificateViewer> mpDlg; + std::unique_ptr<weld::Builder> mxBuilder; + std::unique_ptr<weld::Container> mxContainer; + CertificateViewer* mpDlg; + public: - CertificateViewerTP( vcl::Window* _pParent, const OString& rID, - const OUString& rUIXMLDescription, CertificateViewer* _pDlg ); - virtual ~CertificateViewerTP() override; - virtual void dispose() override; + CertificateViewerTP(weld::Container* pParent, const OUString& rUIXMLDescription, + const OString& rID, CertificateViewer* pDlg); }; class CertificateViewerGeneralTP : public CertificateViewerTP { private: - VclPtr<FixedImage> m_pCertImg; - VclPtr<FixedText> m_pHintNotTrustedFT; - VclPtr<FixedText> m_pIssuedToLabelFT; - VclPtr<FixedText> m_pIssuedToFT; - VclPtr<FixedText> m_pIssuedByLabelFT; - VclPtr<FixedText> m_pIssuedByFT; - VclPtr<FixedText> m_pValidFromDateFT; - VclPtr<FixedText> m_pValidToDateFT; - VclPtr<FixedImage> m_pKeyImg; - VclPtr<FixedText> m_pHintCorrespPrivKeyFT; -public: - CertificateViewerGeneralTP( vcl::Window* pParent, CertificateViewer* _pDlg ); - virtual ~CertificateViewerGeneralTP() override; - virtual void dispose() override; + std::unique_ptr<weld::Image> m_xCertImg; + std::unique_ptr<weld::Label> m_xHintNotTrustedFT; + std::unique_ptr<weld::Label> m_xIssuedToLabelFT; + std::unique_ptr<weld::Label> m_xIssuedToFT; + std::unique_ptr<weld::Label> m_xIssuedByLabelFT; + std::unique_ptr<weld::Label> m_xIssuedByFT; + std::unique_ptr<weld::Label> m_xValidFromDateFT; + std::unique_ptr<weld::Label> m_xValidToDateFT; + std::unique_ptr<weld::Image> m_xKeyImg; + std::unique_ptr<weld::Label> m_xHintCorrespPrivKeyFT; - virtual void ActivatePage() override; +public: + CertificateViewerGeneralTP(weld::Container* pParent, CertificateViewer* pDlg); }; +struct Details_UserDatat +{ + OUString const maTxt; + bool const mbFixedWidthFont; + + Details_UserDatat(const OUString& rTxt, bool bFixedWidthFont) + : maTxt(rTxt) + , mbFixedWidthFont(bFixedWidthFont) + { + } +}; class CertificateViewerDetailsTP : public CertificateViewerTP { private: - VclPtr<SvSimpleTableContainer> m_pElementsLBContainer; - VclPtr<SvSimpleTable> m_pElementsLB; - VclPtr<VclMultiLineEdit> m_pValueDetails; - vcl::Font m_aStdFont; - vcl::Font m_aFixedWidthFont; + std::vector<std::unique_ptr<Details_UserDatat>> m_aUserData; + + std::unique_ptr<weld::TreeView> m_xElementsLB; + std::unique_ptr<weld::TextView> m_xValueDetails; - DECL_LINK( ElementSelectHdl, SvTreeListBox*, void ); + DECL_LINK(ElementSelectHdl, weld::TreeView&, void); void Clear(); - void InsertElement( const OUString& _rField, const OUString& _rValue, - const OUString& _rDetails, bool _bFixedWidthFont = false ); + void InsertElement(const OUString& rField, const OUString& rValue, + const OUString& rDetails, bool bFixedWidthFont = false); public: - CertificateViewerDetailsTP( vcl::Window* pParent, CertificateViewer* _pDlg ); - virtual ~CertificateViewerDetailsTP() override; - virtual void dispose() override; - - virtual void ActivatePage() override; + CertificateViewerDetailsTP(weld::Container* pParent, CertificateViewer* pDlg); }; +struct CertPath_UserData +{ + css::uno::Reference< css::security::XCertificate > mxCert; + bool const mbValid; + + CertPath_UserData(css::uno::Reference<css::security::XCertificate> const & xCert, bool bValid) + : mxCert(xCert) + , mbValid(bValid) + { + } +}; class CertificateViewerCertPathTP : public CertificateViewerTP { private: - VclPtr<SvTreeListBox> mpCertPathLB; - VclPtr<PushButton> mpViewCertPB; - VclPtr<VclMultiLineEdit> mpCertStatusML; - - VclPtr<CertificateViewer> mpParent; + CertificateViewer* mpParent; bool mbFirstActivateDone; - Image maCertImage; - Image maCertNotValidatedImage; - OUString msCertOK; - OUString msCertNotValidated; - DECL_LINK( ViewCertHdl, Button*, void ); - DECL_LINK( CertSelectHdl, SvTreeListBox*, void ); + std::vector<std::unique_ptr<CertPath_UserData>> maUserData; + + std::unique_ptr<weld::TreeView> mxCertPathLB; + std::unique_ptr<weld::Button> mxViewCertPB; + std::unique_ptr<weld::TextView> mxCertStatusML; + std::unique_ptr<weld::Label> mxCertOK; + std::unique_ptr<weld::Label> mxCertNotValidated; + + DECL_LINK(ViewCertHdl, weld::Button&, void); + DECL_LINK(CertSelectHdl, weld::TreeView&, void); void Clear(); - SvTreeListEntry* InsertCert( SvTreeListEntry* _pParent, const OUString& _rName, - const css::uno::Reference< css::security::XCertificate >& rxCert, - bool bValid); + void InsertCert(weld::TreeIter* pParent, const OUString& _rName, + const css::uno::Reference< css::security::XCertificate >& rxCert, + bool bValid); public: - CertificateViewerCertPathTP( vcl::Window* pParent, CertificateViewer* _pDlg ); - virtual ~CertificateViewerCertPathTP() override; - virtual void dispose() override; - - virtual void ActivatePage() override; + CertificateViewerCertPathTP(weld::Container* pParent, CertificateViewer* pDlg); + void ActivatePage(); }; diff --git a/xmlsecurity/inc/strings.hrc b/xmlsecurity/inc/strings.hrc index 1505e3583d38..c44617e10fed 100644 --- a/xmlsecurity/inc/strings.hrc +++ b/xmlsecurity/inc/strings.hrc @@ -23,7 +23,6 @@ #define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) #define STR_CERTIFICATE_NOT_VALIDATED NC_("STR_CERTIFICATE_NOT_VALIDATED", "The certificate could not be validated.") -#define STR_HEADERBAR NC_("STR_HEADERBAR", "Field\tValue") #define STR_VERSION NC_("STR_VERSION", "Version") #define STR_SERIALNUM NC_("STR_SERIALNUM", "Serial Number") #define STR_ISSUER NC_("STR_ISSUER", "Issuer") |