cui/source/options/appearance.cxx  |    3 +++
 include/svtools/colorcfg.hxx       |    1 +
 svtools/source/config/colorcfg.cxx |    5 +++++
 3 files changed, 9 insertions(+)

New commits:
commit d0038ca58e7dfd4a7a9ad8f4b6f889231dbd9f95
Author:     Sahil Gautam <[email protected]>
AuthorDate: Wed Jan 21 02:02:11 2026 +0530
Commit:     Sahil Gautam <[email protected]>
CommitDate: Wed Jan 21 09:15:54 2026 +0100

    tdf#169839 Call ColorConfig_Impl::SetupTheme before showing the restartdlg
    
    UI Theming are disabled by default so when the user enables it in the
    Appearance dialog, we need to call `ColorConfig_Impl::SetupTheme()`
    using an `EditableColorConfig` wrapper because `SetupTheme` loads the
    colors from the registry into the static `ThemeColors` object which
    is then used to query the newly loaded colors in various parts of the
    application (where the widget drawing happens).
    
    This automatically happens when the user presses on `Apply` as that
    calls `SvxAppearanceTabPage::Reset` which creates a new instance of
    `EditableColorConfig` which indirectly calls `SetupTheme`.
    
    But when the user presses `Ok` directly, `SvxAppearanceTabPage::Reset`
    isn't called, thus the restart dialog shows up with unreadable
    buttons as the color of the buttons changed (because of how color
    loading is implemented) but the button text being the same as the
    last theme (because `SetupTheme` wasn't called). Therefore we call
    `SetupTheme` to make sure that this case doesn't happen.
    
    Change-Id: I3939d5ccca36905e3416b10b55c6e7be09efe7e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197700
    Tested-by: Jenkins
    Reviewed-by: Sahil Gautam <[email protected]>

diff --git a/cui/source/options/appearance.cxx 
b/cui/source/options/appearance.cxx
index dcec8916527e..f01d0c9a4545 100644
--- a/cui/source/options/appearance.cxx
+++ b/cui/source/options/appearance.cxx
@@ -162,8 +162,11 @@ void SvxAppearanceTabPage::LoadSchemeList()
 void SvxAppearanceTabPage::ImplDestroy()
 {
     if (m_bRestartRequired)
+    {
+        pColorConfig->SetupTheme();
         
::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), 
GetFrameWeld(),
                                         svtools::RESTART_REASON_THEME_CHANGE);
+    }
 }
 
 SvxAppearanceTabPage::~SvxAppearanceTabPage() { 
suppress_fun_call_w_exception(ImplDestroy()); }
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index 844554e15a65..83212334b65f 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -286,6 +286,7 @@ public:
     void                        DeleteScheme(const OUString& rScheme );
     void                        AddScheme(const OUString& rScheme );
     void                        LoadScheme(const OUString& rScheme );
+    void                        SetupTheme();
     const OUString&             GetCurrentSchemeName() const;
     void                        SetCurrentSchemeName(const OUString& rScheme);
 
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index 6ef48f077e83..d31fcd97773f 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -742,6 +742,11 @@ void EditableColorConfig::LoadScheme(const OUString& 
rScheme )
     m_pImpl->CommitCurrentSchemeName();
 }
 
+void EditableColorConfig::SetupTheme()
+{
+    m_pImpl->SetupTheme();
+}
+
 const OUString& EditableColorConfig::GetCurrentSchemeName()const
 {
     return m_pImpl->GetLoadedScheme();

Reply via email to