diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-01-30 10:21:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-01-30 10:41:28 +0000 |
commit | 5a7532b5ed3df5017b29964125f4609d45bdc647 (patch) | |
tree | 85dd4c73cf4c60a68b20c2bacafe067624f704bd /xmlsecurity/source | |
parent | Updated core (diff) | |
download | core-5a7532b5ed3df5017b29964125f4609d45bdc647.tar.gz core-5a7532b5ed3df5017b29964125f4609d45bdc647.zip |
convert cert path page to .ui
Change-Id: Ic726e5665a46b9e34fb05d800460b50977d94ee6
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r-- | xmlsecurity/source/dialogs/certificateviewer.cxx | 93 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/certificateviewer.src | 62 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/helpids.hrc | 2 |
3 files changed, 41 insertions, 116 deletions
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index f9ef599e0102..2f20b8aac9e6 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -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; diff --git a/xmlsecurity/source/dialogs/certificateviewer.src b/xmlsecurity/source/dialogs/certificateviewer.src index 9deabd966189..a7b35865d89c 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.src +++ b/xmlsecurity/source/dialogs/certificateviewer.src @@ -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: */ diff --git a/xmlsecurity/source/dialogs/helpids.hrc b/xmlsecurity/source/dialogs/helpids.hrc index 88a772987d76..6c49231ab3c0 100644 --- a/xmlsecurity/source/dialogs/helpids.hrc +++ b/xmlsecurity/source/dialogs/helpids.hrc @@ -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" |