summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-18 21:14:00 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-21 19:28:59 +0200
commitd666c2f87d56da1f4dd3d421665ac3078c447a17 (patch)
treefb837b5b12955d94c06e1abdb0ccb09ceb901607 /xmlsecurity
parentd3ba63909740262e0cd64648e2eb00096b4626d2 (diff)
make string translation loading more uniform
change various ResId classes that use conversion operator to OUString to functions that return a OUString drop various defines drop unnecessary toString calls Change-Id: Ibeccdf2b91a46a2ed5b4b74e6024e301a023bc92 Reviewed-on: https://gerrit.libreoffice.org/37817 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 2155e04d6343638ca9815d394cbc4f78c2b17c3a) drop toString Change-Id: I0f67c8931523bbe90bfbc8cc7d9a5bd523758ee5 (cherry picked from commit 8b1101023f01b2c7478a014b5ead73ada4fd4861) pNameResId is unused Change-Id: Ic1fe6abc7066517187695266c4d1a0888b41ffe7 (cherry picked from commit c2667d7ff558a1b7bf83e694909465f00d1a16f6) Reviewed-on: https://gerrit.libreoffice.org/37843 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/inc/resourcemanager.hxx5
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx2
-rw-r--r--xmlsecurity/source/dialogs/certificateviewer.cxx28
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx4
4 files changed, 21 insertions, 18 deletions
diff --git a/xmlsecurity/inc/resourcemanager.hxx b/xmlsecurity/inc/resourcemanager.hxx
index f2352a94e62e..ece7fba24fe2 100644
--- a/xmlsecurity/inc/resourcemanager.hxx
+++ b/xmlsecurity/inc/resourcemanager.hxx
@@ -49,7 +49,10 @@ namespace XmlSec
OUString GetHexString( const css::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep, sal_uInt16 _nLineBreak = 0xFFFF );
}
-#define XMLSEC_RES(id) ResId(id,*XmlSec::GetResMgr())
+inline OUString XsResId(sal_uInt16 nId)
+{
+ return ResId(nId, *XmlSec::GetResMgr());
+}
#endif
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 95f249af12b6..4dfa87edeeda 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -245,7 +245,7 @@ bool DocumentDigitalSignatures::ImplViewSignatures(
}
else
{
- ScopedVclPtrInstance< MessageDialog > aBox(nullptr, XMLSEC_RES(RID_XMLSECWB_NO_MOZILLA_PROFILE), VclMessageType::Warning);
+ ScopedVclPtrInstance< MessageDialog > aBox(nullptr, XsResId(RID_XMLSECWB_NO_MOZILLA_PROFILE), VclMessageType::Warning);
aBox->Execute();
}
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 9aa192f47988..e4afcacf4714 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -121,7 +121,7 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( vcl::Window* _pParent, C
if ( !bCertValid )
{
m_pCertImg->SetImage(Image(BitmapEx(BMP_STATE_NOT_VALIDATED)));
- m_pHintNotTrustedFT->SetText( XMLSEC_RES( STR_CERTIFICATE_NOT_VALIDATED ) );
+ m_pHintNotTrustedFT->SetText( XsResId( STR_CERTIFICATE_NOT_VALIDATED ) );
}
// insert data
@@ -250,7 +250,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
constexpr int CS_LB_WIDTH = (DLGS_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT) - RSC_SP_DLG_INNERBORDER_LEFT;
static long nTabs[] = { 2, 0, 30*CS_LB_WIDTH/100 };
m_pElementsLB->SetTabs( &nTabs[ 0 ] );
- m_pElementsLB->InsertHeaderEntry( XMLSEC_RES( STR_HEADERBAR ) );
+ m_pElementsLB->InsertHeaderEntry( XsResId( STR_HEADERBAR ) );
// fill list box
Reference< security::XCertificate > xCert = mpDlg->mxCert;
@@ -260,62 +260,62 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
OUString aDetails;
// Certificate Versions are reported wrong (#i35107#) - 0 == "V1", 1 == "V2", ..., n = "V(n+1)"
aLBEntry = "V" + OUString::number( xCert->getVersion() + 1 );
- InsertElement( XMLSEC_RES( STR_VERSION ), aLBEntry, aLBEntry );
+ InsertElement( XsResId( STR_VERSION ), aLBEntry, aLBEntry );
Sequence< sal_Int8 > aSeq = xCert->getSerialNumber();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
- InsertElement( XMLSEC_RES( STR_SERIALNUM ), aLBEntry, aDetails, true );
+ InsertElement( XsResId( STR_SERIALNUM ), aLBEntry, aDetails, true );
std::pair< OUString, OUString> pairIssuer =
XmlSec::GetDNForCertDetailsView(xCert->getIssuerName());
aLBEntry = pairIssuer.first;
aDetails = pairIssuer.second;
- InsertElement( XMLSEC_RES( STR_ISSUER ), aLBEntry, aDetails );
+ InsertElement( XsResId( STR_ISSUER ), aLBEntry, aDetails );
DateTime aDateTime( DateTime::EMPTY );
utl::typeConvert( xCert->getNotValidBefore(), aDateTime );
aLBEntry = GetSettings().GetUILocaleDataWrapper().getDate( Date( aDateTime.GetDate()) );
aLBEntry += " ";
aLBEntry += GetSettings().GetUILocaleDataWrapper().getTime( aDateTime.GetTime() );
- InsertElement( XMLSEC_RES( STR_VALIDFROM ), aLBEntry, aLBEntry );
+ InsertElement( XsResId( STR_VALIDFROM ), aLBEntry, aLBEntry );
utl::typeConvert( xCert->getNotValidAfter(), aDateTime );
aLBEntry = GetSettings().GetUILocaleDataWrapper().getDate( Date( aDateTime.GetDate()) );
aLBEntry += " ";
aLBEntry += GetSettings().GetUILocaleDataWrapper().getTime( aDateTime.GetTime() );
- InsertElement( XMLSEC_RES( STR_VALIDTO ), aLBEntry, aLBEntry );
+ InsertElement( XsResId( STR_VALIDTO ), aLBEntry, aLBEntry );
std::pair< OUString, OUString > pairSubject =
XmlSec::GetDNForCertDetailsView(xCert->getSubjectName());
aLBEntry = pairSubject.first;
aDetails = pairSubject.second;
- InsertElement( XMLSEC_RES( STR_SUBJECT ), aLBEntry, aDetails );
+ InsertElement( XsResId( STR_SUBJECT ), aLBEntry, aDetails );
aLBEntry = aDetails = xCert->getSubjectPublicKeyAlgorithm();
- InsertElement( XMLSEC_RES( STR_SUBJECT_PUBKEY_ALGO ), aLBEntry, aDetails );
+ InsertElement( XsResId( STR_SUBJECT_PUBKEY_ALGO ), aLBEntry, aDetails );
aSeq = xCert->getSubjectPublicKeyValue();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
- InsertElement( XMLSEC_RES( STR_SUBJECT_PUBKEY_VAL ), aLBEntry, aDetails, true );
+ InsertElement( XsResId( STR_SUBJECT_PUBKEY_VAL ), aLBEntry, aDetails, true );
aLBEntry = aDetails = xCert->getSignatureAlgorithm();
- InsertElement( XMLSEC_RES( STR_SIGNATURE_ALGO ), aLBEntry, aDetails );
+ InsertElement( XsResId( STR_SIGNATURE_ALGO ), aLBEntry, aDetails );
CertificateChooser* pChooser = dynamic_cast<CertificateChooser*>(mpDlg->GetParent());
if (pChooser)
{
aLBEntry = pChooser->UsageInClearText( mpDlg->mxCert->getCertificateUsage() );
- InsertElement( XMLSEC_RES( STR_USE ), aLBEntry, aLBEntry );
+ InsertElement( XsResId( STR_USE ), aLBEntry, aLBEntry );
}
aSeq = xCert->getSHA1Thumbprint();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
- InsertElement( XMLSEC_RES( STR_THUMBPRINT_SHA1 ), aLBEntry, aDetails, true );
+ InsertElement( XsResId( STR_THUMBPRINT_SHA1 ), aLBEntry, aDetails, true );
aSeq = xCert->getMD5Thumbprint();
aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
- InsertElement( XMLSEC_RES( STR_THUMBPRINT_MD5 ), aLBEntry, aDetails, true );
+ InsertElement( XsResId( STR_THUMBPRINT_MD5 ), aLBEntry, aDetails, true );
m_pElementsLB->SetSelectHdl( LINK( this, CertificateViewerDetailsTP, ElementSelectHdl ) );
}
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index cedcb3ebc1d5..b88dd97337f8 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -273,7 +273,7 @@ bool DigitalSignaturesDialog::canAddRemove()
if ( (!bSave1_1 && bDoc1_1) || (bSave1_1 && bDoc1_1) )
{
//#4
- ScopedVclPtrInstance< MessageDialog > err(nullptr, XMLSEC_RES(STR_XMLSECDLG_OLD_ODF_FORMAT));
+ ScopedVclPtrInstance< MessageDialog > err(nullptr, XsResId(STR_XMLSECDLG_OLD_ODF_FORMAT));
err->Execute();
ret = false;
}
@@ -292,7 +292,7 @@ bool DigitalSignaturesDialog::canAddRemove()
//is shown every time until the user presses 'OK'. From then on, the warning
//is not displayed anymore as long as the signatures dialog is alive.
if (ScopedVclPtrInstance<MessageDialog>(
- nullptr, XMLSEC_RES(STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_NO)
+ nullptr, XsResId(STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_NO)
ret = false;
else
m_bWarningShowSignMacro = true;