summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/filetransfer.cpp
authorzecke <zecke>2002-10-13 15:31:12 (UTC)
committer zecke <zecke>2002-10-13 15:31:12 (UTC)
commit6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34 (patch) (side-by-side diff)
tree14fa6710ef6d80fa213250a97f13253eb88a80cd /noncore/apps/opie-console/filetransfer.cpp
parent5db679753dac04095a2fa4b03297785ed4ba4030 (diff)
downloadopie-6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34.zip
opie-6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34.tar.gz
opie-6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34.tar.bz2
Move some stuff in filetransfer around
make pid == 0 after a finished process. Introduce the FileReceive class it does not parse progress though
Diffstat (limited to 'noncore/apps/opie-console/filetransfer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp7
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 @@
FileTransfer::FileTransfer( Type t, IOLayer* lay )
: FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) {
signal(SIGPIPE, SIG_IGN );
+ m_pid = 0;
m_not = 0l;
m_proc = 0l;
}
FileTransfer::~FileTransfer() {
}
@@ -45,12 +46,13 @@ void FileTransfer::sendFile( const QString& file ) {
m_pid = fork();
switch( m_pid ) {
case -1:
emit error( StartError, tr("Was not able to fork") );
+ slotExec();
break;
case 0:{
setupChild();
qWarning("output:"+file );
/* exec */
char* verbose = "-vv";
@@ -174,13 +176,12 @@ void FileTransfer::slotRead() {
QStringList lis = QStringList::split(' ', str );
/*
* Transfer finished.. either complete or incomplete
*/
if ( lis[0].simplifyWhiteSpace() == "Transfer" ) {
qWarning("sent!!!!");
- emit sent();
return;
}
/*
* do progress reading
*/
slotProgress( lis );
@@ -233,21 +234,23 @@ void FileTransfer::slotProgress( const QStringList& list ) {
emit progress(m_file, m_prog, bps, -1, min , sec );
}
}
void FileTransfer::cancel() {
if(m_pid > 0) ::kill(m_pid,9 );
- delete m_not;
+
}
void FileTransfer::slotExec() {
qWarning("exited!");
char buf[2];
::read(m_term[0], buf, 1 );
delete m_proc;
delete m_not;
m_proc = m_not = 0l;
close( m_term[0] );
close( m_term[1] );
close( m_comm[0] );
close( m_comm[1] );
+ layer()->closeRawIO( m_fd );
emit sent();
+ m_pid = 0;
}