cui/source/options/optupdt.cxx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
New commits: commit 43e6279e8f747b5e1c2d59a8794742c9843f05a8 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Tue Sep 17 11:54:10 2024 +0200 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sat Sep 28 07:32:58 2024 +0200 Resolves tdf#162979 - Avoid oversized online update options Don't wrap at every semicolon but only after 50 chars Change-Id: I91993d503c574a9c60d390afde159ade73567861 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173552 Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Tested-by: Jenkins (cherry picked from commit 74e3f47723471f3ed4dc2dbffc95085bb04d9504) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173913 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 71433ab2258f..71bd03a4e670 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -190,6 +190,25 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText() m_xLastChecked->set_label(aText); } +static inline OUString WrapString(const OUString& aStr) +{ + OUString sResult; + OUString sPos; + int nPos = 0; + for (int i = 0; i < aStr.getLength(); i++) + { + sPos = aStr.subView(i, 1); + sResult += sPos; + if ((nPos > 50) && (sPos == ";")) + { + sResult += "/n"; + nPos = 0; + } + nPos++; + } + return sResult; +} + void SvxOnlineUpdateTabPage::UpdateUserAgent() { try { @@ -209,9 +228,7 @@ void SvxOnlineUpdateTabPage::UpdateUserAgent() if ( aHeader.First == "User-Agent" ) { OUString aText = aHeader.Second; - aText = aText.replaceAll(";", "; "); - aText = aText.replaceAll("(", " ("); - m_xUserAgentLabel->set_label(aText); + m_xUserAgentLabel->set_label(WrapString(aText)); break; } }