summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console
Unidiff
Diffstat (limited to 'noncore/apps/opie-console') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp6
-rw-r--r--noncore/apps/opie-console/configdialog.cpp1
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp6
-rw-r--r--noncore/apps/opie-console/filereceive.cpp2
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp6
-rw-r--r--noncore/apps/opie-console/io_bt.cpp1
-rw-r--r--noncore/apps/opie-console/io_irda.cpp2
-rw-r--r--noncore/apps/opie-console/io_serial.cpp8
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp3
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp5
-rw-r--r--noncore/apps/opie-console/metafactory.cpp1
-rw-r--r--noncore/apps/opie-console/procctl.cpp1
-rw-r--r--noncore/apps/opie-console/profile.cpp2
-rw-r--r--noncore/apps/opie-console/profileconfig.cpp1
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp7
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp4
-rw-r--r--noncore/apps/opie-console/session.cpp1
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp1
18 files changed, 3 insertions, 55 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index ae01392..b6ae1d9 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -105,45 +105,43 @@ void MyPty::setSize(int lines, int columns)
105 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); 105 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
106} 106}
107 107
108 108
109void MyPty::donePty() 109void MyPty::donePty()
110{ 110{
111 // This is code from the Qt DumbTerminal example 111 // This is code from the Qt DumbTerminal example
112 int status = 0; 112 int status = 0;
113 113
114 ::close(m_fd); 114 ::close(m_fd);
115 115
116 if (m_cpid) { 116 if (m_cpid) {
117 qWarning("killing!!!");
118 kill(m_cpid, SIGHUP); 117 kill(m_cpid, SIGHUP);
119 //waitpid(m_cpid, &status, 0); 118 //waitpid(m_cpid, &status, 0);
120 delete m_sn_e; 119 delete m_sn_e;
121 m_sn_e = 0l; 120 m_sn_e = 0l;
122 } 121 }
123 122
124 m_cpid = 0; 123 m_cpid = 0;
125// emit done(status); 124// emit done(status);
126} 125}
127 126
128 127
129const char* MyPty::deviceName() 128const char* MyPty::deviceName()
130{ 129{
131 return m_ttynam; 130 return m_ttynam;
132} 131}
133 132
134 133
135void MyPty::error() 134void MyPty::error()
136{ 135{
137 qWarning("error");
138 // This is code from the Qt DumbTerminal example 136 // This is code from the Qt DumbTerminal example
139 donePty(); 137 donePty();
140} 138}
141 139
142void MyPty::start() { 140void MyPty::start() {
143 char* cmd = "/bin/sh"; 141 char* cmd = "/bin/sh";
144 QStrList lis; 142 QStrList lis;
145 int r =run(cmd, lis, 0, 0); 143 int r =run(cmd, lis, 0, 0);
146 r = r; 144 r = r;
147} 145}
148/*! 146/*!
149 start the client program. 147 start the client program.
@@ -259,48 +257,44 @@ bool MyPty::open() {
259 start(); 257 start();
260 return true; 258 return true;
261} 259}
262void MyPty::close() { 260void MyPty::close() {
263 donePty(); 261 donePty();
264} 262}
265void MyPty::reload( const Profile& ) { 263void MyPty::reload( const Profile& ) {
266 264
267} 265}
268/*! sends len bytes through the line */ 266/*! sends len bytes through the line */
269void MyPty::send(const QByteArray& ar) 267void MyPty::send(const QByteArray& ar)
270{ 268{
271 qWarning("sending!");
272#ifdef VERBOSE_DEBUG 269#ifdef VERBOSE_DEBUG
273 // verbose debug 270 // verbose debug
274 printf("sending bytes:\n"); 271 printf("sending bytes:\n");
275 for (uint i = 0; i < ar.count(); i++) 272 for (uint i = 0; i < ar.count(); i++)
276 printf("%c", ar[i]); 273 printf("%c", ar[i]);
277 printf("\n"); 274 printf("\n");
278#endif 275#endif
279 276
280 ::write(m_fd, ar.data(), ar.count()); 277 ::write(m_fd, ar.data(), ar.count());
281} 278}
282 279
283/*! indicates that a block of data is received */ 280/*! indicates that a block of data is received */
284void MyPty::readPty() 281void MyPty::readPty()
285{ 282{
286 qWarning("read");
287 QByteArray buf(4096); 283 QByteArray buf(4096);
288 284
289 int len = ::read( m_fd, buf.data(), 4096 ); 285 int len = ::read( m_fd, buf.data(), 4096 );
290 286
291 if (len == -1 || len == 0) { 287 if (len == -1 || len == 0) {
292 qWarning("donePty!!! now!");
293 donePty(); 288 donePty();
294 qWarning("return %s", sender()->className() );
295 delete sender(); 289 delete sender();
296 return; 290 return;
297 } 291 }
298 292
299 if (len < 0) 293 if (len < 0)
300 return; 294 return;
301 295
302 296
303 buf.resize(len); 297 buf.resize(len);
304 emit received(buf); 298 emit received(buf);
305 299
306#ifdef VERBOSE_DEBUG 300#ifdef VERBOSE_DEBUG
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp
index 8745305..0bc6588 100644
--- a/noncore/apps/opie-console/configdialog.cpp
+++ b/noncore/apps/opie-console/configdialog.cpp
@@ -83,25 +83,24 @@ void ConfigDialog::slotEdit() {
83 { 83 {
84 if(lstView->currentItem()) delete lstView->currentItem(); 84 if(lstView->currentItem()) delete lstView->currentItem();
85 85
86 // use dlg.terminal()! 86 // use dlg.terminal()!
87 Profile p = dlg.profile(); 87 Profile p = dlg.profile();
88 88
89 new ConfigListItem(lstView, p); 89 new ConfigListItem(lstView, p);
90 } 90 }
91} 91}
92 92
93 93
94void ConfigDialog::slotAdd() { 94void ConfigDialog::slotAdd() {
95 qWarning("slotAdd");
96 ProfileEditorDialog dlg(m_fact); 95 ProfileEditorDialog dlg(m_fact);
97 96
98 dlg.setCaption("New Connection"); 97 dlg.setCaption("New Connection");
99 dlg.showMaximized(); 98 dlg.showMaximized();
100 int ret = dlg.exec(); 99 int ret = dlg.exec();
101 100
102 if(ret == QDialog::Accepted) 101 if(ret == QDialog::Accepted)
103 { 102 {
104 // TODO: Move into general profile save part 103 // TODO: Move into general profile save part
105 // assignments 104 // assignments
106 //QString type = dlg.term_type(); 105 //QString type = dlg.term_type();
107 //if(type == "VT102") profile = Profile::VT102; 106 //if(type == "VT102") profile = Profile::VT102;
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 836a05b..b2cd348 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -28,29 +28,27 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c
28} 28}
29EmulationHandler::~EmulationHandler() { 29EmulationHandler::~EmulationHandler() {
30 delete m_teEmu; 30 delete m_teEmu;
31 delete m_teWid; 31 delete m_teWid;
32} 32}
33void EmulationHandler::load( const Profile& prof) { 33void EmulationHandler::load( const Profile& prof) {
34 m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); 34 m_teWid->setVTFont( font( prof.readNumEntry("Font") ) );
35 int num = prof.readNumEntry("Color"); 35 int num = prof.readNumEntry("Color");
36 setColor( foreColor(num), backColor(num) ); 36 setColor( foreColor(num), backColor(num) );
37 m_teWid->setBackgroundColor(backColor(num) ); 37 m_teWid->setBackgroundColor(backColor(num) );
38} 38}
39void EmulationHandler::recv( const QByteArray& ar) { 39void EmulationHandler::recv( const QByteArray& ar) {
40 qWarning("received in EmulationHandler!");
41 m_teEmu->onRcvBlock(ar.data(), ar.count() ); 40 m_teEmu->onRcvBlock(ar.data(), ar.count() );
42} 41}
43void EmulationHandler::recvEmulation(const char* src, int len ) { 42void EmulationHandler::recvEmulation(const char* src, int len ) {
44 qWarning("received from te ");
45 QByteArray ar(len); 43 QByteArray ar(len);
46 44
47 memcpy(ar.data(), src, sizeof(char) * len ); 45 memcpy(ar.data(), src, sizeof(char) * len );
48 46
49 emit send(ar); 47 emit send(ar);
50} 48}
51QWidget* EmulationHandler::widget() { 49QWidget* EmulationHandler::widget() {
52 return m_teWid; 50 return m_teWid;
53} 51}
54/* 52/*
55 * allocate a new table of colors 53 * allocate a new table of colors
56 */ 54 */
@@ -90,57 +88,53 @@ QFont EmulationHandler::font( int id ) {
90 break; 88 break;
91 } 89 }
92 QFont font(name, size, QFont::Normal ); 90 QFont font(name, size, QFont::Normal );
93 font.setFixedPitch(TRUE ); 91 font.setFixedPitch(TRUE );
94 return font; 92 return font;
95} 93}
96QColor EmulationHandler::foreColor(int col) { 94QColor EmulationHandler::foreColor(int col) {
97 QColor co; 95 QColor co;
98 /* we need to switch it */ 96 /* we need to switch it */
99 switch( col ) { 97 switch( col ) {
100 default: 98 default:
101 case Profile::White: 99 case Profile::White:
102 qWarning("Foreground black");
103 /* color is black */ 100 /* color is black */
104 co = Qt::white; 101 co = Qt::white;
105 break; 102 break;
106 case Profile::Black: 103 case Profile::Black:
107 qWarning("Foreground white");
108 co = Qt::black; 104 co = Qt::black;
109 break; 105 break;
110 case Profile::Green: 106 case Profile::Green:
111 qWarning("Foreground green"); 107 qWarning("Foreground green");
112 co = Qt::green; 108 co = Qt::green;
113 break; 109 break;
114 case Profile::Orange: 110 case Profile::Orange:
115 qWarning("Foreground orange"); 111 qWarning("Foreground orange");
116 // FIXME needs better color here 112 // FIXME needs better color here
117 co = Qt::darkYellow; 113 co = Qt::darkYellow;
118 break; 114 break;
119 } 115 }
120 116
121 return co; 117 return co;
122} 118}
123QColor EmulationHandler::backColor(int col ) { 119QColor EmulationHandler::backColor(int col ) {
124 QColor co; 120 QColor co;
125 /* we need to switch it */ 121 /* we need to switch it */
126 switch( col ) { 122 switch( col ) {
127 default: 123 default:
128 case Profile::White: 124 case Profile::White:
129 qWarning("Background white");
130 /* color is white */ 125 /* color is white */
131 co = Qt::black; 126 co = Qt::black;
132 break; 127 break;
133 case Profile::Black: 128 case Profile::Black:
134 qWarning("Background black");
135 co = Qt::white; 129 co = Qt::white;
136 break; 130 break;
137 case Profile::Green: 131 case Profile::Green:
138 qWarning("Background black"); 132 qWarning("Background black");
139 co = Qt::black; 133 co = Qt::black;
140 break; 134 break;
141 case Profile::Orange: 135 case Profile::Orange:
142 qWarning("Background black"); 136 qWarning("Background black");
143 co = Qt::black; 137 co = Qt::black;
144 break; 138 break;
145 } 139 }
146 140
diff --git a/noncore/apps/opie-console/filereceive.cpp b/noncore/apps/opie-console/filereceive.cpp
index 26b3dec..e517862 100644
--- a/noncore/apps/opie-console/filereceive.cpp
+++ b/noncore/apps/opie-console/filereceive.cpp
@@ -126,31 +126,29 @@ void FileReceive::setupChild() {
126 * now set the communication 126 * now set the communication
127 * m_fd STDIN_FILENO 127 * m_fd STDIN_FILENO
128 * STDOUT_FILENO 128 * STDOUT_FILENO
129 * STDERR_FILENO 129 * STDERR_FILENO
130 */ 130 */
131 dup2( m_fd, STDIN_FILENO ); 131 dup2( m_fd, STDIN_FILENO );
132 dup2( m_fd, STDOUT_FILENO ); 132 dup2( m_fd, STDOUT_FILENO );
133 dup2( m_comm[1], STDERR_FILENO ); 133 dup2( m_comm[1], STDERR_FILENO );
134} 134}
135void FileReceive::slotRead() { 135void FileReceive::slotRead() {
136 QByteArray ar(4096); 136 QByteArray ar(4096);
137 int len = read(m_comm[0], ar.data(), 4096 ); 137 int len = read(m_comm[0], ar.data(), 4096 );
138 qWarning("slot read %d", len);
139 for (int i = 0; i < len; i++ ) { 138 for (int i = 0; i < len; i++ ) {
140 // printf("%c", ar[i] ); 139 // printf("%c", ar[i] );
141 } 140 }
142 ar.resize( len ); 141 ar.resize( len );
143 QString str( ar ); 142 QString str( ar );
144 qWarning(str.simplifyWhiteSpace() );
145} 143}
146void FileReceive::slotExec() { 144void FileReceive::slotExec() {
147 char buf[2]; 145 char buf[2];
148 ::read(m_term[0], buf, 1 ); 146 ::read(m_term[0], buf, 1 );
149 delete m_proc; 147 delete m_proc;
150 delete m_not; 148 delete m_not;
151 m_not = m_proc = 0l; 149 m_not = m_proc = 0l;
152 close( m_term[0] ); 150 close( m_term[0] );
153 close( m_term[1] ); 151 close( m_term[1] );
154 close( m_comm[0] ); 152 close( m_comm[0] );
155 close( m_comm[1] ); 153 close( m_comm[1] );
156 layer()->closeRawIO(m_fd); 154 layer()->closeRawIO(m_fd);
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 8ca0df2..b81c2a2 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -44,25 +44,24 @@ void FileTransfer::sendFile( const QString& file ) {
44 if ( pipe( m_info ) < 0 ) 44 if ( pipe( m_info ) < 0 )
45 m_info[0] = m_info[1] = 0; 45 m_info[0] = m_info[1] = 0;
46 46
47 47
48 m_pid = fork(); 48 m_pid = fork();
49 switch( m_pid ) { 49 switch( m_pid ) {
50 case -1: 50 case -1:
51 emit error( StartError, tr("Was not able to fork") ); 51 emit error( StartError, tr("Was not able to fork") );
52 slotExec(); 52 slotExec();
53 break; 53 break;
54 case 0:{ 54 case 0:{
55 setupChild(); 55 setupChild();
56 qWarning("output:"+file );
57 /* exec */ 56 /* exec */
58 char* verbose = "-vv"; 57 char* verbose = "-vv";
59 char* binray = "-b"; 58 char* binray = "-b";
60 59
61 60
62 char* typus; 61 char* typus;
63 switch(m_type ) { 62 switch(m_type ) {
64 case SZ: 63 case SZ:
65 typus = ""; 64 typus = "";
66 break; 65 break;
67 case SX: 66 case SX:
68 typus = "-X"; 67 typus = "-X";
@@ -157,37 +156,34 @@ void FileTransfer::setupChild() {
157 dup2( m_fd, STDIN_FILENO ); 156 dup2( m_fd, STDIN_FILENO );
158 dup2( m_fd, STDOUT_FILENO ); 157 dup2( m_fd, STDOUT_FILENO );
159 dup2( m_comm[1], STDERR_FILENO ); 158 dup2( m_comm[1], STDERR_FILENO );
160} 159}
161 160
162/* 161/*
163 * read from the stderr of the child 162 * read from the stderr of the child
164 * process 163 * process
165 */ 164 */
166void FileTransfer::slotRead() { 165void FileTransfer::slotRead() {
167 QByteArray ar(4096); 166 QByteArray ar(4096);
168 int len = read(m_comm[0], ar.data(), 4096 ); 167 int len = read(m_comm[0], ar.data(), 4096 );
169 qWarning("slot read %d", len);
170 for (int i = 0; i < len; i++ ) { 168 for (int i = 0; i < len; i++ ) {
171 // printf("%c", ar[i] ); 169 // printf("%c", ar[i] );
172 } 170 }
173 ar.resize( len ); 171 ar.resize( len );
174 QString str( ar ); 172 QString str( ar );
175 qWarning(str.simplifyWhiteSpace() );
176 QStringList lis = QStringList::split(' ', str ); 173 QStringList lis = QStringList::split(' ', str );
177 /* 174 /*
178 * Transfer finished.. either complete or incomplete 175 * Transfer finished.. either complete or incomplete
179 */ 176 */
180 if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { 177 if ( lis[0].simplifyWhiteSpace() == "Transfer" ) {
181 qWarning("sent!!!!");
182 return; 178 return;
183 } 179 }
184 /* 180 /*
185 * do progress reading 181 * do progress reading
186 */ 182 */
187 slotProgress( lis ); 183 slotProgress( lis );
188 184
189 185
190} 186}
191/* 187/*
192 * find the progress 188 * find the progress
193 */ 189 */
@@ -205,25 +201,24 @@ void FileTransfer::slotProgress( const QStringList& list ) {
205 // Data looks like this 201 // Data looks like this
206 // 0 1 2 3 4 5 202 // 0 1 2 3 4 5
207 // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33 203 // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33
208 QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() ); 204 QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() );
209 sent = progi[0].toULong(&complete ); 205 sent = progi[0].toULong(&complete );
210 if (!complete ) return; 206 if (!complete ) return;
211 207
212 total = progi[1].toULong(&complete ); 208 total = progi[1].toULong(&complete );
213 if (!complete || total == 0) { 209 if (!complete || total == 0) {
214 return; 210 return;
215 } 211 }
216 212
217 qWarning("%s, %d, %d", progi.join("/").latin1(), sent, total );
218 213
219 double pro = (double)sent/total; 214 double pro = (double)sent/total;
220 int prog = pro * 100; 215 int prog = pro * 100;
221 216
222 // speed 217 // speed
223 progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); 218 progi = QStringList::split(':', list[3].simplifyWhiteSpace() );
224 bps = progi[1].toInt(); 219 bps = progi[1].toInt();
225 220
226 // time 221 // time
227 progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); 222 progi = QStringList::split(':', list[5].simplifyWhiteSpace() );
228 min = progi[0].toInt(); 223 min = progi[0].toInt();
229 sec = progi[1].toInt(); 224 sec = progi[1].toInt();
@@ -231,25 +226,24 @@ void FileTransfer::slotProgress( const QStringList& list ) {
231 226
232 if ( prog > m_prog ) { 227 if ( prog > m_prog ) {
233 m_prog = prog; 228 m_prog = prog;
234 emit progress(m_file, m_prog, bps, -1, min , sec ); 229 emit progress(m_file, m_prog, bps, -1, min , sec );
235 } 230 }
236 231
237} 232}
238void FileTransfer::cancel() { 233void FileTransfer::cancel() {
239 if(m_pid > 0) ::kill(m_pid,9 ); 234 if(m_pid > 0) ::kill(m_pid,9 );
240 235
241} 236}
242void FileTransfer::slotExec() { 237void FileTransfer::slotExec() {
243 qWarning("exited!");
244 char buf[2]; 238 char buf[2];
245 ::read(m_term[0], buf, 1 ); 239 ::read(m_term[0], buf, 1 );
246 delete m_proc; 240 delete m_proc;
247 delete m_not; 241 delete m_not;
248 m_proc = m_not = 0l; 242 m_proc = m_not = 0l;
249 close( m_term[0] ); 243 close( m_term[0] );
250 close( m_term[1] ); 244 close( m_term[1] );
251 close( m_comm[0] ); 245 close( m_comm[0] );
252 close( m_comm[1] ); 246 close( m_comm[1] );
253 layer()->closeRawIO( m_fd ); 247 layer()->closeRawIO( m_fd );
254 emit sent(); 248 emit sent();
255 m_pid = 0; 249 m_pid = 0;
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index 8bff4df..0831faf 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -27,24 +27,25 @@ bool IOBt::open() {
27 *m_attach << "hciattach /dev/ttyS2 any 57600"; 27 *m_attach << "hciattach /dev/ttyS2 any 57600";
28 28
29 // then start hcid, then rcfomm handling (m_mac) 29 // then start hcid, then rcfomm handling (m_mac)
30 30
31 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 31 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
32 this, SLOT( slotExited( OProcess* ) ) ); 32 this, SLOT( slotExited( OProcess* ) ) );
33 33
34 if ( m_attach->start() ) { 34 if ( m_attach->start() ) {
35 IOSerial::open(); 35 IOSerial::open();
36 } else { 36 } else {
37 qWarning("could not attach to device"); 37 qWarning("could not attach to device");
38 delete m_attach; 38 delete m_attach;
39 m_attach = 0;
39 } 40 }
40} 41}
41 42
42void IOBt::reload( const Profile &config ) { 43void IOBt::reload( const Profile &config ) {
43 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); 44 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
44 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); 45 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
45 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); 46 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
46 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); 47 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
47 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); 48 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
48 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); 49 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
49 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); 50 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
50} 51}
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp
index 8e31e82..56a373c 100644
--- a/noncore/apps/opie-console/io_irda.cpp
+++ b/noncore/apps/opie-console/io_irda.cpp
@@ -23,26 +23,28 @@ void IOIrda::close() {
23bool IOIrda::open() { 23bool IOIrda::open() {
24 24
25 // irdaattach here 25 // irdaattach here
26 m_attach = new OProcess(); 26 m_attach = new OProcess();
27 *m_attach << "irattach /dev/ttyS2 -s"; 27 *m_attach << "irattach /dev/ttyS2 -s";
28 28
29 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 29 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
30 this, SLOT( slotExited( OProcess* ) ) ); 30 this, SLOT( slotExited( OProcess* ) ) );
31 31
32 if ( m_attach->start() ) { 32 if ( m_attach->start() ) {
33 IOSerial::open(); 33 IOSerial::open();
34 } else { 34 } else {
35 // emit error!!!
35 qWarning("could not attach to device"); 36 qWarning("could not attach to device");
36 delete m_attach; 37 delete m_attach;
38 m_attach = 0l;
37 } 39 }
38} 40}
39 41
40void IOIrda::reload( const Profile &config ) { 42void IOIrda::reload( const Profile &config ) {
41 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); 43 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE);
42 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); 44 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD);
43 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); 45 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY);
44 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); 46 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS);
45 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); 47 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS);
46 m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); 48 m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW);
47} 49}
48 50
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index 03f1b1a..a4a6f0b 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -18,52 +18,47 @@ IOSerial::~IOSerial() {
18 } 18 }
19} 19}
20 20
21void IOSerial::send(const QByteArray &data) { 21void IOSerial::send(const QByteArray &data) {
22 if (m_fd) { 22 if (m_fd) {
23 write(m_fd, data.data(), data.size()); 23 write(m_fd, data.data(), data.size());
24 } else { 24 } else {
25 emit error(Refuse, tr("Not connected")); 25 emit error(Refuse, tr("Not connected"));
26 } 26 }
27} 27}
28 28
29void IOSerial::close() { 29void IOSerial::close() {
30 qWarning("closing!");
31 if (m_fd) { 30 if (m_fd) {
32 delete m_read; 31 delete m_read;
33 delete m_error; 32 delete m_error;
34 ::close(m_fd); 33 ::close(m_fd);
35 m_fd = 0; 34 m_fd = 0;
36 } else { 35 } else {
37 emit error(Refuse, tr("Not connected")); 36 emit error(Refuse, tr("Not connected"));
38 } 37 }
39} 38}
40 39
41bool IOSerial::open() { 40bool IOSerial::open() {
42 qWarning("open");
43 if (!m_fd) { 41 if (!m_fd) {
44 qWarning("going to open %s", m_device.latin1());
45 struct termios tty; 42 struct termios tty;
46 m_fd = ::open(m_device, O_RDWR | O_NOCTTY | O_NONBLOCK); 43 m_fd = ::open(m_device, O_RDWR | O_NOCTTY | O_NONBLOCK);
47 if (m_fd < 0) { 44 if (m_fd < 0) {
48 qWarning(" fd < 0 ");
49 emit error(CouldNotOpen, strerror(errno)); 45 emit error(CouldNotOpen, strerror(errno));
50 return FALSE; 46 return FALSE;
51 } 47 }
52 tcgetattr(m_fd, &tty); 48 tcgetattr(m_fd, &tty);
53 49
54 /* Baud rate */ 50 /* Baud rate */
55 int speed = baud(m_baud); 51 int speed = baud(m_baud);
56 if (speed == -1) { 52 if (speed == -1) {
57 qWarning("speed -1");
58 emit error(Refuse, tr("Invalid baud rate")); 53 emit error(Refuse, tr("Invalid baud rate"));
59 } 54 }
60 cfsetospeed(&tty, speed); 55 cfsetospeed(&tty, speed);
61 cfsetispeed(&tty, speed); 56 cfsetispeed(&tty, speed);
62 57
63 /* Take care of Space / Mark parity */ 58 /* Take care of Space / Mark parity */
64 if (m_dbits == 7 && (m_parity == ParitySpace || m_parity == ParityMark)) { 59 if (m_dbits == 7 && (m_parity == ParitySpace || m_parity == ParityMark)) {
65 m_dbits = 8; 60 m_dbits = 8;
66 } 61 }
67 62
68 /* Data bits */ 63 /* Data bits */
69 switch (m_dbits) { 64 switch (m_dbits) {
@@ -109,35 +104,32 @@ bool IOSerial::open() {
109 tty.c_cflag |= (PARENB | PARODD); 104 tty.c_cflag |= (PARENB | PARODD);
110 105
111 /* Set the changes */ 106 /* Set the changes */
112 tcsetattr(m_fd, TCSANOW, &tty); 107 tcsetattr(m_fd, TCSANOW, &tty);
113 108
114 /* Notifications on read & errors */ 109 /* Notifications on read & errors */
115 m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); 110 m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
116 m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this); 111 m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this);
117 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); 112 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
118 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); 113 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
119 return TRUE; 114 return TRUE;
120 } else { 115 } else {
121 qWarning(" already opened");
122 emit error(Refuse, tr("Device is already connected")); 116 emit error(Refuse, tr("Device is already connected"));
123 m_fd = 0; 117 m_fd = 0;
124 return FALSE; 118 return FALSE;
125 } 119 }
126} 120}
127 121
128void IOSerial::reload(const Profile &config) { 122void IOSerial::reload(const Profile &config) {
129 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); 123 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE);
130 qWarning( "Dev" +m_device );
131 qWarning( "Conf:" +config.readEntry("Device") );
132 m_baud = config.readNumEntry("Speed", SERIAL_DEFAULT_BAUD); 124 m_baud = config.readNumEntry("Speed", SERIAL_DEFAULT_BAUD);
133 m_parity = config.readNumEntry("Parity", SERIAL_DEFAULT_PARITY); 125 m_parity = config.readNumEntry("Parity", SERIAL_DEFAULT_PARITY);
134 m_dbits = config.readNumEntry("DataBits", SERIAL_DEFAULT_DBITS); 126 m_dbits = config.readNumEntry("DataBits", SERIAL_DEFAULT_DBITS);
135 m_sbits = config.readNumEntry("StopBits", SERIAL_DEFAULT_SBITS); 127 m_sbits = config.readNumEntry("StopBits", SERIAL_DEFAULT_SBITS);
136 m_flow = config.readNumEntry("Flow", SERIAL_DEFAULT_FLOW); 128 m_flow = config.readNumEntry("Flow", SERIAL_DEFAULT_FLOW);
137 129
138} 130}
139 131
140int IOSerial::baud(int baud) const { 132int IOSerial::baud(int baud) const {
141 switch (baud) { 133 switch (baud) {
142 case 300: return B300; break; 134 case 300: return B300; break;
143 case 600: return B600; break; 135 case 600: return B600; break;
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp
index 49ed284..b0df02d 100644
--- a/noncore/apps/opie-console/iolayerbase.cpp
+++ b/noncore/apps/opie-console/iolayerbase.cpp
@@ -120,31 +120,28 @@ void IOLayerBase::setSpeed( Speed sp ) {
120 break; 120 break;
121 case Baud_19200: 121 case Baud_19200:
122 index = id_baud_19200; 122 index = id_baud_19200;
123 break; 123 break;
124 case Baud_9600: 124 case Baud_9600:
125 index = id_baud_9600; 125 index = id_baud_9600;
126 break; 126 break;
127 } 127 }
128 m_speedBox->setCurrentItem(index ); 128 m_speedBox->setCurrentItem(index );
129} 129}
130IOLayerBase::Flow IOLayerBase::flow()const { 130IOLayerBase::Flow IOLayerBase::flow()const {
131 if (m_flowHw->isChecked() ) { 131 if (m_flowHw->isChecked() ) {
132 qWarning("Hardware flow");
133 return Hardware; 132 return Hardware;
134 }else if( m_flowSw->isChecked() ) { 133 }else if( m_flowSw->isChecked() ) {
135 qWarning("Software");
136 return Software; 134 return Software;
137 } else { 135 } else {
138 qWarning("None");
139 return None; 136 return None;
140 } 137 }
141} 138}
142IOLayerBase::Parity IOLayerBase::parity()const { 139IOLayerBase::Parity IOLayerBase::parity()const {
143 if ( m_parityOdd->isChecked() ) { 140 if ( m_parityOdd->isChecked() ) {
144 return Odd; 141 return Odd;
145 } else if ( m_parityEven->isChecked() ) { 142 } else if ( m_parityEven->isChecked() ) {
146 return Even; 143 return Even;
147 } else { 144 } else {
148 return NonePar; 145 return NonePar;
149 } 146 }
150 147
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index b770551..94c99bc 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -254,25 +254,24 @@ MetaFactory* MainWindow::factory() {
254 return m_factory; 254 return m_factory;
255} 255}
256 256
257Session* MainWindow::currentSession() { 257Session* MainWindow::currentSession() {
258 return m_curSession; 258 return m_curSession;
259} 259}
260 260
261QList<Session> MainWindow::sessions() { 261QList<Session> MainWindow::sessions() {
262 return m_sessions; 262 return m_sessions;
263} 263}
264 264
265void MainWindow::slotNew() { 265void MainWindow::slotNew() {
266 qWarning("New Connection");
267 ProfileEditorDialog dlg(factory() ); 266 ProfileEditorDialog dlg(factory() );
268 dlg.showMaximized(); 267 dlg.showMaximized();
269 int ret = dlg.exec(); 268 int ret = dlg.exec();
270 269
271 if ( ret == QDialog::Accepted ) { 270 if ( ret == QDialog::Accepted ) {
272 create( dlg.profile() ); 271 create( dlg.profile() );
273 } 272 }
274} 273}
275 274
276void MainWindow::slotRecordScript() { 275void MainWindow::slotRecordScript() {
277/* if (currentSession()) { 276/* if (currentSession()) {
278 currentSession()->emulationLayer()->startRecording(); 277 currentSession()->emulationLayer()->startRecording();
@@ -330,46 +329,43 @@ void MainWindow::slotDisconnect() {
330 } 329 }
331} 330}
332 331
333void MainWindow::slotTerminate() { 332void MainWindow::slotTerminate() {
334 if ( currentSession() ) 333 if ( currentSession() )
335 currentSession()->layer()->close(); 334 currentSession()->layer()->close();
336 335
337 slotClose(); 336 slotClose();
338 /* FIXME move to the next session */ 337 /* FIXME move to the next session */
339} 338}
340 339
341void MainWindow::slotConfigure() { 340void MainWindow::slotConfigure() {
342 qWarning("configure");
343 ConfigDialog conf( manager()->all(), factory() ); 341 ConfigDialog conf( manager()->all(), factory() );
344 conf.showMaximized(); 342 conf.showMaximized();
345 343
346 int ret = conf.exec(); 344 int ret = conf.exec();
347 345
348 if ( QDialog::Accepted == ret ) { 346 if ( QDialog::Accepted == ret ) {
349 qWarning("conf %d", conf.list().count() );
350 manager()->setProfiles( conf.list() ); 347 manager()->setProfiles( conf.list() );
351 manager()->save(); 348 manager()->save();
352 populateProfiles(); 349 populateProfiles();
353 } 350 }
354} 351}
355/* 352/*
356 * we will remove 353 * we will remove
357 * this window from the tabwidget 354 * this window from the tabwidget
358 * remove it from the list 355 * remove it from the list
359 * delete it 356 * delete it
360 * and set the currentSession() 357 * and set the currentSession()
361 */ 358 */
362void MainWindow::slotClose() { 359void MainWindow::slotClose() {
363 qWarning("close");
364 if (!currentSession() ) 360 if (!currentSession() )
365 return; 361 return;
366 362
367 tabWidget()->remove( currentSession() ); 363 tabWidget()->remove( currentSession() );
368 /*it's autodelete */ 364 /*it's autodelete */
369 m_sessions.remove( m_curSession ); 365 m_sessions.remove( m_curSession );
370 m_curSession = m_sessions.first(); 366 m_curSession = m_sessions.first();
371 tabWidget()->setCurrent( m_curSession ); 367 tabWidget()->setCurrent( m_curSession );
372 368
373 if (!currentSession() ) { 369 if (!currentSession() ) {
374 m_connect->setEnabled( false ); 370 m_connect->setEnabled( false );
375 m_disconnect->setEnabled( false ); 371 m_disconnect->setEnabled( false );
@@ -429,25 +425,24 @@ void MainWindow::slotTransfer()
429 } 425 }
430} 426}
431 427
432 428
433void MainWindow::slotOpenKeb(bool state) { 429void MainWindow::slotOpenKeb(bool state) {
434 430
435 if (state) m_keyBar->show(); 431 if (state) m_keyBar->show();
436 else m_keyBar->hide(); 432 else m_keyBar->hide();
437 433
438} 434}
439void MainWindow::slotSessionChanged( Session* ses ) { 435void MainWindow::slotSessionChanged( Session* ses ) {
440 if ( ses ) { 436 if ( ses ) {
441 qWarning("changing %s", ses->name().latin1() );
442 m_curSession = ses; 437 m_curSession = ses;
443 438
444 if ( m_curSession->isConnected() ) { 439 if ( m_curSession->isConnected() ) {
445 m_connect->setEnabled( false ); 440 m_connect->setEnabled( false );
446 m_disconnect->setEnabled( true ); 441 m_disconnect->setEnabled( true );
447 } else { 442 } else {
448 m_connect->setEnabled( true ); 443 m_connect->setEnabled( true );
449 m_disconnect->setEnabled( false ); 444 m_disconnect->setEnabled( false );
450 } 445 }
451 } 446 }
452} 447}
453 448
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index 09ba586..04a5dfa 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -111,25 +111,24 @@ ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWid
111 111
112 QMap<QString, configWidget>::Iterator it; 112 QMap<QString, configWidget>::Iterator it;
113 it = m_conFact.find( str ); 113 it = m_conFact.find( str );
114 if ( it != m_conFact.end() ) { 114 if ( it != m_conFact.end() ) {
115 wid = (*(it.data() ) )(str,parent); 115 wid = (*(it.data() ) )(str,parent);
116 } 116 }
117 return wid; 117 return wid;
118} 118}
119ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) { 119ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) {
120 if (str.isEmpty() ) 120 if (str.isEmpty() )
121 return 0l; 121 return 0l;
122 ProfileDialogWidget* wid = 0l; 122 ProfileDialogWidget* wid = 0l;
123 qWarning("new terminalPlugin %s %l", str.latin1(), parent );
124 123
125 QMap<QString, configWidget>::Iterator it; 124 QMap<QString, configWidget>::Iterator it;
126 it = m_termFact.find( str ); 125 it = m_termFact.find( str );
127 if ( it != m_termFact.end() ) { 126 if ( it != m_termFact.end() ) {
128 wid = (*(it.data() ) )(str,parent); 127 wid = (*(it.data() ) )(str,parent);
129 } 128 }
130 return wid; 129 return wid;
131} 130}
132EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) { 131EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) {
133 EmulationLayer* lay = 0l; 132 EmulationLayer* lay = 0l;
134 133
135 QMap<QString, emulationLayer>::Iterator it; 134 QMap<QString, emulationLayer>::Iterator it;
diff --git a/noncore/apps/opie-console/procctl.cpp b/noncore/apps/opie-console/procctl.cpp
index d1cfaf6..ff6bea8 100644
--- a/noncore/apps/opie-console/procctl.cpp
+++ b/noncore/apps/opie-console/procctl.cpp
@@ -62,25 +62,24 @@ void ProcCtl::remove( ProcContainer con ) {
62 remove( con.pid ); 62 remove( con.pid );
63} 63}
64int ProcCtl::status(pid_t pid )const{ 64int ProcCtl::status(pid_t pid )const{
65 ProcContainer *con = m_last; 65 ProcContainer *con = m_last;
66 while (con) { 66 while (con) {
67 if (con->pid == pid ) 67 if (con->pid == pid )
68 return con->status; 68 return con->status;
69 con = con->prev; 69 con = con->prev;
70 } 70 }
71 return -1; 71 return -1;
72} 72}
73void ProcCtl::signal_handler(int) { 73void ProcCtl::signal_handler(int) {
74 qWarning("signal handler in ProcCtl");
75 int status; 74 int status;
76 signal( SIGCHLD, signal_handler ); 75 signal( SIGCHLD, signal_handler );
77 pid_t pi = waitpid( -1, &status, WNOHANG ); 76 pid_t pi = waitpid( -1, &status, WNOHANG );
78 77
79 /* 78 /*
80 * find the container for pid 79 * find the container for pid
81 * 80 *
82 */ 81 */
83 if ( pi < 0 ) { 82 if ( pi < 0 ) {
84 return; 83 return;
85 } 84 }
86 85
diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp
index ffd672e..1a94619 100644
--- a/noncore/apps/opie-console/profile.cpp
+++ b/noncore/apps/opie-console/profile.cpp
@@ -69,29 +69,27 @@ void Profile::setBackground( int back ) {
69} 69}
70void Profile::setForeground( int fore ) { 70void Profile::setForeground( int fore ) {
71 m_fore = fore; 71 m_fore = fore;
72} 72}
73void Profile::setTerminal( int term ) { 73void Profile::setTerminal( int term ) {
74 m_terminal = term; 74 m_terminal = term;
75} 75}
76/* config stuff */ 76/* config stuff */
77void Profile::clearConf() { 77void Profile::clearConf() {
78 m_conf.clear(); 78 m_conf.clear();
79} 79}
80void Profile::writeEntry( const QString& key, const QString& value ) { 80void Profile::writeEntry( const QString& key, const QString& value ) {
81 qWarning("key %s value %s", key.latin1(), value.latin1() );
82 m_conf.replace( key, value ); 81 m_conf.replace( key, value );
83} 82}
84void Profile::writeEntry( const QString& key, int num ) { 83void Profile::writeEntry( const QString& key, int num ) {
85 qWarning("num");
86 writeEntry( key, QString::number( num ) ); 84 writeEntry( key, QString::number( num ) );
87} 85}
88void Profile::writeEntry( const QString& key, bool b ) { 86void Profile::writeEntry( const QString& key, bool b ) {
89 writeEntry( key, QString::number(b) ); 87 writeEntry( key, QString::number(b) );
90} 88}
91void Profile::writeEntry( const QString& key, const QStringList& lis, const QChar& sep ) { 89void Profile::writeEntry( const QString& key, const QStringList& lis, const QChar& sep ) {
92 writeEntry( key, lis.join(sep) ); 90 writeEntry( key, lis.join(sep) );
93} 91}
94QString Profile::readEntry( const QString& key, const QString& deflt )const { 92QString Profile::readEntry( const QString& key, const QString& deflt )const {
95 QMap<QString, QString>::ConstIterator it; 93 QMap<QString, QString>::ConstIterator it;
96 it = m_conf.find( key ); 94 it = m_conf.find( key );
97 95
diff --git a/noncore/apps/opie-console/profileconfig.cpp b/noncore/apps/opie-console/profileconfig.cpp
index 732fae7..bd089c8 100644
--- a/noncore/apps/opie-console/profileconfig.cpp
+++ b/noncore/apps/opie-console/profileconfig.cpp
@@ -3,25 +3,24 @@
3 3
4ProfileConfig::ProfileConfig( const QString& prof ) 4ProfileConfig::ProfileConfig( const QString& prof )
5 : Config( prof ) 5 : Config( prof )
6{ 6{
7} 7}
8ProfileConfig::~ProfileConfig() { 8ProfileConfig::~ProfileConfig() {
9 9
10} 10}
11QStringList ProfileConfig::groups()const { 11QStringList ProfileConfig::groups()const {
12 QStringList list; 12 QStringList list;
13 QMap<QString, ConfigGroup>::ConstIterator it; 13 QMap<QString, ConfigGroup>::ConstIterator it;
14 it= Config::groups.begin(); 14 it= Config::groups.begin();
15 qWarning("config %d", Config::groups.count() );
16 15
17 for (; it != Config::groups.end(); ++it ) 16 for (; it != Config::groups.end(); ++it )
18 list << it.key(); 17 list << it.key();
19 18
20 19
21 return list; 20 return list;
22 21
23} 22}
24void ProfileConfig::clearAll() { 23void ProfileConfig::clearAll() {
25 QMap<QString, ConfigGroup>::ConstIterator it; 24 QMap<QString, ConfigGroup>::ConstIterator it;
26 it = Config::groups.begin(); 25 it = Config::groups.begin();
27 26
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 094c871..b709cf3 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -106,28 +106,24 @@ void ProfileEditorDialog::initUI()
106 list = m_fact->terminalWidgets(); 106 list = m_fact->terminalWidgets();
107 for (it =list.begin(); it != list.end(); ++it ) { 107 for (it =list.begin(); it != list.end(); ++it ) {
108 m_termCmb->insertItem( (*it) ); 108 m_termCmb->insertItem( (*it) );
109 } 109 }
110 110
111 // load profile values 111 // load profile values
112 m_name->setText(m_prof.name()); 112 m_name->setText(m_prof.name());
113 slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); 113 slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
114 slotTermActivated( m_fact->external(m_prof.terminalName() ) ); 114 slotTermActivated( m_fact->external(m_prof.terminalName() ) );
115 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); 115 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
116 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); 116 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
117 117
118 qWarning("Layer: %s %s", m_prof.ioLayerName().data(),
119 m_fact->external(m_prof.ioLayerName() ).latin1() );
120 qWarning("Term: %s %s", m_prof.terminalName().data(),
121 m_fact->external(m_prof.terminalName() ).latin1() );
122 118
123 // signal and slots 119 // signal and slots
124 connect(m_conCmb, SIGNAL(activated(const QString& ) ), 120 connect(m_conCmb, SIGNAL(activated(const QString& ) ),
125 this, SLOT(slotConActivated(const QString&) ) ); 121 this, SLOT(slotConActivated(const QString&) ) );
126 connect(m_termCmb, SIGNAL(activated(const QString& ) ), 122 connect(m_termCmb, SIGNAL(activated(const QString& ) ),
127 this, SLOT(slotTermActivated(const QString& ) ) ); 123 this, SLOT(slotTermActivated(const QString& ) ) );
128 124
129} 125}
130 126
131ProfileEditorDialog::~ProfileEditorDialog() { 127ProfileEditorDialog::~ProfileEditorDialog() {
132 128
133} 129}
@@ -138,26 +134,24 @@ void ProfileEditorDialog::accept()
138 QMessageBox::information(this, 134 QMessageBox::information(this,
139 QObject::tr("Invalid profile"), 135 QObject::tr("Invalid profile"),
140 QObject::tr("Please enter a profile name.")); 136 QObject::tr("Please enter a profile name."));
141 return; 137 return;
142 } 138 }
143 // Save profile and plugin profile 139 // Save profile and plugin profile
144 //if(plugin_plugin) plugin_plugin->save(); 140 //if(plugin_plugin) plugin_plugin->save();
145 141
146 // Save general values 142 // Save general values
147 m_prof.setName(profName()); 143 m_prof.setName(profName());
148 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); 144 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
149 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); 145 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
150 qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(),
151 m_termCmb->currentText().latin1() );
152 146
153 if (m_con ) 147 if (m_con )
154 m_con->save( m_prof ); 148 m_con->save( m_prof );
155 if (m_term ) 149 if (m_term )
156 m_term->save( m_prof ); 150 m_term->save( m_prof );
157 151
158 QDialog::accept(); 152 QDialog::accept();
159} 153}
160 154
161 155
162QString ProfileEditorDialog::profName()const 156QString ProfileEditorDialog::profName()const
163{ 157{
@@ -181,20 +175,19 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) {
181 175
182 if (m_con ) { 176 if (m_con ) {
183 m_con->load( m_prof ); 177 m_con->load( m_prof );
184 m_layCon->addWidget( m_con ); 178 m_layCon->addWidget( m_con );
185 } 179 }
186} 180}
187/* 181/*
188 * we need to switch the widget 182 * we need to switch the widget
189 */ 183 */
190void ProfileEditorDialog::slotTermActivated( const QString& str ) { 184void ProfileEditorDialog::slotTermActivated( const QString& str ) {
191 delete m_term; 185 delete m_term;
192 m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); 186 m_term = m_fact->newTerminalPlugin( str, m_tabTerm );
193 qWarning("past");
194 187
195 if (m_term) { 188 if (m_term) {
196 m_term->load(m_prof ); 189 m_term->load(m_prof );
197 m_layTerm->addWidget( m_term ); 190 m_layTerm->addWidget( m_term );
198 } 191 }
199} 192}
200 193
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 95a46f9..e5aedb6 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -15,40 +15,37 @@
15#include "profilemanager.h" 15#include "profilemanager.h"
16 16
17ProfileManager::ProfileManager( MetaFactory* fact ) 17ProfileManager::ProfileManager( MetaFactory* fact )
18 : m_fact( fact ) 18 : m_fact( fact )
19{ 19{
20 20
21} 21}
22ProfileManager::~ProfileManager() { 22ProfileManager::~ProfileManager() {
23 23
24} 24}
25void ProfileManager::load() { 25void ProfileManager::load() {
26 m_list.clear(); 26 m_list.clear();
27 qWarning("load");
28 ProfileConfig conf("opie-console-profiles"); 27 ProfileConfig conf("opie-console-profiles");
29 QStringList groups = conf.groups(); 28 QStringList groups = conf.groups();
30 QStringList::Iterator it; 29 QStringList::Iterator it;
31 30
32 /* 31 /*
33 * for each profile 32 * for each profile
34 */ 33 */
35 for ( it = groups.begin(); it != groups.end(); ++it ) { 34 for ( it = groups.begin(); it != groups.end(); ++it ) {
36 qWarning("group " + (*it) );
37 conf.setGroup( (*it) ); 35 conf.setGroup( (*it) );
38 Profile prof; 36 Profile prof;
39 prof.setName( conf.readEntry("name") ); 37 prof.setName( conf.readEntry("name") );
40 prof.setIOLayer( conf.readEntry("iolayer").utf8() ); 38 prof.setIOLayer( conf.readEntry("iolayer").utf8() );
41 prof.setTerminalName( conf.readEntry("term").utf8() ); 39 prof.setTerminalName( conf.readEntry("term").utf8() );
42 qWarning(" %s %s", conf.readEntry("iolayer").latin1(), prof.ioLayerName().data() );
43 prof.setBackground( conf.readNumEntry("back") ); 40 prof.setBackground( conf.readNumEntry("back") );
44 prof.setForeground( conf.readNumEntry("fore") ); 41 prof.setForeground( conf.readNumEntry("fore") );
45 prof.setTerminal( conf.readNumEntry("terminal") ); 42 prof.setTerminal( conf.readNumEntry("terminal") );
46 43
47 // THIS is evil because all data get's reset 44 // THIS is evil because all data get's reset
48 prof.setConf( conf.items( (*it) ) ); 45 prof.setConf( conf.items( (*it) ) );
49 46
50 /* now add it */ 47 /* now add it */
51 m_list.append( prof ); 48 m_list.append( prof );
52 } 49 }
53 50
54} 51}
@@ -112,25 +109,24 @@ void ProfileManager::save( ) {
112 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { 109 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
113 conf.setGroup( (*it2).name() ); 110 conf.setGroup( (*it2).name() );
114 111
115 /* now the config stuff */ 112 /* now the config stuff */
116 QMap<QString, QString> map = (*it2).conf(); 113 QMap<QString, QString> map = (*it2).conf();
117 QMap<QString, QString>::Iterator confIt; 114 QMap<QString, QString>::Iterator confIt;
118 for ( confIt = map.begin(); confIt != map.end(); ++confIt ) { 115 for ( confIt = map.begin(); confIt != map.end(); ++confIt ) {
119 conf.writeEntry( confIt.key(), confIt.data() ); 116 conf.writeEntry( confIt.key(), confIt.data() );
120 } 117 }
121 118
122 conf.writeEntry( "name", (*it2).name() ); 119 conf.writeEntry( "name", (*it2).name() );
123 QString str = QString::fromUtf8( (*it2).ioLayerName() ); 120 QString str = QString::fromUtf8( (*it2).ioLayerName() );
124 qWarning("IOLayerName " + str );
125 121
126 conf.writeEntry( "iolayer", str ); 122 conf.writeEntry( "iolayer", str );
127 conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) ); 123 conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) );
128 conf.writeEntry( "back", (*it2).background() ); 124 conf.writeEntry( "back", (*it2).background() );
129 conf.writeEntry( "fore", (*it2).foreground() ); 125 conf.writeEntry( "fore", (*it2).foreground() );
130 conf.writeEntry( "terminal", (*it2).terminal() ); 126 conf.writeEntry( "terminal", (*it2).terminal() );
131 } 127 }
132} 128}
133void ProfileManager::setProfiles( const Profile::ValueList& list ) { 129void ProfileManager::setProfiles( const Profile::ValueList& list ) {
134 m_list = list; 130 m_list = list;
135}; 131};
136Profile ProfileManager::profile( const QString& name )const { 132Profile ProfileManager::profile( const QString& name )const {
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index d0ace6c..e53dbc4 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -38,25 +38,24 @@ EmulationHandler* Session::emulationHandler() {
38} 38}
39/* 39/*
40WidgetLayer* Session::emulationWidget() { 40WidgetLayer* Session::emulationWidget() {
41 return m_widLay; 41 return m_widLay;
42} 42}
43*/ 43*/
44void Session::connect() { 44void Session::connect() {
45 if ( !m_layer || !m_emu ) 45 if ( !m_layer || !m_emu )
46 return; 46 return;
47 47
48 m_connected = true; 48 m_connected = true;
49 49
50 qWarning("connection in session");
51 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), 50 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
52 m_emu, SLOT(recv(const QByteArray&) ) ); 51 m_emu, SLOT(recv(const QByteArray&) ) );
53 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), 52 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ),
54 m_layer, SLOT(send(const QByteArray&) ) ); 53 m_layer, SLOT(send(const QByteArray&) ) );
55} 54}
56 55
57void Session::disconnect() { 56void Session::disconnect() {
58 57
59 if ( !m_layer || !m_emu ) 58 if ( !m_layer || !m_emu )
60 return; 59 return;
61 60
62 m_connected = false; 61 m_connected = false;
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
index 466b536..8a691f9 100644
--- a/noncore/apps/opie-console/tabwidget.cpp
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -3,25 +3,24 @@
3 3
4TabWidget::TabWidget( QWidget* parent, const char* name ) 4TabWidget::TabWidget( QWidget* parent, const char* name )
5 : OTabWidget( parent, name ) { 5 : OTabWidget( parent, name ) {
6 connect(this, SIGNAL( currentChanged(QWidget*) ), 6 connect(this, SIGNAL( currentChanged(QWidget*) ),
7 this, SLOT( slotCurChanged(QWidget*) ) ); 7 this, SLOT( slotCurChanged(QWidget*) ) );
8} 8}
9 9
10TabWidget::~TabWidget() { 10TabWidget::~TabWidget() {
11} 11}
12 12
13void TabWidget::add( Session* ses ) { 13void TabWidget::add( Session* ses ) {
14 if ( !ses->widgetStack() ) return; 14 if ( !ses->widgetStack() ) return;
15 qWarning("going to add it");
16 //reparent( ses->widgetStack(), QPoint() ); 15 //reparent( ses->widgetStack(), QPoint() );
17 addTab( ses->widgetStack(), "console/konsole", ses->name() ); 16 addTab( ses->widgetStack(), "console/konsole", ses->name() );
18 //addTab( ses->widgetStack(), ses->name() ); 17 //addTab( ses->widgetStack(), ses->name() );
19 m_map.insert( ses->widgetStack(), ses ); 18 m_map.insert( ses->widgetStack(), ses );
20} 19}
21 20
22void TabWidget::remove( Session* ses ) { 21void TabWidget::remove( Session* ses ) {
23 m_map.remove( ses->widgetStack() ); 22 m_map.remove( ses->widgetStack() );
24 removePage( ses->widgetStack() ); 23 removePage( ses->widgetStack() );
25} 24}
26 25
27void TabWidget::slotCurChanged( QWidget* wid ) { 26void TabWidget::slotCurChanged( QWidget* wid ) {