00001 /* 00002 This file is part of the Opie Project 00003 00004 (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 00005 00006 Inspired by the config classes from the KDE Project which are 00007 =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org> 00008 .=l. 00009 .>+-= 00010 _;:, .> :=|. This program is free software; you can 00011 .> <`_, > . <= redistribute it and/or modify it under 00012 :`=1 )Y*s>-.-- : the terms of the GNU Library General Public 00013 .="- .-=="i, .._ License as published by the Free Software 00014 - . .-<_> .<> Foundation; either version 2 of the License, 00015 ._= =} : or (at your option) any later version. 00016 .%`+i> _;_. 00017 .i_,=:_. -<s. This program is distributed in the hope that 00018 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00019 : .. .:, . . . without even the implied warranty of 00020 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00021 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00022 ..}^=.= = ; Library General Public License for more 00023 ++= -. .` .: details. 00024 : = ...= . :.=- 00025 -. .:....=;==+<; You should have received a copy of the GNU 00026 -_. . . )=. = Library General Public License along with 00027 -- :-=` this library; see the file COPYING.LIB. 00028 If not, write to the Free Software Foundation, 00029 Inc., 59 Temple Place - Suite 330, 00030 Boston, MA 02111-1307, USA. 00031 */ 00032 00033 #ifndef OCONFIG_H 00034 #define OCONFIG_H 00035 00036 //FIXME: Implement for X11 or reuse libqpe/Config there also? 00037 //FIXME: Or rather use QSettings also for libqpe? 00038 00039 #include <qpe/config.h> 00040 00041 class QColor; 00042 class QFont; 00043 00044 namespace Opie { 00045 namespace Core { 00046 00052 class OConfig : public Config 00053 { 00054 public: 00058 OConfig( const QString &name, Domain domain = User ); 00065 virtual ~OConfig(); 00071 const QString& group()const { return git.key(); }; 00075 QColor readColorEntry( const QString& key, const QColor* pDefault ) const; 00079 QFont readFontEntry( const QString& key, const QFont* pDefault ) const; 00080 00081 private: 00082 class Private; 00083 Private *d; 00084 }; 00085 00125 class OConfigGroupSaver 00126 { 00127 public: 00133 OConfigGroupSaver( OConfig* config, QString group ) :_config(config), _oldgroup(config->group() ) 00134 { _config->setGroup( group ); } 00135 00136 OConfigGroupSaver( OConfig* config, const char *group ) :_config(config), _oldgroup(config->group()) 00137 { _config->setGroup( group ); } 00138 00139 OConfigGroupSaver( OConfig* config, const QCString &group ) : _config(config), _oldgroup(config->group()) 00140 { _config->setGroup( group ); } 00146 ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } 00147 00148 OConfig* config() { return _config; }; 00149 00150 private: 00151 OConfig* _config; 00152 QString _oldgroup; 00153 00154 OConfigGroupSaver( const OConfigGroupSaver& ); 00155 OConfigGroupSaver& operator=( const OConfigGroupSaver& ); 00156 00157 class Private; 00158 Private *d; 00159 }; 00160 } 00161 } 00162 00163 #endif // OCONFIG_H
1.4.2