summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/profilemanager.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/profilemanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 5d39d96..cad2567 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -84,24 +84,25 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
84 /* translate the internal name to the external */ 84 /* translate the internal name to the external */
85 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) , 85 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) ,
86 prof) ); 86 prof) );
87 87
88 QWidgetStack *stack = new QWidgetStack( parent ); 88 QWidgetStack *stack = new QWidgetStack( parent );
89 session->setWidgetStack( stack ); 89 session->setWidgetStack( stack );
90 QWidget* dummy = new QHBox( stack ); 90 QWidget* dummy = new QHBox( stack );
91 stack->raiseWidget( dummy ); 91 stack->raiseWidget( dummy );
92 92
93 EmulationHandler* handler = new EmulationHandler(prof,dummy ); 93 EmulationHandler* handler = new EmulationHandler(prof,dummy );
94 session->setEmulationHandler( handler ); 94 session->setEmulationHandler( handler );
95 session->connect(); 95 session->connect();
96 session->setProfile( prof );
96 97
97 return session; 98 return session;
98} 99}
99void ProfileManager::save( ) { 100void ProfileManager::save( ) {
100 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); 101 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) );
101 ProfileConfig conf("opie-console-profiles"); 102 ProfileConfig conf("opie-console-profiles");
102 Profile::ValueList::Iterator it2; 103 Profile::ValueList::Iterator it2;
103 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { 104 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
104 conf.setGroup( (*it2).name() ); 105 conf.setGroup( (*it2).name() );
105 106
106 /* now the config stuff */ 107 /* now the config stuff */
107 QMap<QString, QString> map = (*it2).conf(); 108 QMap<QString, QString> map = (*it2).conf();
@@ -112,24 +113,27 @@ void ProfileManager::save( ) {
112 113
113 conf.writeEntry( "name", (*it2).name() ); 114 conf.writeEntry( "name", (*it2).name() );
114 QString str = QString::fromUtf8( (*it2).ioLayerName() ); 115 QString str = QString::fromUtf8( (*it2).ioLayerName() );
115 116
116 conf.writeEntry( "iolayer", str ); 117 conf.writeEntry( "iolayer", str );
117 conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) ); 118 conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) );
118 conf.writeEntry( "autoConnect", (*it2).autoConnect()); 119 conf.writeEntry( "autoConnect", (*it2).autoConnect());
119 conf.writeEntry( "back", (*it2).background() ); 120 conf.writeEntry( "back", (*it2).background() );
120 conf.writeEntry( "fore", (*it2).foreground() ); 121 conf.writeEntry( "fore", (*it2).foreground() );
121 conf.writeEntry( "terminal", (*it2).terminal() ); 122 conf.writeEntry( "terminal", (*it2).terminal() );
122 } 123 }
123} 124}
125void ProfileManager::add( const Profile& prof) {
126 m_list.append( prof );
127}
124void ProfileManager::setProfiles( const Profile::ValueList& list ) { 128void ProfileManager::setProfiles( const Profile::ValueList& list ) {
125 m_list = list; 129 m_list = list;
126}; 130};
127Profile ProfileManager::profile( const QString& name )const { 131Profile ProfileManager::profile( const QString& name )const {
128 Profile prof; 132 Profile prof;
129 Profile::ValueList::ConstIterator it; 133 Profile::ValueList::ConstIterator it;
130 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 134 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
131 if ( name == (*it).name() ) { 135 if ( name == (*it).name() ) {
132 prof = (*it); 136 prof = (*it);
133 break; 137 break;
134 } 138 }
135 } 139 }