-rw-r--r-- | libopie2/opiecore/oconfig.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libopie2/opiecore/oconfig.h b/libopie2/opiecore/oconfig.h index becf70d..29c1f86 100644 --- a/libopie2/opiecore/oconfig.h +++ b/libopie2/opiecore/oconfig.h | |||
@@ -31,56 +31,64 @@ | |||
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 <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | 39 | ||
40 | class QColor; | 40 | class QColor; |
41 | class QFont; | 41 | class QFont; |
42 | 42 | ||
43 | namespace Opie { | ||
44 | namespace Core { | ||
45 | |||
43 | /** | 46 | /** |
44 | * A Configuration class based on the Qtopia @ref Config class | 47 | * A Configuration class based on the Qtopia @ref Config class |
45 | * featuring additional handling of color and font entries | 48 | * featuring additional handling of color and font entries |
46 | */ | 49 | */ |
47 | 50 | ||
48 | class OConfig : public Config | 51 | class OConfig : public Config |
49 | { | 52 | { |
50 | public: | 53 | public: |
51 | /** | 54 | /** |
52 | * Constructs a OConfig object with a @a name. | 55 | * Constructs a OConfig object with a @a name. |
53 | */ | 56 | */ |
54 | OConfig( const QString &name, Domain domain = User ); | 57 | OConfig( const QString &name, Domain domain = User ); |
55 | /** | 58 | /** |
56 | * Destructs the OConfig object. | 59 | * Destructs the OConfig object. |
57 | * | 60 | * |
58 | * Writes back any dirty configuration entries, and destroys | 61 | * Writes back any dirty configuration entries, and destroys |
59 | * dynamically created objects. | 62 | * dynamically created objects. |
60 | */ | 63 | */ |
61 | virtual ~OConfig(); | 64 | virtual ~OConfig(); |
62 | /** | 65 | /** |
63 | * @returns the name of the current group. | 66 | * @returns the name of the current group. |
64 | * The current group is used for searching keys and accessing entries. | 67 | * The current group is used for searching keys and accessing entries. |
68 | * @todo make const | ||
65 | */ | 69 | */ |
66 | const QString& group() { return git.key(); }; | 70 | const QString& group() { return git.key(); }; |
67 | /** | 71 | /** |
68 | * @returns a @ref QColor entry or a @a default value if the key is not found. | 72 | * @returns a @ref QColor entry or a @a default value if the key is not found. |
69 | */ | 73 | */ |
70 | QColor readColorEntry( const QString& key, const QColor* pDefault ) const; | 74 | QColor readColorEntry( const QString& key, const QColor* pDefault ) const; |
71 | /** | 75 | /** |
72 | * @returns a @ref QFont value or a @a default value if the key is not found. | 76 | * @returns a @ref QFont value or a @a default value if the key is not found. |
73 | */ | 77 | */ |
74 | QFont readFontEntry( const QString& key, const QFont* pDefault ) const; | 78 | QFont readFontEntry( const QString& key, const QFont* pDefault ) const; |
79 | |||
80 | private: | ||
81 | class Private; | ||
82 | Private *d; | ||
75 | }; | 83 | }; |
76 | 84 | ||
77 | /** | 85 | /** |
78 | * @brief Helper class for easier use of OConfig groups. | 86 | * @brief Helper class for easier use of OConfig groups. |
79 | * | 87 | * |
80 | * Careful programmers always set the group of a | 88 | * Careful programmers always set the group of a |
81 | * @ref OConfig object to the group they want to read from | 89 | * @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 | 90 | * and set it back to the old one of afterwards. This is usually |
83 | * written as: | 91 | * written as: |
84 | * <pre> | 92 | * <pre> |
85 | * | 93 | * |
86 | * QString oldgroup config()->group(); | 94 | * QString oldgroup config()->group(); |
@@ -127,15 +135,20 @@ class OConfigGroupSaver | |||
127 | * @todo make it not inline for bc reasons. See KDE BC guide | 135 | * @todo make it not inline for bc reasons. See KDE BC guide |
128 | */ | 136 | */ |
129 | ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } | 137 | ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } |
130 | 138 | ||
131 | OConfig* config() { return _config; }; | 139 | OConfig* config() { return _config; }; |
132 | 140 | ||
133 | private: | 141 | private: |
134 | OConfig* _config; | 142 | OConfig* _config; |
135 | QString _oldgroup; | 143 | QString _oldgroup; |
136 | 144 | ||
137 | OConfigGroupSaver( const OConfigGroupSaver& ); | 145 | OConfigGroupSaver( const OConfigGroupSaver& ); |
138 | OConfigGroupSaver& operator=( const OConfigGroupSaver& ); | 146 | OConfigGroupSaver& operator=( const OConfigGroupSaver& ); |
147 | |||
148 | class Private; | ||
149 | Private *d; | ||
139 | }; | 150 | }; |
151 | } | ||
152 | } | ||
140 | 153 | ||
141 | #endif // OCONFIG_H | 154 | #endif // OCONFIG_H |