-rw-r--r-- | microkde/kconfig.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/microkde/kconfig.h b/microkde/kconfig.h new file mode 100644 index 0000000..bfedf53 --- a/dev/null +++ b/microkde/kconfig.h | |||
@@ -0,0 +1,100 @@ | |||
1 | #ifndef MINIKDE_KCONFIG_H | ||
2 | #define MINIKDE_KCONFIG_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | #include <qstringlist.h> | ||
6 | #include <qvaluelist.h> | ||
7 | #include <qcolor.h> | ||
8 | #include <qfont.h> | ||
9 | #include <qmap.h> | ||
10 | #include <qdatetime.h> | ||
11 | |||
12 | class KConfig | ||
13 | { | ||
14 | public: | ||
15 | KConfig( const QString & ); | ||
16 | ~KConfig(); | ||
17 | |||
18 | void setGroup( const QString & ); | ||
19 | |||
20 | //US | ||
21 | /** | ||
22 | * Returns the name of the group in which we are | ||
23 | * searching for keys and from which we are retrieving entries. | ||
24 | * | ||
25 | * @return The current group. | ||
26 | */ | ||
27 | QString group() const; | ||
28 | |||
29 | //US I took the following deleteGroup method from a newer version from KDE. | ||
30 | /** | ||
31 | * Deletes a configuration entry group | ||
32 | * | ||
33 | * If the group is not empty and bDeep is false, nothing gets | ||
34 | * deleted and false is returned. | ||
35 | * If this group is the current group and it is deleted, the | ||
36 | * current group is undefined and should be set with setGroup() | ||
37 | * before the next operation on the configuration object. | ||
38 | * | ||
39 | * @param group The name of the group | ||
40 | * returns true if we deleted at least one entry. | ||
41 | */ | ||
42 | bool deleteGroup( const QString& group); | ||
43 | |||
44 | //US I took the following hasGroup method from a newer version from KDE. | ||
45 | /** | ||
46 | * Returns true if the specified group is known about. | ||
47 | * | ||
48 | * @param group The group to search for. | ||
49 | * @return Whether the group exists. | ||
50 | */ | ||
51 | bool hasGroup(const QString &group) const; | ||
52 | |||
53 | |||
54 | QString getFileName(); | ||
55 | |||
56 | //US added method readIntListEntry | ||
57 | QValueList<int> readIntListEntry( const QString &); | ||
58 | |||
59 | int readNumEntry( const QString &, int def=0 ); | ||
60 | QString readEntry( const QString &, const QString &def=QString::null ); | ||
61 | QStringList readListEntry( const QString & ); | ||
62 | bool readBoolEntry( const QString &, bool def=false ); | ||
63 | QColor readColorEntry( const QString &, QColor * ); | ||
64 | QFont readFontEntry( const QString &, QFont * ); | ||
65 | QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 ); | ||
66 | |||
67 | bool hasKey( const QString &); | ||
68 | |||
69 | void writeEntry( const QString &, const QValueList<int>& ); | ||
70 | void writeEntry( const QString &, int ); | ||
71 | void writeEntry( const QString &key , unsigned int value) { writeEntry( key, int( value ) ); } | ||
72 | void writeEntry( const char *key , unsigned int value) { writeEntry( QString( key ), value ); } | ||
73 | void writeEntry( const char *key, int value ) { writeEntry( QString( key ), value ); } | ||
74 | void writeEntry( const QString &, const QString & ); | ||
75 | void writeEntry( const char *key, const QString &value ) { writeEntry( QString( key ), value ); } | ||
76 | void writeEntry( const QString &, const QStringList & ); | ||
77 | void writeEntry( const QString &, bool ); | ||
78 | void writeEntry( const char *key, bool value ) { writeEntry( QString( key ), value ); } | ||
79 | void writeEntry( const QString &, const QColor & ); | ||
80 | void writeEntry( const QString &, const QFont & ); | ||
81 | void writeEntry( const QString &, const QDateTime & ); | ||
82 | |||
83 | void deleteEntry( const QString &); | ||
84 | |||
85 | void load(); | ||
86 | void sync(); | ||
87 | |||
88 | private: | ||
89 | static QString mGroup; | ||
90 | |||
91 | QString mFileName; | ||
92 | |||
93 | QMap<QString,bool> mBoolMap; | ||
94 | QMap<QString,QString> mStringMap; | ||
95 | QMap<QString,QDateTime> mDateTimeMap; | ||
96 | |||
97 | bool mDirty; | ||
98 | }; | ||
99 | |||
100 | #endif | ||