You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1208 lines
32 KiB
1208 lines
32 KiB
15 years ago
|
/*
|
||
|
This file is part of KOrganizer.
|
||
|
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
|
||
|
Copyright (c) 2003 Waldo Bastian <bastian@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
15 years ago
|
#include <tqcolor.h>
|
||
|
#include <tqvariant.h>
|
||
15 years ago
|
|
||
|
#include <kconfig.h>
|
||
|
#include <kstandarddirs.h>
|
||
|
#include <kglobal.h>
|
||
|
#include <kglobalsettings.h>
|
||
|
#include <kdebug.h>
|
||
|
|
||
|
#include "kstringhandler.h"
|
||
|
|
||
|
#include "kconfigskeleton.h"
|
||
|
|
||
|
void KConfigSkeletonItem::readImmutability( KConfig *config )
|
||
|
{
|
||
|
mIsImmutable = config->entryIsImmutable( mKey );
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemString::ItemString( const TQString &group, const TQString &key,
|
||
|
TQString &reference,
|
||
|
const TQString &defaultValue,
|
||
15 years ago
|
Type type )
|
||
15 years ago
|
: KConfigSkeletonGenericItem<TQString>( group, key, reference, defaultValue ),
|
||
15 years ago
|
mType( type )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemString::writeConfig( KConfig *config )
|
||
|
{
|
||
|
if ( mReference != mLoadedValue ) // WABA: Is this test needed?
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
if ((mDefault == mReference) && !config->hasDefault( mKey))
|
||
|
config->revertToDefault( mKey );
|
||
|
else if ( mType == Path )
|
||
|
config->writePathEntry( mKey, mReference );
|
||
|
else if ( mType == Password )
|
||
|
config->writeEntry( mKey, KStringHandler::obscure( mReference ) );
|
||
|
else
|
||
|
config->writeEntry( mKey, mReference );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void KConfigSkeleton::ItemString::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
|
||
|
if ( mType == Path )
|
||
|
{
|
||
|
mReference = config->readPathEntry( mKey, mDefault );
|
||
|
}
|
||
|
else if ( mType == Password )
|
||
|
{
|
||
15 years ago
|
TQString value = config->readEntry( mKey,
|
||
15 years ago
|
KStringHandler::obscure( mDefault ) );
|
||
|
mReference = KStringHandler::obscure( value );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
mReference = config->readEntry( mKey, mDefault );
|
||
|
}
|
||
|
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemString::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toString();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemString::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemPassword::ItemPassword( const TQString &group, const TQString &key,
|
||
|
TQString &reference,
|
||
|
const TQString &defaultValue)
|
||
15 years ago
|
: ItemString( group, key, reference, defaultValue, Password )
|
||
|
{
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemPath::ItemPath( const TQString &group, const TQString &key,
|
||
|
TQString &reference,
|
||
|
const TQString &defaultValue)
|
||
15 years ago
|
: ItemString( group, key, reference, defaultValue, Path )
|
||
|
{
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemProperty::ItemProperty( const TQString &group,
|
||
|
const TQString &key,
|
||
|
TQVariant &reference,
|
||
|
TQVariant defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQVariant>( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemProperty::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readPropertyEntry( mKey, mDefault );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemProperty::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemProperty::property() const
|
||
15 years ago
|
{
|
||
|
return mReference;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemBool::ItemBool( const TQString &group, const TQString &key,
|
||
15 years ago
|
bool &reference, bool defaultValue )
|
||
|
: KConfigSkeletonGenericItem<bool>( group, key, reference, defaultValue )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemBool::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readBoolEntry( mKey, mDefault );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemBool::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toBool();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemBool::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant( mReference, 42 /* dummy */ );
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemInt::ItemInt( const TQString &group, const TQString &key,
|
||
15 years ago
|
int &reference, int defaultValue )
|
||
|
: KConfigSkeletonGenericItem<int>( group, key, reference, defaultValue )
|
||
|
,mHasMin(false), mHasMax(false)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemInt::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readNumEntry( mKey, mDefault );
|
||
|
if (mHasMin)
|
||
|
mReference = QMAX(mReference, mMin);
|
||
|
if (mHasMax)
|
||
|
mReference = QMIN(mReference, mMax);
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemInt::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toInt();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemInt::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemInt::minValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMin)
|
||
15 years ago
|
return TQVariant(mMin);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemInt::maxValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMax)
|
||
15 years ago
|
return TQVariant(mMax);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemInt::setMinValue(int v)
|
||
|
{
|
||
|
mHasMin = true;
|
||
|
mMin = v;
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemInt::setMaxValue(int v)
|
||
|
{
|
||
|
mHasMax = true;
|
||
|
mMax = v;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemInt64::ItemInt64( const TQString &group, const TQString &key,
|
||
14 years ago
|
TQ_INT64 &reference, TQ_INT64 defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQ_INT64>( group, key, reference, defaultValue )
|
||
15 years ago
|
,mHasMin(false), mHasMax(false)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemInt64::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readNum64Entry( mKey, mDefault );
|
||
|
if (mHasMin)
|
||
|
mReference = QMAX(mReference, mMin);
|
||
|
if (mHasMax)
|
||
|
mReference = QMIN(mReference, mMax);
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemInt64::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toLongLong();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemInt64::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemInt64::minValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMin)
|
||
15 years ago
|
return TQVariant(mMin);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemInt64::maxValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMax)
|
||
15 years ago
|
return TQVariant(mMax);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
void KConfigSkeleton::ItemInt64::setMinValue(TQ_INT64 v)
|
||
15 years ago
|
{
|
||
|
mHasMin = true;
|
||
|
mMin = v;
|
||
|
}
|
||
|
|
||
14 years ago
|
void KConfigSkeleton::ItemInt64::setMaxValue(TQ_INT64 v)
|
||
15 years ago
|
{
|
||
|
mHasMax = true;
|
||
|
mMax = v;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemEnum::ItemEnum( const TQString &group, const TQString &key,
|
||
15 years ago
|
int &reference,
|
||
15 years ago
|
const TQValueList<Choice> &choices,
|
||
15 years ago
|
int defaultValue )
|
||
|
: ItemInt( group, key, reference, defaultValue ), mChoices( choices )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemEnum::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
if (!config->hasKey(mKey))
|
||
|
{
|
||
|
mReference = mDefault;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
int i = 0;
|
||
|
mReference = -1;
|
||
15 years ago
|
TQString tmp = config->readEntry( mKey ).lower();
|
||
|
for(TQValueList<Choice>::ConstIterator it = mChoices.begin();
|
||
15 years ago
|
it != mChoices.end(); ++it, ++i)
|
||
|
{
|
||
|
if ((*it).name.lower() == tmp)
|
||
|
{
|
||
|
mReference = i;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
if (mReference == -1)
|
||
|
mReference = config->readNumEntry( mKey, mDefault );
|
||
|
}
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemEnum::writeConfig( KConfig *config )
|
||
|
{
|
||
|
if ( mReference != mLoadedValue ) // WABA: Is this test needed?
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
if ((mDefault == mReference) && !config->hasDefault( mKey))
|
||
|
config->revertToDefault( mKey );
|
||
|
else if ((mReference >= 0) && (mReference < (int) mChoices.count()))
|
||
|
config->writeEntry( mKey, mChoices[mReference].name );
|
||
|
else
|
||
|
config->writeEntry( mKey, mReference );
|
||
|
}
|
||
|
}
|
||
|
|
||
15 years ago
|
TQValueList<KConfigSkeleton::ItemEnum::Choice> KConfigSkeleton::ItemEnum::choices() const
|
||
15 years ago
|
{
|
||
|
return mChoices;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemUInt::ItemUInt( const TQString &group, const TQString &key,
|
||
15 years ago
|
unsigned int &reference,
|
||
|
unsigned int defaultValue )
|
||
|
: KConfigSkeletonGenericItem<unsigned int>( group, key, reference, defaultValue )
|
||
|
,mHasMin(false), mHasMax(false)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemUInt::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readUnsignedNumEntry( mKey, mDefault );
|
||
|
if (mHasMin)
|
||
|
mReference = QMAX(mReference, mMin);
|
||
|
if (mHasMax)
|
||
|
mReference = QMIN(mReference, mMax);
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemUInt::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toUInt();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemUInt::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemUInt::minValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMin)
|
||
15 years ago
|
return TQVariant(mMin);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemUInt::maxValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMax)
|
||
15 years ago
|
return TQVariant(mMax);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemUInt::setMinValue(unsigned int v)
|
||
|
{
|
||
|
mHasMin = true;
|
||
|
mMin = v;
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemUInt::setMaxValue(unsigned int v)
|
||
|
{
|
||
|
mHasMax = true;
|
||
|
mMax = v;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemUInt64::ItemUInt64( const TQString &group, const TQString &key,
|
||
14 years ago
|
TQ_UINT64 &reference, TQ_UINT64 defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQ_UINT64>( group, key, reference, defaultValue )
|
||
15 years ago
|
,mHasMin(false), mHasMax(false)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemUInt64::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readUnsignedNum64Entry( mKey, mDefault );
|
||
|
if (mHasMin)
|
||
|
mReference = QMAX(mReference, mMin);
|
||
|
if (mHasMax)
|
||
|
mReference = QMIN(mReference, mMax);
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemUInt64::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toULongLong();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemUInt64::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemUInt64::minValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMin)
|
||
15 years ago
|
return TQVariant(mMin);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemUInt64::maxValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMax)
|
||
15 years ago
|
return TQVariant(mMax);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
void KConfigSkeleton::ItemUInt64::setMinValue(TQ_UINT64 v)
|
||
15 years ago
|
{
|
||
|
mHasMin = true;
|
||
|
mMin = v;
|
||
|
}
|
||
|
|
||
14 years ago
|
void KConfigSkeleton::ItemUInt64::setMaxValue(TQ_UINT64 v)
|
||
15 years ago
|
{
|
||
|
mHasMax = true;
|
||
|
mMax = v;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemLong::ItemLong( const TQString &group, const TQString &key,
|
||
15 years ago
|
long &reference, long defaultValue )
|
||
|
: KConfigSkeletonGenericItem<long>( group, key, reference, defaultValue )
|
||
|
,mHasMin(false), mHasMax(false)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemLong::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readLongNumEntry( mKey, mDefault );
|
||
|
if (mHasMin)
|
||
|
mReference = QMAX(mReference, mMin);
|
||
|
if (mHasMax)
|
||
|
mReference = QMIN(mReference, mMax);
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemLong::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toLongLong();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemLong::property() const
|
||
15 years ago
|
{
|
||
14 years ago
|
return TQVariant((TQ_LLONG) mReference);
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemLong::minValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMin)
|
||
14 years ago
|
return TQVariant((TQ_LLONG) mMin);
|
||
15 years ago
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemLong::maxValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMax)
|
||
14 years ago
|
return TQVariant((TQ_LLONG) mMax);
|
||
15 years ago
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemLong::setMinValue(long v)
|
||
|
{
|
||
|
mHasMin = true;
|
||
|
mMin = v;
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemLong::setMaxValue(long v)
|
||
|
{
|
||
|
mHasMax = true;
|
||
|
mMax = v;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemULong::ItemULong( const TQString &group, const TQString &key,
|
||
15 years ago
|
unsigned long &reference,
|
||
|
unsigned long defaultValue )
|
||
|
: KConfigSkeletonGenericItem<unsigned long>( group, key, reference, defaultValue )
|
||
|
,mHasMin(false), mHasMax(false)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemULong::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readUnsignedLongNumEntry( mKey, mDefault );
|
||
|
if (mHasMin)
|
||
|
mReference = QMAX(mReference, mMin);
|
||
|
if (mHasMax)
|
||
|
mReference = QMIN(mReference, mMax);
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemULong::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toULongLong();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemULong::property() const
|
||
15 years ago
|
{
|
||
14 years ago
|
return TQVariant((TQ_ULLONG) mReference);
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemULong::minValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMin)
|
||
14 years ago
|
return TQVariant((TQ_ULLONG) mMin);
|
||
15 years ago
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemULong::maxValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMax)
|
||
14 years ago
|
return TQVariant((TQ_ULLONG) mMax);
|
||
15 years ago
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemULong::setMinValue(unsigned long v)
|
||
|
{
|
||
|
mHasMin = true;
|
||
|
mMin = v;
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemULong::setMaxValue(unsigned long v)
|
||
|
{
|
||
|
mHasMax = true;
|
||
|
mMax = v;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemDouble::ItemDouble( const TQString &group, const TQString &key,
|
||
15 years ago
|
double &reference, double defaultValue )
|
||
|
: KConfigSkeletonGenericItem<double>( group, key, reference, defaultValue )
|
||
|
,mHasMin(false), mHasMax(false)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemDouble::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readDoubleNumEntry( mKey, mDefault );
|
||
|
if (mHasMin)
|
||
|
mReference = QMAX(mReference, mMin);
|
||
|
if (mHasMax)
|
||
|
mReference = QMIN(mReference, mMax);
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemDouble::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toDouble();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemDouble::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemDouble::minValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMin)
|
||
15 years ago
|
return TQVariant(mMin);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemDouble::maxValue() const
|
||
15 years ago
|
{
|
||
|
if (mHasMax)
|
||
15 years ago
|
return TQVariant(mMax);
|
||
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemDouble::setMinValue(double v)
|
||
|
{
|
||
|
mHasMin = true;
|
||
|
mMin = v;
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemDouble::setMaxValue(double v)
|
||
|
{
|
||
|
mHasMax = true;
|
||
|
mMax = v;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemColor::ItemColor( const TQString &group, const TQString &key,
|
||
|
TQColor &reference,
|
||
|
const TQColor &defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQColor>( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemColor::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readColorEntry( mKey, &mDefault );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemColor::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toColor();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemColor::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemFont::ItemFont( const TQString &group, const TQString &key,
|
||
|
TQFont &reference,
|
||
|
const TQFont &defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQFont>( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemFont::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readFontEntry( mKey, &mDefault );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemFont::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toFont();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemFont::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemRect::ItemRect( const TQString &group, const TQString &key,
|
||
|
TQRect &reference,
|
||
|
const TQRect &defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQRect>( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemRect::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readRectEntry( mKey, &mDefault );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemRect::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toRect();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemRect::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemPoint::ItemPoint( const TQString &group, const TQString &key,
|
||
|
TQPoint &reference,
|
||
|
const TQPoint &defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQPoint>( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemPoint::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readPointEntry( mKey, &mDefault );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemPoint::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toPoint();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemPoint::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemSize::ItemSize( const TQString &group, const TQString &key,
|
||
|
TQSize &reference,
|
||
|
const TQSize &defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQSize>( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemSize::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readSizeEntry( mKey, &mDefault );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemSize::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toSize();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemSize::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemDateTime::ItemDateTime( const TQString &group, const TQString &key,
|
||
|
TQDateTime &reference,
|
||
|
const TQDateTime &defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQDateTime>( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemDateTime::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
mReference = config->readDateTimeEntry( mKey, &mDefault );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemDateTime::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toDateTime();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemDateTime::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemStringList::ItemStringList( const TQString &group, const TQString &key,
|
||
|
TQStringList &reference,
|
||
|
const TQStringList &defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQStringList>( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemStringList::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
if ( !config->hasKey( mKey ) )
|
||
|
mReference = mDefault;
|
||
|
else
|
||
|
mReference = config->readListEntry( mKey );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemStringList::setProperty(const TQVariant & p)
|
||
15 years ago
|
{
|
||
|
mReference = p.toStringList();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemStringList::property() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQVariant(mReference);
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemPathList::ItemPathList( const TQString &group, const TQString &key,
|
||
|
TQStringList &reference,
|
||
|
const TQStringList &defaultValue )
|
||
15 years ago
|
: ItemStringList( group, key, reference, defaultValue )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemPathList::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
if ( !config->hasKey( mKey ) )
|
||
|
mReference = mDefault;
|
||
|
else
|
||
|
mReference = config->readPathListEntry( mKey );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemPathList::writeConfig( KConfig *config )
|
||
|
{
|
||
|
if ( mReference != mLoadedValue ) // WABA: Is this test needed?
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
if ((mDefault == mReference) && !config->hasDefault( mKey))
|
||
|
config->revertToDefault( mKey );
|
||
|
else {
|
||
15 years ago
|
TQStringList sl = mReference;
|
||
15 years ago
|
config->writePathEntry( mKey, sl );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemIntList::ItemIntList( const TQString &group, const TQString &key,
|
||
|
TQValueList<int> &reference,
|
||
|
const TQValueList<int> &defaultValue )
|
||
|
: KConfigSkeletonGenericItem<TQValueList<int> >( group, key, reference, defaultValue )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::ItemIntList::readConfig( KConfig *config )
|
||
|
{
|
||
|
config->setGroup( mGroup );
|
||
|
if ( !config->hasKey( mKey ) )
|
||
|
mReference = mDefault;
|
||
|
else
|
||
|
mReference = config->readIntListEntry( mKey );
|
||
|
mLoadedValue = mReference;
|
||
|
|
||
|
readImmutability( config );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::ItemIntList::setProperty(const TQVariant &)
|
||
15 years ago
|
{
|
||
|
// TODO: Not yet supported
|
||
|
}
|
||
|
|
||
15 years ago
|
TQVariant KConfigSkeleton::ItemIntList::property() const
|
||
15 years ago
|
{
|
||
|
// TODO: Not yet supported
|
||
15 years ago
|
return TQVariant();
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
KConfigSkeleton::KConfigSkeleton( const TQString &configname )
|
||
15 years ago
|
: mCurrentGroup( "No Group" ), mUseDefaults(false)
|
||
|
{
|
||
|
kdDebug(177) << "Creating KConfigSkeleton (" << (void *)this << ")" << endl;
|
||
|
|
||
|
if ( !configname.isEmpty() )
|
||
|
{
|
||
|
mConfig = KSharedConfig::openConfig( configname );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
mConfig = KGlobal::sharedConfig();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
KConfigSkeleton::KConfigSkeleton(KSharedConfig::Ptr config)
|
||
|
: mCurrentGroup( "No Group" ), mUseDefaults(false)
|
||
|
{
|
||
|
kdDebug(177) << "Creating KConfigSkeleton (" << (void *)this << ")" << endl;
|
||
|
mConfig = config;
|
||
|
}
|
||
|
|
||
|
|
||
|
KConfigSkeleton::~KConfigSkeleton()
|
||
|
{
|
||
|
KConfigSkeletonItem::List::ConstIterator it;
|
||
|
for( it = mItems.begin(); it != mItems.end(); ++it )
|
||
|
{
|
||
|
delete *it;
|
||
|
}
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::setCurrentGroup( const TQString &group )
|
||
15 years ago
|
{
|
||
|
mCurrentGroup = group;
|
||
|
}
|
||
|
|
||
|
KConfig *KConfigSkeleton::config() const
|
||
|
{
|
||
|
return mConfig;
|
||
|
}
|
||
|
|
||
|
bool KConfigSkeleton::useDefaults(bool b)
|
||
|
{
|
||
|
if (b == mUseDefaults)
|
||
|
return mUseDefaults;
|
||
|
|
||
|
mUseDefaults = b;
|
||
|
KConfigSkeletonItem::List::ConstIterator it;
|
||
|
for( it = mItems.begin(); it != mItems.end(); ++it )
|
||
|
{
|
||
|
(*it)->swapDefault();
|
||
|
}
|
||
|
|
||
|
usrUseDefaults(b);
|
||
|
return !mUseDefaults;
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::setDefaults()
|
||
|
{
|
||
|
KConfigSkeletonItem::List::ConstIterator it;
|
||
|
for( it = mItems.begin(); it != mItems.end(); ++it ) {
|
||
|
(*it)->setDefault();
|
||
|
}
|
||
|
|
||
|
usrSetDefaults();
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::readConfig()
|
||
|
{
|
||
|
kdDebug(177) << "KConfigSkeleton::readConfig()" << endl;
|
||
|
|
||
15 years ago
|
TQString origGroup = mConfig->group();
|
||
15 years ago
|
|
||
|
mConfig->reparseConfiguration();
|
||
|
KConfigSkeletonItem::List::ConstIterator it;
|
||
|
for( it = mItems.begin(); it != mItems.end(); ++it )
|
||
|
{
|
||
|
(*it)->readConfig( mConfig );
|
||
|
}
|
||
|
|
||
|
usrReadConfig();
|
||
|
|
||
|
mConfig->setGroup(origGroup);
|
||
|
}
|
||
|
|
||
|
void KConfigSkeleton::writeConfig()
|
||
|
{
|
||
|
kdDebug(177) << "KConfigSkeleton::writeConfig()" << endl;
|
||
|
|
||
15 years ago
|
TQString origGroup = mConfig->group();
|
||
15 years ago
|
|
||
|
KConfigSkeletonItem::List::ConstIterator it;
|
||
|
for( it = mItems.begin(); it != mItems.end(); ++it )
|
||
|
{
|
||
|
(*it)->writeConfig( mConfig );
|
||
|
}
|
||
|
|
||
|
usrWriteConfig();
|
||
|
|
||
|
mConfig->sync();
|
||
|
|
||
|
readConfig();
|
||
|
|
||
|
mConfig->setGroup(origGroup);
|
||
|
}
|
||
|
|
||
15 years ago
|
void KConfigSkeleton::addItem( KConfigSkeletonItem *item, const TQString &name )
|
||
15 years ago
|
{
|
||
|
item->setName( name.isEmpty() ? item->key() : name );
|
||
|
mItems.append( item );
|
||
|
mItemDict.insert( item->name(), item );
|
||
|
item->readDefault( mConfig );
|
||
|
item->readConfig( mConfig );
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemString *KConfigSkeleton::addItemString( const TQString &name, TQString &reference,
|
||
|
const TQString &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemString *item;
|
||
|
item = new KConfigSkeleton::ItemString( mCurrentGroup, key.isEmpty() ? name : key,
|
||
|
reference, defaultValue,
|
||
|
KConfigSkeleton::ItemString::Normal );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemPassword *KConfigSkeleton::addItemPassword( const TQString &name, TQString &reference,
|
||
|
const TQString &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemPassword *item;
|
||
|
item = new KConfigSkeleton::ItemPassword( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemPath *KConfigSkeleton::addItemPath( const TQString &name, TQString &reference,
|
||
|
const TQString &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemPath *item;
|
||
|
item = new KConfigSkeleton::ItemPath( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemProperty *KConfigSkeleton::addItemProperty( const TQString &name, TQVariant &reference,
|
||
|
const TQVariant &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemProperty *item;
|
||
|
item = new KConfigSkeleton::ItemProperty( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemBool *KConfigSkeleton::addItemBool( const TQString &name, bool &reference,
|
||
|
bool defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemBool *item;
|
||
|
item = new KConfigSkeleton::ItemBool( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemInt *KConfigSkeleton::addItemInt( const TQString &name, int &reference,
|
||
|
int defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemInt *item;
|
||
|
item = new KConfigSkeleton::ItemInt( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemUInt *KConfigSkeleton::addItemUInt( const TQString &name, unsigned int &reference,
|
||
|
unsigned int defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemUInt *item;
|
||
|
item = new KConfigSkeleton::ItemUInt( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
14 years ago
|
KConfigSkeleton::ItemInt64 *KConfigSkeleton::addItemInt64( const TQString &name, TQ_INT64 &reference,
|
||
|
TQ_INT64 defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemInt64 *item;
|
||
|
item = new KConfigSkeleton::ItemInt64( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
14 years ago
|
KConfigSkeleton::ItemUInt64 *KConfigSkeleton::addItemUInt64( const TQString &name, TQ_UINT64 &reference,
|
||
|
TQ_UINT64 defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemUInt64 *item;
|
||
|
item = new KConfigSkeleton::ItemUInt64( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemLong *KConfigSkeleton::addItemLong( const TQString &name, long &reference,
|
||
|
long defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemLong *item;
|
||
|
item = new KConfigSkeleton::ItemLong( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemULong *KConfigSkeleton::addItemULong( const TQString &name, unsigned long &reference,
|
||
|
unsigned long defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemULong *item;
|
||
|
item = new KConfigSkeleton::ItemULong( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemDouble *KConfigSkeleton::addItemDouble( const TQString &name, double &reference,
|
||
|
double defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemDouble *item;
|
||
|
item = new KConfigSkeleton::ItemDouble( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemColor *KConfigSkeleton::addItemColor( const TQString &name, TQColor &reference,
|
||
|
const TQColor &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemColor *item;
|
||
|
item = new KConfigSkeleton::ItemColor( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemFont *KConfigSkeleton::addItemFont( const TQString &name, TQFont &reference,
|
||
|
const TQFont &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemFont *item;
|
||
|
item = new KConfigSkeleton::ItemFont( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemRect *KConfigSkeleton::addItemRect( const TQString &name, TQRect &reference,
|
||
|
const TQRect &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemRect *item;
|
||
|
item = new KConfigSkeleton::ItemRect( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemPoint *KConfigSkeleton::addItemPoint( const TQString &name, TQPoint &reference,
|
||
|
const TQPoint &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemPoint *item;
|
||
|
item = new KConfigSkeleton::ItemPoint( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemSize *KConfigSkeleton::addItemSize( const TQString &name, TQSize &reference,
|
||
|
const TQSize &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemSize *item;
|
||
|
item = new KConfigSkeleton::ItemSize( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemDateTime *KConfigSkeleton::addItemDateTime( const TQString &name, TQDateTime &reference,
|
||
|
const TQDateTime &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemDateTime *item;
|
||
|
item = new KConfigSkeleton::ItemDateTime( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemStringList *KConfigSkeleton::addItemStringList( const TQString &name, TQStringList &reference,
|
||
|
const TQStringList &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemStringList *item;
|
||
|
item = new KConfigSkeleton::ItemStringList( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
KConfigSkeleton::ItemIntList *KConfigSkeleton::addItemIntList( const TQString &name, TQValueList<int> &reference,
|
||
|
const TQValueList<int> &defaultValue, const TQString &key )
|
||
15 years ago
|
{
|
||
|
KConfigSkeleton::ItemIntList *item;
|
||
|
item = new KConfigSkeleton::ItemIntList( mCurrentGroup, key.isNull() ? name : key,
|
||
|
reference, defaultValue );
|
||
|
addItem( item, name );
|
||
|
return item;
|
||
|
}
|
||
|
|
||
15 years ago
|
bool KConfigSkeleton::isImmutable(const TQString &name)
|
||
15 years ago
|
{
|
||
14 years ago
|
KConfigSkeletonItem *item = findItem(name);
|
||
15 years ago
|
return !item || item->isImmutable();
|
||
|
}
|
||
|
|
||
14 years ago
|
KConfigSkeletonItem *KConfigSkeleton::findItem(const TQString &name)
|
||
15 years ago
|
{
|
||
14 years ago
|
return mItemDict.find(name);
|
||
15 years ago
|
}
|