cui/source/options/optupdt.cxx | 63 +++++- cui/source/options/optupdt.hxx | 5 cui/uiconfig/ui/optonlineupdatepage.ui | 30 +++ extensions/Library_updatecheckui.mk | 2 extensions/Library_updatefeed.mk | 2 extensions/Library_updchk.mk | 2 extensions/source/update/check/org/openoffice/Office/Jobs.xcu | 3 extensions/source/update/check/updatecheckconfig.cxx | 92 ---------- extensions/source/update/feed/updatefeed.cxx | 1 9 files changed, 89 insertions(+), 111 deletions(-)
New commits: commit 730f4ad76a8b2cec4b48227a5dfb8c4119dbb3db Author: Michael Meeks <michael.me...@collabora.com> Date: Sat Nov 14 22:11:26 2015 +0000 Cleanup while reading extensions. Change-Id: I99c630c2b497b695365728ce5a2497ff64ff9f1a diff --git a/extensions/Library_updatecheckui.mk b/extensions/Library_updatecheckui.mk index 75d0f66..2b98794 100644 --- a/extensions/Library_updatecheckui.mk +++ b/extensions/Library_updatecheckui.mk @@ -1,13 +1,11 @@ # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- # -# # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# $(eval $(call gb_Library_Library,updatecheckui)) diff --git a/extensions/Library_updatefeed.mk b/extensions/Library_updatefeed.mk index 0024240..5c5a5cb 100644 --- a/extensions/Library_updatefeed.mk +++ b/extensions/Library_updatefeed.mk @@ -1,13 +1,11 @@ # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- # -# # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# $(eval $(call gb_Library_Library,updatefeed)) diff --git a/extensions/Library_updchk.mk b/extensions/Library_updchk.mk index c7299d3..7647805 100644 --- a/extensions/Library_updchk.mk +++ b/extensions/Library_updchk.mk @@ -1,13 +1,11 @@ # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- # -# # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# $(eval $(call gb_Library_Library,updchk)) diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index e8b29d7..07ea28c 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -80,14 +80,10 @@ static const sal_Char * const aUpdateEntryProperties[] = { static const sal_uInt32 nUpdateEntryProperties = SAL_N_ELEMENTS(aUpdateEntryProperties); - - NamedValueByNameAccess::~NamedValueByNameAccess() { } - - css::uno::Any NamedValueByNameAccess::getValue(const sal_Char * pName) { const sal_Int32 nLen = m_rValues.getLength(); @@ -99,25 +95,18 @@ css::uno::Any NamedValueByNameAccess::getValue(const sal_Char * pName) return css::uno::Any(); } - - - bool UpdateCheckROModel::isAutoCheckEnabled() const { return m_aNameAccess.getValue(AUTOCHECK_ENABLED).get<bool>(); } - - bool UpdateCheckROModel::isDownloadPaused() const { return m_aNameAccess.getValue(DOWNLOAD_PAUSED).get<bool>(); } - - OUString UpdateCheckROModel::getStringValue(const sal_Char * pStr) const { @@ -129,15 +118,11 @@ UpdateCheckROModel::getStringValue(const sal_Char * pStr) const return aRet; } - - OUString UpdateCheckROModel::getLocalFileName() const { return getStringValue(LOCAL_FILE); }; - - sal_Int64 UpdateCheckROModel::getDownloadSize() const { uno::Any aAny( m_aNameAccess.getValue(DOWNLOAD_SIZE) ); @@ -147,16 +132,12 @@ sal_Int64 UpdateCheckROModel::getDownloadSize() const return nRet; }; - - OUString UpdateCheckROModel::getUpdateEntryVersion() const { return getStringValue(OLD_VERSION); } - - void UpdateCheckROModel::getUpdateEntry(UpdateInfo& rInfo) const { @@ -179,9 +160,6 @@ UpdateCheckROModel::getUpdateEntry(UpdateInfo& rInfo) const } } - - - OUString UpdateCheckConfig::getDesktopDirectory() { OUString aRet; @@ -209,8 +187,6 @@ OUString UpdateCheckConfig::getDesktopDirectory() return aRet; } - - OUString UpdateCheckConfig::getAllUsersDirectory() { OUString aRet; @@ -230,7 +206,6 @@ OUString UpdateCheckConfig::getAllUsersDirectory() return aRet; } - UpdateCheckConfig::UpdateCheckConfig( const uno::Reference<container::XNameContainer>& xContainer, const uno::Reference<container::XNameContainer>& xAvailableUpdates, const uno::Reference<container::XNameContainer>& xIgnoredUpdates, @@ -241,12 +216,9 @@ UpdateCheckConfig::UpdateCheckConfig( const uno::Reference<container::XNameConta m_rListener( rListener ) {} - UpdateCheckConfig::~UpdateCheckConfig() {} - - ::rtl::Reference< UpdateCheckConfig > UpdateCheckConfig::get( const uno::Reference<uno::XComponentContext>& xContext, @@ -278,8 +250,6 @@ UpdateCheckConfig::get( return new UpdateCheckConfig( xContainer, xUpdateAvail, xIgnoredExt, rListener ); } - - bool UpdateCheckConfig::isAutoCheckEnabled() const { @@ -288,8 +258,6 @@ UpdateCheckConfig::isAutoCheckEnabled() const return nValue; } - - bool UpdateCheckConfig::isAutoDownloadEnabled() const { @@ -298,8 +266,6 @@ UpdateCheckConfig::isAutoDownloadEnabled() const return nValue; } - - OUString UpdateCheckConfig::getUpdateEntryVersion() const { @@ -311,8 +277,6 @@ UpdateCheckConfig::getUpdateEntryVersion() const return aValue; } - - sal_Int64 UpdateCheckConfig::getLastChecked() const { @@ -324,8 +288,6 @@ UpdateCheckConfig::getLastChecked() const return nValue; } - - sal_Int64 UpdateCheckConfig::getCheckInterval() const { @@ -337,8 +299,6 @@ UpdateCheckConfig::getCheckInterval() const return nValue; } - - OUString UpdateCheckConfig::getLocalFileName() const { @@ -351,8 +311,6 @@ UpdateCheckConfig::getLocalFileName() const return aRet; } - - OUString UpdateCheckConfig::getDownloadDestination() const { @@ -364,8 +322,6 @@ UpdateCheckConfig::getDownloadDestination() const return aRet; } - - void UpdateCheckConfig::storeLocalFileName(const OUString& rLocalFileName, sal_Int64 nFileSize) { @@ -384,8 +340,6 @@ UpdateCheckConfig::storeLocalFileName(const OUString& rLocalFileName, sal_Int64 commitChanges(); } - - void UpdateCheckConfig::clearLocalFileName() { @@ -401,8 +355,6 @@ UpdateCheckConfig::clearLocalFileName() commitChanges(); } - - void UpdateCheckConfig::storeDownloadPaused(bool paused) { @@ -410,8 +362,6 @@ UpdateCheckConfig::storeDownloadPaused(bool paused) commitChanges(); } - - void UpdateCheckConfig::updateLastChecked() { @@ -423,8 +373,6 @@ UpdateCheckConfig::updateLastChecked() replaceByName(LAST_CHECK, uno::makeAny(lastCheck)); } - - void UpdateCheckConfig::storeUpdateFound( const UpdateInfo& rInfo, const OUString& aCurrentBuild) @@ -460,8 +408,6 @@ UpdateCheckConfig::storeUpdateFound( const UpdateInfo& rInfo, const OUString& aC commitChanges(); } - - void UpdateCheckConfig::clearUpdateFound() { @@ -489,8 +435,6 @@ UpdateCheckConfig::clearUpdateFound() commitChanges(); } - - uno::Sequence< OUString > UpdateCheckConfig::getServiceNames() { @@ -499,32 +443,24 @@ UpdateCheckConfig::getServiceNames() return aServiceList; } - - OUString UpdateCheckConfig::getImplName() { return OUString("vnd.sun.UpdateCheckConfig"); } - - uno::Type SAL_CALL UpdateCheckConfig::getElementType() throw (uno::RuntimeException, std::exception) { return m_xContainer->getElementType(); } - - sal_Bool SAL_CALL UpdateCheckConfig::hasElements() throw (uno::RuntimeException, std::exception) { return m_xContainer->hasElements(); } - - uno::Any SAL_CALL UpdateCheckConfig::getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) @@ -540,28 +476,21 @@ UpdateCheckConfig::getByName( const OUString& aName ) if( aStr.isEmpty() ) aValue = uno::makeAny(getDesktopDirectory()); } - return aValue; } - - uno::Sequence< OUString > SAL_CALL -UpdateCheckConfig::getElementNames( ) throw (uno::RuntimeException, std::exception) +UpdateCheckConfig::getElementNames() throw (uno::RuntimeException, std::exception) { return m_xContainer->getElementNames(); } - - sal_Bool SAL_CALL UpdateCheckConfig::hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) { return m_xContainer->hasByName( aName ); } - - void SAL_CALL UpdateCheckConfig::replaceByName( const OUString& aName, const uno::Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, @@ -570,7 +499,6 @@ UpdateCheckConfig::replaceByName( const OUString& aName, const uno::Any& aElemen return m_xContainer->replaceByName( aName, aElement ); } - // XChangesBatch void SAL_CALL @@ -617,8 +545,6 @@ UpdateCheckConfig::commitChanges() } } - - sal_Bool SAL_CALL UpdateCheckConfig::hasPendingChanges( ) throw (uno::RuntimeException, std::exception) { @@ -629,8 +555,6 @@ UpdateCheckConfig::hasPendingChanges( ) throw (uno::RuntimeException, std::exce return sal_False; } - - uno::Sequence< util::ElementChange > SAL_CALL UpdateCheckConfig::getPendingChanges( ) throw (uno::RuntimeException, std::exception) { @@ -641,7 +565,6 @@ UpdateCheckConfig::getPendingChanges( ) throw (uno::RuntimeException, std::exce return uno::Sequence< util::ElementChange >(); } - bool UpdateCheckConfig::storeExtensionVersion( const OUString& rExtensionName, const OUString& rVersion ) { @@ -672,7 +595,6 @@ bool UpdateCheckConfig::storeExtensionVersion( const OUString& rExtensionName, return bNotify; } - bool UpdateCheckConfig::checkExtensionVersion( const OUString& rExtensionName, const OUString& rVersion ) { @@ -705,7 +627,6 @@ bool UpdateCheckConfig::checkExtensionVersion( const OUString& rExtensionName, return false; } - OUString UpdateCheckConfig::getSubVersion( const OUString& rVersion, sal_Int32 *nIndex ) { @@ -717,9 +638,7 @@ OUString UpdateCheckConfig::getSubVersion( const OUString& rVersion, return rVersion.getToken( 0, '.', *nIndex ); } - -// checks if the second version string is greater than the first one - +/// checks if the second version string is greater than the first one bool UpdateCheckConfig::isVersionGreater( const OUString& rVersion1, const OUString& rVersion2 ) { @@ -741,10 +660,6 @@ bool UpdateCheckConfig::isVersionGreater( const OUString& rVersion1, return false; } - - - - OUString SAL_CALL UpdateCheckConfig::getImplementationName() throw (uno::RuntimeException, std::exception) { @@ -758,13 +673,10 @@ UpdateCheckConfig::supportsService(OUString const & serviceName) return cppu::supportsService(this, serviceName); } - - uno::Sequence< OUString > SAL_CALL UpdateCheckConfig::getSupportedServiceNames() throw (uno::RuntimeException, std::exception) { return getServiceNames(); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx index bbf21be..1ae9a148 100644 --- a/extensions/source/update/feed/updatefeed.cxx +++ b/extensions/source/update/feed/updatefeed.cxx @@ -367,7 +367,6 @@ UpdateInformationProvider::UpdateInformationProvider( } } - uno::Reference< uno::XInterface > UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentContext>& xContext) { commit 24d126b265878463dbf3ef5309d3b7d5cf2b2ca5 Author: Michael Meeks <michael.me...@collabora.com> Date: Sat Nov 14 17:23:00 2015 +0000 Update-check, expand it to allow reporting of H/W and OS versions. Off by default. Change-Id: I1044116ef9beeb341a537c0f4451dca54e198f67 diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 6ca3f1f..174825c 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,6 +56,8 @@ 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_pCheckNowButton->SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) ); @@ -78,8 +80,10 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxIt m_pChangePathButton->Show(bDownloadSupported); m_aLastCheckedTemplate = m_pLastChecked->GetText(); + m_aUserAgentTemplate = m_pUserAgentLabel->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,34 @@ 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 ); + + uno::Sequence< beans::StringPair > aHeaders + = xDav->getUserRequestHeaders( OUString(), ucb::WebDAVHTTPMethod(0) ); + + for ( auto i = aHeaders.begin(); i != aHeaders.end(); ++i ) + { + if ( i->First == "User-Agent" ) + { + OUString aText = m_aUserAgentTemplate; + sal_Int32 nIndex = aText.indexOf( "%USERAGENT%" ); + if ( nIndex != -1 ) + aText = aText.replaceAt( nIndex, 11, i->Second ); + 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 +254,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 +268,6 @@ bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* ) return bModified; } - - void SvxOnlineUpdateTabPage::Reset( const SfxItemSet* ) { bool bValue = false; @@ -266,17 +305,17 @@ 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(); + m_pAutoDownloadCheckBox->SaveValue(); } - - void SvxOnlineUpdateTabPage::FillUserData() { } - - IMPL_LINK_TYPED( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, Button*, pBox, void ) { bool bEnabled = static_cast<CheckBox*>(pBox)->IsChecked(); @@ -286,8 +325,6 @@ IMPL_LINK_TYPED( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, Button*, pBox, void m_pEveryMonthButton->Enable(bEnabled); } - - IMPL_LINK_NOARG_TYPED(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, Button*, void) { uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); @@ -308,8 +345,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 8844826c..37a45cf 100644 --- a/cui/source/options/optupdt.hxx +++ b/cui/source/options/optupdt.hxx @@ -39,16 +39,21 @@ 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; + OUString m_aUserAgentTemplate; 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 cf4c4ae..186d88a 100644 --- a/cui/uiconfig/ui/optonlineupdatepage.ui +++ b/cui/uiconfig/ui/optonlineupdatepage.ui @@ -216,6 +216,36 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="extrabits"> + <property name="label" translatable="yes">_Send OS version & simple hardware info.</property> + <property name="tooltip_text" translatable="yes">This information lets us optimize for your hardware & 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="GtkLabel" id="useragent"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">User Agent: %USERAGENT%</property> + </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 f11c14e..0127678 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>true</value> + </prop> </node> </node> </node> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits