From 16737129e072a766ba58afddae4a992ad61cec6f Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Sat, 4 Nov 2023 12:05:15 +0100 Subject: tdf#158002 - UI: Part 19 - Unify lockdown behavior of Options dialog for LanguageTool Page. Change-Id: Ib1255dd7a67eae7e9c1f2cf6da984ba614f3453a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158931 Tested-by: Jenkins Reviewed-by: Balazs Varga --- cui/source/options/optlanguagetool.cxx | 24 ++++++++++++++++++++++++ cui/source/options/optlanguagetool.hxx | 6 ++++++ 2 files changed, 30 insertions(+) (limited to 'cui/source') diff --git a/cui/source/options/optlanguagetool.cxx b/cui/source/options/optlanguagetool.cxx index fab94987a32d..8c56a40e728f 100644 --- a/cui/source/options/optlanguagetool.cxx +++ b/cui/source/options/optlanguagetool.cxx @@ -31,11 +31,17 @@ OptLanguageToolTabPage::OptLanguageToolTabPage(weld::Container* pPage, const SfxItemSet& rSet) : SfxTabPage(pPage, pController, "cui/ui/langtoolconfigpage.ui", "OptLangToolPage", &rSet) , m_xBaseURLED(m_xBuilder->weld_entry("baseurl")) + , m_xBaseURLImg(m_xBuilder->weld_widget("lockbaseurl")) , m_xUsernameED(m_xBuilder->weld_entry("username")) + , m_xUsernameImg(m_xBuilder->weld_widget("lockusername")) , m_xApiKeyED(m_xBuilder->weld_entry("apikey")) + , m_xApiKeyImg(m_xBuilder->weld_widget("lockapikey")) , m_xRestProtocol(m_xBuilder->weld_entry("restprotocol")) + , m_xRestProtocolImg(m_xBuilder->weld_widget("lockrestprotocol")) , m_xActivateBox(m_xBuilder->weld_check_button("activate")) + , m_xActivateBoxImg(m_xBuilder->weld_widget("lockactivate")) , m_xSSLDisableVerificationBox(m_xBuilder->weld_check_button("verifyssl")) + , m_xSSLDisableVerificationBoxImg(m_xBuilder->weld_widget("lockverifyssl")) , m_xApiSettingsFrame(m_xBuilder->weld_frame("apisettings")) { m_xActivateBox->connect_toggled(LINK(this, OptLanguageToolTabPage, CheckHdl)); @@ -60,7 +66,11 @@ void OptLanguageToolTabPage::EnableControls(bool bEnable) } m_xApiSettingsFrame->set_visible(bEnable); m_xActivateBox->set_active(bEnable); + m_xActivateBox->set_sensitive(!LanguageToolCfg::IsEnabled::isReadOnly()); + m_xActivateBoxImg->set_visible(LanguageToolCfg::IsEnabled::isReadOnly()); m_xSSLDisableVerificationBox->set_active(!LanguageToolCfg::SSLCertVerify::get()); + m_xSSLDisableVerificationBox->set_sensitive(!LanguageToolCfg::SSLCertVerify::isReadOnly()); + m_xSSLDisableVerificationBoxImg->set_visible(LanguageToolCfg::SSLCertVerify::isReadOnly()); } IMPL_LINK_NOARG(OptLanguageToolTabPage, CheckHdl, weld::Toggleable&, void) @@ -77,10 +87,24 @@ void OptLanguageToolTabPage::Reset(const SfxItemSet*) else m_xBaseURLED->set_text(aBaseURL); + m_xBaseURLED->set_sensitive(!LanguageToolCfg::BaseURL::isReadOnly()); + m_xBaseURLImg->set_visible(LanguageToolCfg::BaseURL::isReadOnly()); + m_xUsernameED->set_text(LanguageToolCfg::Username::get().value_or("")); + m_xUsernameED->set_sensitive(!LanguageToolCfg::Username::isReadOnly()); + m_xUsernameImg->set_visible(LanguageToolCfg::Username::isReadOnly()); + m_xApiKeyED->set_text(LanguageToolCfg::ApiKey::get().value_or("")); + m_xApiKeyED->set_sensitive(!LanguageToolCfg::ApiKey::isReadOnly()); + m_xApiKeyImg->set_visible(LanguageToolCfg::ApiKey::isReadOnly()); + m_xRestProtocol->set_text(LanguageToolCfg::RestProtocol::get().value_or("")); + m_xRestProtocol->set_sensitive(!LanguageToolCfg::RestProtocol::isReadOnly()); + m_xRestProtocolImg->set_visible(LanguageToolCfg::RestProtocol::isReadOnly()); + m_xSSLDisableVerificationBox->set_active(!LanguageToolCfg::SSLCertVerify::get()); + m_xSSLDisableVerificationBox->set_sensitive(!LanguageToolCfg::SSLCertVerify::isReadOnly()); + m_xSSLDisableVerificationBoxImg->set_visible(LanguageToolCfg::SSLCertVerify::isReadOnly()); } OUString OptLanguageToolTabPage::GetAllStrings() diff --git a/cui/source/options/optlanguagetool.hxx b/cui/source/options/optlanguagetool.hxx index 25781c612913..3e3c3e8da0c7 100644 --- a/cui/source/options/optlanguagetool.hxx +++ b/cui/source/options/optlanguagetool.hxx @@ -36,11 +36,17 @@ public: private: std::unique_ptr m_xBaseURLED; + std::unique_ptr m_xBaseURLImg; std::unique_ptr m_xUsernameED; + std::unique_ptr m_xUsernameImg; std::unique_ptr m_xApiKeyED; + std::unique_ptr m_xApiKeyImg; std::unique_ptr m_xRestProtocol; + std::unique_ptr m_xRestProtocolImg; std::unique_ptr m_xActivateBox; + std::unique_ptr m_xActivateBoxImg; std::unique_ptr m_xSSLDisableVerificationBox; + std::unique_ptr m_xSSLDisableVerificationBoxImg; std::unique_ptr m_xApiSettingsFrame; void EnableControls(bool bEnable); -- cgit