author | korovkin <korovkin> | 2006-03-19 14:56:24 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-03-19 14:56:24 (UTC) |
commit | bf4d4b814d514762748fe602aeef6c43da102c3a (patch) (side-by-side diff) | |
tree | 611d82e4f062430dedd161242986fefa138e719c /noncore/net/opietooth/manager | |
parent | 4c59235642953b2b1d2a07b47313540e85fa5f6a (diff) | |
download | opie-bf4d4b814d514762748fe602aeef6c43da102c3a.zip opie-bf4d4b814d514762748fe602aeef6c43da102c3a.tar.gz opie-bf4d4b814d514762748fe602aeef6c43da102c3a.tar.bz2 |
Fixed the way OBEX push uses ussp-push utility.
Diffstat (limited to 'noncore/net/opietooth/manager') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.cpp | 69 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.h | 15 |
2 files changed, 71 insertions, 13 deletions
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index 951d87a..d3fdd14 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp @@ -2,2 +2,3 @@ #include "obexdialog.h" +#include <errno.h> #include <qpushbutton.h> @@ -21,3 +22,3 @@ using namespace Opie::Ui; using namespace Opie::Core; -ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) +ObexDialog::ObexDialog(const QString& device, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog( parent, name, modal, fl ) { @@ -25,3 +26,3 @@ ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags f if ( !name ) - setName( "ObexDialog" ); + setName( "ObexDialog" ); setCaption( tr( "beam files " ) ) ; @@ -31,6 +32,13 @@ ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags f layout = new QVBoxLayout( this ); + obexSend = new OProcess(); - QLabel* info = new QLabel( this ); + info = new QLabel( this ); info->setText( tr("Which file should be beamed?") ); + statLine = new QLabel(this); + statLine->setText( tr("Ready") ); + + status = new QMultiLineEdit(this); + status->setReadOnly(true); + cmdLine = new QLineEdit( this ); @@ -47,2 +55,3 @@ ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags f layout->addWidget(info); + layout->addWidget(status); layout->addWidget(cmdLine); @@ -51,2 +60,3 @@ ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags f layout->addWidget(sendButton); + layout->addWidget(statLine); @@ -54,2 +64,9 @@ ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags f + connect(obexSend, SIGNAL(processExited(Opie::Core::OProcess*)), + this, SLOT(slotProcessExited(Opie::Core::OProcess*))); + connect(obexSend, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), + this, SLOT(slotPushOut(Opie::Core::OProcess*, char*, int))); + connect(obexSend, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), + this, SLOT(slotPushErr(Opie::Core::OProcess*, char*, int))); + } @@ -57,2 +74,6 @@ ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags f ObexDialog::~ObexDialog() { + if (obexSend->isRunning()) + obexSend->kill(); + delete obexSend; + obexSend = NULL; } @@ -68,3 +89,3 @@ void ObexDialog::browse() { cmdLine->setText( str ); - + statLine->setText( tr("Ready") ); } @@ -75,17 +96,45 @@ void ObexDialog::sendData() { QString modifiedName = chNameLine->text(); + QString execName = "ussp-push"; + if (obexSend->isRunning()) + return; + obexSend->clearArguments(); // vom popupmenu beziehen - OProcess* obexSend = new OProcess(); if ( !modifiedName.isEmpty() ) { - *obexSend << "ussp-push" << m_device << fileURL << modifiedName; + *obexSend << execName << "--timeo 30" << m_device << fileURL << modifiedName; } else { - *obexSend << "ussp-push" << m_device << fileURL << file; + *obexSend << execName << "--timeo 30" << m_device << fileURL << file; } - if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { - owarn << "could not start" << oendl; - delete obexSend; + obexSend->setUseShell(true); + if (!obexSend->start(OProcess::NotifyOnExit, OProcess::All) ) { + statLine->setText( tr("Error: couln't start process") ); } + else + statLine->setText( tr("Sending") ); +} +void ObexDialog::slotPushOut(OProcess*, char* buf, int len) { + QCString str(buf, len); + status->append(str); +} +void ObexDialog::slotPushErr(OProcess*, char* buf, int len) { + QCString str(buf, len); + status->append(str); +} +void ObexDialog::slotProcessExited(OProcess*) { + if (obexSend == NULL) + return; + if (obexSend->normalExit()) { + status->append( tr("Finished with result ") ); + status->append( QString::number(obexSend->exitStatus()) ); + status->append( tr("\n") ); + odebug << obexSend->exitStatus() << oendl; + statLine->setText( tr("Finished: ") + tr(strerror(obexSend->exitStatus())) ); + } + else { + status->append( tr("Exited abnormally\n") ); + statLine->setText( tr("Exited abnormally") ); + } } diff --git a/noncore/net/opietooth/manager/obexdialog.h b/noncore/net/opietooth/manager/obexdialog.h index d5b5682..44a26f3 100644 --- a/noncore/net/opietooth/manager/obexdialog.h +++ b/noncore/net/opietooth/manager/obexdialog.h @@ -6,2 +6,4 @@ #include <opie2/oprocess.h> +#include <qlabel.h> +#include <qmultilineedit.h> @@ -12,3 +14,3 @@ class QLineEdit; - +namespace Opie {namespace Core {class OProcess;}} namespace OpieTooth { @@ -20,3 +22,3 @@ namespace OpieTooth { public: - ObexDialog( QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0, const QString& device = 0); + ObexDialog( const QString& device = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0); ~ObexDialog(); @@ -27,3 +29,6 @@ private slots: void sendData(); - + void slotPushOut(Opie::Core::OProcess*, char*, int); + void slotPushErr(Opie::Core::OProcess*, char*, int); + void slotProcessExited(Opie::Core::OProcess* proc); + protected: @@ -33,2 +38,5 @@ private slots: QPushButton* sendButton; + QLabel* info; + QMultiLineEdit* status; + QLabel* statLine; private: @@ -36,2 +44,3 @@ private slots: QString m_device; + Opie::Core::OProcess *obexSend; }; |