Diffstat (limited to 'noncore/apps/opie-console/filetransfer.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index 14787f6..8ca0df2 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp | |||
@@ -14,12 +14,13 @@ | |||
14 | 14 | ||
15 | 15 | ||
16 | FileTransfer::FileTransfer( Type t, IOLayer* lay ) | 16 | FileTransfer::FileTransfer( Type t, IOLayer* lay ) |
17 | : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) { | 17 | : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) { |
18 | signal(SIGPIPE, SIG_IGN ); | 18 | signal(SIGPIPE, SIG_IGN ); |
19 | 19 | ||
20 | m_pid = 0; | ||
20 | m_not = 0l; | 21 | m_not = 0l; |
21 | m_proc = 0l; | 22 | m_proc = 0l; |
22 | } | 23 | } |
23 | FileTransfer::~FileTransfer() { | 24 | FileTransfer::~FileTransfer() { |
24 | } | 25 | } |
25 | 26 | ||
@@ -45,12 +46,13 @@ void FileTransfer::sendFile( const QString& file ) { | |||
45 | 46 | ||
46 | 47 | ||
47 | m_pid = fork(); | 48 | m_pid = fork(); |
48 | switch( m_pid ) { | 49 | switch( m_pid ) { |
49 | case -1: | 50 | case -1: |
50 | emit error( StartError, tr("Was not able to fork") ); | 51 | emit error( StartError, tr("Was not able to fork") ); |
52 | slotExec(); | ||
51 | break; | 53 | break; |
52 | case 0:{ | 54 | case 0:{ |
53 | setupChild(); | 55 | setupChild(); |
54 | qWarning("output:"+file ); | 56 | qWarning("output:"+file ); |
55 | /* exec */ | 57 | /* exec */ |
56 | char* verbose = "-vv"; | 58 | char* verbose = "-vv"; |
@@ -174,13 +176,12 @@ void FileTransfer::slotRead() { | |||
174 | QStringList lis = QStringList::split(' ', str ); | 176 | QStringList lis = QStringList::split(' ', str ); |
175 | /* | 177 | /* |
176 | * Transfer finished.. either complete or incomplete | 178 | * Transfer finished.. either complete or incomplete |
177 | */ | 179 | */ |
178 | if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { | 180 | if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { |
179 | qWarning("sent!!!!"); | 181 | qWarning("sent!!!!"); |
180 | emit sent(); | ||
181 | return; | 182 | return; |
182 | } | 183 | } |
183 | /* | 184 | /* |
184 | * do progress reading | 185 | * do progress reading |
185 | */ | 186 | */ |
186 | slotProgress( lis ); | 187 | slotProgress( lis ); |
@@ -233,21 +234,23 @@ void FileTransfer::slotProgress( const QStringList& list ) { | |||
233 | emit progress(m_file, m_prog, bps, -1, min , sec ); | 234 | emit progress(m_file, m_prog, bps, -1, min , sec ); |
234 | } | 235 | } |
235 | 236 | ||
236 | } | 237 | } |
237 | void FileTransfer::cancel() { | 238 | void FileTransfer::cancel() { |
238 | if(m_pid > 0) ::kill(m_pid,9 ); | 239 | if(m_pid > 0) ::kill(m_pid,9 ); |
239 | delete m_not; | 240 | |
240 | } | 241 | } |
241 | void FileTransfer::slotExec() { | 242 | void FileTransfer::slotExec() { |
242 | qWarning("exited!"); | 243 | qWarning("exited!"); |
243 | char buf[2]; | 244 | char buf[2]; |
244 | ::read(m_term[0], buf, 1 ); | 245 | ::read(m_term[0], buf, 1 ); |
245 | delete m_proc; | 246 | delete m_proc; |
246 | delete m_not; | 247 | delete m_not; |
247 | m_proc = m_not = 0l; | 248 | m_proc = m_not = 0l; |
248 | close( m_term[0] ); | 249 | close( m_term[0] ); |
249 | close( m_term[1] ); | 250 | close( m_term[1] ); |
250 | close( m_comm[0] ); | 251 | close( m_comm[0] ); |
251 | close( m_comm[1] ); | 252 | close( m_comm[1] ); |
253 | layer()->closeRawIO( m_fd ); | ||
252 | emit sent(); | 254 | emit sent(); |
255 | m_pid = 0; | ||
253 | } | 256 | } |