[Libreoffice-commits] .: filter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 20 06:13:21 PDT 2012


 filter/source/pdf/impdialog.cxx |   56 +++++++++++++++++++++++++---------------
 filter/source/pdf/impdialog.hrc |   22 ++++++++-------
 filter/source/pdf/impdialog.hxx |   10 ++++---
 filter/source/pdf/impdialog.src |   41 +++++++++++++++++++----------
 4 files changed, 80 insertions(+), 49 deletions(-)

New commits:
commit 74ae4c44627068192eb0bda6c22367dd33cb0316
Author: Gökçen Eraslan <gokcen.eraslan at gmail.com>
Date:   Mon Aug 20 00:54:08 2012 +0200

    Use Thunderbird-like certificate selection GUI in pdf signing.
    
    Change-Id: Ibe834f1aecc60ba09a2c19d75b094881b82c248a
    Reviewed-on: https://gerrit.libreoffice.org/431
    Reviewed-by: Jan Holesovsky <kendy at suse.cz>
    Tested-by: Jan Holesovsky <kendy at suse.cz>

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 9f1bb2c..8330730 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -44,6 +44,7 @@
 #include "com/sun/star/frame/XController.hpp"
 #include "com/sun/star/view/XSelectionSupplier.hpp"
 #include "com/sun/star/security/XDocumentDigitalSignatures.hpp"
+#include "com/sun/star/security/XCertificate.hpp"
 
 #include <boost/shared_ptr.hpp>
 
@@ -1683,7 +1684,10 @@ ImpPDFTabSigningPage::ImpPDFTabSigningPage( Window* pParent,
                                               const SfxItemSet& rCoreSet ) :
     SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_SIGNING ), rCoreSet ),
 
-    maCbSignPDF( this, PDFFilterResId( CB_SIGN_PDF ) ),
+    maFtSignCert( this, PDFFilterResId( FT_SIGN_CERT_TEXT ) ),
+    maEdSignCert( this, PDFFilterResId( ED_SIGN_CERT ) ),
+    maPbSignCertSelect( this, PDFFilterResId( BTN_SIGN_CERT_SELECT ) ),
+    maPbSignCertClear( this, PDFFilterResId( BTN_SIGN_CERT_CLEAR ) ),
     maFtSignPassword( this, PDFFilterResId( FT_SIGN_PASSWORD ) ),
     maEdSignPassword( this, PDFFilterResId( ED_SIGN_PASSWORD ) ),
     maFtSignLocation( this, PDFFilterResId( FT_SIGN_LOCATION ) ),
@@ -1692,12 +1696,13 @@ ImpPDFTabSigningPage::ImpPDFTabSigningPage( Window* pParent,
     maEdSignContactInfo( this, PDFFilterResId( ED_SIGN_CONTACT ) ),
     maFtSignReason( this, PDFFilterResId( FT_SIGN_REASON ) ),
     maEdSignReason( this, PDFFilterResId( ED_SIGN_REASON ) ),
-    maPbSignSelectCert( this, PDFFilterResId( BTN_SIGN_SELECT_CERT ) ),
     maSignCertificate()
 {
     FreeResource();
 
-    maPbSignSelectCert.SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignSelectCert ) );
+    maPbSignCertSelect.Enable( true );
+    maPbSignCertSelect.SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignCertSelect ) );
+    maPbSignCertClear.SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignCertClear ) );
 }
 
 // -----------------------------------------------------------------------------
@@ -1705,7 +1710,7 @@ ImpPDFTabSigningPage::~ImpPDFTabSigningPage()
 {
 }
 
-IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignSelectCert )
+IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect )
 {
 
     uno::Sequence< uno::Any > aArgs( 2 );
@@ -1722,6 +1727,29 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignSelectCert )
 
     maSignCertificate = xSigner->chooseCertificate();
 
+    if (maSignCertificate.is())
+    {
+        maEdSignCert.SetText(maSignCertificate->getSubjectName());
+        maPbSignCertClear.Enable( true );
+        maEdSignLocation.Enable( true );
+        maEdSignPassword.Enable( true );
+        maEdSignContactInfo.Enable( true );
+        maEdSignReason.Enable( true );
+    }
+
+    return 0;
+}
+
+IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertClear )
+{
+    maEdSignCert.SetText(OUString(""));
+    maSignCertificate.clear();
+    maPbSignCertClear.Enable( false );
+    maEdSignLocation.Enable( false );
+    maEdSignPassword.Enable( false );
+    maEdSignContactInfo.Enable( false );
+    maEdSignReason.Enable( false );
+
     return 0;
 }
 
@@ -1735,12 +1763,12 @@ SfxTabPage*  ImpPDFTabSigningPage::Create( Window* pParent,
 // -----------------------------------------------------------------------------
 void ImpPDFTabSigningPage::GetFilterConfigItem( ImpPDFTabDialog* paParent  )
 {
-    paParent->mbSignPDF = maCbSignPDF.IsChecked();
+    paParent->mbSignPDF = maSignCertificate.is();
+    paParent->maSignCertificate = maSignCertificate;
     paParent->msSignLocation = maEdSignLocation.GetText();
     paParent->msSignPassword = maEdSignPassword.GetText();
     paParent->msSignContact = maEdSignContactInfo.GetText();
     paParent->msSignReason = maEdSignReason.GetText();
-    paParent->maSignCertificate = maSignCertificate;
 
 }
 
@@ -1748,16 +1776,14 @@ void ImpPDFTabSigningPage::GetFilterConfigItem( ImpPDFTabDialog* paParent  )
 void ImpPDFTabSigningPage::SetFilterConfigItem( const  ImpPDFTabDialog* paParent )
 {
 
-    maCbSignPDF.SetToggleHdl( LINK( this, ImpPDFTabSigningPage, ToggleSignPDFHdl ) );
     maEdSignLocation.Enable( false );
     maEdSignPassword.Enable( false );
     maEdSignContactInfo.Enable( false );
     maEdSignReason.Enable( false );
-    maPbSignSelectCert.Enable( false );
+    maPbSignCertClear.Enable( false );
 
     if (paParent->mbSignPDF)
     {
-        maCbSignPDF.Check();
         maEdSignPassword.SetText(paParent->msSignPassword);
         maEdSignLocation.SetText(paParent->msSignLocation);
         maEdSignContactInfo.SetText(paParent->msSignContact);
@@ -1766,16 +1792,4 @@ void ImpPDFTabSigningPage::SetFilterConfigItem( const  ImpPDFTabDialog* paParent
     }
 }
 
-// -----------------------------------------------------------------------------
-IMPL_LINK_NOARG(ImpPDFTabSigningPage, ToggleSignPDFHdl)
-{
-    maEdSignPassword.Enable( maCbSignPDF.IsChecked() );
-    maEdSignLocation.Enable( maCbSignPDF.IsChecked() );
-    maEdSignContactInfo.Enable( maCbSignPDF.IsChecked() );
-    maEdSignReason.Enable( maCbSignPDF.IsChecked() );
-    maPbSignSelectCert.Enable( maCbSignPDF.IsChecked() );
-
-    return 0;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc
index 110bae0..4303e13 100644
--- a/filter/source/pdf/impdialog.hrc
+++ b/filter/source/pdf/impdialog.hrc
@@ -180,13 +180,15 @@
 #define FL_SECURITY_VERTICAL 160
 
 //controls for digital signatures tab page
-#define CB_SIGN_PDF          170
-#define FT_SIGN_PASSWORD     171
-#define ED_SIGN_PASSWORD     172
-#define FT_SIGN_LOCATION     173
-#define ED_SIGN_LOCATION     174
-#define FT_SIGN_CONTACT      175
-#define ED_SIGN_CONTACT      176
-#define FT_SIGN_REASON       177
-#define ED_SIGN_REASON       178
-#define BTN_SIGN_SELECT_CERT 179
+#define FT_SIGN_CERT_TEXT    170
+#define ED_SIGN_CERT         171
+#define BTN_SIGN_CERT_SELECT 172
+#define BTN_SIGN_CERT_CLEAR  173
+#define FT_SIGN_PASSWORD     174
+#define ED_SIGN_PASSWORD     175
+#define FT_SIGN_LOCATION     176
+#define ED_SIGN_LOCATION     177
+#define FT_SIGN_CONTACT      178
+#define ED_SIGN_CONTACT      179
+#define FT_SIGN_REASON       180
+#define ED_SIGN_REASON       181
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 8c468b1..0a42cc9 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -441,7 +441,10 @@ public:
 //class to implement the digital signing
 class ImpPDFTabSigningPage : public SfxTabPage
 {
-    CheckBox                    maCbSignPDF;
+    FixedText                   maFtSignCert;
+    Edit                        maEdSignCert;
+    PushButton                  maPbSignCertSelect;
+    PushButton                  maPbSignCertClear;
     FixedText                   maFtSignPassword;
     Edit                        maEdSignPassword;
     FixedText                   maFtSignLocation;
@@ -450,11 +453,10 @@ class ImpPDFTabSigningPage : public SfxTabPage
     Edit                        maEdSignContactInfo;
     FixedText                   maFtSignReason;
     Edit                        maEdSignReason;
-    PushButton                  maPbSignSelectCert;
     com::sun::star::uno::Reference< com::sun::star::security::XCertificate > maSignCertificate;
 
-    DECL_LINK( ToggleSignPDFHdl, void* );
-    DECL_LINK( ClickmaPbSignSelectCert, void* );
+    DECL_LINK( ClickmaPbSignCertSelect, void* );
+    DECL_LINK( ClickmaPbSignCertClear, void* );
 
 public:
     ImpPDFTabSigningPage( Window* pParent,
diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src
index afae67e..cf6cfa1 100644
--- a/filter/source/pdf/impdialog.src
+++ b/filter/source/pdf/impdialog.src
@@ -825,27 +825,40 @@ TabPage  RID_PDF_TAB_SIGNING
     TAB_PDF_SIZE;
     Hide = TRUE;
 
-    CheckBox CB_SIGN_PDF
+    FixedText FT_SIGN_CERT_TEXT
     {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 164 , 16 ) ;
-        TabStop = TRUE ;
-        WordBreak = TRUE ;
-        Text[ en-US ] = "Sign PDF file" ;
+        Pos = MAP_APPFONT( 6, 3 );
+        Size = MAP_APPFONT( 200, 10 );
+        Text[ en-US ] = "Use this certificate to digitally sign PDF documents:";
     };
 
-    PushButton BTN_SIGN_SELECT_CERT
+    Edit ED_SIGN_CERT
     {
-        TabStop = TRUE ;
+        Border = TRUE ;
         Disable = TRUE ;
-        Pos = MAP_APPFONT ( 12, 17 ) ;
+        Pos = MAP_APPFONT ( 6, 17 ) ;
         Size = MAP_APPFONT ( 120 , 13 ) ;
-        Text[ en-US ] = "Select c~ertificate...";
+    };
+
+    PushButton BTN_SIGN_CERT_SELECT
+    {
+        TabStop = TRUE ;
+        Pos = MAP_APPFONT ( 130, 17 ) ;
+        Size = MAP_APPFONT ( 30 , 13 ) ;
+        Text[ en-US ] = "~Select...";
+    };
+
+    PushButton BTN_SIGN_CERT_CLEAR
+    {
+        TabStop = TRUE ;
+        Pos = MAP_APPFONT ( 165, 17 ) ;
+        Size = MAP_APPFONT ( 30 , 13 ) ;
+        Text[ en-US ] = "Clear";
     };
 
     FixedText FT_SIGN_PASSWORD
     {
-        Pos = MAP_APPFONT( 12, 35 );
+        Pos = MAP_APPFONT( 6, 35 );
         Size = MAP_APPFONT( 109, 10 );
         Text[ en-US ] = "Certificate Password";
     };
@@ -859,7 +872,7 @@ TabPage  RID_PDF_TAB_SIGNING
 
     FixedText FT_SIGN_LOCATION
     {
-        Pos = MAP_APPFONT( 12, 48 );
+        Pos = MAP_APPFONT( 6, 48 );
         Size = MAP_APPFONT( 109, 10 );
         Text[ en-US ] = "Location";
     };
@@ -873,7 +886,7 @@ TabPage  RID_PDF_TAB_SIGNING
 
     FixedText FT_SIGN_CONTACT
     {
-        Pos = MAP_APPFONT( 12, 61 );
+        Pos = MAP_APPFONT( 6, 61 );
         Size = MAP_APPFONT( 109, 10 );
         Text[ en-US ] = "Contact Information";
     };
@@ -887,7 +900,7 @@ TabPage  RID_PDF_TAB_SIGNING
 
     FixedText FT_SIGN_REASON
     {
-        Pos = MAP_APPFONT( 12, 74 );
+        Pos = MAP_APPFONT( 6, 74 );
         Size = MAP_APPFONT( 109, 10 );
         Text[ en-US ] = "Reason";
     };


More information about the Libreoffice-commits mailing list