summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-11 22:31:15 (UTC)
committer zecke <zecke>2002-10-11 22:31:15 (UTC)
commitc8c961b4106f49f544195733cef17af5f15f6bb8 (patch) (unidiff)
tree3db3cad73021d14c417de2166249ec9e7a5f1aa4
parent597cda9456f8ef883d486b6ed7d7c09339919da9 (diff)
downloadopie-c8c961b4106f49f544195733cef17af5f15f6bb8.zip
opie-c8c961b4106f49f544195733cef17af5f15f6bb8.tar.gz
opie-c8c961b4106f49f544195733cef17af5f15f6bb8.tar.bz2
suspending connections in rawMode... closeRawIO afterwards please
Progress for FileTransfer FileTransferLayer updates. ErrorCodes + Better methods cancel and better progress default switch to FileTransfer TabWidget is a OTabWidget again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/default.cpp8
-rw-r--r--noncore/apps/opie-console/file_layer.h21
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp143
-rw-r--r--noncore/apps/opie-console/filetransfer.h15
-rw-r--r--noncore/apps/opie-console/io_layer.cpp3
-rw-r--r--noncore/apps/opie-console/io_layer.h8
-rw-r--r--noncore/apps/opie-console/io_serial.cpp16
-rw-r--r--noncore/apps/opie-console/io_serial.h1
-rw-r--r--noncore/apps/opie-console/opie-console.pro6
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp9
-rw-r--r--noncore/apps/opie-console/tabwidget.h4
11 files changed, 197 insertions, 37 deletions
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index a6c3bc4..b092273 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -1,28 +1,28 @@
1#include "io_serial.h" 1#include "io_serial.h"
2#include "sz_transfer.h" 2#include "filetransfer.h"
3#include "serialconfigwidget.h" 3#include "serialconfigwidget.h"
4#include "irdaconfigwidget.h" 4#include "irdaconfigwidget.h"
5#include "btconfigwidget.h" 5#include "btconfigwidget.h"
6#include "terminalwidget.h" 6#include "terminalwidget.h"
7#include "vt102emulation.h" 7#include "vt102emulation.h"
8 8
9#include "default.h" 9#include "default.h"
10 10
11extern "C" { 11extern "C" {
12 // FILE Transfer Stuff 12 // FILE Transfer Stuff
13 FileTransferLayer* newSZTransfer(IOLayer* lay) { 13 FileTransferLayer* newSZTransfer(IOLayer* lay) {
14 return new SzTransfer( SzTransfer::SZ, lay ); 14 return new FileTransfer( FileTransfer::SZ, lay );
15 } 15 }
16 FileTransferLayer* newSYTransfer(IOLayer* lay) { 16 FileTransferLayer* newSYTransfer(IOLayer* lay) {
17 return new SzTransfer( SzTransfer::SY, lay ); 17 return new FileTransfer( FileTransfer::SY, lay );
18 } 18 }
19 FileTransferLayer* newSXTransfer(IOLayer* lay) { 19 FileTransferLayer* newSXTransfer(IOLayer* lay) {
20 return new SzTransfer( SzTransfer::SX, lay ); 20 return new FileTransfer(FileTransfer ::SX, lay );
21 } 21 }
22 22
23 // Layer stuff 23 // Layer stuff
24 IOLayer* newSerialLayer( const Profile& prof) { 24 IOLayer* newSerialLayer( const Profile& prof) {
25 return new IOSerial( prof ); 25 return new IOSerial( prof );
26 } 26 }
27 IOLayer* newBTLayer( const Profile& ) { 27 IOLayer* newBTLayer( const Profile& ) {
28 return 0l; 28 return 0l;
diff --git a/noncore/apps/opie-console/file_layer.h b/noncore/apps/opie-console/file_layer.h
index 0bd0fd1..bf31540 100644
--- a/noncore/apps/opie-console/file_layer.h
+++ b/noncore/apps/opie-console/file_layer.h
@@ -1,52 +1,67 @@
1#ifndef OPIE_FILE_LAYER_H 1#ifndef OPIE_FILE_LAYER_H
2#define OPIE_FILE_LAYER_H 2#define OPIE_FILE_LAYER_H
3 3
4#include <qmap.h>
5
4#include "io_layer.h" 6#include "io_layer.h"
5 7
6class QFile; 8class QFile;
7/** 9/**
8 * this is the layer for sending files 10 * this is the layer for sending files
9 */ 11 */
10class FileTransferLayer : public QObject { 12class FileTransferLayer : public QObject {
11
12 Q_OBJECT 13 Q_OBJECT
13 14
14public: 15public:
16 enum Errors{
17 NotSupported,
18 StartError,
19 NoError,
20 Unknown,
21 Undefined,
22 Incomplete
23 };
15 /** 24 /**
16 *the io layer to be used 25 *the io layer to be used
17 */ 26 */
18 FileTransferLayer( IOLayer* ); 27 FileTransferLayer( IOLayer* );
19 virtual ~FileTransferLayer(); 28 virtual ~FileTransferLayer();
20 29
21public slots: 30public slots:
22 /** 31 /**
23 * send a file over the layer 32 * send a file over the layer
24 */ 33 */
25 virtual void sendFile( const QString& file ) = 0; 34 virtual void sendFile( const QString& file ) = 0;
26 virtual void sendFile( const QFile& ) = 0; 35 virtual void sendFile( const QFile& ) = 0;
36 virtual void cancel() = 0;
27 37
28signals: 38signals:
29 /** 39 /**
30 * sent the file 40 * sent the file
31 */ 41 */
32 void sent(); 42 void sent();
33 43
34 /** 44 /**
35 * an error occured 45 * an error occured
36 */ 46 */
37 47
38 void error( int, const QString& ); 48 void error( int, const QString& );
39 49
40 /* 50 /*
41 * 100 == done 51 * @param file The file to send
52 * @param progress the progress made from 0-100
53 * @param speed Speed in bps
54 * @param hours The hours it take to finish
55 * @param minutes The minutes it takes to finish
56 * @param send The seconds...
42 * 57 *
43 */ 58 */
44 void progress( const QString& file, int progress ); 59 void progress( const QString& file, int progress, int speed, int hours, int minutes, int seconds );
45 60
46protected: 61protected:
47 IOLayer* layer(); 62 IOLayer* layer();
48 63
49private: 64private:
50 IOLayer* m_layer; 65 IOLayer* m_layer;
51 66
52}; 67};
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 78982bd..7b75d35 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -6,50 +6,69 @@
6 6
7#include <qcstring.h> 7#include <qcstring.h>
8#include <qsocketnotifier.h> 8#include <qsocketnotifier.h>
9 9
10#include <opie/oprocess.h> 10#include <opie/oprocess.h>
11 11
12#include "filetransfer.h" 12#include "filetransfer.h"
13 13
14/**
15 *
16 *
17class FileTransferControl {
18public:
19 FileTransferControl();
20 ~FileTransferControl();
21
22
23};
24*/
25
14bool FileTransfer::terminate = false; 26bool FileTransfer::terminate = false;
15pid_t FileTransfer::m_pid; 27pid_t FileTransfer::m_pid;
16 28
17FileTransfer::FileTransfer( Type t, IOLayer* lay ) 29FileTransfer::FileTransfer( Type t, IOLayer* lay )
18 : FileTransferLayer( lay ), m_type( t ) { 30 : FileTransferLayer( lay ), m_type( t ) {
31 signal(SIGPIPE, SIG_IGN );
19 signal( SIGCHLD, signal_handler ); 32 signal( SIGCHLD, signal_handler );
33 m_not = 0l;
20} 34}
21FileTransfer::~FileTransfer() { 35FileTransfer::~FileTransfer() {
22} 36}
23 37
24/** 38/**
25 * now we will send the file. 39 * now we will send the file.
26 * 40 *
27 * we request an fd. The IOLayer should be closed 41 * we request an fd. The IOLayer should be closed
28 * then we will setup a pipe for progress communication 42 * then we will setup a pipe for progress communication
29 * then we will dup2 the m_fd in the forked process 43 * then we will dup2 the m_fd in the forked process
30 * to do direct IO from and to the fd 44 * to do direct IO from and to the fd
31 */ 45 */
32void FileTransfer::sendFile( const QString& file ) { 46void FileTransfer::sendFile( const QString& file ) {
47 m_prog =-1;
33 m_fd = layer()->rawIO(); 48 m_fd = layer()->rawIO();
34// 49//
35// m_fd = ::open("/dev/ttyS0", O_RDWR); 50// m_fd = ::open("/dev/ttyS0", O_RDWR);
36 51
37 52 m_file = file;
38 if ( pipe( m_comm ) < 0 ) 53 if ( pipe( m_comm ) < 0 )
39 m_comm[0] = m_comm[1] = 0; 54 m_comm[0] = m_comm[1] = 0;
40 if ( pipe( m_info ) < 0 ) 55 if ( pipe( m_info ) < 0 )
41 m_info[0] = m_info[1] = 0; 56 m_info[0] = m_info[1] = 0;
42 57
43 qWarning("output:"+file ); 58
44 m_pid = fork(); 59 m_pid = fork();
45 switch( m_pid ) { 60 switch( m_pid ) {
61 case -1:
62 emit error( StartError, tr("Was not able to fork") );
63 break;
46 case 0:{ 64 case 0:{
47 setupChild(); 65 setupChild();
66 qWarning("output:"+file );
48 /* exec */ 67 /* exec */
49 char* verbose = "-vv"; 68 char* verbose = "-vv";
50 char* binray = "-b"; 69 char* binray = "-b";
51 70
52 71
53 /* we should never return from here */ 72 /* we should never return from here */
54 execlp("sz", "sz", verbose, binray, file.latin1(), NULL ); 73 execlp("sz", "sz", verbose, binray, file.latin1(), NULL );
55 74
@@ -62,63 +81,65 @@ void FileTransfer::sendFile( const QString& file ) {
62 } 81 }
63 default:{ 82 default:{
64 if ( m_info[1] ) 83 if ( m_info[1] )
65 close( m_info[1] ); 84 close( m_info[1] );
66 if ( m_info[0] ) for (;;) { 85 if ( m_info[0] ) for (;;) {
67 char resultByte; int len; 86 char resultByte; int len;
68 len = read(m_info[0], &resultByte, 1 ); 87 len = read(m_info[0], &resultByte, 1 );
69 /* len == 1 start up failed */ 88 /* len == 1 start up failed */
70 if ( len == 1 ) 89 if ( len == 1 ) {
90 emit error( StartError, tr("Could not start") );
71 return; 91 return;
92 }
72 if ( len == -1 ) 93 if ( len == -1 )
73 if ( (errno == ECHILD ) || (errno == EINTR ) ) 94 if ( (errno == ECHILD ) || (errno == EINTR ) )
74 continue; 95 continue;
75 96
76 // len == 0 or something like this 97 // len == 0 or something like this
77 break; 98 break;
78 } 99 }
79 if ( m_info[0] ) 100 if ( m_info[0] )
80 close( m_info[0] ); 101 close( m_info[0] );
81 102
82 terminate = false; 103 terminate = false;
83 fd_set fds; 104 fd_set fds;
84 struct timeval timeout; 105 struct timeval timeout;
85 int sel; 106 int sel;
86 107
87 /* replace by QSocketNotifier!!! */ 108 /* replace by QSocketNotifier!!! */
88 while (!terminate) { 109 m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read );
89 FD_ZERO( &fds ); 110 connect(m_not, SIGNAL(activated(int) ),
90 FD_SET( m_comm[0], &fds ); 111 this, SLOT(slotRead() ) );
91 sel = select( m_comm[0]+1, &fds, NULL, NULL, &timeout );
92 if (sel ) {
93 if ( FD_ISSET(m_comm[0], &fds ) ) {
94 printf("out:");
95 QByteArray ar(4096);
96 int len = read(m_comm[0], ar.data(), 4096 );
97 for (int i = 0; i < len; i++ ) {
98 // printf("%c", ar[i] );
99 }
100 printf("\n");
101 }
102 }
103 }
104 break;
105 } 112 }
113 break;
106 } 114 }
107} 115}
116/*
117 * let's call the one with the filename
118 */
108void FileTransfer::sendFile( const QFile& file ) { 119void FileTransfer::sendFile( const QFile& file ) {
109 sendFile( file.name() ); 120 sendFile( file.name() );
110} 121}
122/*
123 * our signal handler to be replaced by
124 * a procctl thingie
125 */
111void FileTransfer::signal_handler(int ) { 126void FileTransfer::signal_handler(int ) {
127 qWarning("Terminated");
112 int status; 128 int status;
113 signal( SIGCHLD, signal_handler ); 129 signal( SIGCHLD, signal_handler );
114 waitpid( m_pid, &status, WNOHANG ); 130 waitpid( m_pid, &status, WNOHANG );
115 terminate = true; 131 terminate = true;
116} 132}
133
134/*
135 * setting up communication
136 * between parent child and ioLayer
137 */
117void FileTransfer::setupChild() { 138void FileTransfer::setupChild() {
118 /* 139 /*
119 * we do not want to read from our 140 * we do not want to read from our
120 * information channel 141 * information channel
121 */ 142 */
122 if (m_info[0] ) 143 if (m_info[0] )
123 close(m_info[0] ); 144 close(m_info[0] );
124 /* 145 /*
@@ -135,8 +156,90 @@ void FileTransfer::setupChild() {
135 * m_fd STDIN_FILENO 156 * m_fd STDIN_FILENO
136 * STDOUT_FILENO 157 * STDOUT_FILENO
137 * STDERR_FILENO 158 * STDERR_FILENO
138 */ 159 */
139 dup2( m_fd, STDIN_FILENO ); 160 dup2( m_fd, STDIN_FILENO );
140 dup2( m_fd, STDOUT_FILENO ); 161 dup2( m_fd, STDOUT_FILENO );
141 dup2( m_comm[1], STDERR_FILENO ); 162 dup2( m_comm[1], STDERR_FILENO );
142} 163}
164
165/*
166 * read from the stderr of the child
167 * process
168 */
169void FileTransfer::slotRead() {
170 QByteArray ar(4096);
171 int len = read(m_comm[0], ar.data(), 4096 );
172 qWarning("slot read %d", len);
173 for (int i = 0; i < len; i++ ) {
174 // printf("%c", ar[i] );
175 }
176 ar.resize( len );
177 QString str( ar );
178 QStringList lis = QStringList::split(' ', str );
179 /*
180 * Transfer finished.. either complete or incomplete
181 */
182 if ( lis[0].simplifyWhiteSpace() == "Transfer" ) {
183 qWarning("sent!!!!");
184 emit sent();
185 return;
186 }
187 /*
188 * do progress reading
189 */
190 slotProgress( lis );
191
192
193}
194/*
195 * find the progress
196 */
197void FileTransfer::slotProgress( const QStringList& list ) {
198 bool complete = true;
199 int min, sec;
200 int bps;
201 unsigned long sent, total;
202
203 min = sec = bps = -1;
204 sent = total = 0;
205
206 // Data looks like this
207 // 0 1 2 3 4 5
208 // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33
209 QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() );
210 sent = progi[0].toULong(&complete );
211 if (!complete ) return;
212
213 total = progi[1].toULong(&complete );
214 if (!complete || total == 0) {
215 qWarning("returning!!");
216 return;
217 }
218
219 qWarning("%s, %d, %d", progi.join("/").latin1(), sent, total );
220
221 double pro = (double)sent/total;
222 int prog = pro * 100;
223
224 // speed
225 progi = QStringList::split(':', list[3].simplifyWhiteSpace() );
226 bps = progi[1].toInt();
227
228 // time
229 progi = QStringList::split(':', list[5].simplifyWhiteSpace() );
230 min = progi[0].toInt();
231 sec = progi[1].toInt();
232
233
234 qWarning("Prog!:%d", prog );
235 if ( prog > m_prog ) {
236 m_prog = prog;
237 emit progress(m_file, m_prog, bps, -1, min , sec );
238 qWarning("Progress: %s, %d\%, %d, %d:%d", m_file.latin1(), m_prog, bps, min, sec );
239 }
240
241}
242void FileTransfer::cancel() {
243 ::kill(m_pid,9 );
244 delete m_not;
245}
diff --git a/noncore/apps/opie-console/filetransfer.h b/noncore/apps/opie-console/filetransfer.h
index 06c6d12..0829f16 100644
--- a/noncore/apps/opie-console/filetransfer.h
+++ b/noncore/apps/opie-console/filetransfer.h
@@ -1,38 +1,53 @@
1#ifndef OPIE_FILE_TRANSFER_H 1#ifndef OPIE_FILE_TRANSFER_H
2#define OPIE_FILE_TRANSFER_H 2#define OPIE_FILE_TRANSFER_H
3 3
4#include <sys/types.h> 4#include <sys/types.h>
5 5
6#include <qfile.h> 6#include <qfile.h>
7#include <qstringlist.h>
7 8
8#include "file_layer.h" 9#include "file_layer.h"
9 10
10class QSocketNotifier; 11class QSocketNotifier;
11class OProcess; 12class OProcess;
13class FileTransferControl;
12class FileTransfer : public FileTransferLayer{ 14class FileTransfer : public FileTransferLayer{
13 Q_OBJECT 15 Q_OBJECT
16 friend class FileTransferControl;
14public: 17public:
15 enum Type { 18 enum Type {
16 SZ = 0, 19 SZ = 0,
17 SX, 20 SX,
18 SY 21 SY
19 }; 22 };
20 FileTransfer( Type t, IOLayer* ); 23 FileTransfer( Type t, IOLayer* );
21 ~FileTransfer(); 24 ~FileTransfer();
22 25
23 void sendFile( const QString& file ); 26 void sendFile( const QString& file );
24 void sendFile( const QFile& ); 27 void sendFile( const QFile& );
28 void cancel();
25 29
26private slots: 30private slots:
27 void setupChild(); 31 void setupChild();
32 void slotRead();
33 void slotProgress( const QStringList& );
28private: 34private:
35 /*
36 * FIXME? What does happen if we've
37 * two FileTransfers at a time?
38 * Have a procctl which does listen
39 * for termination and then send a signal
40 */
29 static pid_t m_pid; 41 static pid_t m_pid;
30 int m_fd; 42 int m_fd;
43 int m_prog;
31 int m_info[2]; 44 int m_info[2];
32 int m_comm[2]; 45 int m_comm[2];
46 QString m_file;
33 Type m_type; 47 Type m_type;
48 QSocketNotifier *m_not;
34 static void signal_handler(int); 49 static void signal_handler(int);
35 static bool terminate; 50 static bool terminate;
36}; 51};
37 52
38#endif 53#endif
diff --git a/noncore/apps/opie-console/io_layer.cpp b/noncore/apps/opie-console/io_layer.cpp
index 79d47f5..9ba2f70 100644
--- a/noncore/apps/opie-console/io_layer.cpp
+++ b/noncore/apps/opie-console/io_layer.cpp
@@ -10,8 +10,11 @@ IOLayer::IOLayer(const Profile &)
10{ 10{
11} 11}
12 12
13IOLayer::~IOLayer() { 13IOLayer::~IOLayer() {
14} 14}
15int IOLayer::rawIO()const{ 15int IOLayer::rawIO()const{
16 return -1; 16 return -1;
17} 17}
18void IOLayer::closeRawIO(int) {
19
20}
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h
index 7745021..bf5a893 100644
--- a/noncore/apps/opie-console/io_layer.h
+++ b/noncore/apps/opie-console/io_layer.h
@@ -49,18 +49,26 @@ public:
49 * a short name 49 * a short name
50 */ 50 */
51 virtual QString name() const = 0; 51 virtual QString name() const = 0;
52 52
53 /** 53 /**
54 * a file descriptor which opens 54 * a file descriptor which opens
55 * the device for io but does not 55 * the device for io but does not
56 * do any ioctling on it... 56 * do any ioctling on it...
57 * and it'll stop listening to the before opened
58 * device
57 */ 59 */
58 virtual int rawIO()const; 60 virtual int rawIO()const;
61
62 /**
63 * will close the rawIO stuff
64 * and will listen to it's data again...
65 */
66 virtual void closeRawIO(int);
59signals: 67signals:
60 /** 68 /**
61 * received input as QCString 69 * received input as QCString
62 */ 70 */
63 virtual void received( const QByteArray& ) = 0; 71 virtual void received( const QByteArray& ) = 0;
64 72
65 /** 73 /**
66 * an error occured 74 * an error occured
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index 845f4be..4129d64 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -22,16 +22,17 @@ void 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!");
30 if (m_fd) { 31 if (m_fd) {
31 delete m_read; 32 delete m_read;
32 delete m_error; 33 delete m_error;
33 ::close(m_fd); 34 ::close(m_fd);
34 m_fd = 0; 35 m_fd = 0;
35 } else { 36 } else {
36 emit error(Refuse, tr("Not connected")); 37 emit error(Refuse, tr("Not connected"));
37 } 38 }
@@ -112,17 +113,17 @@ bool IOSerial::open() {
112 113
113 /* Notifications on read & errors */ 114 /* Notifications on read & errors */
114 m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); 115 m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
115 m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this); 116 m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this);
116 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); 117 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
117 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); 118 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
118 return TRUE; 119 return TRUE;
119 } else { 120 } else {
120 qWarning("opened"); 121 qWarning(" already opened");
121 emit error(Refuse, tr("Device is already connected")); 122 emit error(Refuse, tr("Device is already connected"));
122 m_fd = 0; 123 m_fd = 0;
123 return FALSE; 124 return FALSE;
124 } 125 }
125} 126}
126 127
127void IOSerial::reload(const Profile &config) { 128void IOSerial::reload(const Profile &config) {
128 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); 129 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE);
@@ -171,12 +172,25 @@ void IOSerial::dataArrived() {
171QString IOSerial::identifier() const { 172QString IOSerial::identifier() const {
172 return "serial"; 173 return "serial";
173} 174}
174 175
175QString IOSerial::name() const { 176QString IOSerial::name() const {
176 return "RS232 Serial IO Layer"; 177 return "RS232 Serial IO Layer";
177} 178}
178int IOSerial::rawIO()const { 179int IOSerial::rawIO()const {
180 if (m_read )
181 disconnect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
182 if (m_error )
183 disconnect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
184
179 int fd = ::open(m_device, O_RDWR ); 185 int fd = ::open(m_device, O_RDWR );
180 186
181 return fd; 187 return fd;
182}; 188};
189void IOSerial::closeRawIO(int fd) {
190 if (m_read )
191 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
192 if (m_error )
193 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
194
195 ::close( fd );
196}
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h
index 00a6d2c..facbbc1 100644
--- a/noncore/apps/opie-console/io_serial.h
+++ b/noncore/apps/opie-console/io_serial.h
@@ -31,16 +31,17 @@ public:
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 );
39signals: 40signals:
40 void received(const QByteArray &); 41 void received(const QByteArray &);
41 void error(int, const QString &); 42 void error(int, const QString &);
42public slots: 43public slots:
43 void send(const QByteArray &); 44 void send(const QByteArray &);
44 bool open(); 45 bool open();
45 void close(); 46 void close();
46 void reload(const Profile &); 47 void reload(const Profile &);
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 996eb84..37cef92 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -1,14 +1,14 @@
1TEMPLATE = app 1TEMPLATE = app
2#CONFIG = qt warn_on release 2#CONFIG = qt warn_on release
3 CONFIG = qt debug 3 CONFIG = qt debug
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = io_layer.h io_serial.h io_irda.h \ 5HEADERS = io_layer.h io_serial.h io_irda.h \
6 file_layer.h sz_transfer.h \ 6 file_layer.h filetransfer.h \
7 metafactory.h \ 7 metafactory.h \
8 session.h \ 8 session.h \
9 mainwindow.h \ 9 mainwindow.h \
10 profile.h \ 10 profile.h \
11 profileconfig.h \ 11 profileconfig.h \
12 profilemanager.h \ 12 profilemanager.h \
13 configwidget.h \ 13 configwidget.h \
14 tabwidget.h \ 14 tabwidget.h \
@@ -26,17 +26,17 @@ HEADERS = io_layer.h io_serial.h io_irda.h \
26 default.h \ 26 default.h \
27 terminalwidget.h \ 27 terminalwidget.h \
28 iolayerbase.h \ 28 iolayerbase.h \
29 serialconfigwidget.h irdaconfigwidget.h btconfigwidget.h \ 29 serialconfigwidget.h irdaconfigwidget.h btconfigwidget.h \
30 emulation_widget.h 30 emulation_widget.h
31 31
32 32
33SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp \ 33SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp \
34 file_layer.cpp sz_transfer.cpp \ 34 file_layer.cpp filetransfer.cpp \
35 main.cpp \ 35 main.cpp \
36 metafactory.cpp \ 36 metafactory.cpp \
37 session.cpp \ 37 session.cpp \
38 mainwindow.cpp \ 38 mainwindow.cpp \
39 profile.cpp \ 39 profile.cpp \
40 profileconfig.cpp \ 40 profileconfig.cpp \
41 profilemanager.cpp \ 41 profilemanager.cpp \
42 tabwidget.cpp \ 42 tabwidget.cpp \
@@ -54,11 +54,11 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp \
54 terminalwidget.cpp \ 54 terminalwidget.cpp \
55 iolayerbase.cpp \ 55 iolayerbase.cpp \
56 serialconfigwidget.cpp irdaconfigwidget.cpp btconfigwidget.cpp \ 56 serialconfigwidget.cpp irdaconfigwidget.cpp btconfigwidget.cpp \
57 emulation_widget.cpp 57 emulation_widget.cpp
58 58
59INTERFACES = configurebase.ui editbase.ui 59INTERFACES = configurebase.ui editbase.ui
60INCLUDEPATH += $(OPIEDIR)/include 60INCLUDEPATH += $(OPIEDIR)/include
61DEPENDPATH += $(OPIEDIR)/include 61DEPENDPATH += $(OPIEDIR)/include
62LIBS += -lqpe -lopie 62LIBS += -lqpe -lopie
63TARGET = opie-console 63TARGET = opie-console
64 64
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
index cfaef91..466b536 100644
--- a/noncore/apps/opie-console/tabwidget.cpp
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -1,26 +1,26 @@
1 1
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 : QTabWidget( 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"); 15 qWarning("going to add it");
16 //reparent( ses->widgetStack(), QPoint() ); 16 //reparent( ses->widgetStack(), QPoint() );
17 //addTab( ses->widgetStack(), "console/konsole", ses->name() ); 17 addTab( ses->widgetStack(), "console/konsole", ses->name() );
18 addTab( ses->widgetStack(), ses->name() ); 18 //addTab( ses->widgetStack(), ses->name() );
19 m_map.insert( ses->widgetStack(), ses ); 19 m_map.insert( ses->widgetStack(), ses );
20} 20}
21 21
22void TabWidget::remove( Session* ses ) { 22void TabWidget::remove( Session* ses ) {
23 m_map.remove( ses->widgetStack() ); 23 m_map.remove( ses->widgetStack() );
24 removePage( ses->widgetStack() ); 24 removePage( ses->widgetStack() );
25} 25}
26 26
@@ -32,12 +32,13 @@ void TabWidget::slotCurChanged( QWidget* wid ) {
32 } 32 }
33 33
34 emit activated( it.data() ); 34 emit activated( it.data() );
35} 35}
36void TabWidget::setCurrent( Session* ses ) { 36void TabWidget::setCurrent( Session* ses ) {
37 if (!ses ) 37 if (!ses )
38 return; 38 return;
39 39
40 showPage( ses->widgetStack() ); 40 //showPage( ses->widgetStack() );
41 setCurrentTab( ses->widgetStack() );
41} 42}
42 43
43 44
diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h
index 42a00ec..cbaa0f1 100644
--- a/noncore/apps/opie-console/tabwidget.h
+++ b/noncore/apps/opie-console/tabwidget.h
@@ -1,20 +1,20 @@
1#ifndef OPIE_TAB_WIDGET_H 1#ifndef OPIE_TAB_WIDGET_H
2#define OPIE_TAB_WIDGET_H 2#define OPIE_TAB_WIDGET_H
3 3
4#include <qmap.h> 4#include <qmap.h>
5#include <qtabwidget.h> 5#include <opie/otabwidget.h>
6 6
7#include "session.h" 7#include "session.h"
8/** 8/**
9 * This is our central tab widget 9 * This is our central tab widget
10 * we can add sessions here 10 * we can add sessions here
11 */ 11 */
12class TabWidget : public QTabWidget{ 12class TabWidget : public OTabWidget{
13 Q_OBJECT 13 Q_OBJECT
14public: 14public:
15 TabWidget(QWidget *parent, const char* name ); 15 TabWidget(QWidget *parent, const char* name );
16 ~TabWidget(); 16 ~TabWidget();
17 void add( Session* ); 17 void add( Session* );
18 void remove( Session* ); 18 void remove( Session* );
19 void setCurrent( Session* ); 19 void setCurrent( Session* );
20 20