Kaydet (Commit) 8438f7dc authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS xmlsec08 (1.4.24); FILE MERGED

2005/02/17 17:55:31 mt 1.4.24.3: #i41270# Don't check for pric key in doc cert...
2005/02/03 08:03:23 pb 1.4.24.2: fix: #i40109# enable OK button if a certificate is selected
2005/01/21 11:06:52 pb 1.4.24.1: fix: #i40374# use new GetContentPart()
üst 7c7d915c
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: certificatechooser.cxx,v $ * $RCSfile: certificatechooser.cxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: mt $ $Date: 2004-07-26 07:29:31 $ * last change: $Author: vg $ $Date: 2005-03-10 18:04:16 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -77,6 +77,10 @@ ...@@ -77,6 +77,10 @@
#include <dialogs.hrc> #include <dialogs.hrc>
#include <resourcemanager.hxx> #include <resourcemanager.hxx>
#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif
/* HACK: disable some warnings for MS-C */ /* HACK: disable some warnings for MS-C */
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (disable : 4355) // 4355: this used in initializer-list #pragma warning (disable : 4355) // 4355: this used in initializer-list
...@@ -114,9 +118,9 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< dcss:: ...@@ -114,9 +118,9 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< dcss::
FreeResource(); FreeResource();
mxSecurityEnvironment = _rxSecurityEnvironment; mxSecurityEnvironment = _rxSecurityEnvironment;
maCertLB.SetSelectHdl( LINK( this, CertificateChooser, CertificateHighlightHdl ) ); maCertLB.SetSelectHdl( LINK( this, CertificateChooser, CertificateHighlightHdl ) );
maCertLB.SetDoubleClickHdl( LINK( this, CertificateChooser, CertificateSelectHdl ) ); maCertLB.SetDoubleClickHdl( LINK( this, CertificateChooser, CertificateSelectHdl ) );
maViewBtn.SetClickHdl( LINK( this, CertificateChooser, ViewButtonHdl ) );
try try
{ {
...@@ -140,7 +144,8 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< dcss:: ...@@ -140,7 +144,8 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< dcss::
for( sal_Int32 nSig = 0; nSig < nCertificatesToIgnore; ++nSig ) for( sal_Int32 nSig = 0; nSig < nCertificatesToIgnore; ++nSig )
{ {
const SignatureInformation& rInf = _rCertsToIgnore[ nSig ]; const SignatureInformation& rInf = _rCertsToIgnore[ nSig ];
if( ( aIssuerName == rInf.ouX509IssuerName ) && ( bigIntegerToNumericString( xCert->getSerialNumber() ) == rInf.ouX509SerialNumber ) ) if ( ( aIssuerName == rInf.ouX509IssuerName ) &&
( bigIntegerToNumericString( xCert->getSerialNumber() ) == rInf.ouX509SerialNumber ) )
{ {
bIgnoreThis = true; bIgnoreThis = true;
break; break;
...@@ -165,22 +170,20 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< dcss:: ...@@ -165,22 +170,20 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< dcss::
} }
} }
String aCN_Id( String::CreateFromAscii( "CN" ) ); // fill list of certificates; the first entry will be selected
for ( sal_Int32 nC = 0; nC < nCertificates; ++nC )
for( sal_Int32 nC = 0; nC < nCertificates; ++nC )
{ {
String aSubject ( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName(), aCN_Id ) ); String sEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() ) );
String aDateTimeStr( XmlSec::GetDateString( maCerts[ nC ]->getNotAfter() ) ); sEntry += '\t';
String aIssuer ( XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName(), aCN_Id ) ); sEntry += XmlSec::GetDateString( maCerts[ nC ]->getNotAfter() );
sEntry += '\t';
SvLBoxEntry* pEntry = maCertLB.InsertEntry( aSubject ); sEntry += XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() );
maCertLB.SetEntryText( aIssuer, pEntry, 1 ); SvLBoxEntry* pEntry = maCertLB.InsertEntry( sEntry );
maCertLB.SetEntryText( aDateTimeStr, pEntry, 2 ); pEntry->SetUserData( ( void* )nC ); // missuse user data as index
pEntry->SetUserData( ( void* ) nC ); // missuse user data as index
} }
maViewBtn.SetClickHdl( LINK( this, CertificateChooser, ViewButtonHdl ) ); // enable/disable buttons
maViewBtn.Disable(); CertificateHighlightHdl( NULL );
} }
CertificateChooser::~CertificateChooser() CertificateChooser::~CertificateChooser()
...@@ -191,21 +194,22 @@ uno::Reference< dcss::security::XCertificate > CertificateChooser::GetSelectedCe ...@@ -191,21 +194,22 @@ uno::Reference< dcss::security::XCertificate > CertificateChooser::GetSelectedCe
{ {
uno::Reference< dcss::security::XCertificate > xCert; uno::Reference< dcss::security::XCertificate > xCert;
USHORT nSelected = GetSelectedEntryPos(); USHORT nSelected = GetSelectedEntryPos();
if( nSelected < maCerts.getLength() ) if ( nSelected < maCerts.getLength() )
xCert = maCerts[ nSelected ]; xCert = maCerts[ nSelected ];
return xCert; return xCert;
} }
IMPL_LINK( CertificateChooser, CertificateHighlightHdl, void*, EMPTYARG ) IMPL_LINK( CertificateChooser, CertificateHighlightHdl, void*, EMPTYARG )
{ {
maViewBtn.Enable(); sal_Bool bEnable = GetSelectedCertificate().is();
maViewBtn.Enable( bEnable );
maOKBtn.Enable( bEnable );
return 0; return 0;
} }
IMPL_LINK( CertificateChooser, CertificateSelectHdl, void*, EMPTYARG ) IMPL_LINK( CertificateChooser, CertificateSelectHdl, void*, EMPTYARG )
{ {
EndDialog( 1 ); EndDialog( RET_OK );
return 0; return 0;
} }
...@@ -220,7 +224,8 @@ void CertificateChooser::ImplShowCertificateDetails() ...@@ -220,7 +224,8 @@ void CertificateChooser::ImplShowCertificateDetails()
uno::Reference< dcss::security::XCertificate > xCert = GetSelectedCertificate(); uno::Reference< dcss::security::XCertificate > xCert = GetSelectedCertificate();
if( xCert.is() ) if( xCert.is() )
{ {
CertificateViewer aViewer( this, mxSecurityEnvironment, xCert ); CertificateViewer aViewer( this, mxSecurityEnvironment, xCert, TRUE );
aViewer.Execute(); aViewer.Execute();
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment