summaryrefslogtreecommitdiff
path: root/library/config.h
authorsandman <sandman>2002-11-26 23:34:04 (UTC)
committer sandman <sandman>2002-11-26 23:34:04 (UTC)
commite52158d2f9e1fdc9766d991dc672729648d5a020 (patch) (unidiff)
tree2e87e8d9a24cdb336b2d7ca654a5ffa2f80c5f8c /library/config.h
parentac4f32931212847803534a72eb5e951bd01e6ff5 (diff)
downloadopie-e52158d2f9e1fdc9766d991dc672729648d5a020.zip
opie-e52158d2f9e1fdc9766d991dc672729648d5a020.tar.gz
opie-e52158d2f9e1fdc9766d991dc672729648d5a020.tar.bz2
Sharp ROM compatibilty upgrade:
All these functions are needed to get qtmail (from the Sharp ROM) running on Opie - I have even tested qtmail on an iPAQ and it seems to work ..
Diffstat (limited to 'library/config.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/config.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/config.h b/library/config.h
index 1dc32fa..0bab7ca 100644
--- a/library/config.h
+++ b/library/config.h
@@ -1,102 +1,105 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef CONFIG_H 21#ifndef CONFIG_H
22#define CONFIG_H 22#define CONFIG_H
23 23
24// ##### could use QSettings with Qt 3.0 24// ##### could use QSettings with Qt 3.0
25 25
26#include <qmap.h> 26#include <qmap.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28 28
29class ConfigPrivate; 29class ConfigPrivate;
30class Config 30class Config
31{ 31{
32public: 32public:
33 typedef QMap< QString, QString > ConfigGroup; 33 typedef QMap< QString, QString > ConfigGroup;
34 34
35 enum Domain { File, User }; 35 enum Domain { File, User };
36 Config( const QString &name, Domain domain=User ); 36 Config( const QString &name, Domain domain=User );
37 ~Config(); 37 ~Config();
38 38
39 bool operator == ( const Config & other ) const { return (filename == other.filename); } 39 bool operator == ( const Config & other ) const { return (filename == other.filename); }
40 bool operator != ( const Config & other ) const { return (filename != other.filename); } 40 bool operator != ( const Config & other ) const { return (filename != other.filename); }
41 41
42 bool isValid() const; 42 bool isValid() const;
43 bool hasKey( const QString &key ) const; 43 bool hasKey( const QString &key ) const;
44 44
45 void setGroup( const QString &gname ); 45 void setGroup( const QString &gname );
46 void writeEntry( const QString &key, const char* value ); 46 void writeEntry( const QString &key, const char* value );
47 void writeEntry( const QString &key, const QString &value ); 47 void writeEntry( const QString &key, const QString &value );
48 void writeEntryCrypt( const QString &key, const QString &value ); 48 void writeEntryCrypt( const QString &key, const QString &value );
49 void writeEntry( const QString &key, int num ); 49 void writeEntry( const QString &key, int num );
50#ifdef Q_HAS_BOOL_TYPE 50#ifdef Q_HAS_BOOL_TYPE
51 void writeEntry( const QString &key, bool b ); 51 void writeEntry( const QString &key, bool b );
52#endif 52#endif
53 void writeEntry( const QString &key, const QStringList &lst, const QChar &sep ); 53 void writeEntry( const QString &key, const QStringList &lst, const QChar &sep );
54 void removeEntry( const QString &key ); 54 void removeEntry( const QString &key );
55 55
56 QString readEntry( const QString &key, const QString &deflt = QString::null ) const; 56 QString readEntry( const QString &key, const QString &deflt = QString::null ) const;
57 QString readEntryCrypt( const QString &key, const QString &deflt = QString::null ) const; 57 QString readEntryCrypt( const QString &key, const QString &deflt = QString::null ) const;
58 QString readEntryDirect( const QString &key, const QString &deflt = QString::null ) const; 58 QString readEntryDirect( const QString &key, const QString &deflt = QString::null ) const;
59 int readNumEntry( const QString &key, int deflt = -1 ) const; 59 int readNumEntry( const QString &key, int deflt = -1 ) const;
60 bool readBoolEntry( const QString &key, bool deflt = FALSE ) const; 60 bool readBoolEntry( const QString &key, bool deflt = FALSE ) const;
61 QStringList readListEntry( const QString &key, const QChar &sep ) const; 61 QStringList readListEntry( const QString &key, const QChar &sep ) const;
62 62
63 // For compatibility, non-const versions. 63 // For compatibility, non-const versions.
64 QString readEntry( const QString &key, const QString &deflt ); 64 QString readEntry( const QString &key, const QString &deflt );
65 QString readEntryCrypt( const QString &key, const QString &deflt ); 65 QString readEntryCrypt( const QString &key, const QString &deflt );
66 QString readEntryDirect( const QString &key, const QString &deflt ); 66 QString readEntryDirect( const QString &key, const QString &deflt );
67 int readNumEntry( const QString &key, int deflt ); 67 int readNumEntry( const QString &key, int deflt );
68 bool readBoolEntry( const QString &key, bool deflt ); 68 bool readBoolEntry( const QString &key, bool deflt );
69 QStringList readListEntry( const QString &key, const QChar &sep ); 69 QStringList readListEntry( const QString &key, const QChar &sep );
70 70
71 void clearGroup(); 71 void clearGroup();
72 72
73 void write( const QString &fn = QString::null ); 73 void write( const QString &fn = QString::null );
74 74
75protected: 75protected:
76 void read(); 76 void read();
77 bool parse( const QString &line ); 77 bool parse( const QString &line );
78 78
79 QMap< QString, ConfigGroup > groups; 79 QMap< QString, ConfigGroup > groups;
80 QMap< QString, ConfigGroup >::Iterator git; 80 QMap< QString, ConfigGroup >::Iterator git;
81 QString filename; 81 QString filename;
82 QString lang; 82 QString lang;
83 QString glang; 83 QString glang;
84 bool changed; 84 bool changed;
85 ConfigPrivate *d; 85 ConfigPrivate *d;
86 static QString configFilename(const QString& name, Domain); 86 static QString configFilename(const QString& name, Domain);
87
88private: // Sharp ROM compatibility
89 Config( const QString &name, bool what );
87}; 90};
88 91
89inline QString Config::readEntry( const QString &key, const QString &deflt ) const 92inline QString Config::readEntry( const QString &key, const QString &deflt ) const
90{ return ((Config*)this)->readEntry(key,deflt); } 93{ return ((Config*)this)->readEntry(key,deflt); }
91inline QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const 94inline QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const
92{ return ((Config*)this)->readEntryCrypt(key,deflt); } 95{ return ((Config*)this)->readEntryCrypt(key,deflt); }
93inline QString Config::readEntryDirect( const QString &key, const QString &deflt ) const 96inline QString Config::readEntryDirect( const QString &key, const QString &deflt ) const
94{ return ((Config*)this)->readEntryDirect(key,deflt); } 97{ return ((Config*)this)->readEntryDirect(key,deflt); }
95inline int Config::readNumEntry( const QString &key, int deflt ) const 98inline int Config::readNumEntry( const QString &key, int deflt ) const
96{ return ((Config*)this)->readNumEntry(key,deflt); } 99{ return ((Config*)this)->readNumEntry(key,deflt); }
97inline bool Config::readBoolEntry( const QString &key, bool deflt ) const 100inline bool Config::readBoolEntry( const QString &key, bool deflt ) const
98{ return ((Config*)this)->readBoolEntry(key,deflt); } 101{ return ((Config*)this)->readBoolEntry(key,deflt); }
99inline QStringList Config::readListEntry( const QString &key, const QChar &sep ) const 102inline QStringList Config::readListEntry( const QString &key, const QChar &sep ) const
100{ return ((Config*)this)->readListEntry(key,sep); } 103{ return ((Config*)this)->readListEntry(key,sep); }
101 104
102#endif 105#endif