Resolves: tdf#153497 update automatic icon-theme name on dark mode change
Change-Id: I6b41d04ad902d5b123a110b52426ea2c2de79e4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146774
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 88cee07ee023899ffd482bbe52bf0c02c58890d0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146794
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 4405fdb..eea8868 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -546,6 +546,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
, m_xMouseMiddleLB(m_xBuilder->weld_combo_box("mousemiddle"))
, m_xMoreIcons(m_xBuilder->weld_button("btnMoreIcons"))
, m_xRunGPTests(m_xBuilder->weld_button("btn_rungptest"))
, m_sAutoStr(m_xIconStyleLB->get_text(0))
{
if (Application::GetToolkitName().startsWith("gtk"))
m_xMenuIconBox->hide();
@@ -554,8 +555,18 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
m_xUseSkia->connect_toggled(LINK(this, OfaViewTabPage, OnUseSkiaToggled));
UpdateIconThemes();
m_xIconStyleLB->set_active(0);
m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
}
void OfaViewTabPage::UpdateIconThemes()
{
// Set known icon themes
OUString sAutoStr( m_xIconStyleLB->get_text( 0 ) );
m_xIconStyleLB->clear();
StyleSettings aStyleSettings = Application::GetSettings().GetStyleSettings();
mInstalledIconThemes = aStyleSettings.GetInstalledIconThemes();
@@ -565,9 +576,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
OUString autoThemeId = aStyleSettings.GetAutomaticallyChosenIconTheme();
const vcl::IconThemeInfo& autoIconTheme = vcl::IconThemeInfo::FindIconThemeById(mInstalledIconThemes, autoThemeId);
OUString entryForAuto = sAutoStr + " (" +
autoIconTheme.GetDisplayName() +
")";
OUString entryForAuto = m_sAutoStr + " (" + autoIconTheme.GetDisplayName() + ")";
m_xIconStyleLB->append("auto", entryForAuto); // index 0 means choose style automatically
// separate auto and other icon themes
@@ -575,12 +584,6 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
for (auto const& installIconTheme : mInstalledIconThemes)
m_xIconStyleLB->append(installIconTheme.GetThemeId(), installIconTheme.GetDisplayName());
m_xIconStyleLB->set_active(0);
m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
}
OfaViewTabPage::~OfaViewTabPage()
@@ -899,6 +902,9 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
m_xNotebookbarIconSizeLB->set_active(nNotebookbarSizeLB_InitialSelection);
m_xNotebookbarIconSizeLB->save_value();
// tdf#153497 set name of automatic icon theme, it may have changed due to "Apply" while this page is visible
UpdateIconThemes();
if (aMiscOptions.IconThemeWasSetAutomatically()) {
nStyleLB_InitialSelection = 0;
}
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index a4c686c..0e0796e 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -113,6 +113,8 @@ private:
std::unique_ptr<weld::Button> m_xMoreIcons;
std::unique_ptr<weld::Button> m_xRunGPTests;
OUString m_sAutoStr;
DECL_LINK(OnAntialiasingToggled, weld::Toggleable&, void);
DECL_LINK(OnUseSkiaToggled, weld::Toggleable&, void);
DECL_STATIC_LINK(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void);
@@ -120,6 +122,7 @@ private:
void UpdateSkiaStatus();
void HideSkiaWidgets();
void UpdateHardwareAccelStatus();
void UpdateIconThemes();
public:
OfaViewTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);