include/vcl/svapp.hxx | 7 +++++++ sc/source/core/tool/interpr5.cxx | 9 +++++++++ vcl/source/app/svapp.cxx | 18 ++++++++++++------ 3 files changed, 28 insertions(+), 6 deletions(-)
New commits: commit 4d0d4fb11f7251e0437ec8e6fe7b7693f3a31800 Author: scito <i...@scito.ch> AuthorDate: Thu Dec 30 13:25:38 2021 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Sat Jan 1 16:52:20 2022 +0100 tdf#140286 fix INFO("OSVERSION") for Linux: return kernel version If LibreOffice Calc is running on Linux, the Linux version as shown in about dialog is returned, e.g. "Linux 5.3". MacOS and Windows parts are prepared, but not implemented. (I develop only on Linux.) Change-Id: I2b266a257e5c01c0fde7d076385ded4a6413d3c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127756 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index b1db15915815..f4d065f1d664 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -901,6 +901,13 @@ public: */ static OUString GetAppName(); + /** + * Get the OS version based on the OS specific implementation. + * + * @return OUString version string or "-" in case of problems + */ + static OUString GetOSVersion(); + /** Get useful OS, Hardware and configuration information, * cf. Help->About, and User-Agent * bSelection = 0 to return all info, 1 for environment only, diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 74807696e055..f29fd1eaf941 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -38,6 +38,7 @@ #include <scresid.hxx> #include <cellkeytranslator.hxx> #include <formulagroup.hxx> +#include <vcl/svapp.hxx> //Application:: #include <vector> @@ -3320,7 +3321,15 @@ void ScInterpreter::ScInfo() if( aStr == "SYSTEM" ) PushString( SC_INFO_OSVERSION ); else if( aStr == "OSVERSION" ) +#if (defined LINUX || defined __FreeBSD__) + PushString(Application::GetOSVersion()); +#elif defined MACOSX + // TODO tdf#140286 handle MACOSX version to get result compatible to Excel + PushString("Windows (32-bit) NT 5.01"); +#else // handle Windows (WNT, WIN_NT, WIN32, _WIN32) + // TODO tdf#140286 handle Windows version to get a result compatible to Excel PushString( "Windows (32-bit) NT 5.01" ); +#endif else if( aStr == "RELEASE" ) PushString( ::utl::Bootstrap::getBuildIdData( OUString() ) ); else if( aStr == "NUMFILE" ) diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 66c030dd5501..f5e84b94bbd1 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1152,9 +1152,19 @@ static OUString Localize(TranslateId aId, const bool bLocalize) return Translate::get(aId, Translate::Create("vcl", LanguageTag("en-US"))); } -OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize) +OUString Application::GetOSVersion() { ImplSVData* pSVData = ImplGetSVData(); + OUString aVersion; + if (pSVData && pSVData->mpDefInst) + aVersion = pSVData->mpDefInst->getOSVersion(); + else + aVersion = "-"; + return aVersion; +} + +OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize) +{ OUStringBuffer aDetails; const auto appendDetails = [&aDetails](std::u16string_view sep, auto&& val) { @@ -1167,11 +1177,7 @@ OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize appendDetails(u"; ", Localize(SV_APP_CPUTHREADS, bLocalize) + OUString::number(std::thread::hardware_concurrency())); - OUString aVersion; - if ( pSVData && pSVData->mpDefInst ) - aVersion = pSVData->mpDefInst->getOSVersion(); - else - aVersion = "-"; + OUString aVersion = GetOSVersion(); appendDetails(u"; ", Localize(SV_APP_OSVERSION, bLocalize) + aVersion); }