author | zecke <zecke> | 2002-10-12 01:04:40 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-12 01:04:40 (UTC) |
commit | 78eddaa8057462b0b8e94f10f8673bb9f555061b (patch) (unidiff) | |
tree | ec73d894164866c349fd0bc28e441f6006269069 | |
parent | 39b88e5809e50a4951869434b8015c55265fc495 (diff) | |
download | opie-78eddaa8057462b0b8e94f10f8673bb9f555061b.zip opie-78eddaa8057462b0b8e94f10f8673bb9f555061b.tar.gz opie-78eddaa8057462b0b8e94f10f8673bb9f555061b.tar.bz2 |
SWITCH to the ProcCtl interface
-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 55 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/console.pro | 4 |
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 @@ | |||
11 | 11 | ||
12 | #include "procctl.h" | ||
12 | #include "filetransfer.h" | 13 | #include "filetransfer.h" |
13 | 14 | ||
14 | /** | ||
15 | * | ||
16 | * | ||
17 | class FileTransferControl { | ||
18 | public: | ||
19 | FileTransferControl(); | ||
20 | ~FileTransferControl(); | ||
21 | |||
22 | |||
23 | }; | ||
24 | */ | ||
25 | |||
26 | bool FileTransfer::terminate = false; | ||
27 | pid_t FileTransfer::m_pid; | ||
28 | 15 | ||
@@ -31,4 +18,5 @@ FileTransfer::FileTransfer( Type t, IOLayer* lay ) | |||
31 | signal(SIGPIPE, SIG_IGN ); | 18 | signal(SIGPIPE, SIG_IGN ); |
32 | signal( SIGCHLD, signal_handler ); | 19 | |
33 | m_not = 0l; | 20 | m_not = 0l; |
21 | m_proc = 0l; | ||
34 | } | 22 | } |
@@ -102,6 +90,3 @@ void FileTransfer::sendFile( const QString& file ) { | |||
102 | 90 | ||
103 | terminate = false; | 91 | |
104 | fd_set fds; | ||
105 | struct timeval timeout; | ||
106 | int sel; | ||
107 | 92 | ||
@@ -111,2 +96,10 @@ void FileTransfer::sendFile( const QString& file ) { | |||
111 | this, SLOT(slotRead() ) ); | 96 | this, SLOT(slotRead() ) ); |
97 | if ( pipe(m_term) < 0 ) | ||
98 | m_term[0] = m_term[1] = 0; | ||
99 | |||
100 | ProcCtl::self()->add(m_pid, m_term[1] ); | ||
101 | m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read ); | ||
102 | connect(m_proc, SIGNAL(activated(int) ), | ||
103 | this, SLOT(slotExec() ) ); | ||
104 | |||
112 | } | 105 | } |
@@ -121,13 +114,2 @@ void FileTransfer::sendFile( const QFile& file ) { | |||
121 | } | 114 | } |
122 | /* | ||
123 | * our signal handler to be replaced by | ||
124 | * a procctl thingie | ||
125 | */ | ||
126 | void FileTransfer::signal_handler(int ) { | ||
127 | qWarning("Terminated"); | ||
128 | int status; | ||
129 | signal( SIGCHLD, signal_handler ); | ||
130 | waitpid( m_pid, &status, WNOHANG ); | ||
131 | terminate = true; | ||
132 | } | ||
133 | 115 | ||
@@ -177,2 +159,3 @@ void FileTransfer::slotRead() { | |||
177 | QString str( ar ); | 159 | QString str( ar ); |
160 | qWarning(str.simplifyWhiteSpace() ); | ||
178 | QStringList lis = QStringList::split(' ', str ); | 161 | QStringList lis = QStringList::split(' ', str ); |
@@ -242 +225,13 @@ void FileTransfer::cancel() { | |||
242 | } | 225 | } |
226 | void FileTransfer::slotExec() { | ||
227 | qWarning("exited!"); | ||
228 | char buf[2]; | ||
229 | ::read(m_term[0], buf, 1 ); | ||
230 | delete m_proc; | ||
231 | delete m_not; | ||
232 | close( m_term[0] ); | ||
233 | close( m_term[1] ); | ||
234 | close( m_comm[0] ); | ||
235 | close( m_comm[1] ); | ||
236 | emit sent(); | ||
237 | } | ||
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 | |||
5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ | 5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ |
6 | senderui.h ../profile.h ../filetransfer.h | 6 | senderui.h ../profile.h ../filetransfer.h ../procctl.h |
7 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ | 7 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ |
8 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ | 8 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ |
9 | main.cpp senderui.cpp ../filetransfer.cpp | 9 | main.cpp senderui.cpp ../filetransfer.cpp ../procctl.cpp |
10 | INTERFACES = sender.ui | 10 | INTERFACES = sender.ui |