Kaydet (Commit) 5a7532b5 authored tarafından Caolán McNamara's avatar Caolán McNamara

convert cert path page to .ui

Change-Id: Ic726e5665a46b9e34fb05d800460b50977d94ee6
üst 992f52a8
......@@ -10,6 +10,7 @@
$(eval $(call gb_UIConfig_UIConfig,xmlsec))
$(eval $(call gb_UIConfig_add_uifiles,xmlsec,\
xmlsecurity/uiconfig/ui/certpage \
xmlsecurity/uiconfig/ui/digitalsignaturesdialog \
xmlsecurity/uiconfig/ui/securitylevelpage \
xmlsecurity/uiconfig/ui/securitytrustpage \
......
......@@ -67,15 +67,14 @@ protected:
CertificateViewer* mpDlg;
public:
CertificateViewerTP( Window* _pParent, const ResId& _rResId, CertificateViewer* _pDlg );
inline void SetTabDlg( CertificateViewer* pTabDlg );
CertificateViewerTP( Window* _pParent, const OString& rID,
const OUString& rUIXMLDescription, CertificateViewer* _pDlg );
void SetTabDlg( CertificateViewer* _pTabDlg )
{
mpDlg = _pTabDlg;
}
};
inline void CertificateViewerTP::SetTabDlg( CertificateViewer* _pTabDlg )
{
mpDlg = _pTabDlg;
}
class CertificateViewerGeneralTP : public CertificateViewerTP
{
private:
......@@ -123,11 +122,9 @@ public:
class CertificateViewerCertPathTP : public CertificateViewerTP
{
private:
FixedText maCertPathFT;
SvTreeListBox maCertPathLB;
PushButton maViewCertPB;
FixedText maCertStatusFT;
MultiLineEdit maCertStatusML;
SvTreeListBox* mpCertPathLB;
PushButton* mpViewCertPB;
VclMultiLineEdit* mpCertStatusML;
CertificateViewer* mpParent;
bool mbFirstActivateDone;
......
......@@ -24,7 +24,6 @@
#define RID_XMLSECTP_GENERAL 1003
#define RID_XMLSECTP_DETAILS 1004
#define RID_XMLSECTP_CERTPATH 1005
#define RID_XMLSECTP_MACROWARN 1009
......
......@@ -78,6 +78,12 @@ CertificateViewerTP::CertificateViewerTP( Window* _pParent, const ResId& _rResId
{
}
CertificateViewerTP::CertificateViewerTP( Window* _pParent, const OString& rID,
const OUString& rUIXMLDescription, CertificateViewer* _pDlg )
: TabPage(_pParent, rID, rUIXMLDescription)
, mpDlg(_pDlg)
{
}
CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, CertificateViewer* _pDlg )
:CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_GENERAL ), _pDlg )
......@@ -363,46 +369,29 @@ struct CertPath_UserData
CertificateViewerCertPathTP::CertificateViewerCertPathTP( Window* _pParent, CertificateViewer* _pDlg )
:CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_CERTPATH ), _pDlg )
,maCertPathFT ( this, XMLSEC_RES( FT_CERTPATH ) )
,maCertPathLB ( this, XMLSEC_RES( LB_SIGNATURES ) )
,maViewCertPB ( this, XMLSEC_RES( BTN_VIEWCERT ) )
,maCertStatusFT ( this, XMLSEC_RES( FT_CERTSTATUS ) )
,maCertStatusML ( this, XMLSEC_RES( ML_CERTSTATUS ) )
,mpParent ( _pDlg )
,mbFirstActivateDone ( false )
,maCertImage ( XMLSEC_RES( IMG_CERT_SMALL ) )
,maCertNotValidatedImage( XMLSEC_RES( IMG_CERT_NOTVALIDATED_SMALL ) )
,msCertOK ( XMLSEC_RES( STR_PATH_CERT_OK ) )
,msCertNotValidated ( XMLSEC_RES( STR_PATH_CERT_NOT_VALIDATED ) )
: CertificateViewerTP(_pParent, "CertPage", "xmlsec/ui/certpage.ui", _pDlg)
, mpParent(_pDlg)
, mbFirstActivateDone(false)
{
FreeResource();
maCertPathLB.SetNodeDefaultImages();
maCertPathLB.SetSublistOpenWithLeftRight();
maCertPathLB.SetSelectHdl( LINK( this, CertificateViewerCertPathTP, CertSelectHdl ) );
maViewCertPB.SetClickHdl( LINK( this, CertificateViewerCertPathTP, ViewCertHdl ) );
// check if buttontext is to wide
const long nOffset = 10;
OUString sText = maViewCertPB.GetText();
long nTxtW = maViewCertPB.GetTextWidth( sText );
if ( sText.indexOf( '~' ) == -1 )
nTxtW += nOffset;
long nBtnW = maViewCertPB.GetSizePixel().Width();
if ( nTxtW > nBtnW )
{
// broaden the button
long nDelta = nTxtW - nBtnW;
Size aNewSize = maViewCertPB.GetSizePixel();
aNewSize.Width() += nDelta;
maViewCertPB.SetSizePixel( aNewSize );
// and give it a new position
Point aNewPos = maViewCertPB.GetPosPixel();
aNewPos.X() -= nDelta;
maViewCertPB.SetPosPixel( aNewPos );
}
get(mpCertPathLB, "signatures");
get(mpViewCertPB, "viewcert");
get(mpCertStatusML, "status");
msCertOK = get<FixedText>("certok")->GetText();
msCertNotValidated = get<FixedText>("certnotok")->GetText();
maCertImage = get<FixedImage>("imgok")->GetImage();
maCertNotValidatedImage = get<FixedImage>("imgnotok")->GetImage();
Size aControlSize(LogicToPixel(Size(251, 45), MAP_APPFONT));
mpCertPathLB->set_width_request(aControlSize.Width());
mpCertPathLB->set_height_request(aControlSize.Height());
mpCertStatusML->set_width_request(aControlSize.Width());
mpCertStatusML->set_height_request(aControlSize.Height());
mpCertPathLB->SetNodeDefaultImages();
mpCertPathLB->SetSublistOpenWithLeftRight();
mpCertPathLB->SetSelectHdl( LINK( this, CertificateViewerCertPathTP, CertSelectHdl ) );
mpViewCertPB->SetClickHdl( LINK( this, CertificateViewerCertPathTP, ViewCertHdl ) );
}
CertificateViewerCertPathTP::~CertificateViewerCertPathTP()
......@@ -432,13 +421,13 @@ void CertificateViewerCertPathTP::ActivatePage()
pParent = InsertCert( pParent, sName, rCert, bCertValid);
}
maCertPathLB.Select( pParent );
maViewCertPB.Disable(); // Own certificate selected
mpCertPathLB->Select( pParent );
mpViewCertPB->Disable(); // Own certificate selected
while( pParent )
{
maCertPathLB.Expand( pParent );
pParent = maCertPathLB.GetParent( pParent );
mpCertPathLB->Expand( pParent );
pParent = mpCertPathLB->GetParent( pParent );
}
CertSelectHdl( NULL );
......@@ -447,7 +436,7 @@ void CertificateViewerCertPathTP::ActivatePage()
IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl)
{
SvTreeListEntry* pEntry = maCertPathLB.FirstSelected();
SvTreeListEntry* pEntry = mpCertPathLB->FirstSelected();
if( pEntry )
{
CertificateViewer aViewer( this, mpDlg->mxSecurityEnvironment, ((CertPath_UserData*)pEntry->GetUserData())->mxCert, false );
......@@ -460,7 +449,7 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl)
IMPL_LINK_NOARG(CertificateViewerCertPathTP, CertSelectHdl)
{
OUString sStatus;
SvTreeListEntry* pEntry = maCertPathLB.FirstSelected();
SvTreeListEntry* pEntry = mpCertPathLB->FirstSelected();
if( pEntry )
{
CertPath_UserData* pData = (CertPath_UserData*) pEntry->GetUserData();
......@@ -468,24 +457,24 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, CertSelectHdl)
sStatus = pData->mbValid ? msCertOK : msCertNotValidated;
}
maCertStatusML.SetText( sStatus );
maViewCertPB.Enable( pEntry && ( pEntry != maCertPathLB.Last() ) );
mpCertStatusML->SetText( sStatus );
mpViewCertPB->Enable( pEntry && ( pEntry != mpCertPathLB->Last() ) );
return 0;
}
void CertificateViewerCertPathTP::Clear( void )
{
maCertStatusML.SetText( OUString() );
mpCertStatusML->SetText( OUString() );
sal_uLong i = 0;
SvTreeListEntry* pEntry = maCertPathLB.GetEntry( i );
SvTreeListEntry* pEntry = mpCertPathLB->GetEntry( i );
while( pEntry )
{
delete ( CertPath_UserData* ) pEntry->GetUserData();
++i;
pEntry = maCertPathLB.GetEntry( i );
pEntry = mpCertPathLB->GetEntry( i );
}
maCertPathLB.Clear();
mpCertPathLB->Clear();
}
SvTreeListEntry* CertificateViewerCertPathTP::InsertCert(
......@@ -493,7 +482,7 @@ SvTreeListEntry* CertificateViewerCertPathTP::InsertCert(
bool bValid)
{
Image aImage = bValid ? maCertImage : maCertNotValidatedImage;
SvTreeListEntry* pEntry = maCertPathLB.InsertEntry( _rName, aImage, aImage, _pParent );
SvTreeListEntry* pEntry = mpCertPathLB->InsertEntry( _rName, aImage, aImage, _pParent );
pEntry->SetUserData( ( void* ) new CertPath_UserData( rxCert, bValid ) );
return pEntry;
......
......@@ -208,66 +208,4 @@ TabPage RID_XMLSECTP_DETAILS
};
};
TabPage RID_XMLSECTP_CERTPATH
{
HelpId = HID_XMLSEC_TP_CERTPATH;
Size = MAP_APPFONT( TP_WIDTH, TP_HEIGHT );
OutputSize = TRUE;
Hide = TRUE;
SVLook = TRUE;
FixedText FT_CERTPATH
{
Pos = MAP_APPFONT( CV_COL_0, CVP_ROW_0 );
Size = MAP_APPFONT( CV_CONT_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
Text [ en-US ] = "Certification path";
};
Control LB_SIGNATURES
{
HelpId = HID_XMLSEC_CTRL_VIEWSIGNATURES;
Pos = MAP_APPFONT( CV_COL_0, CVP_ROW_1 );
Size = MAP_APPFONT( CV_CONT_WIDTH, REST_HEIGHT/3*2 );
SVLook = TRUE;
Border = TRUE;
};
PushButton BTN_VIEWCERT
{
HelpID = "xmlsecurity:PushButton:RID_XMLSECTP_CERTPATH:BTN_VIEWCERT";
Pos = MAP_APPFONT( CV_COL_1-(CV_COL_B-CV_COL_A), CVP_ROW_2 );
Size = MAP_APPFONT( CV_COL_B-CV_COL_A, RSC_CD_PUSHBUTTON_HEIGHT );
Text [ en-US ] = "View Certificate...";
};
FixedText FT_CERTSTATUS
{
Pos = MAP_APPFONT( CV_COL_0, CVP_ROW_3 );
Size = MAP_APPFONT( CV_CONT_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
Text [ en-US ] = "Certification status";
};
MultiLineEdit ML_CERTSTATUS
{
HelpID = "xmlsecurity:MultiLineEdit:RID_XMLSECTP_CERTPATH:ML_CERTSTATUS";
Pos = MAP_APPFONT( CV_COL_0, CVP_ROW_4 );
Size = MAP_APPFONT( CV_CONT_WIDTH, REST_HEIGHT/3 );
ReadOnly = TRUE;
Border = TRUE;
};
Image IMG_CERT_SMALL
{
ImageBitmap = Bitmap { File = "certificate_16.png"; };
MaskColor = STD_MASKCOLOR;
};
Image IMG_CERT_NOTVALIDATED_SMALL
{
ImageBitmap = Bitmap { File = "notcertificate_16.png"; };
MaskColor = STD_MASKCOLOR;
};
String STR_PATH_CERT_OK
{
Text [ en-US ] = "The certificate is OK.";
};
String STR_PATH_CERT_NOT_VALIDATED
{
Text [ en-US ] = "The certificate could not be validated.";
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -26,10 +26,8 @@
#define HID_XMLSEC_TP_GENERAL "XMLSECURITY_HID_XMLSEC_TP_GENERAL"
#define HID_XMLSEC_TP_DETAILS "XMLSECURITY_HID_XMLSEC_TP_DETAILS"
#define HID_XMLSEC_TP_CERTPATH "XMLSECURITY_HID_XMLSEC_TP_CERTPATH"
#define HID_XMLSEC_TP_MACROWARN "XMLSECURITY_HID_XMLSEC_TP_MACROWARN"
#define HID_XMLSEC_CTRL_ELEMENTS "XMLSECURITY_HID_XMLSEC_CTRL_ELEMENTS"
#define HID_XMLSEC_CTRL_VIEWSIGNATURES "XMLSECURITY_HID_XMLSEC_CTRL_VIEWSIGNATURES"
#define HID_XMLSEC_CTRL_SIGNATURESDLG "XMLSECURITY_HID_XMLSEC_CTRL_SIGNATURESDLG"
#define HID_XMLSEC_CTRL_CHOOSESIGNATURES "XMLSECURITY_HID_XMLSEC_CTRL_CHOOSESIGNATURES"
#define HID_XMLSEC_TREE_SIGNATURESDLG "XMLSECURITY_HID_XMLSEC_TREE_SIGNATURESDLG"
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Thu Jan 30 10:32:36 2014 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkBox" id="CertPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Certification path</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">signatures:border</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>
<object class="GtkButton" id="viewcert">
<property name="label" translatable="yes">View Certificate...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="use_underline">True</property>
<property name="xalign">0.52999997138977051</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>
<object class="svtlo-SvTreeListBox" id="signatures:border">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Tree List-selection1"/>
</child>
</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>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Certification status</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">status:border</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>
<object class="GtkTextView" id="status:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="editable">False</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>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="certok">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">The certificate is OK.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="certnotok">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">The certificate could not be validated.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkImage" id="imgok">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="pixbuf">xmlsecurity/res/certificate_16.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkImage" id="imgnotok">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="pixbuf">xmlsecurity/res/notcertificate_16.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
</interface>
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