From 4840b07e220dc63279f24a8de3766565d72dfcc7 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 22 Dec 2010 22:08:41 +0000 Subject: [PATCH] write only configuration options that differ from default svn path=/trunk/KDE/kdebase/workspace/; revision=1208701 --- clients/oxygen/oxygenconfiguration.cpp | 44 +++++++++++++++----------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/clients/oxygen/oxygenconfiguration.cpp b/clients/oxygen/oxygenconfiguration.cpp index 33759e61b7..8c91ddbb67 100644 --- a/clients/oxygen/oxygenconfiguration.cpp +++ b/clients/oxygen/oxygenconfiguration.cpp @@ -27,6 +27,7 @@ #include "oxygenconfiguration.h" #include "oxygenexception.h" +#include #include namespace Oxygen @@ -162,33 +163,38 @@ namespace Oxygen if( exception.mask() & Exception::TitleOutline ) setDrawTitleOutline( exception.drawTitleOutline() ); if( exception.mask() & Exception::SizeGripMode ) setSizeGripMode( exception.sizeGripMode() ); setHideTitleBar( exception.hideTitleBar() ); - } //__________________________________________________ void Configuration::write( KConfigGroup& group ) const { - group.writeEntry( OxygenConfig::TITLE_ALIGNMENT, titleAlignmentName( false ) ); - group.writeEntry( OxygenConfig::BUTTON_SIZE, buttonSizeName( false ) ); - group.writeEntry( OxygenConfig::BLEND_COLOR, blendColorName( false ) ); - group.writeEntry( OxygenConfig::FRAME_BORDER, frameBorderName( false ) ); - group.writeEntry( OxygenConfig::SIZE_GRIP_MODE, sizeGripModeName( false ) ); + Configuration defaultConfiguration; - group.writeEntry( OxygenConfig::DRAW_SEPARATOR, separatorMode() != SeparatorNever ); - group.writeEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, separatorMode() == SeparatorActive ); + if( titleAlignment() != defaultConfiguration.titleAlignment() ) group.writeEntry( OxygenConfig::TITLE_ALIGNMENT, titleAlignmentName( false ) ); + if( buttonSize() != defaultConfiguration.buttonSize() ) group.writeEntry( OxygenConfig::BUTTON_SIZE, buttonSizeName( false ) ); - group.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, drawTitleOutline() ); - group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() ); - group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() ); - group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() ); - group.writeEntry( OxygenConfig::USE_ANIMATIONS, useAnimations() ); - group.writeEntry( OxygenConfig::ANIMATE_TITLE_CHANGE, animateTitleChange() ); - group.writeEntry( OxygenConfig::ANIMATIONS_DURATION, animationsDuration() ); - group.writeEntry( OxygenConfig::TABS_ENABLED, tabsEnabled() ); - group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() ); - group.writeEntry( OxygenConfig::SHADOW_MODE, shadowModeName( false ) ); - group.writeEntry( OxygenConfig::SHADOW_CACHE_MODE, shadowCacheModeName( false ) ); + if( blendColor() != defaultConfiguration.blendColor() ) group.writeEntry( OxygenConfig::BLEND_COLOR, blendColorName( false ) ); + if( frameBorder() != defaultConfiguration.frameBorder() ) group.writeEntry( OxygenConfig::FRAME_BORDER, frameBorderName( false ) ); + if( sizeGripMode() != defaultConfiguration.sizeGripMode() ) group.writeEntry( OxygenConfig::SIZE_GRIP_MODE, sizeGripModeName( false ) ); + + if( separatorMode() != defaultConfiguration.separatorMode() ) + { + group.writeEntry( OxygenConfig::DRAW_SEPARATOR, separatorMode() != SeparatorNever ); + group.writeEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, separatorMode() == SeparatorActive ); + } + + if( drawTitleOutline() != defaultConfiguration.drawTitleOutline() ) group.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, drawTitleOutline() ); + if( hideTitleBar() != defaultConfiguration.hideTitleBar() ) group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() ); + if( useDropShadows() != defaultConfiguration.useDropShadows() ) group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() ); + if( useOxygenShadows() != defaultConfiguration.useOxygenShadows() ) group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() ); + if( useAnimations() != defaultConfiguration.useAnimations() ) group.writeEntry( OxygenConfig::USE_ANIMATIONS, useAnimations() ); + if( animateTitleChange() != defaultConfiguration.animateTitleChange() ) group.writeEntry( OxygenConfig::ANIMATE_TITLE_CHANGE, animateTitleChange() ); + if( animationsDuration() != defaultConfiguration.animationsDuration() ) group.writeEntry( OxygenConfig::ANIMATIONS_DURATION, animationsDuration() ); + if( tabsEnabled() != defaultConfiguration.tabsEnabled() ) group.writeEntry( OxygenConfig::TABS_ENABLED, tabsEnabled() ); + if( useNarrowButtonSpacing() != defaultConfiguration.useNarrowButtonSpacing() ) group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() ); + if( shadowMode() != defaultConfiguration.shadowMode() ) group.writeEntry( OxygenConfig::SHADOW_MODE, shadowModeName( false ) ); + if( shadowCacheMode() != defaultConfiguration.shadowCacheMode() ) group.writeEntry( OxygenConfig::SHADOW_CACHE_MODE, shadowCacheModeName( false ) ); }