diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-02-10 12:53:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-10 19:37:08 +0000 |
commit | 88cee07ee023899ffd482bbe52bf0c02c58890d0 (patch) | |
tree | 892654d1b3ae917158b9bbd17132c98af750ca2b /cui | |
parent | e43062523b53f7c472f4c0183d333b34cf7adbdf (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>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optgdlg.cxx | 26 | ||||
-rw-r--r-- | cui/source/options/optgdlg.hxx | 3 |
2 files changed, 19 insertions, 10 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 5663d3912488..3b1f652adbcf 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -548,6 +548,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)) { OUString sToolKitName(Application::GetToolkitName()); if (sToolKitName.startsWith("gtk")) @@ -561,8 +562,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(); @@ -572,9 +583,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 @@ -582,12 +591,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() @@ -921,6 +924,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 870e3f39bccc..e13102270bdc 100644 --- a/cui/source/options/optgdlg.hxx +++ b/cui/source/options/optgdlg.hxx @@ -115,6 +115,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); @@ -122,6 +124,7 @@ private: void UpdateSkiaStatus(); void HideSkiaWidgets(); void UpdateHardwareAccelStatus(); + void UpdateIconThemes(); public: OfaViewTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); |