cui/source/options/optlanguagetool.cxx |   24 ++++++
 cui/source/options/optlanguagetool.hxx |    6 +
 cui/uiconfig/ui/langtoolconfigpage.ui  |  130 ++++++++++++++++++++++++++++-----
 3 files changed, 143 insertions(+), 17 deletions(-)

New commits:
commit 16737129e072a766ba58afddae4a992ad61cec6f
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Sat Nov 4 12:05:15 2023 +0100
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Mon Nov 6 10:17:28 2023 +0100

    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 <balazs.varga.ext...@allotropia.de>

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<weld::Entry> m_xBaseURLED;
+    std::unique_ptr<weld::Widget> m_xBaseURLImg;
     std::unique_ptr<weld::Entry> m_xUsernameED;
+    std::unique_ptr<weld::Widget> m_xUsernameImg;
     std::unique_ptr<weld::Entry> m_xApiKeyED;
+    std::unique_ptr<weld::Widget> m_xApiKeyImg;
     std::unique_ptr<weld::Entry> m_xRestProtocol;
+    std::unique_ptr<weld::Widget> m_xRestProtocolImg;
     std::unique_ptr<weld::CheckButton> m_xActivateBox;
+    std::unique_ptr<weld::Widget> m_xActivateBoxImg;
     std::unique_ptr<weld::CheckButton> m_xSSLDisableVerificationBox;
+    std::unique_ptr<weld::Widget> m_xSSLDisableVerificationBoxImg;
     std::unique_ptr<weld::Frame> m_xApiSettingsFrame;
 
     void EnableControls(bool bEnable);
diff --git a/cui/uiconfig/ui/langtoolconfigpage.ui 
b/cui/uiconfig/ui/langtoolconfigpage.ui
index 03da9968b0e1..98da2f9c88e6 100644
--- a/cui/uiconfig/ui/langtoolconfigpage.ui
+++ b/cui/uiconfig/ui/langtoolconfigpage.ui
@@ -17,7 +17,7 @@
         <property name="label-xalign">0</property>
         <property name="shadow-type">none</property>
         <child>
-          <!-- n-columns=1 n-rows=3 -->
+          <!-- n-columns=2 n-rows=3 -->
           <object class="GtkGrid" id="grid0">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
@@ -39,7 +39,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">0</property>
               </packing>
             </child>
@@ -54,7 +54,7 @@
                 <property 
name="uri">https://languagetool.org/legal/privacy</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">1</property>
               </packing>
             </child>
@@ -67,11 +67,30 @@
                 <property name="halign">start</property>
                 <property name="draw-indicator">True</property>
               </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockactivate">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
               <packing>
                 <property name="left-attach">0</property>
                 <property name="top-attach">2</property>
               </packing>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </object>
         </child>
         <child type="label">
@@ -98,7 +117,7 @@
         <property name="label-xalign">0</property>
         <property name="shadow-type">none</property>
         <child>
-          <!-- n-columns=2 n-rows=9 -->
+          <!-- n-columns=3 n-rows=9 -->
           <object class="GtkGrid" id="grid1">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
@@ -117,7 +136,7 @@
                 <property name="mnemonic-widget">baseurl</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">0</property>
               </packing>
             </child>
@@ -129,7 +148,7 @@
                 <property name="truncate-multiline">True</property>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">0</property>
               </packing>
             </child>
@@ -143,7 +162,7 @@
                 <property name="mnemonic-widget">username</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">2</property>
               </packing>
             </child>
@@ -157,7 +176,7 @@
                 <property name="mnemonic-widget">apikey</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">4</property>
               </packing>
             </child>
@@ -168,7 +187,7 @@
                 <property name="truncate-multiline">True</property>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">2</property>
               </packing>
             </child>
@@ -179,7 +198,7 @@
                 <property name="truncate-multiline">True</property>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">4</property>
               </packing>
             </child>
@@ -199,7 +218,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">1</property>
               </packing>
             </child>
@@ -219,7 +238,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">3</property>
               </packing>
             </child>
@@ -239,7 +258,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">5</property>
               </packing>
             </child>
@@ -253,7 +272,7 @@
                 <property name="mnemonic-widget">restprotocol</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">6</property>
               </packing>
             </child>
@@ -264,7 +283,7 @@
                 <property name="truncate-multiline">True</property>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">6</property>
               </packing>
             </child>
@@ -284,7 +303,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">7</property>
               </packing>
             </child>
@@ -298,11 +317,88 @@
                 <property name="draw-indicator">True</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">8</property>
                 <property name="width">2</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkImage" id="lockbaseurl">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockusername">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockapikey">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockrestprotocol">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">6</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockverifyssl">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">8</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
             <child>
               <placeholder/>
             </child>

Reply via email to