decorations: small refactor for decorationpalette.cpp

Handle header color schemes first since the code is smaller for that
block, which makes things more readable.
This commit is contained in:
Nate Graham 2021-10-19 07:20:02 -06:00
parent 00ade26624
commit 6c2834cc8a

View file

@ -128,7 +128,11 @@ void DecorationPalette::update()
{
m_colorSchemeConfig->sync();
if (!KColorScheme::isColorSetSupported(m_colorSchemeConfig, KColorScheme::Header)) {
if (KColorScheme::isColorSetSupported(m_colorSchemeConfig, KColorScheme::Header)) {
m_palette.active = KColorScheme(QPalette::Normal, KColorScheme::Header, m_colorSchemeConfig);
m_palette.inactive = KColorScheme(QPalette::Inactive, KColorScheme::Header, m_colorSchemeConfig);
m_legacyPalette.reset();
} else {
KConfigGroup wmConfig(m_colorSchemeConfig, QStringLiteral("WM"));
if (!wmConfig.exists()) {
@ -149,10 +153,6 @@ void DecorationPalette::update()
KConfigGroup windowColorsConfig(m_colorSchemeConfig, QStringLiteral("Colors:Window"));
m_legacyPalette->warningForegroundColor = windowColorsConfig.readEntry("ForegroundNegative", QColor(237, 21, 2));
} else {
m_palette.active = KColorScheme(QPalette::Normal, KColorScheme::Header, m_colorSchemeConfig);
m_palette.inactive = KColorScheme(QPalette::Inactive, KColorScheme::Header, m_colorSchemeConfig);
m_legacyPalette.reset();
}
Q_EMIT changed();