From 5092305fa80f1900d7229df75a30204ecb53daf0 Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Sun, 1 Apr 2018 00:28:57 +0200 Subject: Respect read-only config items in Internet/Proxy dialog Change-Id: Ie310d97eba7b02135ddd04dcdd5ff38542d490f8 Reviewed-on: https://gerrit.libreoffice.org/52204 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/options/optinet2.cxx | 54 +++++++++++++++++++++++++---------------- cui/source/options/optinet2.hxx | 2 +- 2 files changed, 34 insertions(+), 22 deletions(-) (limited to 'cui/source') diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 1a03dba47d9c..16d62d4acaa5 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -417,7 +418,7 @@ void SvxProxyTabPage::Reset(const SfxItemSet*) m_pFtpPortED->SaveValue(); m_pNoProxyForED->SaveValue(); - EnableControls_Impl( m_pProxyModeLB->GetSelectedEntryPos() == 2 ); + EnableControls_Impl(); } bool SvxProxyTabPage::FillItemSet(SfxItemSet* ) @@ -504,26 +505,37 @@ bool SvxProxyTabPage::FillItemSet(SfxItemSet* ) return bModified; } -void SvxProxyTabPage::EnableControls_Impl(bool bEnable) +void SvxProxyTabPage::EnableControls_Impl() { - m_pHttpProxyFT->Enable(bEnable); - m_pHttpProxyED->Enable(bEnable); - m_pHttpPortFT->Enable(bEnable); - m_pHttpPortED->Enable(bEnable); - - m_pHttpsProxyFT->Enable(bEnable); - m_pHttpsProxyED->Enable(bEnable); - m_pHttpsPortFT->Enable(bEnable); - m_pHttpsPortED->Enable(bEnable); - - m_pFtpProxyFT->Enable(bEnable); - m_pFtpProxyED->Enable(bEnable); - m_pFtpPortFT->Enable(bEnable); - m_pFtpPortED->Enable(bEnable); - - m_pNoProxyForFT->Enable(bEnable); - m_pNoProxyForED->Enable(bEnable); - m_pNoProxyDescFT->Enable(bEnable); + m_pProxyModeLB->Enable(!officecfg::Inet::Settings::ooInetNoProxy::isReadOnly()); + + const bool bManualConfig = m_pProxyModeLB->GetSelectedEntryPos() == 2; + + const bool bHTTPProxyNameEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetHTTPProxyName::isReadOnly(); + const bool bHTTPProxyPortEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetHTTPProxyPort::isReadOnly(); + m_pHttpProxyFT->Enable(bHTTPProxyNameEnabled); + m_pHttpProxyED->Enable(bHTTPProxyNameEnabled); + m_pHttpPortFT->Enable(bHTTPProxyPortEnabled); + m_pHttpPortED->Enable(bHTTPProxyPortEnabled); + + const bool bHTTPSProxyNameEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetHTTPSProxyName::isReadOnly(); + const bool bHTTPSProxyPortEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetHTTPSProxyPort::isReadOnly(); + m_pHttpsProxyFT->Enable(bHTTPSProxyNameEnabled); + m_pHttpsProxyED->Enable(bHTTPSProxyNameEnabled); + m_pHttpsPortFT->Enable(bHTTPSProxyPortEnabled); + m_pHttpsPortED->Enable(bHTTPSProxyPortEnabled); + + const bool bFTPProxyNameEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetFTPProxyName::isReadOnly(); + const bool bFTPProxyPortEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetFTPProxyPort::isReadOnly(); + m_pFtpProxyFT->Enable(bFTPProxyNameEnabled); + m_pFtpProxyED->Enable(bFTPProxyNameEnabled); + m_pFtpPortFT->Enable(bFTPProxyPortEnabled); + m_pFtpPortED->Enable(bFTPProxyPortEnabled); + + const bool bInetNoProxyEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetNoProxy::isReadOnly(); + m_pNoProxyForFT->Enable(bInetNoProxyEnabled); + m_pNoProxyForED->Enable(bInetNoProxyEnabled); + m_pNoProxyDescFT->Enable(bInetNoProxyEnabled); } @@ -537,7 +549,7 @@ IMPL_LINK( SvxProxyTabPage, ProxyHdl_Impl, ListBox&, rBox, void ) ReadConfigDefaults_Impl(); } - EnableControls_Impl(nPos == 2); + EnableControls_Impl(); } diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx index cd402a4513bd..b0d8f7884dc8 100644 --- a/cui/source/options/optinet2.hxx +++ b/cui/source/options/optinet2.hxx @@ -81,7 +81,7 @@ private: css::uno::Reference< css::uno::XInterface > m_xConfigurationUpdateAccess; - void EnableControls_Impl(bool bEnable); + void EnableControls_Impl(); void ReadConfigData_Impl(); void ReadConfigDefaults_Impl(); void RestoreConfigDefaults_Impl(); -- cgit