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/BUGS9
-rw-r--r--noncore/apps/opie-console/MyPty.cpp23
-rw-r--r--noncore/apps/opie-console/MyPty.h2
-rw-r--r--noncore/apps/opie-console/io_layer.h14
-rw-r--r--noncore/apps/opie-console/io_serial.cpp7
-rw-r--r--noncore/apps/opie-console/io_serial.h4
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp10
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp15
-rw-r--r--noncore/apps/opie-console/session.cpp6
-rw-r--r--noncore/apps/opie-console/session.h1
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp1
11 files changed, 72 insertions, 20 deletions
diff --git a/noncore/apps/opie-console/BUGS b/noncore/apps/opie-console/BUGS
new file mode 100644
index 0000000..ffaceef
--- a/dev/null
+++ b/noncore/apps/opie-console/BUGS
@@ -0,0 +1,9 @@
1Ok we all know we write perfect code
2but sometimes the compiler produces bad code
3and we need to work around some compiler bugs!! -zecke
4
5MyPty is broken in some ways
6 if you do connect/disconnect/connect sh will be executed in the
7 process of opie-console.... funny aye?
8
9OTabWidget seems to give us problems too
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index b6ae1d9..565d03f 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -108,28 +108,31 @@ void MyPty::setSize(int lines, int columns)
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 kill(m_cpid, SIGHUP); 117 kill(m_cpid, SIGHUP);
118 //waitpid(m_cpid, &status, 0); 118 //waitpid(m_cpid, &status, 0);
119 delete m_sn_e; 119 delete m_sn_e;
120 delete m_sn_r;
120 m_sn_e = 0l; 121 m_sn_e = 0l;
122 m_sn_r = 0l;
121 } 123 }
122 124
123 m_cpid = 0; 125 m_cpid = 0;
126 m_fd = -1;
124// emit done(status); 127// emit done(status);
125} 128}
126 129
127 130
128const char* MyPty::deviceName() 131const char* MyPty::deviceName()
129{ 132{
130 return m_ttynam; 133 return m_ttynam;
131} 134}
132 135
133 136
134void MyPty::error() 137void MyPty::error()
135{ 138{
@@ -176,28 +179,29 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int)
176 179
177 if (getuid() == 0) { 180 if (getuid() == 0) {
178 char msg[] = "WARNING: You are running this shell as root!\n"; 181 char msg[] = "WARNING: You are running this shell as root!\n";
179 write(ttyfd, msg, sizeof(msg)); 182 write(ttyfd, msg, sizeof(msg));
180 } 183 }
181 execl(cmd, cmd, 0); 184 execl(cmd, cmd, 0);
182 185
183 donePty(); 186 donePty();
184 exit(-1); 187 exit(-1);
185 } 188 }
186 189
187 // parent - continue as a widget 190 // parent - continue as a widget
188 QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); 191 delete m_sn_r;
192 m_sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this);
189 delete m_sn_e; 193 delete m_sn_e;
190 m_sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); 194 m_sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this);
191 connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); 195 connect(m_sn_r,SIGNAL(activated(int)),this,SLOT(readPty()));
192 connect(m_sn_e,SIGNAL(activated(int)),this,SLOT(error())); 196 connect(m_sn_e,SIGNAL(activated(int)),this,SLOT(error()));
193 197
194 return 0; 198 return 0;
195} 199}
196 200
197int MyPty::openPty() 201int MyPty::openPty()
198{ 202{
199 // This is code from the Qt DumbTerminal example 203 // This is code from the Qt DumbTerminal example
200 int ptyfd = -1; 204 int ptyfd = -1;
201 205
202#ifdef HAVE_OPENPTY 206#ifdef HAVE_OPENPTY
203 int ttyfd; 207 int ttyfd;
@@ -212,62 +216,67 @@ int MyPty::openPty()
212 sprintf(m_ttynam,"/dev/tty%c%c",*c0,*c1); 216 sprintf(m_ttynam,"/dev/tty%c%c",*c0,*c1);
213 if ((ptyfd = ::open(m_ptynam,O_RDWR)) >= 0) { 217 if ((ptyfd = ::open(m_ptynam,O_RDWR)) >= 0) {
214 if (geteuid() != 0 && !access(m_ttynam,R_OK|W_OK) == 0) { 218 if (geteuid() != 0 && !access(m_ttynam,R_OK|W_OK) == 0) {
215 ::close(ptyfd); 219 ::close(ptyfd);
216 ptyfd = -1; 220 ptyfd = -1;
217 } 221 }
218 } 222 }
219 } 223 }
220 } 224 }
221#endif 225#endif
222 226
223 if ( ptyfd < 0 ) { 227 if ( ptyfd < 0 ) {
224 qApp->exit(1); 228 //qApp->exit(1);
225 return -1; 229 return -1;
226 } 230 }
227 231
228 return ptyfd; 232 return ptyfd;
229} 233}
230 234
231/*! 235/*!
232 Create an instance. 236 Create an instance.
233*/ 237*/
234MyPty::MyPty(const Profile&) : m_cpid(0) 238MyPty::MyPty(const Profile&) : m_cpid(0)
235{ 239{
236 m_sn_e = 0l; 240 m_sn_e = 0l;
241 m_sn_r = 0l;
237 m_fd = openPty(); 242 m_fd = openPty();
238 ProcCtl* ctl = ProcCtl::self(); 243 ProcCtl* ctl = ProcCtl::self();
239} 244}
240 245
241/*! 246/*!
242 Destructor. 247 Destructor.
243 Note that the related client program is not killed 248 Note that the related client program is not killed
244 (yet) when a instance is deleted. 249 (yet) when a instance is deleted.
245*/ 250*/
246MyPty::~MyPty() 251MyPty::~MyPty()
247{ 252{
248 donePty(); 253 donePty();
249} 254}
250QString MyPty::identifier()const { 255QString MyPty::identifier()const {
251 return QString::fromLatin1("term"); 256 return QString::fromLatin1("term");
252} 257}
253QString MyPty::name()const{ 258QString MyPty::name()const{
254 return identifier(); 259 return identifier();
255} 260}
256bool MyPty::open() { 261bool MyPty::open() {
262 if (m_fd < 0)
263 m_fd = openPty();
264
257 start(); 265 start();
258 return true; 266 return true;
259} 267}
260void MyPty::close() { 268void MyPty::close() {
261 donePty(); 269 donePty();
270 m_fd = openPty();
262} 271}
263void MyPty::reload( const Profile& ) { 272void MyPty::reload( const Profile& ) {
264 273
265} 274}
266/*! sends len bytes through the line */ 275/*! sends len bytes through the line */
267void MyPty::send(const QByteArray& ar) 276void MyPty::send(const QByteArray& ar)
268{ 277{
269#ifdef VERBOSE_DEBUG 278#ifdef VERBOSE_DEBUG
270 // verbose debug 279 // verbose debug
271 printf("sending bytes:\n"); 280 printf("sending bytes:\n");
272 for (uint i = 0; i < ar.count(); i++) 281 for (uint i = 0; i < ar.count(); i++)
273 printf("%c", ar[i]); 282 printf("%c", ar[i]);
@@ -277,33 +286,39 @@ void MyPty::send(const QByteArray& ar)
277 ::write(m_fd, ar.data(), ar.count()); 286 ::write(m_fd, ar.data(), ar.count());
278} 287}
279 288
280/*! indicates that a block of data is received */ 289/*! indicates that a block of data is received */
281void MyPty::readPty() 290void MyPty::readPty()
282{ 291{
283 QByteArray buf(4096); 292 QByteArray buf(4096);
284 293
285 int len = ::read( m_fd, buf.data(), 4096 ); 294 int len = ::read( m_fd, buf.data(), 4096 );
286 295
287 if (len == -1 || len == 0) { 296 if (len == -1 || len == 0) {
288 donePty(); 297 donePty();
289 delete sender();
290 return; 298 return;
291 } 299 }
292 300
293 if (len < 0) 301 if (len < 0)
294 return; 302 return;
295 303
296 304
297 buf.resize(len); 305 buf.resize(len);
298 emit received(buf); 306 emit received(buf);
299 307
300#ifdef VERBOSE_DEBUG 308#ifdef VERBOSE_DEBUG
301 // verbose debug 309 // verbose debug
302 printf("read bytes:\n"); 310 printf("read bytes:\n");
303 for (uint i = 0; i < buf.count(); i++) 311 for (uint i = 0; i < buf.count(); i++)
304 printf("%c", buf[i]); 312 printf("%c", buf[i]);
305 printf("\n"); 313 printf("\n");
306#endif 314#endif
307 315
308} 316}
317QBitArray MyPty::supports()const {
318 QBitArray ar(3);
319 ar[0] = 1;
320 ar[1] = 0;
321 ar[2] = 0;
309 322
323 return ar;
324}
diff --git a/noncore/apps/opie-console/MyPty.h b/noncore/apps/opie-console/MyPty.h
index 3166fa0..ad271df 100644
--- a/noncore/apps/opie-console/MyPty.h
+++ b/noncore/apps/opie-console/MyPty.h
@@ -32,24 +32,25 @@ class QSocketNotifier;
32class MyPty : public IOLayer 32class MyPty : public IOLayer
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 36
37 MyPty(const Profile&); 37 MyPty(const Profile&);
38 ~MyPty(); 38 ~MyPty();
39 39
40 40
41 41
42 QString identifier()const; 42 QString identifier()const;
43 QString name()const; 43 QString name()const;
44 QBitArray supports()const;
44 45
45 public slots: 46 public slots:
46 /*! 47 /*!
47 having a `run' separate from the constructor allows to make 48 having a `run' separate from the constructor allows to make
48 the necessary connections to the signals and slots of the 49 the necessary connections to the signals and slots of the
49 instance before starting the execution of the client. 50 instance before starting the execution of the client.
50 */ 51 */
51 void start(); 52 void start();
52 int run(const char* pgm, QStrList & args , const char* term, int addutmp); 53 int run(const char* pgm, QStrList & args , const char* term, int addutmp);
53 bool open(); 54 bool open();
54 void close(); 55 void close();
55 void reload( const Profile& ); 56 void reload( const Profile& );
@@ -83,15 +84,16 @@ protected slots:
83 void donePty(); 84 void donePty();
84 85
85private: 86private:
86 int openPty(); 87 int openPty();
87 88
88private: 89private:
89 90
90 char m_ptynam[16]; // "/dev/ptyxx" | "/dev/ptmx" 91 char m_ptynam[16]; // "/dev/ptyxx" | "/dev/ptmx"
91 char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." 92 char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..."
92 int m_fd; 93 int m_fd;
93 int m_cpid; 94 int m_cpid;
94 QSocketNotifier* m_sn_e; 95 QSocketNotifier* m_sn_e;
96 QSocketNotifier* m_sn_r;
95}; 97};
96 98
97#endif 99#endif
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h
index 5f2fa3c..4977e94 100644
--- a/noncore/apps/opie-console/io_layer.h
+++ b/noncore/apps/opie-console/io_layer.h
@@ -1,37 +1,45 @@
1#ifndef OPIE_IO_LAYER_H 1#ifndef OPIE_IO_LAYER_H
2#define OPIE_IO_LAYER_H 2#define OPIE_IO_LAYER_H
3 3
4#include <qbitarray.h>
4#include <qobject.h> 5#include <qobject.h>
6
7
5#include <qpe/config.h> 8#include <qpe/config.h>
6 9
7#include "profile.h" 10#include "profile.h"
8 11
9/** 12/**
10 * This is the base class for IO Layers 13 * This is the base class for IO Layers
11 * It will used to sent and recv data( QByteArray ) 14 * It will used to sent and recv data( QByteArray )
12 * it 15 * it
13 */ 16 */
14class IOLayer : public QObject { 17class IOLayer : public QObject {
15 Q_OBJECT 18 Q_OBJECT
16public: 19public:
17 enum Error { 20 enum Error {
18 NoError = -1, 21 NoError = -1,
19 Refuse = 0, 22 Refuse = 0,
20 CouldNotOpen =1, 23 CouldNotOpen =1,
21 ClosedUnexpected =2, 24 ClosedUnexpected =2,
22 ClosedError =3, 25 ClosedError =3,
23 Terminate = 4 26 Terminate = 4
24 /* add more errors here */ 27 /* add more errors here */
25 }; 28 };
29 enum Feature {
30 AutoConnect = 0,
31 TransferFile =1,
32 Close =2
33 };
26 /** 34 /**
27 * a small c'tor 35 * a small c'tor
28 */ 36 */
29 IOLayer(); 37 IOLayer();
30 38
31 /** 39 /**
32 * create an IOLayer instance from a config file 40 * create an IOLayer instance from a config file
33 * the currently set group stores the profile/session 41 * the currently set group stores the profile/session
34 * information 42 * information
35 */ 43 */
36 IOLayer( const Profile& ); 44 IOLayer( const Profile& );
37 45
@@ -56,38 +64,44 @@ public:
56 * do any ioctling on it... 64 * do any ioctling on it...
57 * and it'll stop listening to the before opened 65 * and it'll stop listening to the before opened
58 * device 66 * device
59 */ 67 */
60 virtual int rawIO()const; 68 virtual int rawIO()const;
61 69
62 /** 70 /**
63 * will close the rawIO stuff 71 * will close the rawIO stuff
64 * and will listen to it's data again... 72 * and will listen to it's data again...
65 */ 73 */
66 virtual void closeRawIO(int); 74 virtual void closeRawIO(int);
67 75
76 /**
77 * What does the IOLayer support?
78 * Bits are related to features
79 */
80 virtual QBitArray supports()const = 0;
68 81
69signals: 82signals:
70 /** 83 /**
71 * received input as QCString 84 * received input as QCString
72 */ 85 */
73 virtual void received( const QByteArray& ); 86 virtual void received( const QByteArray& );
74 87
75 /** 88 /**
76 * an error occured 89 * an error occured
77 * int for the error number 90 * int for the error number
78 * and QString for a text 91 * and QString for a text
79 */ 92 */
80 virtual void error( int, const QString& ); 93 virtual void error( int, const QString& );
81 94
95 virtual void closed();
82public slots: 96public slots:
83 /** 97 /**
84 * send a QCString to the device 98 * send a QCString to the device
85 */ 99 */
86 virtual void send( const QByteArray& ) = 0; 100 virtual void send( const QByteArray& ) = 0;
87 101
88 /** 102 /**
89 * bool open 103 * bool open
90 */ 104 */
91 virtual bool open() = 0; 105 virtual bool open() = 0;
92 106
93 /** 107 /**
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index a4a6f0b..c10d5a8 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -178,12 +178,19 @@ int IOSerial::rawIO()const {
178 int fd = ::open(m_device, O_RDWR ); 178 int fd = ::open(m_device, O_RDWR );
179 179
180 return fd; 180 return fd;
181}; 181};
182void IOSerial::closeRawIO(int fd) { 182void IOSerial::closeRawIO(int fd) {
183 if (m_read ) 183 if (m_read )
184 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); 184 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
185 if (m_error ) 185 if (m_error )
186 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); 186 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
187 187
188 ::close( fd ); 188 ::close( fd );
189} 189}
190QBitArray IOSerial::supports()const {
191 QBitArray ar(3);
192 ar[0] = ar[2] = 0;
193 ar[1] = 1;
194
195 return ar;
196}
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h
index facbbc1..b1d1be1 100644
--- a/noncore/apps/opie-console/io_serial.h
+++ b/noncore/apps/opie-console/io_serial.h
@@ -28,27 +28,29 @@ public:
28 enum Flow { 28 enum Flow {
29 FlowHW = 0x01, 29 FlowHW = 0x01,
30 FlowSW = 0x02 30 FlowSW = 0x02
31 }; 31 };
32 32
33 IOSerial(const Profile &); 33 IOSerial(const Profile &);
34 ~IOSerial(); 34 ~IOSerial();
35 35
36 QString identifier() const; 36 QString identifier() const;
37 QString name() const; 37 QString name() const;
38 int rawIO()const; 38 int rawIO()const;
39 void closeRawIO(int fd ); 39 void closeRawIO(int fd );
40signals: 40 QBitArray supports()const;
41/*signals:
41 void received(const QByteArray &); 42 void received(const QByteArray &);
42 void error(int, const QString &); 43 void error(int, const QString &);
44*/
43public slots: 45public slots:
44 void send(const QByteArray &); 46 void send(const QByteArray &);
45 bool open(); 47 bool open();
46 void close(); 48 void close();
47 void reload(const Profile &); 49 void reload(const Profile &);
48protected: 50protected:
49 int baud(int baud) const; 51 int baud(int baud) const;
50protected slots: 52protected slots:
51 void dataArrived(); 53 void dataArrived();
52 void errorOccured(); 54 void errorOccured();
53protected: 55protected:
54 QSocketNotifier *m_read; 56 QSocketNotifier *m_read;
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 94c99bc..29dbcf3 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -351,29 +351,30 @@ void MainWindow::slotConfigure() {
351} 351}
352/* 352/*
353 * we will remove 353 * we will remove
354 * this window from the tabwidget 354 * this window from the tabwidget
355 * remove it from the list 355 * remove it from the list
356 * delete it 356 * delete it
357 * and set the currentSession() 357 * and set the currentSession()
358 */ 358 */
359void MainWindow::slotClose() { 359void MainWindow::slotClose() {
360 if (!currentSession() ) 360 if (!currentSession() )
361 return; 361 return;
362 362
363 Session* ses = currentSession();
364 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
363 tabWidget()->remove( currentSession() ); 365 tabWidget()->remove( currentSession() );
364 /*it's autodelete */ 366 /*it's autodelete */
365 m_sessions.remove( m_curSession ); 367 m_sessions.remove( ses );
366 m_curSession = m_sessions.first(); 368 qWarning("after remove!!");
367 tabWidget()->setCurrent( m_curSession );
368 369
369 if (!currentSession() ) { 370 if (!currentSession() ) {
370 m_connect->setEnabled( false ); 371 m_connect->setEnabled( false );
371 m_disconnect->setEnabled( false ); 372 m_disconnect->setEnabled( false );
372 m_terminate->setEnabled( false ); 373 m_terminate->setEnabled( false );
373 m_transfer->setEnabled( false ); 374 m_transfer->setEnabled( false );
374 m_recordScript->setEnabled( false ); 375 m_recordScript->setEnabled( false );
375 m_saveScript->setEnabled( false ); 376 m_saveScript->setEnabled( false );
376 m_runScript->setEnabled( false ); 377 m_runScript->setEnabled( false );
377 m_fullscreen->setEnabled( false ); 378 m_fullscreen->setEnabled( false );
378 m_closewindow->setEnabled( false ); 379 m_closewindow->setEnabled( false );
379 } 380 }
@@ -386,25 +387,25 @@ void MainWindow::slotClose() {
386 */ 387 */
387void MainWindow::slotProfile( int id) { 388void MainWindow::slotProfile( int id) {
388 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 389 Profile prof = manager()->profile( m_sessionsPop->text( id) );
389 create( prof ); 390 create( prof );
390} 391}
391void MainWindow::create( const Profile& prof ) { 392void MainWindow::create( const Profile& prof ) {
392 Session *ses = manager()->fromProfile( prof, tabWidget() ); 393 Session *ses = manager()->fromProfile( prof, tabWidget() );
393 394
394 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 395 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
395 { 396 {
396 QMessageBox::warning(this, 397 QMessageBox::warning(this,
397 QObject::tr("Session failed"), 398 QObject::tr("Session failed"),
398 QObject::tr("Cannot open session: Not all components were found.")); 399 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
399 //if(ses) delete ses; 400 //if(ses) delete ses;
400 return; 401 return;
401 } 402 }
402 403
403 m_sessions.append( ses ); 404 m_sessions.append( ses );
404 tabWidget()->add( ses ); 405 tabWidget()->add( ses );
405 m_curSession = ses; 406 m_curSession = ses;
406 407
407 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 408 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
408 m_connect->setEnabled( true ); 409 m_connect->setEnabled( true );
409 m_disconnect->setEnabled( false ); 410 m_disconnect->setEnabled( false );
410 m_terminate->setEnabled( true ); 411 m_terminate->setEnabled( true );
@@ -424,24 +425,25 @@ void MainWindow::slotTransfer()
424 dlg.exec(); 425 dlg.exec();
425 } 426 }
426} 427}
427 428
428 429
429void MainWindow::slotOpenKeb(bool state) { 430void MainWindow::slotOpenKeb(bool state) {
430 431
431 if (state) m_keyBar->show(); 432 if (state) m_keyBar->show();
432 else m_keyBar->hide(); 433 else m_keyBar->hide();
433 434
434} 435}
435void MainWindow::slotSessionChanged( Session* ses ) { 436void MainWindow::slotSessionChanged( Session* ses ) {
437 qWarning("changed!");
436 if ( ses ) { 438 if ( ses ) {
437 m_curSession = ses; 439 m_curSession = ses;
438 440
439 if ( m_curSession->isConnected() ) { 441 if ( m_curSession->isConnected() ) {
440 m_connect->setEnabled( false ); 442 m_connect->setEnabled( false );
441 m_disconnect->setEnabled( true ); 443 m_disconnect->setEnabled( true );
442 } else { 444 } else {
443 m_connect->setEnabled( true ); 445 m_connect->setEnabled( true );
444 m_disconnect->setEnabled( false ); 446 m_disconnect->setEnabled( false );
445 } 447 }
446 } 448 }
447} 449}
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index e5aedb6..7c15560 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -1,16 +1,17 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdlib.h> 2#include <stdlib.h>
3 3
4#include <qfile.h> 4#include <qfile.h>
5#include <qhbox.h>
5#include <qlayout.h> 6#include <qlayout.h>
6#include <qwidgetstack.h> 7#include <qwidgetstack.h>
7 8
8#include <qpe/config.h> 9#include <qpe/config.h>
9 10
10#include "emulation_handler.h" 11#include "emulation_handler.h"
11#include "widget_layer.h" 12#include "widget_layer.h"
12#include "emulation_widget.h" 13#include "emulation_widget.h"
13#include "metafactory.h" 14#include "metafactory.h"
14#include "profileconfig.h" 15#include "profileconfig.h"
15#include "profilemanager.h" 16#include "profilemanager.h"
16 17
@@ -76,37 +77,29 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
76 prof.writeEntry("Baud", 115200 ); 77 prof.writeEntry("Baud", 115200 );
77 prof.setIOLayer("serial"); 78 prof.setIOLayer("serial");
78 prof.setName( "test"); 79 prof.setName( "test");
79*/ 80*/
80 Session* session = new Session(); 81 Session* session = new Session();
81 session->setName( prof.name() ); 82 session->setName( prof.name() );
82 /* translate the internal name to the external */ 83 /* translate the internal name to the external */
83 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) , 84 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) ,
84 prof) ); 85 prof) );
85 86
86 QWidgetStack *stack = new QWidgetStack( parent ); 87 QWidgetStack *stack = new QWidgetStack( parent );
87 session->setWidgetStack( stack ); 88 session->setWidgetStack( stack );
88 QWidget* dummy = new QWidget( stack ); 89 QWidget* dummy = new QHBox( stack );
89 QHBoxLayout* lay = new QHBoxLayout( dummy ); 90 stack->raiseWidget( dummy );
90 stack->addWidget( dummy, 0 ); 91
91 stack->raiseWidget( 0 );
92 EmulationHandler* handler = new EmulationHandler(prof,dummy ); 92 EmulationHandler* handler = new EmulationHandler(prof,dummy );
93 session->setEmulationHandler( handler ); 93 session->setEmulationHandler( handler );
94 lay->addWidget( handler->widget() );
95// WidgetLayer* wid = new EmulationWidget( prof, dummy );
96// lay->addWidget( wid );
97
98// session->setEmulationWidget( wid );
99// session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ),
100// wid ) );
101 session->connect(); 94 session->connect();
102 95
103 return session; 96 return session;
104} 97}
105void ProfileManager::save( ) { 98void ProfileManager::save( ) {
106 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); 99 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) );
107 ProfileConfig conf("opie-console-profiles"); 100 ProfileConfig conf("opie-console-profiles");
108 Profile::ValueList::Iterator it2; 101 Profile::ValueList::Iterator it2;
109 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { 102 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
110 conf.setGroup( (*it2).name() ); 103 conf.setGroup( (*it2).name() );
111 104
112 /* now the config stuff */ 105 /* now the config stuff */
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index e53dbc4..aad100d 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -27,24 +27,30 @@ Session::~Session() {
27QString Session::name()const { 27QString Session::name()const {
28 return m_name; 28 return m_name;
29} 29}
30QWidgetStack* Session::widgetStack() { 30QWidgetStack* Session::widgetStack() {
31 return m_widget; 31 return m_widget;
32} 32}
33IOLayer* Session::layer() { 33IOLayer* Session::layer() {
34 return m_layer; 34 return m_layer;
35} 35}
36EmulationHandler* Session::emulationHandler() { 36EmulationHandler* Session::emulationHandler() {
37 return m_emu; 37 return m_emu;
38} 38}
39QWidget* Session::widget() {
40 if (!m_emu )
41 return 0l;
42
43 return m_emu->widget();
44}
39/* 45/*
40WidgetLayer* Session::emulationWidget() { 46WidgetLayer* Session::emulationWidget() {
41 return m_widLay; 47 return m_widLay;
42} 48}
43*/ 49*/
44void Session::connect() { 50void Session::connect() {
45 if ( !m_layer || !m_emu ) 51 if ( !m_layer || !m_emu )
46 return; 52 return;
47 53
48 m_connected = true; 54 m_connected = true;
49 55
50 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), 56 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h
index a1121d3..ff92df3 100644
--- a/noncore/apps/opie-console/session.h
+++ b/noncore/apps/opie-console/session.h
@@ -25,24 +25,25 @@ public:
25 * return the name of the session 25 * return the name of the session
26 */ 26 */
27 QString name()const; 27 QString name()const;
28 28
29 /** 29 /**
30 * return the widgetstack 30 * return the widgetstack
31 * this is used to be semi modal 31 * this is used to be semi modal
32 * for FileTransfer 32 * for FileTransfer
33 * 33 *
34 * semi modal == SessionModal 34 * semi modal == SessionModal
35 */ 35 */
36 QWidgetStack* widgetStack(); 36 QWidgetStack* widgetStack();
37 QWidget* widget();
37 38
38 /** 39 /**
39 * return the layer 40 * return the layer
40 */ 41 */
41 IOLayer* layer(); 42 IOLayer* layer();
42 43
43 EmulationHandler* emulationHandler(); 44 EmulationHandler* emulationHandler();
44 45
45 /* 46 /*
46 * connects the data flow from 47 * connects the data flow from
47 * the IOLayer to the EmulationLayer 48 * the IOLayer to the EmulationLayer
48 */ 49 */
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
index 8a691f9..419f8ac 100644
--- a/noncore/apps/opie-console/tabwidget.cpp
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -2,24 +2,25 @@
2#include "tabwidget.h" 2#include "tabwidget.h"
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 qWarning("session ses " + ses->name() );
14 if ( !ses->widgetStack() ) return; 15 if ( !ses->widgetStack() ) return;
15 //reparent( ses->widgetStack(), QPoint() ); 16 //reparent( ses->widgetStack(), QPoint() );
16 addTab( ses->widgetStack(), "console/konsole", ses->name() ); 17 addTab( ses->widgetStack(), "console/konsole", ses->name() );
17 //addTab( ses->widgetStack(), ses->name() ); 18 //addTab( ses->widgetStack(), ses->name() );
18 m_map.insert( ses->widgetStack(), ses ); 19 m_map.insert( ses->widgetStack(), ses );
19} 20}
20 21
21void TabWidget::remove( Session* ses ) { 22void TabWidget::remove( Session* ses ) {
22 m_map.remove( ses->widgetStack() ); 23 m_map.remove( ses->widgetStack() );
23 removePage( ses->widgetStack() ); 24 removePage( ses->widgetStack() );
24} 25}
25 26