From ddb7b7d3ba0bcd815a8deb226b47fba025d5597e Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Mon, 25 Oct 2021 12:03:26 +0200 Subject: Make View Certificate sub-dialog async MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0e1a6a59d856ab266511fc3d6be87fe04c5afdfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124143 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128840 Tested-by: Jenkins --- xmlsecurity/inc/certificateviewer.hxx | 2 ++ xmlsecurity/source/dialogs/certificateviewer.cxx | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'xmlsecurity') diff --git a/xmlsecurity/inc/certificateviewer.hxx b/xmlsecurity/inc/certificateviewer.hxx index 1d0ec5f72e2d..ea47c41029a8 100644 --- a/xmlsecurity/inc/certificateviewer.hxx +++ b/xmlsecurity/inc/certificateviewer.hxx @@ -134,6 +134,7 @@ private: bool mbFirstActivateDone; std::vector> maUserData; + std::shared_ptr mxCertificateViewer; std::unique_ptr mxCertPathLB; std::unique_ptr mxScratchIter; @@ -150,6 +151,7 @@ private: public: CertificateViewerCertPathTP(weld::Container* pParent, CertificateViewer* pDlg); + ~CertificateViewerCertPathTP(); void ActivatePage(); }; diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index c252024ed954..3e0480b9317b 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -271,6 +271,12 @@ CertificateViewerCertPathTP::CertificateViewerCertPathTP(weld::Container* pParen mxViewCertPB->connect_clicked( LINK( this, CertificateViewerCertPathTP, ViewCertHdl ) ); } +CertificateViewerCertPathTP::~CertificateViewerCertPathTP() +{ + if (mxCertificateViewer) + mxCertificateViewer->response(RET_OK); +} + void CertificateViewerCertPathTP::ActivatePage() { if ( mbFirstActivateDone ) @@ -322,10 +328,13 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl, weld::Button&, void) std::unique_ptr xIter = mxCertPathLB->make_iterator(); if (mxCertPathLB->get_selected(xIter.get())) { + if (mxCertificateViewer) + mxCertificateViewer->response(RET_OK); + CertPath_UserData* pData = reinterpret_cast(mxCertPathLB->get_id(*xIter).toInt64()); - CertificateViewer aViewer(mpDlg->getDialog(), mpDlg->mxSecurityEnvironment, + mxCertificateViewer = std::make_shared(mpDlg->getDialog(), mpDlg->mxSecurityEnvironment, pData->mxCert, false, nullptr); - aViewer.run(); + weld::DialogController::runAsync(mxCertificateViewer, [this] (sal_Int32) { mxCertificateViewer = nullptr; }); } } -- cgit