From 2b64a84d39eeed5681d0ee5068c7d11a01527750 Mon Sep 17 00:00:00 2001 From: alwin Date: Mon, 28 Feb 2005 09:40:30 +0000 Subject: other keymapping tool - not working this moment, I have to check it out - the reason is that the config file is somewhat easier to understand than from zkbapplet and has a nice config tool. Please don't put it into any repositories this moment. --- (limited to 'noncore/applets/keyhelper/keyhelperapplet/misc/ConfigEx.h') 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 @@ +#ifndef _CONFIG_EX_H_ +#define _CONFIG_EX_H_ + +#include +#include +#include +#include +#include + +#define QTOPIA_INTERNAL_LANGLIST +#include +#include + +#define CONFIG_MULTICODEC + +/* Singleton Object */ +class ConfigEx : public Config +{ +public: + static ConfigEx& getInstance(const QString& name){ + static ConfigEx cfg(name); + if(/*cfg.flush() ||*/cfg.m_lastRead < cfg.lastModified()){ + cfg.load(&cfg); + } + return(cfg); + } + +#if 0 + bool flush(){ + if(changed){ + write(); + return(true); + } else { + return(false); + } + } +#endif + + const QString& getGroup(){ + return(git.key()); + } + + void load(ConfigEx* cfg){ + cfg->read(); + cfg->decode(); + cfg->m_lastRead = QDateTime::currentDateTime(); + } + + void setConfig(const QString& name){ + if(name == QString::null){ + return; + } + /*flush();*/ + filename = configFilename(name, User); + load(this); + } + + void reload() { + /*flush();*/ + load(this); + } + + QStringList getKeys(); + QDateTime lastModified(); + QDateTime lastRead(){ + return(m_lastRead); + } + + friend class Dummy; /* for compie warning */ +private: + ConfigEx(const QString& name, Domain domain=User); + ConfigEx& operator=(const ConfigEx&); + virtual ~ConfigEx(){changed = false;} + + class Dummy{}; /* for compile warning */ + + + void read(); + void decode(); + //void removeComment(); + + QDateTime m_lastRead; +#ifdef CONFIG_MULTICODEC + QString m_charset; +#endif +}; + +#endif /* _CONFIG_EX_H_ */ + -- cgit v0.9.0.2