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 c0b5b3d2100edf8e9d27036c3d8d831e2333a753
Author:     Sahil Gautam <[email protected]>
AuthorDate: Wed Jan 21 02:02:11 2026 +0530
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Jan 22 19:55:31 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]>
    (cherry picked from commit d0038ca58e7dfd4a7a9ad8f4b6f889231dbd9f95)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197717
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/cui/source/options/appearance.cxx 
b/cui/source/options/appearance.cxx
index 43312c6c2927..85ce4e77f323 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 8d11846ee03d..58c04141a825 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -284,6 +284,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 7390433af451..dff245fe6b46 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -741,6 +741,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