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.tietze@documentfoundation.org>
Tested-by: Jenkins
This commit is contained in:
Heiko Tietze 2024-09-17 11:54:10 +02:00 committed by Heiko Tietze
parent 7ccfc0277a
commit 74e3f47723

View file

@ -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(";", ";\n");
aText = aText.replaceAll("(", "\n(");
m_xUserAgentLabel->set_label(aText);
m_xUserAgentLabel->set_label(WrapString(aText));
break;
}
}