summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/dialogs/about.cxx8
-rw-r--r--cui/source/options/optupdt.cxx69
-rw-r--r--cui/source/options/optupdt.hxx4
-rw-r--r--cui/uiconfig/ui/optonlineupdatepage.ui65
-rw-r--r--extensions/source/update/check/org/openoffice/Office/Jobs.xcu3
-rw-r--r--extensions/source/update/feed/updatefeed.cxx111
-rw-r--r--include/vcl/svapp.hxx5
-rw-r--r--instsetoo_native/CustomTarget_setup.mk2
-rw-r--r--offapi/com/sun/star/awt/XToolkitExperimental.idl3
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx9
-rw-r--r--vcl/generic/app/geninst.cxx33
-rw-r--r--vcl/inc/generic/geninst.h2
-rw-r--r--vcl/inc/salinst.hxx3
-rw-r--r--vcl/inc/win/salinst.h2
-rw-r--r--vcl/source/app/svapp.cxx32
-rw-r--r--vcl/win/source/app/salinst.cxx40
16 files changed, 343 insertions, 48 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 7dec2934519e..07615cdcef6a 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -48,7 +48,6 @@
#include <rtl/ustrbuf.hxx>
#include <vcl/bitmap.hxx>
#include <officecfg/Office/Common.hxx>
-#include <vcl/opengl/OpenGLWrapper.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -295,10 +294,9 @@ OUString AboutDialog::GetVersionString()
sVersion += m_sBuildStr.replaceAll("$BUILDID", sBuildId);
}
- if (OpenGLWrapper::isVCLOpenGLEnabled())
- {
- sVersion += "-GL";
- }
+ sVersion += "\n";
+ sVersion += Application::GetHWOSConfInfo();
+ sVersion += "\n";
if (EXTRA_BUILDID[0] != '\0')
{
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index 6ca3f1f63eec..9da2bb42da65 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -29,6 +29,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/deployment/UpdateInformationProvider.hpp>
+#include <com/sun/star/ucb/XWebDAVCommandEnvironment.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
@@ -38,9 +40,7 @@
#include <osl/file.hxx>
#include <osl/security.hxx>
-using namespace ::com::sun::star;
-
-// class SvxOnlineUpdateTabPage --------------------------------------------------
+using namespace ::css;
SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
: SfxTabPage(pParent, "OptOnlineUpdatePage", "cui/ui/optonlineupdatepage.ui", &rSet)
@@ -56,8 +56,11 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxIt
get(m_pDestPath, "destpath");
get(m_pChangePathButton, "changepath");
get(m_pLastChecked, "lastchecked");
+ get(m_pExtrasCheckBox, "extrabits");
+ get(m_pUserAgentLabel, "useragent");
m_pAutoCheckCheckBox->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) );
+ m_pExtrasCheckBox->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl ) );
m_pCheckNowButton->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) );
m_pChangePathButton->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) );
@@ -80,6 +83,7 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxIt
m_aLastCheckedTemplate = m_pLastChecked->GetText();
UpdateLastCheckedText();
+ UpdateUserAgent();
}
SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage()
@@ -99,10 +103,12 @@ void SvxOnlineUpdateTabPage::dispose()
m_pDestPath.clear();
m_pChangePathButton.clear();
m_pLastChecked.clear();
+ m_pExtrasCheckBox.clear();
+ m_pUserAgentLabel.clear();
+
SfxTabPage::dispose();
}
-
void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
{
OUString aDateStr;
@@ -160,6 +166,36 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
m_pLastChecked->SetText( aText );
}
+void SvxOnlineUpdateTabPage::UpdateUserAgent()
+{
+ try {
+ uno::Reference< ucb::XWebDAVCommandEnvironment > xDav(
+ css::deployment::UpdateInformationProvider::create(
+ ::comphelper::getProcessComponentContext() ),
+ css::uno::UNO_QUERY_THROW );
+
+ OUString aPseudoURL = "useragent:normal";
+ if( m_pExtrasCheckBox->IsChecked() )
+ aPseudoURL = "useragent:extended";
+ uno::Sequence< beans::StringPair > aHeaders
+ = xDav->getUserRequestHeaders( aPseudoURL, ucb::WebDAVHTTPMethod(0) );
+
+ for ( auto i = aHeaders.begin(); i != aHeaders.end(); ++i )
+ {
+ if ( i->First == "User-Agent" )
+ {
+ OUString aText = i->Second;
+ aText = aText.replaceAll(";", ";\n");
+ aText = aText.replaceAll("(", "\n(");
+ m_pUserAgentLabel->SetText( aText );
+ break;
+ }
+ }
+ } catch (const uno::Exception &) {
+ SAL_WARN( "cui.options", "Unexpected exception fetching User Agent" );
+ }
+}
+
VclPtr<SfxTabPage>
SvxOnlineUpdateTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
@@ -220,6 +256,13 @@ bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* )
bModified = true;
}
+ if( m_pExtrasCheckBox->IsValueChangedFromSaved() )
+ {
+ bValue = m_pExtrasCheckBox->IsChecked();
+ m_xUpdateAccess->replaceByName( "ExtendedUserAgent", uno::makeAny( bValue ) );
+ bModified = true;
+ }
+
uno::Reference< util::XChangesBatch > xChangesBatch(m_xUpdateAccess, uno::UNO_QUERY);
if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
xChangesBatch->commitChanges();
@@ -227,8 +270,6 @@ bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* )
return bModified;
}
-
-
void SvxOnlineUpdateTabPage::Reset( const SfxItemSet* )
{
bool bValue = false;
@@ -266,17 +307,18 @@ void SvxOnlineUpdateTabPage::Reset( const SfxItemSet* )
if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sValue, aPath) )
m_pDestPath->SetText(aPath);
+ m_xUpdateAccess->getByName( "ExtendedUserAgent" ) >>= bValue;
+ m_pExtrasCheckBox->Check(bValue);
+ m_pExtrasCheckBox->SaveValue();
+ UpdateUserAgent();
+
m_pAutoDownloadCheckBox->SaveValue();
}
-
-
void SvxOnlineUpdateTabPage::FillUserData()
{
}
-
-
IMPL_LINK_TYPED( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, Button*, pBox, void )
{
bool bEnabled = static_cast<CheckBox*>(pBox)->IsChecked();
@@ -286,7 +328,10 @@ IMPL_LINK_TYPED( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, Button*, pBox, void
m_pEveryMonthButton->Enable(bEnabled);
}
-
+IMPL_LINK_TYPED( SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl, Button*, , void )
+{
+ UpdateUserAgent();
+}
IMPL_LINK_NOARG_TYPED(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, Button*, void)
{
@@ -308,8 +353,6 @@ IMPL_LINK_NOARG_TYPED(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, Button*, void)
}
}
-
-
IMPL_LINK_NOARG_TYPED(SvxOnlineUpdateTabPage, CheckNowHdl_Impl, Button*, void)
{
uno::Reference < uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx
index 8844826cb69e..9460930fc164 100644
--- a/cui/source/options/optupdt.hxx
+++ b/cui/source/options/optupdt.hxx
@@ -39,16 +39,20 @@ private:
VclPtr<FixedText> m_pDestPath;
VclPtr<PushButton> m_pChangePathButton;
VclPtr<FixedText> m_pLastChecked;
+ VclPtr<CheckBox> m_pExtrasCheckBox;
+ VclPtr<FixedText> m_pUserAgentLabel;
OUString m_aNeverChecked;
OUString m_aLastCheckedTemplate;
DECL_LINK_TYPED(FileDialogHdl_Impl, Button*, void);
DECL_LINK_TYPED(CheckNowHdl_Impl, Button*, void);
DECL_LINK_TYPED(AutoCheckHdl_Impl, Button*, void);
+ DECL_LINK_TYPED(ExtrasCheckHdl_Impl, Button*, void);
css::uno::Reference< css::container::XNameReplace > m_xUpdateAccess;
void UpdateLastCheckedText();
+ void UpdateUserAgent();
public:
SvxOnlineUpdateTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
diff --git a/cui/uiconfig/ui/optonlineupdatepage.ui b/cui/uiconfig/ui/optonlineupdatepage.ui
index cf4c4ae9f093..4de11234344a 100644
--- a/cui/uiconfig/ui/optonlineupdatepage.ui
+++ b/cui/uiconfig/ui/optonlineupdatepage.ui
@@ -216,6 +216,71 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="extrabits">
+ <property name="label" translatable="yes">_Send OS version &amp; simple hardware info.</property>
+ <property name="tooltip_text" translatable="yes">This information lets us optimize for your hardware &amp; OS.</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <property name="homogeneous">False</property>
+ <child>
+ <object class="GtkLabel" id="useragent_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">User Agent:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="useragent_changed">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Hit apply to update</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="useragent">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="neverchecked">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
diff --git a/extensions/source/update/check/org/openoffice/Office/Jobs.xcu b/extensions/source/update/check/org/openoffice/Office/Jobs.xcu
index f11c14e9f74e..58db4048099e 100644
--- a/extensions/source/update/check/org/openoffice/Office/Jobs.xcu
+++ b/extensions/source/update/check/org/openoffice/Office/Jobs.xcu
@@ -49,6 +49,9 @@
<prop oor:name="DownloadPaused" oor:type="xs:boolean" oor:op="replace">
<value>false</value>
</prop>
+ <prop oor:name="ExtendedUserAgent" oor:type="xs:boolean" oor:op="replace">
+ <value>false</value>
+ </prop>
</node>
</node>
</node>
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index 8bb92778e288..12ee3a824249 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -46,6 +46,8 @@
#include <com/sun/star/task/PasswordContainerInteractionHandler.hpp>
#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
#include <com/sun/star/xml/xpath/XPathAPI.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
+#include <com/sun/star/awt/XToolkitExperimental.hpp>
#include <rtl/ref.hxx>
#include <rtl/bootstrap.hxx>
@@ -136,6 +138,8 @@ class UpdateInformationProvider :
ucb::XWebDAVCommandEnvironment,
lang::XServiceInfo >
{
+ OUString getUserAgent(bool bExtended);
+ bool isUserAgentExtended();
public:
static uno::Reference< uno::XInterface > createInstance(const uno::Reference<uno::XComponentContext>& xContext);
@@ -176,7 +180,7 @@ public:
// XWebDAVCommandEnvironment
virtual uno::Sequence< beans::StringPair > SAL_CALL getUserRequestHeaders(
const OUString&, ucb::WebDAVHTTPMethod )
- throw ( uno::RuntimeException, std::exception ) override { return m_aRequestHeaderList; };
+ throw ( uno::RuntimeException, std::exception ) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName()
@@ -190,6 +194,7 @@ protected:
virtual ~UpdateInformationProvider();
static OUString getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, OUString const & node, OUString const & item);
+ static uno::Any getConfigurationItemAny(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, OUString const & node, OUString const & item);
private:
uno::Reference< io::XInputStream > load(const OUString& rURL);
@@ -312,9 +317,6 @@ private:
deployment::UpdateInformationEntry m_aEntry;
};
-
-
-
UpdateInformationProvider::UpdateInformationProvider(
const uno::Reference<uno::XComponentContext>& xContext,
const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker,
@@ -324,11 +326,35 @@ UpdateInformationProvider::UpdateInformationProvider(
, m_xUniversalContentBroker(xUniversalContentBroker)
, m_xDocumentBuilder(xDocumentBuilder)
, m_xXPathAPI(xXPathAPI)
- , m_aRequestHeaderList(1)
+ , m_aRequestHeaderList(2)
, m_nCommandId(0)
{
uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(
- css::configuration::theDefaultProvider::get(xContext));
+ css::configuration::theDefaultProvider::get(m_xContext));
+
+ m_aRequestHeaderList[0].First = "Accept-Language";
+ m_aRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, "org.openoffice.Setup/L10N", "ooLocale" );
+}
+
+bool
+UpdateInformationProvider::isUserAgentExtended()
+{
+ uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(
+ css::configuration::theDefaultProvider::get(m_xContext));
+
+ uno::Any aExtended = getConfigurationItemAny(
+ xConfigurationProvider,
+ "org.openoffice.Office.Jobs/Jobs/UpdateCheck/Arguments",
+ "ExtendedUserAgent");
+ bool bExtendedUserAgent = false;
+ aExtended >>= bExtendedUserAgent;
+ return bExtendedUserAgent;
+}
+
+OUString UpdateInformationProvider::getUserAgent(bool bExtended)
+{
+ uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(
+ css::configuration::theDefaultProvider::get(m_xContext));
OUStringBuffer buf;
buf.append(
@@ -342,30 +368,63 @@ UpdateInformationProvider::UpdateInformationProvider(
xConfigurationProvider,
"org.openoffice.Setup/Product",
"ooSetupVersion"));
+
OUString extension(
getConfigurationItem(
xConfigurationProvider,
"org.openoffice.Setup/Product",
"ooSetupExtension"));
- if (!extension.isEmpty()) {
+ if (!extension.isEmpty())
buf.append(extension);
- }
+
OUString product(buf.makeStringAndClear());
OUString aUserAgent( "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ":UpdateUserAgent}" );
+ OUString aExtended;
+ if( bExtended )
+ {
+ try {
+ uno::Reference< css::awt::XToolkitExperimental > xToolkit(
+ css::awt::Toolkit::create( m_xContext ), uno::UNO_QUERY_THROW );
+ if ( xToolkit.is() )
+ aExtended = xToolkit->getHWOSConfInfo();
+ } catch (const uno::Exception &) {
+ SAL_WARN( "extensions.update", "Failed to find version info from toolkit" );
+ }
+ }
rtl::Bootstrap::expandMacros( aUserAgent );
aUserAgent = aUserAgent.replaceAll("<PRODUCT>", product);
+ aUserAgent = aUserAgent.replaceAll("<OPTIONAL_OS_HW_DATA>", aExtended);
SAL_INFO("extensions.update", "UpdateUserAgent: " << aUserAgent);
- m_aRequestHeaderList[0].First = "Accept-Language";
- m_aRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, "org.openoffice.Setup/L10N", "ooLocale" );
- if( !aUserAgent.isEmpty() )
+ return aUserAgent;
+}
+
+uno::Sequence< beans::StringPair > SAL_CALL UpdateInformationProvider::getUserRequestHeaders(
+ const OUString &aURL, ucb::WebDAVHTTPMethod )
+ throw ( uno::RuntimeException, std::exception )
+{
+ bool bExtendedUserAgent;
+ uno::Sequence< beans::StringPair > aPair = m_aRequestHeaderList;
+
+ // Internal use from cui/ some magic URLs
+ if( aURL.startsWith( "useragent:" ) )
+ bExtendedUserAgent = (aURL == "useragent:extended");
+ else
+ bExtendedUserAgent = isUserAgentExtended();
+
+ OUString aUserAgent = getUserAgent(bExtendedUserAgent);
+
+ if( aUserAgent.isEmpty() )
+ aPair.realloc(1);
+ else
{
- m_aRequestHeaderList.realloc(2);
- m_aRequestHeaderList[1].First = "User-Agent";
- m_aRequestHeaderList[1].Second = aUserAgent;
+ aPair[1].First = "User-Agent";
+ aPair[1].Second = aUserAgent;
}
-}
+
+ return aPair;
+};
uno::Reference< uno::XInterface >
UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentContext>& xContext)
@@ -383,18 +442,13 @@ UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentCo
return *new UpdateInformationProvider(xContext, xUniversalContentBroker, xDocumentBuilder, xXPath);
}
-
-
UpdateInformationProvider::~UpdateInformationProvider()
{
}
-
-
-OUString
-UpdateInformationProvider::getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, OUString const & node, OUString const & item)
+uno::Any
+UpdateInformationProvider::getConfigurationItemAny(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, OUString const & node, OUString const & item)
{
- rtl::OUString sRet;
beans::PropertyValue aProperty;
aProperty.Name = "nodepath";
aProperty.Value = uno::makeAny(node);
@@ -408,11 +462,16 @@ UpdateInformationProvider::getConfigurationItem(uno::Reference<lang::XMultiServi
aArgumentList ),
uno::UNO_QUERY_THROW);
- xNameAccess->getByName(item) >>= sRet;
- return sRet;
+ return xNameAccess->getByName(item);
}
-
+OUString
+UpdateInformationProvider::getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, OUString const & node, OUString const & item)
+{
+ OUString sRet;
+ getConfigurationItemAny(configurationProvider, node, item) >>= sRet;
+ return sRet;
+}
void
UpdateInformationProvider::storeCommandInfo(
@@ -425,8 +484,6 @@ UpdateInformationProvider::storeCommandInfo(
m_xCommandProcessor = rxCommandProcessor;
}
-
-
uno::Reference< io::XInputStream >
UpdateInformationProvider::load(const OUString& rURL)
{
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index f3521b0e7d86..a8b813bee26d 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -948,6 +948,11 @@ public:
*/
static OUString GetAppName();
+ /** Get useful OS, Hardware and configuration information,
+ * cf. Help->About, and User-Agent
+ */
+ static OUString GetHWOSConfInfo();
+
/** Load a localized branding PNG file as a bitmap.
@param pName Name of the bitmap to load.
diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk
index 5c332e001eed..e4cdd5330d36 100644
--- a/instsetoo_native/CustomTarget_setup.mk
+++ b/instsetoo_native/CustomTarget_setup.mk
@@ -143,7 +143,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_
&& echo 'ReferenceOOoMajorMinor=4.1' \
&& echo 'UpdateID=$(PRODUCTNAME)_$(LIBO_VERSION_MAJOR)_en-US' \
&& echo 'UpdateURL=$(if $(ENABLE_ONLINE_UPDATE),http://update.libreoffice.org/check.php$(if $(filter-out WNT,$(OS)),?pkgfmt=$(PKGFORMAT)))' \
- && echo 'UpdateUserAgent=<PRODUCT> ($${buildid}; $${_OS}; $${_ARCH}; BundledLanguages=$${AllLanguages})' \
+ && echo 'UpdateUserAgent=<PRODUCT> ($${buildid}; $${_OS}; $${_ARCH}; <OPTIONAL_OS_HW_DATA>BundledLanguages=$${AllLanguages})' \
&& echo 'Vendor=$(OOO_VENDOR)' \
) > $@
diff --git a/offapi/com/sun/star/awt/XToolkitExperimental.idl b/offapi/com/sun/star/awt/XToolkitExperimental.idl
index d12029029ab5..72fb3593242e 100644
--- a/offapi/com/sun/star/awt/XToolkitExperimental.idl
+++ b/offapi/com/sun/star/awt/XToolkitExperimental.idl
@@ -23,6 +23,9 @@ interface XToolkitExperimental : XToolkit2
*/
void processEventsToIdle();
+ /** Get misc. information for User-Agent:
+ */
+ string getHWOSConfInfo();
};
}; }; }; };
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index a763df17b8ff..a1100a866069 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -194,6 +194,8 @@ public:
// css::awt::XToolkitExperimental
virtual void SAL_CALL processEventsToIdle()
throw (css::uno::RuntimeException, std::exception) override;
+ virtual OUString SAL_CALL getHWOSConfInfo()
+ throw (::css::uno::RuntimeException, ::std::exception) override;
// css::awt::XToolkit
css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getDesktopWindow( ) throw(css::uno::RuntimeException, std::exception) override;
@@ -1913,6 +1915,13 @@ void SAL_CALL VCLXToolkit::processEventsToIdle()
Scheduler::ProcessTaskScheduling(false);
}
+OUString SAL_CALL VCLXToolkit::getHWOSConfInfo()
+ throw (::css::uno::RuntimeException, ::std::exception)
+{
+ SolarMutexGuard aSolarGuard;
+ return Application::GetHWOSConfInfo();
+}
+
// css:awt:XToolkitRobot
void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent )
diff --git a/vcl/generic/app/geninst.cxx b/vcl/generic/app/geninst.cxx
index f481eb880b27..27923a1b56c0 100644
--- a/vcl/generic/app/geninst.cxx
+++ b/vcl/generic/app/geninst.cxx
@@ -20,6 +20,10 @@
#include <string.h>
#include <stdlib.h>
+#if defined(LINUX)
+# include <stdio.h>
+#endif
+
#include <osl/module.hxx>
#include <comphelper/solarmutex.hxx>
#include <vcl/opengl/OpenGLContext.hxx>
@@ -128,4 +132,33 @@ SalGenericInstance::~SalGenericInstance()
delete mpSalYieldMutex;
}
+OUString SalGenericInstance::getOSVersion()
+{
+ OUString aKernelVer = "unknown";
+
+// not so generic, but at least shared between all unix backend
+#if defined(LINUX)
+ FILE* pVersion = fopen( "/proc/version", "r" );
+ if ( pVersion )
+ {
+ char aVerBuffer[512];
+ if ( fgets ( aVerBuffer, 511, pVersion ) )
+ {
+ aKernelVer = OUString::createFromAscii( aVerBuffer );
+ sal_Int32 nIndex = 0;
+ // "Linux version 3.16.7-29-desktop ..."
+ OUString aVers = aKernelVer.getToken( 2, ' ', nIndex );
+ // "3.16.7-29-desktop ..."
+ sal_Int32 nTooDetailed = aVers.indexOf( '.', 2);
+ if (nTooDetailed < 1 || nTooDetailed > 8)
+ aKernelVer = "misparse";
+ else // "3.16.7-29-desktop ..."
+ aKernelVer = aVers.copy(0, nTooDetailed);
+ }
+ fclose( pVersion );
+ }
+#endif
+ return aKernelVer;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/geninst.h b/vcl/inc/generic/geninst.h
index 0ebfd67f3957..5e7e61e0a50a 100644
--- a/vcl/inc/generic/geninst.h
+++ b/vcl/inc/generic/geninst.h
@@ -105,6 +105,8 @@ public:
bool isPrinterInit() const { return mbPrinterInit; }
virtual GenPspGraphics *CreatePrintGraphics() = 0;
+ virtual OUString getOSVersion() override;
+
// prolly belongs somewhere else ... just a font help
static void RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection );
static int FetchFontSubstitutionFlags();
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 8f1a4a595886..a5f8806a27de 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -172,6 +172,9 @@ public:
virtual void updatePrinterUpdate() {}
virtual void jobStartedPrinterUpdate() {}
virtual void jobEndedPrinterUpdate() {}
+
+ /// get information about underlying versions
+ virtual OUString getOSVersion() { return OUString("-"); }
};
// called from SVMain
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index 601159a26fb0..4c1bc7f7f055 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -82,6 +82,8 @@ public:
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) override;
virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override;
+ virtual OUString getOSVersion() override;
+
static int WorkaroundExceptionHandlingInUSER32Lib(int nExcept, LPEXCEPTION_POINTERS pExceptionInfo);
};
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 7f490b603c87..e8cb62f865b5 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -51,6 +51,7 @@
#include "vcl/scheduler.hxx"
#include "vcl/unohelp.hxx"
#include "vcl/lazydelete.hxx"
+#include "vcl/opengl/OpenGLWrapper.hxx"
#include "salinst.hxx"
#include "salframe.hxx"
@@ -74,6 +75,7 @@
#include <cassert>
#include <utility>
+#include <thread>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -1162,6 +1164,36 @@ OUString Application::GetAppName()
return OUString();
}
+OUString Application::GetHWOSConfInfo()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ OUStringBuffer aDetails;
+
+ aDetails.append( "Threads " );
+ aDetails.append( (sal_Int32)
+ std::thread::hardware_concurrency() );
+ aDetails.append( "; " );
+
+ OUString aVersion;
+ if ( pSVData && pSVData->mpDefInst )
+ aVersion = pSVData->mpDefInst->getOSVersion();
+ else
+ aVersion = "-";
+
+ aDetails.append( "Ver: " );
+ aDetails.append( aVersion );
+ aDetails.append( "; " );
+
+ aDetails.append( "Render: " );
+ if ( OpenGLWrapper::isVCLOpenGLEnabled() )
+ aDetails.append( "GL" );
+ else
+ aDetails.append( "default" );
+ aDetails.append( "; " );
+
+ return aDetails.makeStringAndClear();
+}
+
void Application::SetDisplayName( const OUString& rName )
{
ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index 4ddf3a9e616c..fcb5a1581405 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -115,7 +115,7 @@ class SalYieldMutex : public comphelper::SolarMutex
public: // for ImplSalYield()
WinSalInstance* mpInstData;
- sal_uLong mnCount;
+ sal_uLong mnCount;
DWORD mnThreadId;
public:
@@ -125,7 +125,7 @@ public:
virtual void release();
virtual bool tryToAcquire();
- sal_uLong GetAcquireCount( sal_uLong nThreadId );
+ sal_uLong GetAcquireCount( sal_uLong nThreadId );
};
SalYieldMutex::SalYieldMutex( WinSalInstance* pInstData )
@@ -1114,4 +1114,40 @@ int WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POIN
}
#endif
+OUString WinSalInstance::getOSVersion()
+{
+ SalData* pSalData = GetSalData();
+ if ( !pSalData )
+ return OUString("unknown");
+
+ WORD nMajor = 0, nMinor = 0;
+#ifdef _WIN32_WINNT_WINBLUE
+ // Trying to hide the real version info behind an
+ // uber-lame non-forward-compatible, 'compatibility' API
+ // seems unlikely to help OS designers, or API users.
+ nMajor = 30;
+ while( !IsWindowsVersionOrGreater( nMajor, 0, 0 ) && nMajor > 0)
+ nMajor--;
+ nMinor = 30;
+ while( !IsWindowsVersionOrGreater( nMajor, nMinor, 0 ) && nMinor > 0)
+ nMinor--;
+#else
+ OSVERSIONINFO aVersionInfo;
+ memset( &aVersionInfo, 0, sizeof( aVersionInfo ) );
+ aVersionInfo.dwOSVersionInfoSize = sizeof( aVersionInfo );
+ if ( GetVersionEx( &aVersionInfo ) )
+ {
+ nMajor = aVersionInfo.dwMajorVersion;
+ nMinor = aVersionInfo.dwMinorVersion;
+ }
+#endif
+ OUStringBuffer aVer;
+ aVer.append( "Windows " );
+ aVer.append( (sal_Int32)nMajor );
+ aVer.append( "." );
+ aVer.append( (sal_Int32)nMinor );
+
+ return aVer.makeStringAndClear();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */