summaryrefslogtreecommitdiff
path: root/noncore/applets/keyhelper/keyhelperapplet/misc/ConfigEx.h
Unidiff
Diffstat (limited to 'noncore/applets/keyhelper/keyhelperapplet/misc/ConfigEx.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/keyhelper/keyhelperapplet/misc/ConfigEx.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/noncore/applets/keyhelper/keyhelperapplet/misc/ConfigEx.h b/noncore/applets/keyhelper/keyhelperapplet/misc/ConfigEx.h
new file mode 100644
index 0000000..32120cc
--- a/dev/null
+++ b/noncore/applets/keyhelper/keyhelperapplet/misc/ConfigEx.h
@@ -0,0 +1,89 @@
1#ifndef _CONFIG_EX_H_
2#define _CONFIG_EX_H_
3
4#include <qstringlist.h>
5#include <qdatetime.h>
6#include <qfileinfo.h>
7#include <qtextstream.h>
8#include <qtextcodec.h>
9
10#define QTOPIA_INTERNAL_LANGLIST
11#include <qpe/config.h>
12#include <qpe/global.h>
13
14#define CONFIG_MULTICODEC
15
16/* Singleton Object */
17class ConfigEx : public Config
18{
19public:
20 static ConfigEx& getInstance(const QString& name){
21 static ConfigEx cfg(name);
22 if(/*cfg.flush() ||*/cfg.m_lastRead < cfg.lastModified()){
23 cfg.load(&cfg);
24 }
25 return(cfg);
26 }
27
28#if 0
29 bool flush(){
30 if(changed){
31 write();
32 return(true);
33 } else {
34 return(false);
35 }
36 }
37#endif
38
39 const QString& getGroup(){
40 return(git.key());
41 }
42
43 void load(ConfigEx* cfg){
44 cfg->read();
45 cfg->decode();
46 cfg->m_lastRead = QDateTime::currentDateTime();
47 }
48
49 void setConfig(const QString& name){
50 if(name == QString::null){
51 return;
52 }
53 /*flush();*/
54 filename = configFilename(name, User);
55 load(this);
56 }
57
58 void reload() {
59 /*flush();*/
60 load(this);
61 }
62
63 QStringList getKeys();
64 QDateTime lastModified();
65 QDateTime lastRead(){
66 return(m_lastRead);
67 }
68
69 friend class Dummy; /* for compie warning */
70private:
71 ConfigEx(const QString& name, Domain domain=User);
72 ConfigEx& operator=(const ConfigEx&);
73 virtual ~ConfigEx(){changed = false;}
74
75 class Dummy{}; /* for compile warning */
76
77
78 void read();
79 void decode();
80 //void removeComment();
81
82 QDateTime m_lastRead;
83#ifdef CONFIG_MULTICODEC
84 QString m_charset;
85#endif
86};
87
88#endif /* _CONFIG_EX_H_ */
89