From 539275e0dfea56605abdc0d9d8424c89b014e919 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Mon, 10 Dec 2007 19:04:21 +0000 Subject: [PATCH] BUG:153554 Make the checkbox a tri-state when not all items it represents were selected svn path=/trunk/KDE/kdebase/workspace/; revision=746970 --- kcmkwin/kwincompositing/main.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 4e98a8e06b..e533141f2d 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -202,11 +202,17 @@ void KWinCompositingConfig::loadGeneralTab() // Load effect settings KConfigGroup effectconfig(mTmpConfig, "Plugins"); #define LOAD_EFFECT_CONFIG(effectname) effectconfig.readEntry("kwin4_effect_" effectname "Enabled", true) - bool winManagementEnabled = LOAD_EFFECT_CONFIG("presentwindows") - && LOAD_EFFECT_CONFIG("boxswitch") - && LOAD_EFFECT_CONFIG("desktopgrid") - && LOAD_EFFECT_CONFIG("dialogparent"); - ui.effectWinManagement->setChecked(winManagementEnabled); + int winManagementEnabled = LOAD_EFFECT_CONFIG("presentwindows") + + LOAD_EFFECT_CONFIG("boxswitch") + + LOAD_EFFECT_CONFIG("desktopgrid") + + LOAD_EFFECT_CONFIG("dialogparent"); +qDebug() << "winManagementEnabled" << winManagementEnabled; + if (winManagementEnabled > 0 && winManagementEnabled < 4) { + ui.effectWinManagement->setTristate(true); + ui.effectWinManagement->setCheckState(Qt::PartiallyChecked); + } + else + ui.effectWinManagement->setChecked(winManagementEnabled); ui.effectShadows->setChecked(LOAD_EFFECT_CONFIG("shadow")); ui.effectAnimations->setChecked(LOAD_EFFECT_CONFIG("minimizeanimation")); #undef LOAD_EFFECT_CONFIG @@ -257,10 +263,13 @@ bool KWinCompositingConfig::saveGeneralTab() // Save effects KConfigGroup effectconfig(mTmpConfig, "Plugins"); #define WRITE_EFFECT_CONFIG(effectname, widget) effectconfig.writeEntry("kwin4_effect_" effectname "Enabled", widget->isChecked()) - WRITE_EFFECT_CONFIG("presentwindows", ui.effectWinManagement); - WRITE_EFFECT_CONFIG("boxswitch", ui.effectWinManagement); - WRITE_EFFECT_CONFIG("desktopgrid", ui.effectWinManagement); - WRITE_EFFECT_CONFIG("dialogparent", ui.effectWinManagement); + if (ui.effectWinManagement->checkState() != Qt::PartiallyChecked) { +qDebug() << "partial!"; + WRITE_EFFECT_CONFIG("presentwindows", ui.effectWinManagement); + WRITE_EFFECT_CONFIG("boxswitch", ui.effectWinManagement); + WRITE_EFFECT_CONFIG("desktopgrid", ui.effectWinManagement); + WRITE_EFFECT_CONFIG("dialogparent", ui.effectWinManagement); + } WRITE_EFFECT_CONFIG("shadow", ui.effectShadows); // TODO: maybe also do some effect-specific configuration here, e.g. // enable/disable desktopgrid's animation according to this setting