From b6df65ad2ffb50f029b96ebf9d0d78dfa23f3f19 Mon Sep 17 00:00:00 2001 From: zecke Date: Sat, 28 Sep 2002 20:07:52 +0000 Subject: Profiles, loading and saving completed --- (limited to 'noncore/apps/opie-console') diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp index cdf595e..c8f5eb0 100644 --- a/noncore/apps/opie-console/profile.cpp +++ b/noncore/apps/opie-console/profile.cpp @@ -33,6 +33,9 @@ Profile &Profile::operator=( const Profile& prof ) { } Profile::~Profile() { } +QMap Profile::conf()const { + return m_conf; +} QString Profile::name()const { return m_name; } @@ -104,3 +107,6 @@ int Profile::readNumEntry( const QString& key, int def )const { bool Profile::readBoolEntry( const QString& key, bool def )const { return readNumEntry( key, def ); } +void Profile::setConf( const QMap& conf ) { + m_conf = conf; +}; diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h index eff2be1..9956bdb 100644 --- a/noncore/apps/opie-console/profile.h +++ b/noncore/apps/opie-console/profile.h @@ -40,7 +40,7 @@ public: /* * config stuff */ - QMap conf(); + QMap conf()const; void clearConf(); void writeEntry( const QString& key, const QString& value ); void writeEntry( const QString& key, int num ); @@ -55,6 +55,7 @@ public: void setBackground( int back ); void setForeground( int fore ); void setTerminal( int term ); + void setConf( const QMap& ); private: QMap m_conf; QString m_name; diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index 54b184d..c8a4db5 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp @@ -22,9 +22,6 @@ void ProfileManager::load() { /* * for each profile */ - /* - * QAsciiDict Parsing FIXME - */ for ( it = groups.begin(); it != groups.end(); ++it ) { conf.setGroup( (*it) ); Profile prof; @@ -33,7 +30,9 @@ void ProfileManager::load() { prof.setBackground( conf.readNumEntry("back") ); prof.setForeground( conf.readNumEntry("fore") ); prof.setTerminal( conf.readNumEntry("terminal") ); + prof.setConf( conf.items( (*it) ) ); + /* now add it */ m_list.append( prof ); } @@ -52,7 +51,7 @@ Session* ProfileManager::fromProfile( const Profile& prof) { /* * FIXME * load emulation - * load widget + * load widget? * set colors + fonts */ return session; @@ -60,6 +59,20 @@ Session* ProfileManager::fromProfile( const Profile& prof) { void ProfileManager::save( ) { ProfileConfig conf("opie-console-profiles"); conf.clearAll(); - Session* se= 0l; + Profile::ValueList::Iterator it; + for (it = m_list.begin(); it != m_list.end(); ++it ) { + conf.setGroup( (*it).name() ); + conf.writeEntry( "name", (*it).name() ); + conf.writeEntry( "ioplayer", (*it).ioLayerName() ); + conf.writeEntry( "back", (*it).background() ); + conf.writeEntry( "fore", (*it).foreground() ); + conf.writeEntry( "terminal", (*it).terminal() ); + /* now the config stuff */ + QMap map = (*it).conf(); + QMap::Iterator it; + for ( it = map.begin(); it != map.end(); ++it ) { + conf.writeEntry( it.key(), it.data() ); + } + } // FIXME save } -- cgit v0.9.0.2