// -*- c++ -*- /* * Copyright (C) 2003, Ian Reinhart Geiser * * 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. */ #ifndef KJSEMBED_CONFIG_IMP_H #define KJSEMBED_CONFIG_IMP_H #include #include #include #include #include #include #include #include #include "bindingobject.h" #ifndef QT_ONLY class KConfig; #else class TTQSettings; #endif namespace KJSEmbed { namespace Bindings { class Config : public BindingObject { Q_OBJECT Q_PROPERTY( bool forceGlobal READ forceGlobal WRITE setForceGlobal ) Q_PROPERTY( bool dollarExpansion READ isDollarExpansion WRITE setDollarExpansion ) Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) Q_PROPERTY( bool readDefaults READ readDefaults WRITE setReadDefaults ) public: Config( TTQObject *parent=0, const char *name=0); /* Config( TTQObject *parent, const char *name, const TTQString& confName ); */ virtual ~Config(); void setForceGlobal( bool force ); bool forceGlobal() const; void setDollarExpansion( bool _bExpand ); bool isDollarExpansion() const; void setReadOnly(bool _ro); bool isReadOnly() const; void setReadDefaults(bool b); bool readDefaults() const; public slots: // Group void setDesktopGroup(); void setGroup(const TTQString&); TTQString group(); TTQStringList groupList(); TTQString locale(); void rollback( bool bDeep ); void sync(); bool hasKey( const TTQString& key ) const; bool entryIsImmutable(const TTQString &key) const; void revertToDefault(const TTQString &key); bool hasDefault(const TTQString &key) const; void setFileWriteMode(int mode); TTQString readEntry(const TTQString& pKey, const TTQString& aDefault ) const; TTQVariant readPropertyEntry( const TTQString& pKey, const TTQVariant &var) const; TTQStringList readListEntry( const TTQString& pKey ) const; TTQString readPathEntry( const TTQString& pKey, const TTQString & aDefault) const; TTQStringList readPathListEntry( const TTQString& pKey ) const; int readNumEntry( const TTQString& pKey, int nDefault ) const; uint readUnsignedNumEntry( const TTQString& pKey, uint nDefault ) const; long readLongNumEntry( const TTQString& pKey, long nDefault ) const; double readDoubleNumEntry( const TTQString& pKey, double nDefault ) const; TTQFont readFontEntry( const TTQString& pKey, const TTQFont* pDefault) const; bool readBoolEntry( const TTQString& pKey, const bool bDefault ) const; TTQRect readRectEntry( const TTQString& pKey, const TTQRect* pDefault) const; TTQPoint readPointEntry( const TTQString& pKey, const TTQPoint* pDefault) const; TTQSize readSizeEntry( const TTQString& pKey, const TTQSize* pDefault) const; TTQColor readColorEntry( const TTQString& pKey, const TTQColor* pDefault) const; TTQDateTime readDateTimeEntry( const TTQString& pKey, const TTQDateTime* pDefault) const; TTQString readEntryUntranslated( const TTQString& pKey, const TTQString& aDefault ) const; void writeEntry( const TTQString& pKey, const TTQString& pValue ); void writePropertyEntry( const TTQString& pKey, const TTQVariant& pValue ); void writeListEntry( const TTQString& pKey, const TTQStringList &rValue ); void writeNumEntry( const TTQString& pKey, int nValue ); void writeUnsignedNumEntry( const TTQString& pKey, uint nValue ); void writeLongNumEntry( const TTQString& pKey, unsigned long nValue ); void writeDoubleNumEntry( const TTQString& pKey, double nValue ); void writeBoolEntry( const TTQString& pKey, bool bValue ); void writeFontEntry( const TTQString& pKey, const TTQFont& rFont ); void writeColorEntry( const TTQString& pKey, const TTQColor& rColor ); void writeDateTimeEntry( const TTQString& pKey, const TTQDateTime& rDateTime ); void writeRectEntry( const TTQString& pKey, const TTQRect& rValue ); void writePointEntry( const TTQString& pKey, const TTQPoint& rValue ); void writeSizeEntry( const TTQString& pKey, const TTQSize& rValue ); void writePathEntry( const TTQString& pKey, const TTQString & path ); void writePathListEntry( const TTQString& pKey, const TTQStringList &rValue); void deleteEntry( const TTQString& pKey, bool bNLS , bool bGlobal ); bool deleteGroup( const TTQString& group, bool bDeep , bool bGlobal ); private: #ifndef QT_ONLY KConfig *m_config; #else TTQSettings *m_config; TTQString m_name; bool m_forceGlobal; #endif }; } } #endif