diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-19 13:18:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-05 09:39:11 +0200 |
commit | 14cfff500e93f0d6cbf8412065feea85c01ea81d (patch) | |
tree | 76e3fb8fbf2b0d8a12c8406d8cf994ea6a37aaff /uui/source | |
parent | d924ce30e0ca260682bd2aed192b8b1b2ca3e7c0 (diff) |
Pass context and resource string down to boost::locale separately
because this is often on a hot path, and we can avoid the splitting and
joining of strings like this.
Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'uui/source')
-rw-r--r-- | uui/source/iahndl-ssl.cxx | 4 | ||||
-rw-r--r-- | uui/source/iahndl.cxx | 2 | ||||
-rw-r--r-- | uui/source/iahndl.hxx | 5 | ||||
-rw-r--r-- | uui/source/passworddlg.cxx | 6 |
4 files changed, 9 insertions, 8 deletions
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx index df156bc44e3a..b0bdbb98eb38 100644 --- a/uui/source/iahndl-ssl.cxx +++ b/uui/source/iahndl-ssl.cxx @@ -176,8 +176,8 @@ executeSSLWarnDialog( // Get correct resource string std::vector< OUString > aArguments_1; - char const * pMessageKey = nullptr; - char const * pTitleKey = nullptr; + TranslateId pMessageKey; + TranslateId pTitleKey; switch( failure ) { diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 2897a582c3e9..2c6465c9e0ff 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -1246,7 +1246,7 @@ UUIInteractionHelper::handleBrokenPackageRequest( // ErrorResource Implementation bool ErrorResource::getString(ErrCode nErrorCode, OUString &rString) const { - for (const std::pair<const char*, ErrCode>* pStringArray = m_pStringArray; pStringArray->first != nullptr; ++pStringArray) + for (const std::pair<TranslateId, ErrCode>* pStringArray = m_pStringArray; pStringArray->first; ++pStringArray) { if (nErrorCode.StripWarningAndDynamic() == pStringArray->second.StripWarningAndDynamic()) { diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index 8dc828a7dd5f..5a8227b990a5 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -29,6 +29,7 @@ #include <com/sun/star/task/InteractionClassification.hpp> #include <vcl/errcode.hxx> +#include <unotools/resmgr.hxx> #include <unordered_map> #include <vector> @@ -251,10 +252,10 @@ private: class ErrorResource { - const std::pair<const char*, ErrCode>* m_pStringArray; + const std::pair<TranslateId, ErrCode>* m_pStringArray; const std::locale& m_rResLocale; public: - explicit ErrorResource(const std::pair<const char*, ErrCode>* pStringArray, const std::locale& rResLocale) + explicit ErrorResource(const std::pair<TranslateId, ErrCode>* pStringArray, const std::locale& rResLocale) : m_pStringArray(pStringArray) , m_rResLocale(rResLocale) { diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx index 694e717216b1..fb4c95e623f6 100644 --- a/uui/source/passworddlg.cxx +++ b/uui/source/passworddlg.cxx @@ -46,8 +46,8 @@ PasswordDialog::PasswordDialog(weld::Window* pParent, if( nDialogMode == task::PasswordRequestMode_PASSWORD_REENTER ) { - const char* pOpenToModifyErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG; - const char* pErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG : pOpenToModifyErrStrId; + TranslateId pOpenToModifyErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG; + TranslateId pErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG : pOpenToModifyErrStrId; OUString aErrorMsg(Translate::get(pErrStrId, rResLocale)); std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, VclButtonsType::Ok, aErrorMsg)); @@ -76,7 +76,7 @@ PasswordDialog::PasswordDialog(weld::Window* pParent, m_xDialog->set_title(aTitle); - const char* pStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN; + TranslateId pStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN; OUString aMessage(Translate::get(pStrId, rResLocale)); INetURLObject url(aDocURL); |