summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-12 01:04:40 (UTC)
committer zecke <zecke>2002-10-12 01:04:40 (UTC)
commit78eddaa8057462b0b8e94f10f8673bb9f555061b (patch) (side-by-side diff)
treeec73d894164866c349fd0bc28e441f6006269069
parent39b88e5809e50a4951869434b8015c55265fc495 (diff)
downloadopie-78eddaa8057462b0b8e94f10f8673bb9f555061b.zip
opie-78eddaa8057462b0b8e94f10f8673bb9f555061b.tar.gz
opie-78eddaa8057462b0b8e94f10f8673bb9f555061b.tar.bz2
SWITCH to the ProcCtl interface
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp55
-rw-r--r--noncore/apps/opie-console/test/console.pro4
2 files changed, 27 insertions, 32 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 7fd9f37..97552fe 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -11,18 +11,5 @@
+#include "procctl.h"
#include "filetransfer.h"
-/**
- *
- *
-class FileTransferControl {
-public:
- FileTransferControl();
- ~FileTransferControl();
-
-
-};
-*/
-
-bool FileTransfer::terminate = false;
-pid_t FileTransfer::m_pid;
@@ -31,4 +18,5 @@ FileTransfer::FileTransfer( Type t, IOLayer* lay )
signal(SIGPIPE, SIG_IGN );
- signal( SIGCHLD, signal_handler );
+
m_not = 0l;
+ m_proc = 0l;
}
@@ -102,6 +90,3 @@ void FileTransfer::sendFile( const QString& file ) {
- terminate = false;
- fd_set fds;
- struct timeval timeout;
- int sel;
+
@@ -111,2 +96,10 @@ void FileTransfer::sendFile( const QString& file ) {
this, SLOT(slotRead() ) );
+ if ( pipe(m_term) < 0 )
+ m_term[0] = m_term[1] = 0;
+
+ ProcCtl::self()->add(m_pid, m_term[1] );
+ m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read );
+ connect(m_proc, SIGNAL(activated(int) ),
+ this, SLOT(slotExec() ) );
+
}
@@ -121,13 +114,2 @@ void FileTransfer::sendFile( const QFile& file ) {
}
-/*
- * our signal handler to be replaced by
- * a procctl thingie
- */
-void FileTransfer::signal_handler(int ) {
- qWarning("Terminated");
- int status;
- signal( SIGCHLD, signal_handler );
- waitpid( m_pid, &status, WNOHANG );
- terminate = true;
-}
@@ -177,2 +159,3 @@ void FileTransfer::slotRead() {
QString str( ar );
+ qWarning(str.simplifyWhiteSpace() );
QStringList lis = QStringList::split(' ', str );
@@ -242 +225,13 @@ void FileTransfer::cancel() {
}
+void FileTransfer::slotExec() {
+ qWarning("exited!");
+ char buf[2];
+ ::read(m_term[0], buf, 1 );
+ delete m_proc;
+ delete m_not;
+ close( m_term[0] );
+ close( m_term[1] );
+ close( m_comm[0] );
+ close( m_comm[1] );
+ emit sent();
+}
diff --git a/noncore/apps/opie-console/test/console.pro b/noncore/apps/opie-console/test/console.pro
index 9fe8e13..af0e9f7 100644
--- a/noncore/apps/opie-console/test/console.pro
+++ b/noncore/apps/opie-console/test/console.pro
@@ -5,6 +5,6 @@ CONFIG = qt debug
HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\
- senderui.h ../profile.h ../filetransfer.h
+ senderui.h ../profile.h ../filetransfer.h ../procctl.h
SOURCES = ../io_layer.cpp ../io_serial.cpp \
../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\
- main.cpp senderui.cpp ../filetransfer.cpp
+ main.cpp senderui.cpp ../filetransfer.cpp ../procctl.cpp
INTERFACES = sender.ui