tdf#157840 - UI: Part 6 - Unify lockdown behavior of Options dialog
for Security Page.
Change-Id: I9b5282326ea8edeb00d45d9d034a18041f89a281
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158393
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 29fe7d7..9080195 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -497,19 +497,27 @@ SvxSecurityTabPage::SvxSecurityTabPage(weld::Container* pPage, weld::DialogContr
: SfxTabPage(pPage, pController, "cui/ui/optsecuritypage.ui", "OptSecurityPage", &rSet)
, m_xSecurityOptionsPB(m_xBuilder->weld_button("options"))
, m_xSavePasswordsCB(m_xBuilder->weld_check_button("savepassword"))
, m_xSavePasswordsImg(m_xBuilder->weld_widget("locksavepassword"))
, m_xShowConnectionsPB(m_xBuilder->weld_button("connections"))
, m_xMasterPasswordCB(m_xBuilder->weld_check_button("usemasterpassword"))
, m_xMasterPasswordImg(m_xBuilder->weld_widget("lockusemasterpassword"))
, m_xMasterPasswordFT(m_xBuilder->weld_label("masterpasswordtext"))
, m_xMasterPasswordPB(m_xBuilder->weld_button("masterpassword"))
, m_xMacroSecFrame(m_xBuilder->weld_container("macrosecurity"))
, m_xMacroSecPB(m_xBuilder->weld_button("macro"))
, m_xCertFrame(m_xBuilder->weld_container("certificatepath"))
, m_xCertPathPB(m_xBuilder->weld_button("cert"))
, m_xCertPathImg(m_xBuilder->weld_widget("lockcertipath"))
, m_xCertPathLabel(m_xBuilder->weld_label("label7"))
, m_xTSAURLsFrame(m_xBuilder->weld_container("tsaurls"))
, m_xTSAURLsPB(m_xBuilder->weld_button("tsas"))
, m_xTSAURLsImg(m_xBuilder->weld_widget("locktsas"))
, m_xTSAURLsLabel(m_xBuilder->weld_label("label9"))
, m_xNoPasswordSaveFT(m_xBuilder->weld_label("nopasswordsave"))
, m_xCertMgrPathLB(m_xBuilder->weld_button("browse"))
, m_xParameterEdit(m_xBuilder->weld_entry("parameterfield"))
, m_xCertMgrPathImg(m_xBuilder->weld_widget("lockcertimanager"))
, m_xCertMgrPathLabel(m_xBuilder->weld_label("label11"))
{
//fdo#65595, we need height-for-width support here, but for now we can
//bodge it
@@ -798,6 +806,16 @@ void SvxSecurityTabPage::InitControls()
m_xMasterPasswordFT->set_sensitive(true);
}
}
if (officecfg::Office::Common::Passwords::UseStorage::isReadOnly())
{
m_xSavePasswordsCB->set_sensitive(false);
m_xShowConnectionsPB->set_sensitive(false);
m_xSavePasswordsImg->set_visible(true);
m_xMasterPasswordCB->set_sensitive(false);
m_xMasterPasswordPB->set_sensitive(false);
m_xMasterPasswordImg->set_visible(true);
}
}
catch (const Exception&)
{
@@ -810,6 +828,25 @@ void SvxSecurityTabPage::InitControls()
if (!sCurCertMgr.isEmpty())
m_xParameterEdit->set_text(sCurCertMgr);
bool bEnable = !officecfg::Office::Common::Security::Scripting::CertMgrPath::isReadOnly();
m_xCertMgrPathLB->set_sensitive(bEnable);
m_xParameterEdit->set_sensitive(bEnable);
m_xCertMgrPathLabel->set_sensitive(bEnable);
m_xCertMgrPathImg->set_visible(!bEnable);
bEnable = !officecfg::Office::Common::Security::Scripting::TSAURLs::isReadOnly();
m_xTSAURLsPB->set_sensitive(bEnable);
m_xTSAURLsLabel->set_sensitive(bEnable);
m_xTSAURLsImg->set_visible(!bEnable);
#ifndef UNX
bEnable = !officecfg::Office::Common::Security::Scripting::CertDir::isReadOnly() ||
!officecfg::Office::Common::Security::Scripting::ManualCertDir::isReadOnly();
m_xCertPathPB->set_sensitive(bEnable);
m_xCertPathLabel->set_sensitive(bEnable);
m_xCertPathImg->set_visible(!bEnable);
#endif
}
catch (const uno::Exception&)
{
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index f99c30b..1ad3072 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -90,9 +90,11 @@ private:
std::unique_ptr<weld::Button> m_xSecurityOptionsPB;
std::unique_ptr<weld::CheckButton> m_xSavePasswordsCB;
std::unique_ptr<weld::Widget> m_xSavePasswordsImg;
std::unique_ptr<weld::Button> m_xShowConnectionsPB;
std::unique_ptr<weld::CheckButton> m_xMasterPasswordCB;
std::unique_ptr<weld::Widget> m_xMasterPasswordImg;
std::unique_ptr<weld::Label> m_xMasterPasswordFT;
std::unique_ptr<weld::Button> m_xMasterPasswordPB;
@@ -101,14 +103,20 @@ private:
std::unique_ptr<weld::Container> m_xCertFrame;
std::unique_ptr<weld::Button> m_xCertPathPB;
std::unique_ptr<weld::Widget> m_xCertPathImg;
std::unique_ptr<weld::Label> m_xCertPathLabel;
std::unique_ptr<weld::Container> m_xTSAURLsFrame;
std::unique_ptr<weld::Button> m_xTSAURLsPB;
std::unique_ptr<weld::Widget> m_xTSAURLsImg;
std::unique_ptr<weld::Label> m_xTSAURLsLabel;
std::unique_ptr<weld::Label> m_xNoPasswordSaveFT;
std::unique_ptr<weld::Button> m_xCertMgrPathLB;
std::unique_ptr<weld::Entry> m_xParameterEdit;
std::unique_ptr<weld::Widget> m_xCertMgrPathImg;
std::unique_ptr<weld::Label> m_xCertMgrPathLabel;
DECL_LINK(SecurityOptionsHdl, weld::Button&, void);
DECL_LINK(SavePasswordHdl, weld::Toggleable&, void);
diff --git a/cui/uiconfig/ui/optsecuritypage.ui b/cui/uiconfig/ui/optsecuritypage.ui
index 9003cba..200f63a 100644
--- a/cui/uiconfig/ui/optsecuritypage.ui
+++ b/cui/uiconfig/ui/optsecuritypage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<!-- Generated with glade 3.38.2 -->
<interface domain="cui">
<requires lib="gtk+" version="3.20"/>
<!-- n-columns=1 n-rows=6 -->
@@ -25,22 +25,6 @@
<property name="hexpand">True</property>
<property name="column-spacing">24</property>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="optsecuritypage|label9">Maintain a list of Time Stamping Authority (TSA) URLs to be used for digital signatures in PDF export.</property>
<property name="wrap">True</property>
<property name="width-chars">56</property>
<property name="max-width-chars">56</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="tsas">
<property name="label" translatable="yes" context="optsecuritypage|tsas">_TSAs...</property>
<property name="visible">True</property>
@@ -59,6 +43,48 @@
<property name="top-attach">0</property>
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="optsecuritypage|label9">Maintain a list of Time Stamping Authority (TSA) URLs to be used for digital signatures in PDF export.</property>
<property name="wrap">True</property>
<property name="width-chars">56</property>
<property name="max-width-chars">56</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="locktsas">
<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>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
</child>
<child type="label">
@@ -94,22 +120,6 @@
<property name="hexpand">True</property>
<property name="column-spacing">24</property>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="optsecuritypage|label7">Select the Network Security Services certificate directory to use for digital signatures.</property>
<property name="wrap">True</property>
<property name="width-chars">56</property>
<property name="max-width-chars">56</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cert">
<property name="label" translatable="yes" context="optsecuritypage|cert">_Certificate...</property>
<property name="visible">True</property>
@@ -128,6 +138,48 @@
<property name="top-attach">0</property>
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="optsecuritypage|label7">Select the Network Security Services certificate directory to use for digital signatures.</property>
<property name="wrap">True</property>
<property name="width-chars">56</property>
<property name="max-width-chars">56</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockcertipath">
<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>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
</child>
<child type="label">
@@ -239,25 +291,6 @@
<property name="hexpand">True</property>
<property name="row-spacing">12</property>
<child>
<object class="GtkCheckButton" id="savepassword">
<property name="label" translatable="yes" context="optsecuritypage|savepassword">Persistently _save passwords for web connections</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="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="savepassword-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|savepassword">If enabled, all passwords that you use to access files from web servers will be securely stored. You can retrieve the passwords from the list after you enter the master password.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<!-- n-columns=1 n-rows=3 -->
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
@@ -266,20 +299,6 @@
<property name="hexpand">True</property>
<property name="row-spacing">6</property>
<child>
<object class="GtkCheckButton" id="usemasterpassword">
<property name="label" translatable="yes" context="optsecuritypage|usemasterpassword">Protected _by a master password (recommended)</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="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="masterpasswordtext">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -316,12 +335,97 @@ Do you want to delete password list and reset master password?</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkCheckButton" id="usemasterpassword">
<property name="label" translatable="yes" context="optsecuritypage|usemasterpassword">Protected _by a master password (recommended)</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="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockusemasterpassword">
<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>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkCheckButton" id="savepassword">
<property name="label" translatable="yes" context="optsecuritypage|savepassword">Persistently _save passwords for web connections</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="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="savepassword-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|savepassword">If enabled, all passwords that you use to access files from web servers will be securely stored. You can retrieve the passwords from the list after you enter the master password.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="locksavepassword">
<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>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>
@@ -504,22 +608,6 @@ Do you want to delete password list and reset master password?</property>
<property name="row-spacing">8</property>
<property name="column-spacing">24</property>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="optsecuritypage|label11">Select custom certificate manager executable. Note that %PRODUCTNAME tries to locate installed ones automatically.</property>
<property name="wrap">True</property>
<property name="width-chars">56</property>
<property name="max-width-chars">56</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browse">
<property name="label" translatable="yes" context="optsecuritypage|browse">_Browse...</property>
<property name="visible">True</property>
@@ -552,6 +640,53 @@ Do you want to delete password list and reset master password?</property>
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="optsecuritypage|label11">Select custom certificate manager executable. Note that %PRODUCTNAME tries to locate installed ones automatically.</property>
<property name="wrap">True</property>
<property name="width-chars">56</property>
<property name="max-width-chars">56</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockcertimanager">
<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>
<child internal-child="accessible">
<object class="AtkObject" id="lockcertimanager-atkobject">
<property name="AtkObject::accessible-description">Enter the executable of the certificate manager path is readonly.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>