1 | /* |
2 | Copyright (c) 2010 Laurent Montel <montel@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or modify it |
5 | under the terms of the GNU Library General Public License as published by |
6 | the Free Software Foundation; either version 2 of the License, or (at your |
7 | option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, but WITHOUT |
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
12 | License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to the |
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
17 | 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef CONFIGFILE_H |
21 | #define CONFIGFILE_H |
22 | |
23 | #include "setupobject.h" |
24 | |
25 | class KConfig; |
26 | |
27 | struct Config { |
28 | QString group; |
29 | QString key; |
30 | QString value; |
31 | bool obscure; |
32 | }; |
33 | |
34 | class ConfigFile : public SetupObject |
35 | { |
36 | Q_OBJECT |
37 | public: |
38 | explicit ConfigFile( const QString& configName, QObject *parent = 0 ); |
39 | ~ConfigFile(); |
40 | void create(); |
41 | void destroy(); |
42 | public slots: |
43 | Q_SCRIPTABLE void write(); |
44 | Q_SCRIPTABLE void setName( const QString & name ); |
45 | Q_SCRIPTABLE void setConfig( const QString &group, const QString &key, const QString &value ); |
46 | Q_SCRIPTABLE void setPassword( const QString &group, const QString &key, const QString &value ); |
47 | private: |
48 | QList<Config> m_configData; |
49 | QString m_name; |
50 | KConfig *m_config; |
51 | }; |
52 | |
53 | #endif |
54 | |