tdf#157842 - UI: Part 7 - Unify lockdown behavior of Options dialog

for Personalization Page.

Change-Id: I5f2b674b9548610be8f918e6713e6ea91be7442e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158418
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
This commit is contained in:
Balazs Varga 2023-10-25 10:31:47 +02:00
parent 6a8cae6995
commit 54aa9a9cb7
3 changed files with 138 additions and 82 deletions

View file

@ -33,7 +33,9 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage(weld::Container* pPage,
: SfxTabPage(pPage, pController, "cui/ui/personalization_tab.ui", "PersonalizationTabPage", : SfxTabPage(pPage, pController, "cui/ui/personalization_tab.ui", "PersonalizationTabPage",
&rSet) &rSet)
, m_xNoPersona(m_xBuilder->weld_radio_button("no_persona")) , m_xNoPersona(m_xBuilder->weld_radio_button("no_persona"))
, m_xPersonaImg(m_xBuilder->weld_widget("lockpersona"))
, m_xDefaultPersona(m_xBuilder->weld_radio_button("default_persona")) , m_xDefaultPersona(m_xBuilder->weld_radio_button("default_persona"))
, m_xContentGrid(m_xBuilder->weld_container("gridpersonasetting"))
{ {
for (sal_uInt32 i = 0; i < MAX_DEFAULT_PERSONAS; ++i) for (sal_uInt32 i = 0; i < MAX_DEFAULT_PERSONAS; ++i)
{ {
@ -116,6 +118,16 @@ void SvxPersonalizationTabPage::Reset(const SfxItemSet*)
m_xNoPersona->set_active(true); m_xNoPersona->set_active(true);
else else
m_xDefaultPersona->set_active(true); m_xDefaultPersona->set_active(true);
if (officecfg::Office::Common::Misc::Persona::isReadOnly())
{
m_xNoPersona->set_sensitive(false);
m_xDefaultPersona->set_sensitive(false);
m_xPersonaImg->set_visible(true);
}
if (officecfg::Office::Common::Misc::PersonaSettings::isReadOnly())
m_xContentGrid->set_sensitive(false);
} }
void SvxPersonalizationTabPage::LoadDefaultImages() void SvxPersonalizationTabPage::LoadDefaultImages()

View file

@ -18,7 +18,9 @@ class SvxPersonalizationTabPage : public SfxTabPage
{ {
private: private:
std::unique_ptr<weld::RadioButton> m_xNoPersona; ///< Just the default look, without any bitmap std::unique_ptr<weld::RadioButton> m_xNoPersona; ///< Just the default look, without any bitmap
std::unique_ptr<weld::Widget> m_xPersonaImg;
std::unique_ptr<weld::RadioButton> m_xDefaultPersona; ///< Use the built-in bitmap std::unique_ptr<weld::RadioButton> m_xDefaultPersona; ///< Use the built-in bitmap
std::unique_ptr<weld::Container> m_xContentGrid;
std::unique_ptr<weld::ToggleButton> m_vDefaultPersonaImages std::unique_ptr<weld::ToggleButton> m_vDefaultPersonaImages
[MAX_DEFAULT_PERSONAS]; ///< Buttons to show the default persona images [MAX_DEFAULT_PERSONAS]; ///< Buttons to show the default persona images
OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings. OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings.

View file

@ -1,38 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 --> <!-- Generated with glade 3.38.2 -->
<interface domain="cui"> <interface domain="cui">
<requires lib="gtk+" version="3.20"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkBox" id="PersonalizationTabPage"> <object class="GtkBox" id="PersonalizationTabPage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can-focus">False</property>
<property name="border_width">6</property> <property name="border-width">6</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="GtkFrame" id="frame2"> <object class="GtkFrame" id="frame2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can-focus">False</property>
<property name="label_xalign">0</property> <property name="label-xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow-type">none</property>
<child> <child>
<object class="GtkBox" id="vbox2"> <object class="GtkBox" id="vbox2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="margin-start">12</property> <property name="margin-start">12</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="margin-end">6</property> <property name="orientation">vertical</property>
<property name="spacing">12</property>
<child> <child>
<object class="GtkRadioButton" id="no_persona"> <!-- n-columns=2 n-rows=1 -->
<property name="label" translatable="yes" context="personalization_tab|no_persona">Default look, do not use Themes</property> <object class="GtkGrid">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can-focus">False</property>
<property name="receives_default">False</property> <property name="hexpand">True</property>
<property name="use_underline">True</property> <child>
<property name="active">True</property> <!-- n-columns=1 n-rows=2 -->
<property name="draw_indicator">True</property> <object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="row-spacing">12</property>
<child>
<object class="GtkRadioButton" id="no_persona">
<property name="label" translatable="yes" context="personalization_tab|no_persona">Default look, do not use Themes</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="active">True</property>
<property name="draw-indicator">True</property>
<property name="group">default_persona</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="default_persona">
<property name="label" translatable="yes" context="personalization_tab|default_persona">Preinstalled Theme</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="active">True</property>
<property name="draw-indicator">True</property>
<property name="group">no_persona</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockpersona">
<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> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -41,128 +96,115 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="default_persona"> <placeholder/>
<property name="label" translatable="yes" context="personalization_tab|default_persona">Preinstalled Theme</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>
<property name="group">no_persona</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child> </child>
<child> <child>
<!-- n-columns=1 n-rows=1 --> <!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid"> <object class="GtkGrid" id="gridpersonasetting">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can-focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="margin-start">24</property> <property name="margin-start">24</property>
<property name="margin-end">6</property> <property name="margin-end">6</property>
<property name="row_spacing">6</property> <property name="row-spacing">6</property>
<property name="column_spacing">6</property> <property name="column-spacing">6</property>
<child> <child>
<object class="GtkToggleButton" id="default1"> <object class="GtkToggleButton" id="default1">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left-attach">1</property>
<property name="top_attach">0</property> <property name="top-attach">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="default0"> <object class="GtkToggleButton" id="default0">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left-attach">0</property>
<property name="top_attach">0</property> <property name="top-attach">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="default2"> <object class="GtkToggleButton" id="default2">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left-attach">2</property>
<property name="top_attach">0</property> <property name="top-attach">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="default3"> <object class="GtkToggleButton" id="default3">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left-attach">0</property>
<property name="top_attach">1</property> <property name="top-attach">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="default4"> <object class="GtkToggleButton" id="default4">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left-attach">1</property>
<property name="top_attach">1</property> <property name="top-attach">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="default5"> <object class="GtkToggleButton" id="default5">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left-attach">2</property>
<property name="top_attach">1</property> <property name="top-attach">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="default6"> <object class="GtkToggleButton" id="default6">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left-attach">0</property>
<property name="top_attach">2</property> <property name="top-attach">2</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="default7"> <object class="GtkToggleButton" id="default7">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left-attach">1</property>
<property name="top_attach">2</property> <property name="top-attach">2</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="default8"> <object class="GtkToggleButton" id="default8">
<property name="can_focus">True</property> <property name="can-focus">True</property>
<property name="receives_default">True</property> <property name="receives-default">True</property>
<property name="always_show_image">True</property> <property name="always-show-image">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left-attach">2</property>
<property name="top_attach">2</property> <property name="top-attach">2</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -177,7 +219,7 @@
<child type="label"> <child type="label">
<object class="GtkLabel" id="personas_label"> <object class="GtkLabel" id="personas_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes" context="personalization_tab|personas_label">LibreOffice Themes</property> <property name="label" translatable="yes" context="personalization_tab|personas_label">LibreOffice Themes</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>