summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-02-10 12:53:33 +0000
committerAndras Timar <andras.timar@collabora.com>2023-02-12 21:09:30 +0100
commitcbe20db87054c949a02c9aac4bd60014ac917fea (patch)
treeca721587ebbd61cc20994169076a0f80e430c86a /cui
parent0d136e0c877e85c21765b20ef08099af4f607c9f (diff)
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>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/options/optgdlg.cxx26
-rw-r--r--cui/source/options/optgdlg.hxx3
2 files changed, 19 insertions, 10 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 4405fdb3e76b..eea8868a646c 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 a4c686cc2b27..0e0796e0db62 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);