summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-14 15:57:59 (UTC)
committer zecke <zecke>2002-10-14 15:57:59 (UTC)
commitda3868438e739310862bf65b0d0c8ffa864392e8 (patch) (side-by-side diff)
tree16cdd38a4fc088d4483eeab8363e9a3b503d3f25
parent16caa7343f4190a31bd80a9caa76118d7177ad3f (diff)
downloadopie-da3868438e739310862bf65b0d0c8ffa864392e8.zip
opie-da3868438e739310862bf65b0d0c8ffa864392e8.tar.gz
opie-da3868438e739310862bf65b0d0c8ffa864392e8.tar.bz2
What does happen if you store the whole config
inside the conf map? yes on save custom data overwrites fixed data... As a workaround we now do save custom data first and then the fixed stuff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index c965700..4b88dec 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -29,32 +29,34 @@ void ProfileManager::load() {
QStringList::Iterator it;
/*
* for each profile
*/
for ( it = groups.begin(); it != groups.end(); ++it ) {
qWarning("group " + (*it) );
conf.setGroup( (*it) );
Profile prof;
prof.setName( conf.readEntry("name") );
prof.setIOLayer( conf.readEntry("iolayer").utf8() );
prof.setTerminalName( conf.readEntry("term").utf8() );
qWarning(" %s %s", conf.readEntry("iolayer").latin1(), prof.ioLayerName().data() );
prof.setBackground( conf.readNumEntry("back") );
prof.setForeground( conf.readNumEntry("fore") );
prof.setTerminal( conf.readNumEntry("terminal") );
+
+ // THIS is evil because all data get's reset
prof.setConf( conf.items( (*it) ) );
/* now add it */
m_list.append( prof );
}
}
void ProfileManager::clear() {
m_list.clear();
}
Profile::ValueList ProfileManager::all()const {
return m_list;
}
/*
* Our goal is to create a Session
* We will load the the IOLayer and EmulationLayer
@@ -81,47 +83,52 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
QHBoxLayout* lay = new QHBoxLayout(dummy );
stack->addWidget( dummy, 0 );
stack->raiseWidget( 0 );
WidgetLayer* wid = new EmulationWidget( prof, dummy );
lay->addWidget( wid );
session->setEmulationWidget( wid );
session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ),
wid ) );
session->connect();
return session;
}
void ProfileManager::save( ) {
QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) );
ProfileConfig conf("opie-console-profiles");
- 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( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) );
- conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) );
- conf.writeEntry( "back", (*it).background() );
- conf.writeEntry( "fore", (*it).foreground() );
- conf.writeEntry( "terminal", (*it).terminal() );
+ Profile::ValueList::Iterator it2;
+ for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
+ conf.setGroup( (*it2).name() );
+
/* now the config stuff */
- QMap<QString, QString> map = (*it).conf();
- QMap<QString, QString>::Iterator it;
- for ( it = map.begin(); it != map.end(); ++it ) {
- conf.writeEntry( it.key(), it.data() );
+ QMap<QString, QString> map = (*it2).conf();
+ QMap<QString, QString>::Iterator confIt;
+ for ( confIt = map.begin(); confIt != map.end(); ++confIt ) {
+ conf.writeEntry( confIt.key(), confIt.data() );
}
+
+ conf.writeEntry( "name", (*it2).name() );
+ QString str = QString::fromUtf8( (*it2).ioLayerName() );
+ qWarning("IOLayerName " + str );
+
+ conf.writeEntry( "iolayer", str );
+ conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) );
+ conf.writeEntry( "back", (*it2).background() );
+ conf.writeEntry( "fore", (*it2).foreground() );
+ conf.writeEntry( "terminal", (*it2).terminal() );
}
}
void ProfileManager::setProfiles( const Profile::ValueList& list ) {
m_list = list;
};
Profile ProfileManager::profile( const QString& name )const {
Profile prof;
Profile::ValueList::ConstIterator it;
for ( it = m_list.begin(); it != m_list.end(); ++it ) {
if ( name == (*it).name() ) {
prof = (*it);
break;
}
}
return prof;
}