Diffstat (limited to 'noncore/apps/opie-console/profilemanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 4 |
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 | |||
@@ -72,66 +72,70 @@ Profile::ValueList ProfileManager::all()const { | |||
72 | */ | 72 | */ |
73 | Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { | 73 | Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { |
74 | /* TEST PROFILE!!! | 74 | /* TEST PROFILE!!! |
75 | Profile prof; | 75 | Profile prof; |
76 | QString str = "/dev/ttyS0"; | 76 | QString str = "/dev/ttyS0"; |
77 | prof.writeEntry("Device",str ); | 77 | prof.writeEntry("Device",str ); |
78 | prof.writeEntry("Baud", 115200 ); | 78 | prof.writeEntry("Baud", 115200 ); |
79 | prof.setIOLayer("serial"); | 79 | prof.setIOLayer("serial"); |
80 | prof.setName( "test"); | 80 | prof.setName( "test"); |
81 | */ | 81 | */ |
82 | Session* session = new Session(); | 82 | Session* session = new Session(); |
83 | session->setName( prof.name() ); | 83 | session->setName( prof.name() ); |
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 | } |
99 | void ProfileManager::save( ) { | 100 | void 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(); |
108 | QMap<QString, QString>::Iterator confIt; | 109 | QMap<QString, QString>::Iterator confIt; |
109 | for ( confIt = map.begin(); confIt != map.end(); ++confIt ) { | 110 | for ( confIt = map.begin(); confIt != map.end(); ++confIt ) { |
110 | conf.writeEntry( confIt.key(), confIt.data() ); | 111 | conf.writeEntry( confIt.key(), confIt.data() ); |
111 | } | 112 | } |
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 | } |
125 | void ProfileManager::add( const Profile& prof) { | ||
126 | m_list.append( prof ); | ||
127 | } | ||
124 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { | 128 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { |
125 | m_list = list; | 129 | m_list = list; |
126 | }; | 130 | }; |
127 | Profile ProfileManager::profile( const QString& name )const { | 131 | Profile 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 | } |
136 | return prof; | 140 | return prof; |
137 | } | 141 | } |