summaryrefslogtreecommitdiff
authorzecke <zecke>2002-09-28 19:45:01 (UTC)
committer zecke <zecke>2002-09-28 19:45:01 (UTC)
commitcb33923e1db6df3ead352f21c94b80a5785d70ca (patch) (side-by-side diff)
treeac7816a66fe94c3d9d51411b458ee14dc117ce09
parenta52cf21d13cc26844adbce20b24287563a559d14 (diff)
downloadopie-cb33923e1db6df3ead352f21c94b80a5785d70ca.zip
opie-cb33923e1db6df3ead352f21c94b80a5785d70ca.tar.gz
opie-cb33923e1db6df3ead352f21c94b80a5785d70ca.tar.bz2
make it possible in profileconfig
to iterate over the items in a group
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileconfig.cpp10
-rw-r--r--noncore/apps/opie-console/profileconfig.h4
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp5
3 files changed, 18 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/profileconfig.cpp b/noncore/apps/opie-console/profileconfig.cpp
index 8b16920..bd089c8 100644
--- a/noncore/apps/opie-console/profileconfig.cpp
+++ b/noncore/apps/opie-console/profileconfig.cpp
@@ -1,35 +1,45 @@
#include "profileconfig.h"
ProfileConfig::ProfileConfig( const QString& prof )
: Config( prof )
{
}
ProfileConfig::~ProfileConfig() {
}
QStringList ProfileConfig::groups()const {
QStringList list;
QMap<QString, ConfigGroup>::ConstIterator it;
it= Config::groups.begin();
for (; it != Config::groups.end(); ++it )
list << it.key();
return list;
}
void ProfileConfig::clearAll() {
QMap<QString, ConfigGroup>::ConstIterator it;
it = Config::groups.begin();
for ( ; it != Config::groups.end(); ++it )
clearGroup( it.key() );
}
void ProfileConfig::clearGroup( const QString& str ) {
QString cur =git.key();
setGroup( str );
Config::clearGroup();
setGroup( cur );
}
+QMap<QString, QString> ProfileConfig::items( const QString& group )const {
+ QMap<QString, QString> map;
+ QMap<QString, ConfigGroup>::ConstIterator it;
+ it = Config::groups.find( group );
+
+ if (it != Config::groups.end() )
+ map = it.data();
+
+ return map;
+}
diff --git a/noncore/apps/opie-console/profileconfig.h b/noncore/apps/opie-console/profileconfig.h
index e2e149c..f371ead 100644
--- a/noncore/apps/opie-console/profileconfig.h
+++ b/noncore/apps/opie-console/profileconfig.h
@@ -1,17 +1,21 @@
#ifndef OPIE_PROFILE_CONFIG_H
#define OPIE_PROFILE_CONFIG_H
#include <qpe/config.h>
#include <qstringlist.h>
class ProfileConfig : public Config {
public:
ProfileConfig( const QString& prof );
~ProfileConfig();
QStringList groups()const;
+ /**
+ * return the items in the group
+ */
+ QMap<QString, QString> items(const QString& group)const;
void clearGroup( const QString& );
void clearAll();
};
#endif
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index db36686..54b184d 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -1,62 +1,65 @@
#include <qpe/config.h>
#include "metafactory.h"
#include "profileconfig.h"
#include "profilemanager.h"
ProfileManager::ProfileManager( MetaFactory* fact )
: m_fact( fact )
{
}
ProfileManager::~ProfileManager() {
}
void ProfileManager::load() {
m_list.clear();
ProfileConfig conf("opie-console-profiles");
QStringList groups = conf.groups();
QStringList::Iterator it;
/*
* for each profile
*/
/*
* QAsciiDict Parsing FIXME
*/
for ( it = groups.begin(); it != groups.end(); ++it ) {
conf.setGroup( (*it) );
Profile prof;
prof.setName( conf.readEntry("name") );
prof.setIOLayer( conf.readEntry("iolayer") );
prof.setBackground( conf.readNumEntry("back") );
prof.setForeground( conf.readNumEntry("fore") );
prof.setTerminal( conf.readNumEntry("terminal") );
m_list.append( prof );
}
}
+void ProfileManager::clear() {
+ m_list.clear();
+}
Profile::ValueList ProfileManager::all()const {
return m_list;
}
Session* ProfileManager::fromProfile( const Profile& prof) {
Session* session = new Session();
session->setName( prof.name() );
session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(),
prof) );
/*
* FIXME
* load emulation
* load widget
* set colors + fonts
*/
return session;
}
void ProfileManager::save( ) {
- m_list.clear();
ProfileConfig conf("opie-console-profiles");
+ conf.clearAll();
Session* se= 0l;
// FIXME save
}