diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-11-14 17:23:00 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-11-23 11:18:08 +0000 |
commit | 56a9594649872f4076b6891f917138d2b1e8d028 (patch) | |
tree | 2d14083e97fae7de29162e6002d6a7f2da08ffd3 /cui | |
parent | 91cbbb7797f048834b51690e9fab60aa778b1e44 (diff) |
Update-check, expand to allow reporting of H/W and OS versions.
Off by default.
Expand config options to show the user agent used.
Re-use this to show more useful info in Help->About too.
Change-Id: I1044116ef9beeb341a537c0f4451dca54e198f67
Reviewed-on: https://gerrit.libreoffice.org/20098
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/about.cxx | 8 | ||||
-rw-r--r-- | cui/source/options/optupdt.cxx | 69 | ||||
-rw-r--r-- | cui/source/options/optupdt.hxx | 4 | ||||
-rw-r--r-- | cui/uiconfig/ui/optonlineupdatepage.ui | 65 |
4 files changed, 128 insertions, 18 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 & 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="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> |