Converted RID_XMLSECTP_GENERAL to Widget Layout.

Change-Id: I52a7f857715dc9cba7aa7748cea5b30b91ed9011
Reviewed-on: https://gerrit.libreoffice.org/10842
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
This commit is contained in:
Rachit Gupta 2014-08-09 11:29:36 +05:30 committed by David Tardon
parent 4d635dcae4
commit ab1892d0cd
6 changed files with 274 additions and 202 deletions

View file

@ -12,6 +12,7 @@ $(eval $(call gb_UIConfig_UIConfig,xmlsec))
$(eval $(call gb_UIConfig_add_uifiles,xmlsec,\
xmlsecurity/uiconfig/ui/certpage \
xmlsecurity/uiconfig/ui/certdetails \
xmlsecurity/uiconfig/ui/certgeneral \
xmlsecurity/uiconfig/ui/digitalsignaturesdialog \
xmlsecurity/uiconfig/ui/securitylevelpage \
xmlsecurity/uiconfig/ui/securitytrustpage \

View file

@ -78,19 +78,13 @@ public:
class CertificateViewerGeneralTP : public CertificateViewerTP
{
private:
Window maFrameWin;
FixedImage maCertImg;
FixedInfo maCertInfoFI;
FixedLine maSep1FL;
FixedInfo maHintNotTrustedFI;
FixedLine maSep2FL;
FixedInfo maIssuedToLabelFI;
FixedInfo maIssuedToFI;
FixedInfo maIssuedByLabelFI;
FixedInfo maIssuedByFI;
FixedInfo maValidDateFI;
FixedImage maKeyImg;
FixedInfo maHintCorrespPrivKeyFI;
FixedImage* m_pCertImg;
FixedText* m_pHintNotTrustedFI;
FixedText* m_pIssuedToFI;
FixedText* m_pIssuedByFI;
FixedText* m_pValidDateFI;
FixedImage* m_pKeyImg;
FixedText* m_pHintCorrespPrivKeyFI;
public:
CertificateViewerGeneralTP( Window* pParent, CertificateViewer* _pDlg );

View file

@ -88,21 +88,16 @@ CertificateViewerTP::CertificateViewerTP( Window* _pParent, const OString& rID,
}
CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, CertificateViewer* _pDlg )
:CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_GENERAL ), _pDlg )
,maFrameWin ( this, XMLSEC_RES( WIN_FRAME ) )
,maCertImg ( this, XMLSEC_RES( IMG_CERT ) )
,maCertInfoFI ( this, XMLSEC_RES( FI_CERTINFO ) )
,maSep1FL ( this, XMLSEC_RES( FL_SEP1 ) )
,maHintNotTrustedFI ( this, XMLSEC_RES( FI_HINTNOTTRUST ) )
,maSep2FL ( this, XMLSEC_RES( FL_SEP2 ) )
,maIssuedToLabelFI ( this, XMLSEC_RES( FI_ISSTOLABEL ) )
,maIssuedToFI ( this, XMLSEC_RES( FI_ISSTO ) )
,maIssuedByLabelFI ( this, XMLSEC_RES( FI_ISSBYLABEL ) )
,maIssuedByFI ( this, XMLSEC_RES( FI_ISSBY ) )
,maValidDateFI ( this, XMLSEC_RES( FI_VALIDDATE ) )
,maKeyImg ( this, XMLSEC_RES( IMG_KEY ) )
,maHintCorrespPrivKeyFI ( this, XMLSEC_RES( FI_CORRPRIVKEY ) )
:CertificateViewerTP ( _pParent, "CertGeneral", "xmlsec/ui/certgeneral.ui", _pDlg )
{
get( m_pCertImg, "certimage" );
get( m_pHintNotTrustedFI, "hintnotrust" );
get( m_pIssuedToFI, "issuedto" );
get( m_pIssuedByFI, "issuedby" );
get( m_pValidDateFI, "validdate" );
get( m_pKeyImg, "keyimage" );
get( m_pHintCorrespPrivKeyFI, "privatekey" );
//Verify the certificate
sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(mpDlg->mxCert,
Sequence<Reference<css::security::XCertificate> >());
@ -111,80 +106,27 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif
if ( !bCertValid )
{
maCertImg.SetImage(
m_pCertImg->SetImage(
Image( XMLSEC_RES( IMG_STATE_NOT_VALIDATED ) ) );
maHintNotTrustedFI.SetText( XMLSEC_RES( STR_CERTIFICATE_NOT_VALIDATED ) );
m_pHintNotTrustedFI->SetText( XMLSEC_RES( STR_CERTIFICATE_NOT_VALIDATED ) );
}
FreeResource();
Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() );
maFrameWin.SetBackground( aBack );
maCertImg.SetBackground( aBack );
maCertInfoFI.SetBackground( aBack );
maSep1FL.SetBackground( aBack );
maHintNotTrustedFI.SetBackground( aBack );
maSep2FL.SetBackground( aBack );
maIssuedToLabelFI.SetBackground( aBack );
maIssuedToFI.SetBackground( aBack );
maIssuedByLabelFI.SetBackground( aBack );
maIssuedByFI.SetBackground( aBack );
maValidDateFI.SetBackground( aBack );
maKeyImg.SetBackground( aBack );
maHintCorrespPrivKeyFI.SetBackground( aBack );
// make some bold
Font aFnt( maCertInfoFI.GetFont() );
aFnt.SetWeight( WEIGHT_BOLD );
maCertInfoFI.SetFont( aFnt );
maHintNotTrustedFI.SetFont( aFnt );
maIssuedToLabelFI.SetFont( aFnt );
maIssuedByLabelFI.SetFont( aFnt );
maValidDateFI.SetFont( aFnt );
// insert data
css::uno::Reference< css::security::XCertificate > xCert = mpDlg->mxCert;
maIssuedToFI.SetText( XmlSec::GetContentPart( xCert->getSubjectName() ) );
maIssuedByFI.SetText( XmlSec::GetContentPart( xCert->getIssuerName() ) );
// dynamic length because of the different languages
long nWidth1 = maIssuedToLabelFI.GetTextWidth( maIssuedToLabelFI.GetText() );
long nWidth2 = maIssuedByLabelFI.GetTextWidth( maIssuedByLabelFI.GetText() );
long nNewWidth = std::max( nWidth1, nWidth2 ) + 5;
Size aNewSize = maIssuedToLabelFI.GetSizePixel();
aNewSize.Width() = nNewWidth;
maIssuedToLabelFI.SetSizePixel( aNewSize );
maIssuedByLabelFI.SetSizePixel( aNewSize );
long nNewX = maIssuedToLabelFI.GetPosPixel().X() + nNewWidth + 1;
Point aNewPos = maIssuedToFI.GetPosPixel();
aNewPos.X() = nNewX;
maIssuedToFI.SetPosPixel( aNewPos );
aNewPos = maIssuedByFI.GetPosPixel();
aNewPos.X() = nNewX;
maIssuedByFI.SetPosPixel( aNewPos );
nNewWidth = maValidDateFI.GetSizePixel().Width() - nNewX;
aNewSize = maIssuedToFI.GetSizePixel();
aNewSize.Width() = nNewWidth;
maIssuedToFI.SetSizePixel( aNewSize );
maIssuedByFI.SetSizePixel( aNewSize );
m_pIssuedToFI->SetText( XmlSec::GetContentPart( xCert->getSubjectName() ) );
m_pIssuedByFI->SetText( XmlSec::GetContentPart( xCert->getIssuerName() ) );
DateTime aDateTimeStart( DateTime::EMPTY );
DateTime aDateTimeEnd( DateTime::EMPTY );
utl::typeConvert( xCert->getNotValidBefore(), aDateTimeStart );
utl::typeConvert( xCert->getNotValidAfter(), aDateTimeEnd );
OUString sText = maValidDateFI.GetText();
OUString sText = m_pValidDateFI->GetText();
sText = sText.replaceFirst( "%SDATE%",
GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeStart.GetDate() ) );
sText = sText.replaceFirst( "%EDATE%",
GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeEnd.GetDate() ) );
maValidDateFI.SetText( sText );
// adjust position of fixed text depending on image sizes
ShrinkToFit( maCertImg );
ShrinkToFit( maKeyImg );
XmlSec::AlignAfterImage( maCertImg, maCertInfoFI, 12 );
XmlSec::AlignAfterImage( maKeyImg, maHintCorrespPrivKeyFI, 12 );
m_pValidDateFI->SetText( sText );
// Check if we have the private key...
bool bHasPrivateKey = false;
@ -196,8 +138,8 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif
}
if ( !bHasPrivateKey )
{
maKeyImg.Hide();
maHintCorrespPrivKeyFI.Hide();
m_pKeyImg->Hide();
m_pHintCorrespPrivKeyFI->Hide();
}
}

View file

@ -20,106 +20,15 @@
#include "dialogs.hrc"
#include "helpids.hrc"
TabPage RID_XMLSECTP_GENERAL
String STR_CERTIFICATE_NOT_VALIDATED
{
HelpId = HID_XMLSEC_TP_GENERAL;
Size = MAP_APPFONT( TP_WIDTH, TP_HEIGHT );
OutputSize = TRUE;
Hide = TRUE;
SVLook = TRUE;
Window WIN_FRAME
{
SVLook = TRUE;
Border = TRUE;
Pos = MAP_APPFONT( CV_COL_0, CV_ROW_0 );
Size = MAP_APPFONT( CV_CONT_WIDTH, CV_CONT_HEIGHT );
};
FixedImage IMG_CERT
{
Pos = MAP_APPFONT( CW_COL_0, CW_ROW_0 );
Size = MAP_APPFONT( IMG1_WIDTH, IMG1_HEIGHT );
Fixed = Image
{
ImageBitmap = Bitmap { File = "certificate_40x56.png"; };
MaskColor = STD_MASKCOLOR;
};
};
FixedText FI_CERTINFO
{
Pos = MAP_APPFONT( CW_COL_3, CW_ROW_1 );
Size = MAP_APPFONT( CW_COL_5-CW_COL_3, RSC_CD_FIXEDTEXT_HEIGHT );
Text [ en-US ] = " Certificate Information";
};
FixedLine FL_SEP1
{
Pos = MAP_APPFONT( CW_COL_0, CW_ROW_3 );
Size = MAP_APPFONT( CW_COL_5-CW_COL_0, RSC_CD_FIXEDLINE_HEIGHT );
};
FixedText FI_HINTNOTTRUST
{
Pos = MAP_APPFONT( CW_COL_1, CW_ROW_4 );
Size = MAP_APPFONT( CW_COL_5a-CW_COL_1, CW_ROW_4a-CW_ROW_4 );
WordBreak = TRUE;
Text [ en-US ] = "This certificate is intended for the following purpose(s):";
};
FixedLine FL_SEP2
{
Pos = MAP_APPFONT( CW_COL_0, CW_ROW_5 );
Size = MAP_APPFONT( CW_COL_5-CW_COL_0, RSC_CD_FIXEDLINE_HEIGHT );
};
FixedText FI_ISSTOLABEL
{
Pos = MAP_APPFONT( CW_COL_1, CW_ROW_6 );
Size = MAP_APPFONT( CW_COL_4-CW_COL_1-1, RSC_CD_FIXEDTEXT_HEIGHT );
Text [ en-US ] = "Issued to:";
};
FixedText FI_ISSTO
{
Pos = MAP_APPFONT( CW_COL_4, CW_ROW_6 );
Size = MAP_APPFONT( CW_COL_5-CW_COL_4, RSC_CD_FIXEDTEXT_HEIGHT );
};
FixedText FI_ISSBYLABEL
{
Pos = MAP_APPFONT( CW_COL_1, CW_ROW_7 );
Size = MAP_APPFONT( CW_COL_4-CW_COL_1-1, RSC_CD_FIXEDTEXT_HEIGHT );
Text [ en-US ] = "Issued by:";
};
FixedText FI_ISSBY
{
Pos = MAP_APPFONT( CW_COL_4, CW_ROW_7 );
Size = MAP_APPFONT( CW_COL_5-CW_COL_4, RSC_CD_FIXEDTEXT_HEIGHT );
};
FixedText FI_VALIDDATE
{
Pos = MAP_APPFONT( CW_COL_1, CW_ROW_8 );
Size = MAP_APPFONT( CW_COL_5-CW_COL_1-1, RSC_CD_FIXEDTEXT_HEIGHT );
Text [ en-US ] = "Valid from %SDATE% to %EDATE%";
};
FixedImage IMG_KEY
{
Pos = MAP_APPFONT( CW_COL_0, CW_ROW_9 );
Size = MAP_APPFONT( IMG2_WIDTH, IMG2_HEIGHT );
Fixed = Image
{
ImageBitmap = Bitmap { File = "key_12.png"; };
MaskColor = STD_MASKCOLOR;
};
};
FixedText FI_CORRPRIVKEY
{
Pos = MAP_APPFONT( CW_COL_1a, CW_ROW_10 );
Size = MAP_APPFONT( CW_COL_5-CW_COL_1a, RSC_CD_FIXEDTEXT_HEIGHT );
Text [ en-US ] = "You have a private key that corresponds to this certificate.";
};
String STR_CERTIFICATE_NOT_VALIDATED
{
Text [ en-US ] = "The certificate could not be validated.";
};
Image IMG_STATE_NOT_VALIDATED
{
ImageBitmap = Bitmap { File = "notcertificate_40x56.png"; };
MaskColor = STD_MASKCOLOR;
};
Text [ en-US ] = "The certificate could not be validated.";
};
Image IMG_STATE_NOT_VALIDATED
{
ImageBitmap = Bitmap { File = "notcertificate_40x56.png"; };
MaskColor = STD_MASKCOLOR;
};
String STR_HEADERBAR

View file

@ -74,21 +74,8 @@
#define CV_ROW_2 (CV_ROW_1+RSC_SP_CTRL_GROUP_Y)
// --------- tab page Certificate viewer - General ---------
#define WIN_FRAME 2
#define IMG_CERT 3
#define FI_CERTINFO 4
#define FL_SEP1 5
#define FI_HINTNOTTRUST 6
#define FL_SEP2 7
#define FI_ISSTOLABEL 8
#define FI_ISSTO 9
#define FI_ISSBYLABEL 10
#define FI_ISSBY 11
#define FI_VALIDDATE 12
#define IMG_KEY 13
#define FI_CORRPRIVKEY 14
#define STR_CERTIFICATE_NOT_VALIDATED 15
#define IMG_STATE_NOT_VALIDATED 16
#define STR_CERTIFICATE_NOT_VALIDATED 269
#define IMG_STATE_NOT_VALIDATED 270
#define IMG1_WIDTH 33
#define IMG1_HEIGHT 22

View file

@ -0,0 +1,239 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="CertGeneral">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="certimage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_top">12</property>
<property name="pixbuf">xmlsecurity/res/certificate_40x56.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">24</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="label" translatable="yes">Certificate Information</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="separator1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="hintnotrust">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">36</property>
<property name="margin_right">36</property>
<property name="margin_bottom">108</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">This certificate is intended for the following purpose(s):</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="separator2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="label" translatable="yes">Issued to: </property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="issuedto">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="label" translatable="yes">Issued by: </property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="issuedby">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="validdate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Valid from %SDATE% to %EDATE%</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="keyimage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="pixbuf">xmlsecurity/res/key_12.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="privatekey">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="label" translatable="yes">You have a private key that corresponds to this certificate.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</interface>