From fd4c9ce6a752d55bdc1aeb19759625fc2cb9666b Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 22 Dec 2010 22:24:09 +0000 Subject: [PATCH] use ShadowConfiguration::write() to write config to file. Do not write options which have default value. This is consistent with what kconfigskeleton does. svn path=/trunk/KDE/kdebase/workspace/; revision=1208709 --- clients/oxygen/config/oxygenconfig.cpp | 15 ++++++++++----- clients/oxygen/oxygenshadowconfiguration.cpp | 13 +++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/clients/oxygen/config/oxygenconfig.cpp b/clients/oxygen/config/oxygenconfig.cpp index 03a15a813b..8f10fe0662 100644 --- a/clients/oxygen/config/oxygenconfig.cpp +++ b/clients/oxygen/config/oxygenconfig.cpp @@ -183,13 +183,18 @@ namespace Oxygen assert( colorGroup == QPalette::Active || colorGroup == QPalette::Inactive ); + // create shadow configuration + ShadowConfiguration configuration( colorGroup ); + configuration.setShadowSize( ui.ui.shadowSize->value() ); + configuration.setHorizontalOffset( 0.1*ui.ui.verticalOffset->value() ); + configuration.setInnerColor( ui.ui.innerColor->color() ); + configuration.setOuterColor( ui.ui.outerColor->color() ); + configuration.setUseOuterColor( ui.ui.useOuterColor->isChecked() ); + // save shadow configuration KConfigGroup configurationGroup( configuration_, ( (colorGroup == QPalette::Active) ? "ActiveShadow":"InactiveShadow" ) ); - configurationGroup.writeEntry( OxygenConfig::SHADOW_SIZE, ui.ui.shadowSize->value() ); - configurationGroup.writeEntry( OxygenConfig::SHADOW_VOFFSET, 0.1*ui.ui.verticalOffset->value() ); - configurationGroup.writeEntry( OxygenConfig::SHADOW_INNER_COLOR, ui.ui.innerColor->color() ); - configurationGroup.writeEntry( OxygenConfig::SHADOW_OUTER_COLOR, ui.ui.outerColor->color() ); - configurationGroup.writeEntry( OxygenConfig::SHADOW_USE_OUTER_COLOR, ui.ui.useOuterColor->isChecked() ); + configurationGroup.deleteGroup(); + configuration.write( configurationGroup ); } diff --git a/clients/oxygen/oxygenshadowconfiguration.cpp b/clients/oxygen/oxygenshadowconfiguration.cpp index b87db664e2..f94e88a7b7 100644 --- a/clients/oxygen/oxygenshadowconfiguration.cpp +++ b/clients/oxygen/oxygenshadowconfiguration.cpp @@ -92,12 +92,13 @@ namespace Oxygen //_________________________________________________________ void ShadowConfiguration::write( KConfigGroup& group ) const { - group.writeEntry( OxygenConfig::SHADOW_SIZE, shadowSize() ); - group.writeEntry( OxygenConfig::SHADOW_HOFFSET, horizontalOffset() ); - group.writeEntry( OxygenConfig::SHADOW_VOFFSET, verticalOffset() ); - group.writeEntry( OxygenConfig::SHADOW_INNER_COLOR, innerColor().name() ); - group.writeEntry( OxygenConfig::SHADOW_OUTER_COLOR, outerColor().name() ); - group.writeEntry( OxygenConfig::SHADOW_USE_OUTER_COLOR, useOuterColor() ); + ShadowConfiguration defaultConfiguration( colorGroup_ ); + if( shadowSize() != defaultConfiguration.shadowSize() ) group.writeEntry( OxygenConfig::SHADOW_SIZE, shadowSize() ); + if( horizontalOffset() != defaultConfiguration.horizontalOffset() ) group.writeEntry( OxygenConfig::SHADOW_HOFFSET, horizontalOffset() ); + if( verticalOffset() != defaultConfiguration.verticalOffset() ) group.writeEntry( OxygenConfig::SHADOW_VOFFSET, verticalOffset() ); + if( innerColor() != defaultConfiguration.innerColor() ) group.writeEntry( OxygenConfig::SHADOW_INNER_COLOR, innerColor().name() ); + if( outerColor() != defaultConfiguration.outerColor() ) group.writeEntry( OxygenConfig::SHADOW_OUTER_COLOR, outerColor().name() ); + if( useOuterColor() != defaultConfiguration.useOuterColor() ) group.writeEntry( OxygenConfig::SHADOW_USE_OUTER_COLOR, useOuterColor() ); } //_________________________________________________________