summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/filetransfer.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/filetransfer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 8ca0df2..b81c2a2 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -50,13 +50,12 @@ void FileTransfer::sendFile( const QString& file ) {
50 case -1: 50 case -1:
51 emit error( StartError, tr("Was not able to fork") ); 51 emit error( StartError, tr("Was not able to fork") );
52 slotExec(); 52 slotExec();
53 break; 53 break;
54 case 0:{ 54 case 0:{
55 setupChild(); 55 setupChild();
56 qWarning("output:"+file );
57 /* exec */ 56 /* exec */
58 char* verbose = "-vv"; 57 char* verbose = "-vv";
59 char* binray = "-b"; 58 char* binray = "-b";
60 59
61 60
62 char* typus; 61 char* typus;
@@ -163,25 +162,22 @@ void FileTransfer::setupChild() {
163 * read from the stderr of the child 162 * read from the stderr of the child
164 * process 163 * process
165 */ 164 */
166void FileTransfer::slotRead() { 165void FileTransfer::slotRead() {
167 QByteArray ar(4096); 166 QByteArray ar(4096);
168 int len = read(m_comm[0], ar.data(), 4096 ); 167 int len = read(m_comm[0], ar.data(), 4096 );
169 qWarning("slot read %d", len);
170 for (int i = 0; i < len; i++ ) { 168 for (int i = 0; i < len; i++ ) {
171 // printf("%c", ar[i] ); 169 // printf("%c", ar[i] );
172 } 170 }
173 ar.resize( len ); 171 ar.resize( len );
174 QString str( ar ); 172 QString str( ar );
175 qWarning(str.simplifyWhiteSpace() );
176 QStringList lis = QStringList::split(' ', str ); 173 QStringList lis = QStringList::split(' ', str );
177 /* 174 /*
178 * Transfer finished.. either complete or incomplete 175 * Transfer finished.. either complete or incomplete
179 */ 176 */
180 if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { 177 if ( lis[0].simplifyWhiteSpace() == "Transfer" ) {
181 qWarning("sent!!!!");
182 return; 178 return;
183 } 179 }
184 /* 180 /*
185 * do progress reading 181 * do progress reading
186 */ 182 */
187 slotProgress( lis ); 183 slotProgress( lis );
@@ -211,13 +207,12 @@ void FileTransfer::slotProgress( const QStringList& list ) {
211 207
212 total = progi[1].toULong(&complete ); 208 total = progi[1].toULong(&complete );
213 if (!complete || total == 0) { 209 if (!complete || total == 0) {
214 return; 210 return;
215 } 211 }
216 212
217 qWarning("%s, %d, %d", progi.join("/").latin1(), sent, total );
218 213
219 double pro = (double)sent/total; 214 double pro = (double)sent/total;
220 int prog = pro * 100; 215 int prog = pro * 100;
221 216
222 // speed 217 // speed
223 progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); 218 progi = QStringList::split(':', list[3].simplifyWhiteSpace() );
@@ -237,13 +232,12 @@ void FileTransfer::slotProgress( const QStringList& list ) {
237} 232}
238void FileTransfer::cancel() { 233void FileTransfer::cancel() {
239 if(m_pid > 0) ::kill(m_pid,9 ); 234 if(m_pid > 0) ::kill(m_pid,9 );
240 235
241} 236}
242void FileTransfer::slotExec() { 237void FileTransfer::slotExec() {
243 qWarning("exited!");
244 char buf[2]; 238 char buf[2];
245 ::read(m_term[0], buf, 1 ); 239 ::read(m_term[0], buf, 1 );
246 delete m_proc; 240 delete m_proc;
247 delete m_not; 241 delete m_not;
248 m_proc = m_not = 0l; 242 m_proc = m_not = 0l;
249 close( m_term[0] ); 243 close( m_term[0] );