vcl/jsdialog/enabled.cxx                         |    3 ++-
 xmlsecurity/inc/certificateviewer.hxx            |    2 ++
 xmlsecurity/source/dialogs/certificateviewer.cxx |   13 +++++++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 98d2c965aca67f59a27c0a9a7a3bc6e4fdb90950
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Oct 25 12:03:26 2021 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Mon Jan 24 13:46:42 2022 +0100

    Make View Certificate sub-dialog async
    
    Change-Id: I0e1a6a59d856ab266511fc3d6be87fe04c5afdfc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124143
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128840
    Tested-by: Jenkins

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index dc5857afda61..e51b44493527 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -52,7 +52,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
         || rUIFile == u"cui/ui/macroselectordialog.ui" || rUIFile == 
u"uui/ui/macrowarnmedium.ui"
         || rUIFile == u"modules/scalc/ui/textimportcsv.ui"
         || rUIFile == u"xmlsec/ui/digitalsignaturesdialog.ui"
-        || rUIFile == u"xmlsec/ui/viewcertdialog.ui")
+        || rUIFile == u"xmlsec/ui/viewcertdialog.ui" || rUIFile == 
u"xmlsec/ui/certgeneral.ui"
+        || rUIFile == u"xmlsec/ui/certpage.ui")
     {
         return true;
     }
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<std::unique_ptr<CertPath_UserData>> maUserData;
+    std::shared_ptr<CertificateViewer> mxCertificateViewer;
 
     std::unique_ptr<weld::TreeView> mxCertPathLB;
     std::unique_ptr<weld::TreeIter> 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<weld::TreeIter> xIter = mxCertPathLB->make_iterator();
     if (mxCertPathLB->get_selected(xIter.get()))
     {
+        if (mxCertificateViewer)
+            mxCertificateViewer->response(RET_OK);
+
         CertPath_UserData* pData = 
reinterpret_cast<CertPath_UserData*>(mxCertPathLB->get_id(*xIter).toInt64());
-        CertificateViewer aViewer(mpDlg->getDialog(), 
mpDlg->mxSecurityEnvironment,
+        mxCertificateViewer = 
std::make_shared<CertificateViewer>(mpDlg->getDialog(), 
mpDlg->mxSecurityEnvironment,
                 pData->mxCert, false, nullptr);
-        aViewer.run();
+        weld::DialogController::runAsync(mxCertificateViewer, [this] 
(sal_Int32) { mxCertificateViewer = nullptr; });
     }
 }
 

Reply via email to