[Libreoffice-commits] core.git: cui/source filter/source offapi/com sfx2/source uui/source xmlsecurity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Feb 14 08:58:11 UTC 2019


 cui/source/dialogs/SignSignatureLineDialog.cxx              |    1 +
 cui/source/options/optinet2.cxx                             |    3 ++-
 cui/source/options/optinet2.hxx                             |    2 +-
 filter/source/pdf/impdialog.cxx                             |    1 +
 offapi/com/sun/star/security/XDocumentDigitalSignatures.idl |    6 ++++++
 sfx2/source/dialog/dinfdlg.cxx                              |    1 +
 uui/source/secmacrowarnings.cxx                             |    2 ++
 uui/source/sslwarndlg.cxx                                   |    4 ++--
 uui/source/unknownauthdlg.cxx                               |    4 ++--
 xmlsecurity/source/component/documentdigitalsignatures.cxx  |   11 +++++++++--
 10 files changed, 27 insertions(+), 8 deletions(-)

New commits:
commit a9a59d53783dd773fd4853266a1d98fab9912922
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 13 10:32:40 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Feb 14 09:57:40 2019 +0100

    [API CHANGE] add setParentWindow to XDocumentDigitalSignatures
    
    so we can specify which window modal dialogs are modal to
    
    Change-Id: I7cd7348b5cd0f55d698553f313f745d5e0d6389d
    Reviewed-on: https://gerrit.libreoffice.org/67765
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx
index 009ae54e055d..12c6590934fb 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -175,6 +175,7 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void)
 
     Reference<XDocumentDigitalSignatures> xSigner(DocumentDigitalSignatures::createWithVersion(
         comphelper::getProcessComponentContext(), "1.2"));
+    xSigner->setParentWindow(m_xDialog->GetXWindow());
     OUString aDescription;
     CertificateKind certificateKind = CertificateKind_NONE;
     // When signing ooxml, we only want X.509 certificates
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index bee5e2d64d14..e090744d5f90 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -816,12 +816,13 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, TSAURLsPBHdl, Button*, void)
     aTSAURLsDlg.run();
 }
 
-IMPL_STATIC_LINK_NOARG(SvxSecurityTabPage, MacroSecPBHdl, Button*, void)
+IMPL_LINK_NOARG(SvxSecurityTabPage, MacroSecPBHdl, Button*, void)
 {
     try
     {
         Reference< security::XDocumentDigitalSignatures > xD(
             security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext() ) );
+        xD->setParentWindow(VCLUnoHelper::GetInterface(GetTabDialog()));
         xD->manageTrustedSources();
     }
     catch (const Exception& e)
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index a5334c157052..dc19ed9466a5 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -138,7 +138,7 @@ private:
     DECL_LINK(MasterPasswordHdl, Button*, void);
     DECL_LINK(MasterPasswordCBHdl, Button*, void);
     DECL_LINK(ShowPasswordsHdl, Button*, void);
-    DECL_STATIC_LINK(SvxSecurityTabPage, MacroSecPBHdl, Button*, void );
+    DECL_LINK(MacroSecPBHdl, Button*, void );
     DECL_LINK(CertPathPBHdl, Button*, void );
     DECL_LINK(TSAURLsPBHdl, Button*, void );
 
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index ea069da20b75..e7959a610387 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -1473,6 +1473,7 @@ IMPL_LINK_NOARG(ImpPDFTabSigningPage, ClickmaPbSignCertSelect, weld::Button&, vo
     Reference< security::XDocumentDigitalSignatures > xSigner(
         security::DocumentDigitalSignatures::createWithVersion(
             comphelper::getProcessComponentContext(), "1.2" ) );
+    xSigner->setParentWindow(GetDialogFrameWeld()->GetXWindow());
 
     // The use may provide a description while choosing a certificate.
     OUString aDescription;
diff --git a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
index d7e001c57607..efe9e200cb4d 100644
--- a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
+++ b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
@@ -20,6 +20,7 @@
 #ifndef __com_sun_star_security_XDocumentDigitalSignatures_idl_
 #define __com_sun_star_security_XDocumentDigitalSignatures_idl_
 
+#include <com/sun/star/awt/XWindow.idl>
 #include <com/sun/star/uno/XInterface.idl>
 #include <com/sun/star/io/XInputStream.idl>
 #include <com/sun/star/io/XStream.idl>
@@ -199,6 +200,11 @@ interface XDocumentDigitalSignatures : com::sun::star::uno::XInterface
                                         [in] ::com::sun::star::embed::XStorage xStorage,
                                         [in] ::com::sun::star::io::XStream xStream);
 
+    /** Set parent window to use when showing dialogs
+
+        @since LibreOffice 6.3
+    */
+    void setParentWindow([in] ::com::sun::star::awt::XWindow xParentWindow);
 };
 
 } ; } ; } ; } ;
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 0322ba3d6ac9..41087c90d276 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -843,6 +843,7 @@ void SfxDocumentPage::ImplUpdateSignatures()
     try
     {
         xD = security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext());
+        xD->setParentWindow(VCLUnoHelper::GetInterface(GetTabDialog()));
     }
     catch ( const css::uno::DeploymentException& )
     {
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 4e8119c09648..af913b303172 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -94,6 +94,7 @@ IMPL_LINK_NOARG(MacroWarning, ViewSignsBtnHdl, weld::Button&, void)
         security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), maODFVersion));
     if( xD.is() )
     {
+        xD->setParentWindow(m_xDialog->GetXWindow());
         if( mxCert.is() )
             xD->showCertificate( mxCert );
         else if( mxStore.is() )
@@ -107,6 +108,7 @@ IMPL_LINK_NOARG(MacroWarning, EnableBtnHdl, weld::Button&, void)
     {   // insert path into trusted path list
         uno::Reference< security::XDocumentDigitalSignatures > xD(
             security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), maODFVersion));
+        xD->setParentWindow(m_xDialog->GetXWindow());
         if( mxCert.is() )
             xD->addAuthorToTrustedSources( mxCert );
         else if( mxStore.is() )
diff --git a/uui/source/sslwarndlg.cxx b/uui/source/sslwarndlg.cxx
index 9ff629e5b345..a1c340cc0afe 100644
--- a/uui/source/sslwarndlg.cxx
+++ b/uui/source/sslwarndlg.cxx
@@ -31,8 +31,8 @@ IMPL_LINK_NOARG(SSLWarnDialog, ViewCertHdl, weld::Button&, void)
     uno::Reference< css::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures;
 
     xDocumentDigitalSignatures = css::security::DocumentDigitalSignatures::createDefault( m_xContext );
-
-    xDocumentDigitalSignatures.get()->showCertificate(m_rXCert);
+    xDocumentDigitalSignatures->setParentWindow(m_xDialog->GetXWindow());
+    xDocumentDigitalSignatures->showCertificate(m_rXCert);
 }
 
 SSLWarnDialog::SSLWarnDialog(weld::Window* pParent,
diff --git a/uui/source/unknownauthdlg.cxx b/uui/source/unknownauthdlg.cxx
index 3d92b74455ae..f6e4eb3f7b4d 100644
--- a/uui/source/unknownauthdlg.cxx
+++ b/uui/source/unknownauthdlg.cxx
@@ -43,8 +43,8 @@ IMPL_LINK_NOARG(UnknownAuthDialog, ViewCertHdl_Impl, weld::Button&, void)
 {
     uno::Reference< css::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures(
         css::security::DocumentDigitalSignatures::createDefault(m_xContext) );
-
-    xDocumentDigitalSignatures.get()->showCertificate(m_rXCert);
+    xDocumentDigitalSignatures->setParentWindow(m_xDialog->GetXWindow());
+    xDocumentDigitalSignatures->showCertificate(m_rXCert);
 }
 
 UnknownAuthDialog::UnknownAuthDialog(weld::Window* pParent,
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index ef838b6fedff..0f6d9e909035 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -67,6 +67,8 @@ class DocumentDigitalSignatures
 {
 private:
     css::uno::Reference<css::uno::XComponentContext> mxCtx;
+    css::uno::Reference<css::awt::XWindow> mxParentWindow;
+
     /// will be set by XInitialization. If not we assume true. false means an earlier version (whatever that means,
     /// this is a string, not a boolean).
     /// Note that the code talks about "ODF version" even if this class is also used to sign OOXML.
@@ -176,6 +178,11 @@ public:
                             css::uno::Reference<css::security::XCertificate> const & xCertificate,
                             css::uno::Reference<css::embed::XStorage> const & xStoragexStorage,
                             css::uno::Reference<css::io::XStream> const & xStream) override;
+
+    void SAL_CALL setParentWindow(const css::uno::Reference<css::awt::XWindow>& rParentwindow) override
+    {
+        mxParentWindow = rParentwindow;
+    }
 };
 
 DocumentDigitalSignatures::DocumentDigitalSignatures( const Reference< XComponentContext >& rxCtx ):
@@ -417,7 +424,7 @@ bool DocumentDigitalSignatures::ImplViewSignatures(
     }
     else
     {
-        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(Application::GetFrameWeld(mxParentWindow),
                                                   VclMessageType::Warning, VclButtonsType::Ok,
                                                   XsResId(RID_XMLSECWB_NO_MOZILLA_PROFILE)));
         xBox->run();
@@ -599,7 +606,7 @@ void DocumentDigitalSignatures::showCertificate(
 
     if ( bInit )
     {
-        CertificateViewer aViewer(nullptr, aSignatureManager.getSecurityEnvironment(), Certificate, false, nullptr);
+        CertificateViewer aViewer(Application::GetFrameWeld(mxParentWindow), aSignatureManager.getSecurityEnvironment(), Certificate, false, nullptr);
         aViewer.run();
     }
 }


More information about the Libreoffice-commits mailing list