-rw-r--r-- | microkde/kdecore/kprefs.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/microkde/kdecore/kprefs.h b/microkde/kdecore/kprefs.h index 95d2724..d9d1572 100644 --- a/microkde/kdecore/kprefs.h +++ b/microkde/kdecore/kprefs.h | |||
@@ -1,60 +1,62 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef _KPREFS_H | 20 | #ifndef _KPREFS_H |
21 | #define _KPREFS_H | 21 | #define _KPREFS_H |
22 | // $Id$ | 22 | // $Id$ |
23 | 23 | ||
24 | #include <qptrlist.h> | 24 | #include <q3ptrlist.h> |
25 | #include <qcolor.h> | 25 | #include <qcolor.h> |
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qsize.h> | 27 | #include <qsize.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3ValueList> | ||
29 | 31 | ||
30 | class KConfig; | 32 | class KConfig; |
31 | 33 | ||
32 | /** | 34 | /** |
33 | @short Class for storing a preferences setting | 35 | @short Class for storing a preferences setting |
34 | @author Cornelius Schumacher | 36 | @author Cornelius Schumacher |
35 | @see KPref | 37 | @see KPref |
36 | 38 | ||
37 | This class represents one preferences setting as used by @ref KPrefs. | 39 | This class represents one preferences setting as used by @ref KPrefs. |
38 | Subclasses of KPrefsItem implement storage functions for a certain type of | 40 | Subclasses of KPrefsItem implement storage functions for a certain type of |
39 | setting. Normally you don't have to use this class directly. Use the special | 41 | setting. Normally you don't have to use this class directly. Use the special |
40 | addItem() functions of KPrefs instead. If you subclass this class you will | 42 | addItem() functions of KPrefs instead. If you subclass this class you will |
41 | have to register instances with the function KPrefs::addItem(). | 43 | have to register instances with the function KPrefs::addItem(). |
42 | */ | 44 | */ |
43 | class KPrefsItem { | 45 | class KPrefsItem { |
44 | public: | 46 | public: |
45 | /** | 47 | /** |
46 | Constructor. | 48 | Constructor. |
47 | 49 | ||
48 | @param group Config file group. | 50 | @param group Config file group. |
49 | @param name Config file key. | 51 | @param name Config file key. |
50 | */ | 52 | */ |
51 | KPrefsItem(const QString &group,const QString &name) : | 53 | KPrefsItem(const QString &group,const QString &name) : |
52 | mGroup(group),mName(name) {} | 54 | mGroup(group),mName(name) {} |
53 | /** | 55 | /** |
54 | Destructor. | 56 | Destructor. |
55 | */ | 57 | */ |
56 | virtual ~KPrefsItem() {} | 58 | virtual ~KPrefsItem() {} |
57 | 59 | ||
58 | /** | 60 | /** |
59 | This function is called by @ref KPrefs to set this setting to its default | 61 | This function is called by @ref KPrefs to set this setting to its default |
60 | value. | 62 | value. |
@@ -254,63 +256,63 @@ class KPrefs { | |||
254 | @param key Key used in config file. | 256 | @param key Key used in config file. |
255 | @param reference Pointer to the variable, which is set by readConfig() | 257 | @param reference Pointer to the variable, which is set by readConfig() |
256 | and setDefaults() calls and read by writeConfig() calls. | 258 | and setDefaults() calls and read by writeConfig() calls. |
257 | @param defaultValue Default value, which is used by setDefaults() and | 259 | @param defaultValue Default value, which is used by setDefaults() and |
258 | when the config file does not yet contain the key of | 260 | when the config file does not yet contain the key of |
259 | this item. | 261 | this item. |
260 | */ | 262 | */ |
261 | void addItemPassword(const QString &key,QString *reference, | 263 | void addItemPassword(const QString &key,QString *reference, |
262 | const QString &defaultValue=""); | 264 | const QString &defaultValue=""); |
263 | /** | 265 | /** |
264 | Register an item of type QStringList. | 266 | Register an item of type QStringList. |
265 | 267 | ||
266 | @param key Key used in config file. | 268 | @param key Key used in config file. |
267 | @param reference Pointer to the variable, which is set by readConfig() | 269 | @param reference Pointer to the variable, which is set by readConfig() |
268 | and setDefaults() calls and read by writeConfig() calls. | 270 | and setDefaults() calls and read by writeConfig() calls. |
269 | @param defaultValue Default value, which is used by setDefaults() and | 271 | @param defaultValue Default value, which is used by setDefaults() and |
270 | when the config file does not yet contain the key of | 272 | when the config file does not yet contain the key of |
271 | this item. | 273 | this item. |
272 | */ | 274 | */ |
273 | void addItemStringList(const QString &key,QStringList *reference, | 275 | void addItemStringList(const QString &key,QStringList *reference, |
274 | const QStringList &defaultValue=QStringList()); | 276 | const QStringList &defaultValue=QStringList()); |
275 | 277 | ||
276 | /** | 278 | /** |
277 | Register an item of type QValueList<int>. | 279 | Register an item of type QValueList<int>. |
278 | 280 | ||
279 | @param key Key used in config file. | 281 | @param key Key used in config file. |
280 | @param reference Pointer to the variable, which is set by readConfig() | 282 | @param reference Pointer to the variable, which is set by readConfig() |
281 | and setDefaults() calls and read by writeConfig() calls. | 283 | and setDefaults() calls and read by writeConfig() calls. |
282 | @param defaultValue Default value, which is used by setDefaults() and | 284 | @param defaultValue Default value, which is used by setDefaults() and |
283 | when the config file does not yet contain the key of | 285 | when the config file does not yet contain the key of |
284 | this item. | 286 | this item. |
285 | */ | 287 | */ |
286 | void addItemIntList(const QString &key,QValueList<int> *reference, | 288 | void addItemIntList(const QString &key,Q3ValueList<int> *reference, |
287 | const QValueList<int> &defaultValue=QValueList<int>()); | 289 | const Q3ValueList<int> &defaultValue=Q3ValueList<int>()); |
288 | 290 | ||
289 | protected: | 291 | protected: |
290 | /** | 292 | /** |
291 | Implemented by subclasses that use special defaults. | 293 | Implemented by subclasses that use special defaults. |
292 | */ | 294 | */ |
293 | virtual void usrSetDefaults() {}; | 295 | virtual void usrSetDefaults() {}; |
294 | /** | 296 | /** |
295 | Implemented by subclasses that read special config values. | 297 | Implemented by subclasses that read special config values. |
296 | */ | 298 | */ |
297 | virtual void usrReadConfig() {}; | 299 | virtual void usrReadConfig() {}; |
298 | /** | 300 | /** |
299 | Implemented by subclasses that write special config values. | 301 | Implemented by subclasses that write special config values. |
300 | */ | 302 | */ |
301 | virtual void usrWriteConfig() {}; | 303 | virtual void usrWriteConfig() {}; |
302 | 304 | ||
303 | /** | 305 | /** |
304 | Return the @ref KConfig object used for reading and writing the settings. | 306 | Return the @ref KConfig object used for reading and writing the settings. |
305 | */ | 307 | */ |
306 | KConfig *config() const; | 308 | KConfig *config() const; |
307 | 309 | ||
308 | private: | 310 | private: |
309 | static QString *mCurrentGroup; | 311 | static QString *mCurrentGroup; |
310 | 312 | ||
311 | KConfig *mConfig; // pointer to KConfig object | 313 | KConfig *mConfig; // pointer to KConfig object |
312 | 314 | ||
313 | QPtrList<KPrefsItem> mItems; | 315 | Q3PtrList<KPrefsItem> mItems; |
314 | }; | 316 | }; |
315 | 317 | ||
316 | #endif | 318 | #endif |