[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - xmlsecurity/inc xmlsecurity/source xmlsecurity/uiconfig

Katarina Behrens Katarina.Behrens at cib.de
Wed Jun 7 04:19:53 UTC 2017


 xmlsecurity/inc/digitalsignaturesdialog.hxx            |    2 
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   47 ++++++++++
 xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui     |   77 ++++++-----------
 3 files changed, 78 insertions(+), 48 deletions(-)

New commits:
commit 093f469eeec48e66050127e48f4a73f5c211621c
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Mar 14 13:25:37 2017 +0100

    gpg4libre: add 'Start certificate manager' button
    
    Change-Id: Ief3239fd1b3ff1f4e2e95e4413aa9f707f3dfb50
    Reviewed-on: https://gerrit.libreoffice.org/36689
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 28ae89f4655ee7d630f2400e3994c227dcf47f70)
    Reviewed-on: https://gerrit.libreoffice.org/38478
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/xmlsecurity/inc/digitalsignaturesdialog.hxx b/xmlsecurity/inc/digitalsignaturesdialog.hxx
index 4c3c6de7e951..44cf85da7d50 100644
--- a/xmlsecurity/inc/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/digitalsignaturesdialog.hxx
@@ -75,6 +75,7 @@ private:
     VclPtr<PushButton>         m_pViewBtn;
     VclPtr<PushButton>         m_pAddBtn;
     VclPtr<PushButton>         m_pRemoveBtn;
+    VclPtr<PushButton>         m_pStartCertMgrBtn;
 
     VclPtr<CloseButton>        m_pCloseBtn;
 
@@ -94,6 +95,7 @@ private:
     DECL_LINK(SignatureSelectHdl, SvTreeListBox*, bool );
     DECL_LINK(StartVerifySignatureHdl, LinkParamNone*, bool );
     DECL_LINK(OKButtonHdl, Button*, void );
+    DECL_STATIC_LINK(DigitalSignaturesDialog, CertMgrButtonHdl, Button*, void );
 
     void                ImplGetSignatureInformations(bool bUseTempStream, bool bCacheLastSignature);
     void                ImplFillSignaturesBox();
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index b88dd97337f8..f691ab063157 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -35,8 +35,11 @@
 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
 #include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
 #include <com/sun/star/packages/manifest/ManifestReader.hpp>
+#include <com/sun/star/system/SystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/system/SystemShellExecuteException.hpp>
 
-
+#include <osl/file.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/uri.hxx>
 
@@ -119,6 +122,7 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
     get(m_pAddBtn, "sign");
     get(m_pRemoveBtn, "remove");
     get(m_pCloseBtn, "close");
+    get(m_pStartCertMgrBtn, "start_certmanager");
     get(m_pSigsValidImg, "validimg");
     get(m_pSigsValidFI, "validft");
     get(m_pSigsInvalidImg, "invalidimg");
@@ -165,6 +169,8 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
     m_pRemoveBtn->SetClickHdl( LINK( this, DigitalSignaturesDialog, RemoveButtonHdl ) );
     m_pRemoveBtn->Disable();
 
+    m_pStartCertMgrBtn->SetClickHdl( LINK( this, DigitalSignaturesDialog, CertMgrButtonHdl ) );
+
     m_pCloseBtn->SetClickHdl( LINK( this, DigitalSignaturesDialog, OKButtonHdl) );
 
     switch( maSignatureManager.meSignatureMode )
@@ -205,6 +211,7 @@ void DigitalSignaturesDialog::dispose()
     m_pAddBtn.clear();
     m_pRemoveBtn.clear();
     m_pCloseBtn.clear();
+    m_pStartCertMgrBtn.clear();
     ModalDialog::dispose();
 }
 
@@ -445,6 +452,44 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, RemoveButtonHdl, Button*, void)
     }
 }
 
+IMPL_STATIC_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, Button*, void)
+{
+    const OUString aGUIServers[] = {  OUString("kleopatra"), OUString("gpa"), OUString("kgpg") };
+    // FIXME: the same for Windows + registry search for gpg4win
+    const char* cPath = getenv("PATH");
+
+    if (cPath)
+    {
+       OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding());
+       OUString sFoundGUIServer, sExecutable;
+
+       for ( auto const &rServer : aGUIServers )
+       {
+           osl::FileBase::RC searchError = osl::File::searchFileURL(rServer, aPath, sFoundGUIServer );
+           if (searchError == osl::FileBase::E_None)
+           {
+               osl::File::getSystemPathFromFileURL( sFoundGUIServer, sExecutable );
+               break;
+           }
+
+       }
+
+       if ( !sExecutable.isEmpty() )
+       {
+           uno::Reference< uno::XComponentContext > xContext =
+               ::comphelper::getProcessComponentContext();
+           uno::Reference< css::system::XSystemShellExecute > xSystemShell(
+                    css::system::SystemShellExecute::create(xContext) );
+
+           xSystemShell->execute( sExecutable, OUString(),
+               css::system::SystemShellExecuteFlags::DEFAULTS );
+       }
+       //else FIXME: none of the certificate managers' there
+
+    }
+
+}
+
 IMPL_LINK_NOARG(DigitalSignaturesDialog, StartVerifySignatureHdl, LinkParamNone*, bool)
 {
     return mbVerifySignatures;
diff --git a/xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui b/xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui
index 31bec8316eb3..487bebdf8764 100644
--- a/xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui
+++ b/xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
+  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkDialog" id="DigitalSignaturesDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
@@ -65,14 +67,12 @@
               <object class="GtkLabel" id="dochint">
                 <property name="can_focus">False</property>
                 <property name="no_show_all">True</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes">The following have signed the document content: </property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -81,12 +81,13 @@
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection" id="Simple Table Container-selection1"/>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">4</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -136,12 +137,23 @@
                     <property name="position">2</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkButton" id="start_certmanager">
+                    <property name="label" translatable="yes">Start Certificate Manager...</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">7</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -160,8 +172,6 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -174,8 +184,6 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -188,14 +196,12 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkLabel" id="description">
-                    <property name="no_show_all">True</property>
                     <property name="can_focus">False</property>
+                    <property name="no_show_all">True</property>
                     <property name="label" translatable="yes">Description</property>
                   </object>
                   <packing>
@@ -205,8 +211,8 @@
                 </child>
                 <child>
                   <object class="GtkLabel" id="type">
-                    <property name="no_show_all">True</property>
                     <property name="can_focus">False</property>
+                    <property name="no_show_all">True</property>
                     <property name="label" translatable="yes">Signature type</property>
                   </object>
                   <packing>
@@ -218,36 +224,30 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">3</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkLabel" id="macrohint">
                 <property name="can_focus">False</property>
                 <property name="no_show_all">True</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes">The following have signed the document macro:</property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkLabel" id="packagehint">
                 <property name="can_focus">False</property>
                 <property name="no_show_all">True</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes">The following have signed this package:</property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -260,14 +260,12 @@
                     <property name="can_focus">False</property>
                     <property name="no_show_all">True</property>
                     <property name="hexpand">True</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">The signatures in this document are valid</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -279,8 +277,6 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -288,14 +284,12 @@
                     <property name="can_focus">False</property>
                     <property name="no_show_all">True</property>
                     <property name="hexpand">True</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">The signatures in this document are invalid</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -303,14 +297,12 @@
                     <property name="can_focus">False</property>
                     <property name="no_show_all">True</property>
                     <property name="hexpand">True</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">Not all parts of the document are signed</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -318,14 +310,12 @@
                     <property name="can_focus">False</property>
                     <property name="no_show_all">True</property>
                     <property name="hexpand">True</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">Certificate could not be validated</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="top_attach">3</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -337,8 +327,6 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -350,8 +338,6 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -363,16 +349,12 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">3</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">5</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -382,9 +364,10 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="halign">start</property>
+                <property name="xalign">0.5</property>
+                <property name="draw_indicator">False</property>
               </object>
               <packing>
-                <property name="expand">False</property>
                 <property name="left_attach">0</property>
                 <property name="top_attach">6</property>
               </packing>


More information about the Libreoffice-commits mailing list