diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2020-03-24 22:45:05 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2020-03-25 17:37:12 +0100 |
commit | d34f54776f51747658556c148eab0d0fc96ea3e0 (patch) | |
tree | bf86e84492221a2caafe0f52fda5be10a1e89d14 /cui | |
parent | 4af18ebae9d74b43fcd114d5fa5b145586651bc2 (diff) |
Related tdf#46037: use a bit of simplified config access (cui/optinet2)
Change-Id: Ie784468030bf612ba4209e0619d07032a488f700
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91011
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optinet2.cxx | 79 |
1 files changed, 29 insertions, 50 deletions
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index a4acc0b96d9f..86a0431e03ad 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -191,61 +191,40 @@ std::unique_ptr<SfxTabPage> SvxProxyTabPage::Create(weld::Container* pPage, weld void SvxProxyTabPage::ReadConfigData_Impl() { - try { - Reference< container::XNameAccess > xNameAccess(m_xConfigurationUpdateAccess, UNO_QUERY_THROW); - - sal_Int32 nIntValue = 0; - OUString aStringValue; - - if( xNameAccess->getByName(g_aProxyModePN) >>= nIntValue ) - { - m_xProxyModeLB->set_active(nIntValue); - } - - if( xNameAccess->getByName(g_aHttpProxyPN) >>= aStringValue ) - { - m_xHttpProxyED->set_text( aStringValue ); - } - - if( xNameAccess->getByName(g_aHttpPortPN) >>= nIntValue ) - { - m_xHttpPortED->set_text( OUString::number( nIntValue )); - } - - if( xNameAccess->getByName(g_aHttpsProxyPN) >>= aStringValue ) - { - m_xHttpsProxyED->set_text( aStringValue ); - } - - if( xNameAccess->getByName(g_aHttpsPortPN) >>= nIntValue ) - { - m_xHttpsPortED->set_text( OUString::number( nIntValue )); - } - - if( xNameAccess->getByName(g_aFtpProxyPN) >>= aStringValue ) - { - m_xFtpProxyED->set_text( aStringValue ); - } + sal_Int32 nIntValue = 0; - if( xNameAccess->getByName(g_aFtpPortPN) >>= nIntValue ) - { - m_xFtpPortED->set_text( OUString::number( nIntValue )); - } - - if( xNameAccess->getByName(g_aNoProxyDescPN) >>= aStringValue ) - { - m_xNoProxyForED->set_text( aStringValue ); - } + std::optional<sal_Int32> x(officecfg::Inet::Settings::ooInetProxyType::get()); + if (x) + { + nIntValue = *x; + m_xProxyModeLB->set_active(nIntValue); } - catch (const container::NoSuchElementException&) { - SAL_WARN("cui.options", "SvxProxyTabPage::ReadConfigData_Impl: NoSuchElementException caught" ); + + m_xHttpProxyED->set_text( officecfg::Inet::Settings::ooInetHTTPProxyName::get() ); + x = officecfg::Inet::Settings::ooInetHTTPProxyPort::get(); + if (x) + { + nIntValue = *x; + m_xHttpPortED->set_text( OUString::number( nIntValue )); } - catch (const css::lang::WrappedTargetException &) { - SAL_WARN("cui.options", "SvxProxyTabPage::ReadConfigData_Impl: WrappedTargetException caught" ); + + m_xHttpsProxyED->set_text( officecfg::Inet::Settings::ooInetHTTPSProxyName::get() ); + x = officecfg::Inet::Settings::ooInetHTTPSProxyPort::get(); + if (x) + { + nIntValue = *x; + m_xHttpsPortED->set_text( OUString::number( nIntValue )); } - catch (const RuntimeException &) { - SAL_WARN("cui.options", "SvxProxyTabPage::ReadConfigData_Impl: RuntimeException caught" ); + + m_xFtpProxyED->set_text( officecfg::Inet::Settings::ooInetFTPProxyName::get() ); + x = officecfg::Inet::Settings::ooInetFTPProxyPort::get(); + if (x) + { + nIntValue = *x; + m_xFtpPortED->set_text( OUString::number( nIntValue )); } + + m_xNoProxyForED->set_text( officecfg::Inet::Settings::ooInetNoProxy::get() ); } void SvxProxyTabPage::ReadConfigDefaults_Impl() |