cui/source/options/appearance.cxx |   11 +++++++++++
 cui/source/options/appearance.hxx |    2 ++
 cui/uiconfig/ui/appearance.ui     |   21 ++++++++++++++++++++-
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 22a8a7583c5e906a7a5ecac97b34e2beca506389
Author:     Sahil Gautam <[email protected]>
AuthorDate: Wed May 21 15:57:44 2025 +0530
Commit:     Sahil Gautam <[email protected]>
CommitDate: Fri May 23 11:51:11 2025 +0200

    tdf#164970 add a checkbox for enabling/disabling application theming
    
    the "enable application theming" checkbox allows the users to
    enable/disable ui theming. in the beginning, theming was enabled by
    default but then after [quite some discussion], it was disabled. so if
    the user wanted to enable it again, he had to dig through the expert
    settings to set an integer config value to 1. this checkbox makes it
    convenient.
    
    [quite some discussion]: https://gerrit.libreoffice.org/c/core/+/183490
    
    Change-Id: I5c4228d103d41b8739ff0b72743f962bb20bdb50
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185605
    Reviewed-by: Sahil Gautam <[email protected]>
    Tested-by: Jenkins

diff --git a/cui/source/options/appearance.cxx 
b/cui/source/options/appearance.cxx
index 644a7e7a06fb..12383791aaf4 100644
--- a/cui/source/options/appearance.cxx
+++ b/cui/source/options/appearance.cxx
@@ -102,6 +102,7 @@ SvxAppearanceTabPage::SvxAppearanceTabPage(weld::Container* 
pPage,
     , pColorConfig(new EditableColorConfig)
     , m_xSchemeList(m_xBuilder->weld_combo_box(u"scheme"_ustr))
     , m_xMoreThemesBtn(m_xBuilder->weld_button(u"morethemesbtn"_ustr))
+    , 
m_xEnableAppTheming(m_xBuilder->weld_check_button(u"enableapptheming"_ustr))
     , m_xColorEntryBtn(m_xBuilder->weld_combo_box(u"registrydropdown"_ustr))
     , m_xColorChangeBtn((new 
ColorListBox(m_xBuilder->weld_menu_button(u"colorsdropdownbtn"_ustr),
                                           [this] { return GetFrameWeld(); })))
@@ -215,6 +216,13 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, ShowInDocumentHdl, 
weld::Toggleable&, void
     pColorConfig->SetColorValue(nEntry, aCurrentEntryColor);
 }
 
+IMPL_LINK_NOARG(SvxAppearanceTabPage, EnableAppThemingHdl, weld::Toggleable&, 
void)
+{
+    ThemeColors::SetThemeState(m_xEnableAppTheming->get_active() ? 
ThemeState::ENABLED
+                                                                 : 
ThemeState::DISABLED);
+    m_bRestartRequired = true;
+}
+
 IMPL_LINK_NOARG(SvxAppearanceTabPage, ColorEntryChgHdl, weld::ComboBox&, void)
 {
     // get selected entry index and ColorConfigValue
@@ -423,6 +431,9 @@ void SvxAppearanceTabPage::InitThemes()
     m_xSchemeList->connect_changed(LINK(this, SvxAppearanceTabPage, 
SchemeChangeHdl));
     m_xSchemeList->connect_popup_toggled(LINK(this, SvxAppearanceTabPage, 
SchemeListToggleHdl));
     m_xMoreThemesBtn->connect_clicked(LINK(this, SvxAppearanceTabPage, 
MoreThemesHdl));
+
+    m_xEnableAppTheming->connect_toggled(LINK(this, SvxAppearanceTabPage, 
EnableAppThemingHdl));
+    m_xEnableAppTheming->set_active(ThemeColors::IsThemeEnabled());
 }
 
 void SvxAppearanceTabPage::InitCustomization()
diff --git a/cui/source/options/appearance.hxx 
b/cui/source/options/appearance.hxx
index 03dfb850b41b..cc62c28460c0 100644
--- a/cui/source/options/appearance.hxx
+++ b/cui/source/options/appearance.hxx
@@ -38,6 +38,7 @@ private:
 
     std::unique_ptr<weld::ComboBox> m_xSchemeList;
     std::unique_ptr<weld::Button> m_xMoreThemesBtn;
+    std::unique_ptr<weld::CheckButton> m_xEnableAppTheming;
     std::unique_ptr<weld::ComboBox> m_xColorEntryBtn;
     std::unique_ptr<ColorListBox> m_xColorChangeBtn;
     std::unique_ptr<weld::CheckButton> m_xShowInDocumentChkBtn;
@@ -53,6 +54,7 @@ private:
     DECL_LINK(ColorEntryChgHdl, weld::ComboBox&, void);
     DECL_LINK(ColorValueChgHdl, ColorListBox&, void);
     DECL_LINK(ShowInDocumentHdl, weld::Toggleable&, void);
+    DECL_LINK(EnableAppThemingHdl, weld::Toggleable&, void);
     DECL_LINK(SchemeChangeHdl, weld::ComboBox&, void);
     DECL_LINK(SchemeListToggleHdl, weld::ComboBox&, void);
     DECL_STATIC_LINK(SvxAppearanceTabPage, MoreThemesHdl, weld::Button&, void);
diff --git a/cui/uiconfig/ui/appearance.ui b/cui/uiconfig/ui/appearance.ui
index f060e123dcd6..2833647e776d 100644
--- a/cui/uiconfig/ui/appearance.ui
+++ b/cui/uiconfig/ui/appearance.ui
@@ -35,6 +35,7 @@
                 <property name="margin-start">12</property>
                 <property name="margin-top">6</property>
                 <property name="orientation">vertical</property>
+                <property name="spacing">3</property>
                 <child>
                   <object class="GtkBox">
                     <property name="visible">True</property>
@@ -83,6 +84,25 @@
                     <property name="position">0</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkCheckButton" id="enableapptheming">
+                    <property name="label" translatable="yes" 
context="appearance|enableapptheming">Enable application theming</property>
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="draw-indicator">True</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" 
id="enableapptheming-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="appearance|extended_tip|enableapptheming">Check to 
enable application theming with extension themes.</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </object>
             </child>
             <child type="label">
@@ -119,7 +139,6 @@
           <object class="GtkBox">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
-            <property name="margin-start">13</property>
             <property name="margin-start">12</property>
             <property name="margin-top">6</property>
             <property name="orientation">vertical</property>

Reply via email to