summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-09-25 18:11:23 (UTC)
committer mickeyl <mickeyl>2003-09-25 18:11:23 (UTC)
commit2d97604243f83dc7d057656148112c8018677bba (patch) (unidiff)
treeeee78eff5aa141bd55214fa0ba6dca8fad83091a
parent9047b6d4ffe0cbcecd90fd994ce2353277c378a1 (diff)
downloadopie-2d97604243f83dc7d057656148112c8018677bba.zip
opie-2d97604243f83dc7d057656148112c8018677bba.tar.gz
opie-2d97604243f83dc7d057656148112c8018677bba.tar.bz2
fix tille's infinite recursion ;-)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oconfig.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/oconfig.h b/libopie2/opiecore/oconfig.h
index e7d3be6..75aa170 100644
--- a/libopie2/opiecore/oconfig.h
+++ b/libopie2/opiecore/oconfig.h
@@ -1,140 +1,140 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4 (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4 (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 Inspired by the config classes from the KDE Project which are 5 Inspired by the config classes from the KDE Project which are
6 =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org> 6 =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org>
7 .=l. 7 .=l.
8           .>+-= 8           .>+-=
9 _;:,     .>    :=|. This program is free software; you can 9 _;:,     .>    :=|. This program is free software; you can
10.> <`_,   >  .   <= redistribute it and/or modify it under 10.> <`_,   >  .   <= redistribute it and/or modify it under
11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
12.="- .-=="i,     .._ License as published by the Free Software 12.="- .-=="i,     .._ License as published by the Free Software
13 - .   .-<_>     .<> Foundation; either version 2 of the License, 13 - .   .-<_>     .<> Foundation; either version 2 of the License,
14     ._= =}       : or (at your option) any later version. 14     ._= =}       : or (at your option) any later version.
15    .%`+i>       _;_. 15    .%`+i>       _;_.
16    .i_,=:_.      -<s. This program is distributed in the hope that 16    .i_,=:_.      -<s. This program is distributed in the hope that
17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18    : ..    .:,     . . . without even the implied warranty of 18    : ..    .:,     . . . without even the implied warranty of
19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21..}^=.=       =       ; Library General Public License for more 21..}^=.=       =       ; Library General Public License for more
22++=   -.     .`     .: details. 22++=   -.     .`     .: details.
23 :     =  ...= . :.=- 23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with 25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30*/ 30*/
31 31
32#ifndef OCONFIG_H 32#ifndef OCONFIG_H
33#define OCONFIG_H 33#define OCONFIG_H
34 34
35//FIXME: Implement for X11 or reuse libqpe/Config there also? 35//FIXME: Implement for X11 or reuse libqpe/Config there also?
36//FIXME: Or rather use QSettings also for libqpe? 36//FIXME: Or rather use QSettings also for libqpe?
37 37
38#include "opieconfig.h" 38#include "opieconfig.h"
39 39
40class QColor; 40class QColor;
41class QFont; 41class QFont;
42 42
43/** 43/**
44 * A Configuration class based on the Qtopia @ref Config class 44 * A Configuration class based on the Qtopia @ref Config class
45 * featuring additional handling of color and font entries 45 * featuring additional handling of color and font entries
46 */ 46 */
47 47
48class OConfig : public OpieConfig 48class OConfig : public OpieConfig
49{ 49{
50 public: 50 public:
51 /** 51 /**
52 * Constructs a OConfig object with a @a name. 52 * Constructs a OConfig object with a @a name.
53 */ 53 */
54 OConfig( const QString &name, Domain domain = User ); 54 OConfig( const QString &name, Domain domain = User );
55 /** 55 /**
56 * Destructs the OConfig object. 56 * Destructs the OConfig object.
57 * 57 *
58 * Writes back any dirty configuration entries, and destroys 58 * Writes back any dirty configuration entries, and destroys
59 * dynamically created objects. 59 * dynamically created objects.
60 */ 60 */
61 virtual ~OConfig(); 61 virtual ~OConfig();
62 /** 62 /**
63 * @returns the name of the current group. 63 * @returns the name of the current group.
64 * The current group is used for searching keys and accessing entries. 64 * The current group is used for searching keys and accessing entries.
65 */ 65 */
66 const QString& group() { return group(); }; 66 const QString& group() { return OpieConfig::group(); };
67 /** 67 /**
68 * @returns a @ref QColor entry or a @a default value if the key is not found. 68 * @returns a @ref QColor entry or a @a default value if the key is not found.
69 */ 69 */
70 QColor readColorEntry( const QString& key, const QColor* pDefault ) const; 70 QColor readColorEntry( const QString& key, const QColor* pDefault ) const;
71 /** 71 /**
72 * @returns a @ref QFont value or a @a default value if the key is not found. 72 * @returns a @ref QFont value or a @a default value if the key is not found.
73 */ 73 */
74 QFont readFontEntry( const QString& key, const QFont* pDefault ) const; 74 QFont readFontEntry( const QString& key, const QFont* pDefault ) const;
75}; 75};
76 76
77/** 77/**
78 * @brief Helper class for easier use of OConfig groups. 78 * @brief Helper class for easier use of OConfig groups.
79 * 79 *
80 * Careful programmers always set the group of a 80 * Careful programmers always set the group of a
81 * @ref OConfig object to the group they want to read from 81 * @ref OConfig object to the group they want to read from
82 * and set it back to the old one of afterwards. This is usually 82 * and set it back to the old one of afterwards. This is usually
83 * written as: 83 * written as:
84 * <pre> 84 * <pre>
85 * 85 *
86 * QString oldgroup config()->group(); 86 * QString oldgroup config()->group();
87 * config()->setGroup( "TheGroupThatIWant" ); 87 * config()->setGroup( "TheGroupThatIWant" );
88 * ... 88 * ...
89 * config()->writeEntry( "Blah", "Blubb" ); 89 * config()->writeEntry( "Blah", "Blubb" );
90 * 90 *
91 * config()->setGroup( oldgroup ); 91 * config()->setGroup( oldgroup );
92 * </pre> 92 * </pre>
93 * 93 *
94 * In order to facilitate this task, you can use 94 * In order to facilitate this task, you can use
95 * OConfigGroupSaver. Simply construct such an object ON THE STACK 95 * OConfigGroupSaver. Simply construct such an object ON THE STACK
96 * when you want to switch to a new group. Then, when the object goes 96 * when you want to switch to a new group. Then, when the object goes
97 * out of scope, the group will automatically be restored. If you 97 * out of scope, the group will automatically be restored. If you
98 * want to use several different groups within a function or method, 98 * want to use several different groups within a function or method,
99 * you can still use OConfigGroupSaver: Simply enclose all work with 99 * you can still use OConfigGroupSaver: Simply enclose all work with
100 * one group (including the creation of the OConfigGroupSaver object) 100 * one group (including the creation of the OConfigGroupSaver object)
101 * in one block. 101 * in one block.
102 * 102 *
103 * @author Matthias Kalle Dalheimer <Kalle@kde.org> 103 * @author Matthias Kalle Dalheimer <Kalle@kde.org>
104 * @version $Id$ 104 * @version $Id$
105 * @see OConfig 105 * @see OConfig
106 */ 106 */
107 107
108class OConfigGroupSaver 108class OConfigGroupSaver
109{ 109{
110 public: 110 public:
111 /** 111 /**
112 * Constructor. 112 * Constructor.
113 * Create the object giving a @config object and a @a group to become 113 * Create the object giving a @config object and a @a group to become
114 * the current group. 114 * the current group.
115 */ 115 */
116 OConfigGroupSaver( OConfig* config, QString group ) :_config(config), _oldgroup(config->group() ) 116 OConfigGroupSaver( OConfig* config, QString group ) :_config(config), _oldgroup(config->group() )
117 { _config->setGroup( group ); } 117 { _config->setGroup( group ); }
118 118
119 OConfigGroupSaver( OConfig* config, const char *group ) :_config(config), _oldgroup(config->group()) 119 OConfigGroupSaver( OConfig* config, const char *group ) :_config(config), _oldgroup(config->group())
120 { _config->setGroup( group ); } 120 { _config->setGroup( group ); }
121 121
122 OConfigGroupSaver( OConfig* config, const QCString &group ) : _config(config), _oldgroup(config->group()) 122 OConfigGroupSaver( OConfig* config, const QCString &group ) : _config(config), _oldgroup(config->group())
123 { _config->setGroup( group ); } 123 { _config->setGroup( group ); }
124 /** 124 /**
125 * Destructor. 125 * Destructor.
126 * Restores the last current group. 126 * Restores the last current group.
127 */ 127 */
128 ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } 128 ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); }
129 129
130 OConfig* config() { return _config; }; 130 OConfig* config() { return _config; };
131 131
132 private: 132 private:
133 OConfig* _config; 133 OConfig* _config;
134 QString _oldgroup; 134 QString _oldgroup;
135 135
136 OConfigGroupSaver( const OConfigGroupSaver& ); 136 OConfigGroupSaver( const OConfigGroupSaver& );
137 OConfigGroupSaver& operator=( const OConfigGroupSaver& ); 137 OConfigGroupSaver& operator=( const OConfigGroupSaver& );
138}; 138};
139 139
140#endif // OCONFIG_H 140#endif // OCONFIG_H