diff options
Diffstat (limited to 'cui/source/dialogs/about.cxx')
-rw-r--r-- | cui/source/dialogs/about.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 336951b3a7f3..5d155dc9333a 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -47,6 +47,7 @@ #include <sfx2/app.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/bitmap.hxx> +#include <cctype> #if HAVE_FEATURE_OPENCL #include <opencl/openclwrapper.hxx> @@ -65,6 +66,7 @@ AboutDialog::AboutDialog(vcl::Window* pParent) get(m_pVersion, "version"); get(m_pDescriptionText, "description"); get(m_pCopyrightText, "copyright"); + get(m_pBuildIdLink, "buildIdLink"); m_aCopyrightTextStr = m_pCopyrightText->GetText(); get(m_pWebsiteButton, "website"); get(m_pCreditsButton, "credits"); @@ -75,12 +77,15 @@ AboutDialog::AboutDialog(vcl::Window* pParent) m_aBasedTextStr = get<FixedText>("libreoffice")->GetText(); m_aBasedDerivedTextStr = get<FixedText>("derived")->GetText(); m_aLocaleStr = get<FixedText>("locale")->GetText(); + m_buildIdLinkString = m_pBuildIdLink->GetText(); m_pVersion->SetText(GetVersionString()); OUString aCopyrightString = GetCopyrightString(); m_pCopyrightText->SetText( aCopyrightString ); + SetBuildIdLink(); + StyleControls(); SetLogo(); @@ -106,6 +111,7 @@ void AboutDialog::dispose() m_pLogoReplacement.clear(); m_pCreditsButton.clear(); m_pWebsiteButton.clear(); + m_pBuildIdLink.clear(); SfxModalDialog::dispose(); } @@ -142,6 +148,27 @@ IMPL_LINK( AboutDialog, HandleClick, Button*, pButton, void ) } } +void AboutDialog::SetBuildIdLink() +{ + const OUString buildId = GetBuildId(); + + if (IsStringValidGitHash(buildId)) + { + if (m_buildIdLinkString.indexOf("$GITHASH") == -1) + { + SAL_WARN( "cui.dialogs", "translated git hash string in translations doesn't contain $GITHASH placeholder" ); + m_buildIdLinkString += " $GITHASH"; + } + + m_pBuildIdLink->SetText(m_buildIdLinkString.replaceAll("$GITHASH", buildId)); + m_pBuildIdLink->SetURL("https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=" + buildId); + } + else + { + m_pBuildIdLink->Hide(); + } +} + void AboutDialog::StyleControls() { // Make all the controls have a transparent background @@ -264,6 +291,19 @@ OUString AboutDialog::GetLocaleString() return aLocaleStr; } +bool AboutDialog::IsStringValidGitHash(const OUString& hash) +{ + for (int i = 0; i < hash.getLength(); i++) + { + if (!std::isxdigit(hash[i])) + { + return false; + } + } + + return true; +} + OUString AboutDialog::GetVersionString() { OUString sVersion = m_aVersionTextStr; |