[Libreoffice-commits] core.git: cui/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 18 21:54:30 UTC 2020
cui/source/dialogs/about.cxx | 3 ---
1 file changed, 3 deletions(-)
New commits:
commit 9f4f44bbc7864cb7f1c996f9da6f4fabd81d0783
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Aug 18 21:53:06 2020 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Aug 18 23:53:49 2020 +0200
Remove code that has become nonsense over time
The getToken call started out as
> commit 6f9dff66ee12c3cf5874fd4a33b82dbb090fe124
> Author: Caolán McNamara <caolanm at redhat.com>
> Date: Tue Jun 28 13:00:51 2011 +0100
>
> break build id into multiple lines if using g log
>
> diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
> index 3157a9b48fd7..863bd90312fa 100644
> --- a/cui/source/dialogs/about.cxx
> +++ b/cui/source/dialogs/about.cxx
> @@ -72,13 +72,34 @@ Image SfxApplication::GetApplicationLogo()
> return Image( aBitmap );
> }
>
> -/* intense magic to get strong version information */
> +/* get good version information */
> static String
> GetBuildId()
> {
> rtl::OUString sDefault;
> - String sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) );
> - OSL_ENSURE( sBuildId.Len() > 0, "No BUILDID in bootstrap file" );
> + rtl::OUString sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) );
> + //strip trailing - from ./g log
> + if (!sBuildId.isEmpty() && sBuildId.getStr()[sBuildId.getLength()-1] == '-')
> + {
> + rtl::OUStringBuffer aBuffer;
> + sal_Int32 nIndex = 0;
> + do
> + {
> + rtl::OUString aToken = sBuildId.getToken( 0, '-', nIndex );
> + if (!aToken.isEmpty())
> + {
> + aBuffer.append(aToken);
> + if (nIndex % 5)
> + aBuffer.append(static_cast<sal_Unicode>('-'));
> + else
> + aBuffer.append(static_cast<sal_Unicode>('\n'));
> + }
> + }
> + while ( nIndex >= 0 );
> + sBuildId = aBuffer.makeStringAndClear();
> + }
> +
> + OSL_ENSURE( sBuildId.getLength() > 0, "No BUILDID in bootstrap file" );
> return sBuildId;
> }
>
presumably at a time when utl::Bootstrap::getBuildIdData returned multiple git
hashes for the split repositories back then, separated by dashes.
Then
> commit 8a3aae9b694deb2b41157509e84815a5b7fb7655
> Author: Andrew Higginson <at.higginsonAtgmail.com>
> Date: Tue Apr 10 12:43:48 2012 +0100
>
> Resolves: fdo#31022 about dialog is suboptimal
>
[...]
> diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
> index 3ee3e8fad261..a4352e1dd396 100644
> --- a/cui/source/dialogs/about.cxx
> +++ b/cui/source/dialogs/about.cxx
[...]
> +rtl::OUString AboutDialog::GetBuildId()
> +{
> + rtl::OUString sDefault;
> + rtl::OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault));
> + if (!sBuildId.isEmpty())
> + return sBuildId;
> +
> + sBuildId = utl::Bootstrap::getBuildIdData(sDefault);
> +
> + if (!sBuildId.isEmpty())
> + {
> + sal_Int32 nIndex = 0;
> + return sBuildId.getToken( 0, '-', nIndex );
> + }
> +
> + OSL_ENSURE( !sBuildId.isEmpty(), "No BUILDID in bootstrap file" );
> + return sBuildId;
> +}
[...]
changed that to only use the first dash-separated part of
utl::Bootstrap::getBuildIdData. The commit (and the corresponding
<https://bugs.documentfoundation.org/show_bug.cgi?id=31022> "EasyHacks: 'About
dialog' wording and layout are suboptimal") is vague on why it did that, but
maybe the value returned by utl::Bootstrap::getBuildIdData had meanwhile been
reduced to a single git monorepo hash value without any dashes anyway.
Finally,
> commit ab846145bbd56f4308c8657df8b1354a403edd74
> Author: Heiko Tietze <tietze.heiko at gmail.com>
> Date: Wed Apr 29 11:39:57 2020 +0200
>
> Resolves tdf#132322 - Link to Gerrit hash reintroduced
>
> Mulit-line label split, Build realized as link_button
>
> Required changes also solve tdf#132066 partially as many
> localized strings are not anymore copied to clipboard
>
> Change-Id: I346fdc65cd1734f17854eccd587fe0b7e216e720
> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93119
> Tested-by: Jenkins
> Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>
>
[...]
> diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
> index ed58d06acc1c..845ad5496a37 100644
> --- a/cui/source/dialogs/about.cxx
> +++ b/cui/source/dialogs/about.cxx
[...]
> +OUString AboutDialog::GetBuildString() {
>
[...]
> + OUString sDefault;
> + OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault));
> + if (sBuildId.isEmpty())
> + sBuildId = utl::Bootstrap::getBuildIdData(sDefault);
> + if (sBuildId.isEmpty()) {
> + sBuildId = sBuildId.getToken(0, '-');
> + }
> + OSL_ENSURE(!sBuildId.isEmpty(), "No BUILDID in bootstrap file");
> +
> + OUString sBuildStr;
>
> if (!sBuildId.trim().isEmpty()) {
[...]
> + sBuildStr = CuiResId(RID_SVXSTR_ABOUT_BUILDID);
> if (sBuildStr.indexOf("$BUILDID") == -1) {
> SAL_WARN("cui.dialogs", "translated Build Id string in translations "
> "doesn't contain $BUILDID placeholder");
> sBuildStr += " $BUILDID";
> }
[...]
> + sBuildStr = sBuildStr.replaceAll("$BUILDID", sBuildId);
> }
> + return sBuildStr;
> +}
apparently made two mistakes: For one, it dropped the early returns, so that
cutting at the first dash would also be done for a non-empty value returned from
utl::Bootstrap::getBuildVersion, and not only for the value returned from
utl::Bootstrap::getBuildIdData. But for another, it lost the "!" negation, so
that
if (sBuildId.isEmpty()) {
sBuildId = sBuildId.getToken(0, '-');
}
is dead code now.
The best solution for this mess is probably to just not attempt any kind of
cutting at a first dash.
Change-Id: Id801bb5995325e4d6cc6f8d257afe1af64ef12bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100961
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 84460e2984db..dd1b27442573 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -162,9 +162,6 @@ OUString AboutDialog::GetBuildString() {
OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault));
if (sBuildId.isEmpty())
sBuildId = utl::Bootstrap::getBuildIdData(sDefault);
- if (sBuildId.isEmpty()) {
- sBuildId = sBuildId.getToken(0, '-');
- }
OSL_ENSURE(!sBuildId.isEmpty(), "No BUILDID in bootstrap file");
return sBuildId;
More information about the Libreoffice-commits
mailing list