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 06f69de8cd04edb15d1c0e2a6cad7adf2a34e90d
Author:     Sahil Gautam <[email protected]>
AuthorDate: Wed May 21 15:57:44 2025 +0530
Commit:     Sahil Gautam <[email protected]>
CommitDate: Mon Jan 26 10:00:55 2026 +0100

    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
    (cherry picked from commit 22a8a7583c5e906a7a5ecac97b34e2beca506389)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198096
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Sahil Gautam <[email protected]>

diff --git a/cui/source/options/appearance.cxx 
b/cui/source/options/appearance.cxx
index 2164dbe5d4d6..6d3fe3edf732 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(); })))
@@ -216,6 +217,13 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, ShowInDocumentHdl, 
weld::Toggleable&, void
     pColorConfig->SetColorValue(static_cast<ColorConfigEntry>(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
@@ -415,6 +423,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 dd2792c6b4bc..d4c7aeb7af30 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 fe8200eb066b..acb14beb459a 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>
@@ -73,6 +74,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">
@@ -109,7 +129,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