Commit e9d1e940 authored by Benjamin Port's avatar Benjamin Port
Browse files

Add immutability to kcm fonts

Summary: Add immutability to kcm fonts, apply all willa apply font for mutable font type only

Reviewers: #plasma, ervin

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26229
parent 11092af7
......@@ -608,13 +608,23 @@ void KFonts::adjustAllFonts()
int ret = KFontDialog::getFontDiff(font, fontDiffFlags, KFontChooser::NoDisplayFlags);
if (ret == KDialog::Accepted && fontDiffFlags) {
m_settings->setFont(applyFontDiff(m_settings->font(), font, fontDiffFlags));
m_settings->setMenuFont(applyFontDiff(m_settings->menuFont(), font, fontDiffFlags));
m_settings->setToolBarFont(applyFontDiff(m_settings->toolBarFont(), font, fontDiffFlags));
m_settings->setActiveFont(applyFontDiff(m_settings->activeFont(), font, fontDiffFlags));
m_settings->setSmallestReadableFont(applyFontDiff(m_settings->smallestReadableFont(), font, fontDiffFlags));
if (!m_settings->isImmutable("font")) {
m_settings->setFont(applyFontDiff(m_settings->font(), font, fontDiffFlags));
}
if (!m_settings->isImmutable("menuFont")) {
m_settings->setMenuFont(applyFontDiff(m_settings->menuFont(), font, fontDiffFlags));
}
if (!m_settings->isImmutable("toolBarFont")) {
m_settings->setToolBarFont(applyFontDiff(m_settings->toolBarFont(), font, fontDiffFlags));
}
if (!m_settings->isImmutable("activeFont")) {
m_settings->setActiveFont(applyFontDiff(m_settings->activeFont(), font, fontDiffFlags));
}
if (!m_settings->isImmutable("smallestReadableFont")) {
m_settings->setSmallestReadableFont(applyFontDiff(m_settings->smallestReadableFont(), font, fontDiffFlags));
}
const QFont adjustedFont = applyFontDiff(m_settings->fixed(), font, fontDiffFlags);
if (QFontInfo(adjustedFont).fixedPitch()) {
if (QFontInfo(adjustedFont).fixedPitch() && !m_settings->isImmutable("fixed")) {
m_settings->setFixed(adjustedFont);
}
}
......
......@@ -55,6 +55,12 @@ KCM.SimpleKCM {
text: i18n("&Adjust All Fonts...")
onClicked: kcm.adjustAllFonts();
enabled: !kcm.fontsSettings.isImmutable("font")
|| !kcm.fontsSettings.isImmutable("fixed")
|| !kcm.fontsSettings.isImmutable("smallestReadableFont")
|| !kcm.fontsSettings.isImmutable("toolBarFont")
|| !kcm.fontsSettings.isImmutable("menuFont")
|| !kcm.fontsSettings.isImmutable("activeFont")
}
FontWidget {
......@@ -62,31 +68,37 @@ KCM.SimpleKCM {
label: i18n("General:")
category: "font"
font: kcm.fontsSettings.font
enabled: !kcm.fontsSettings.isImmutable("font")
}
FontWidget {
label: i18n("Fixed width:")
category: "fixed"
font: kcm.fontsSettings.fixed
enabled: !kcm.fontsSettings.isImmutable("fixed")
}
FontWidget {
label: i18n("Small:")
category: "smallestReadableFont"
font: kcm.fontsSettings.smallestReadableFont
enabled: !kcm.fontsSettings.isImmutable("smallestReadableFont")
}
FontWidget {
label: i18n("Toolbar:")
category: "toolBarFont"
font: kcm.fontsSettings.toolBarFont
enabled: !kcm.fontsSettings.isImmutable("toolBarFont")
}
FontWidget {
label: i18n("Menu:")
category: "menuFont"
font: kcm.fontsSettings.menuFont
enabled: !kcm.fontsSettings.isImmutable("menuFont")
}
FontWidget {
label: i18n("Window title:")
category: "activeFont"
font: kcm.fontsSettings.activeFont
enabled: !kcm.fontsSettings.isImmutable("activeFont")
}
Kirigami.Separator {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment