summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth/manager') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/obexdialog.cpp62
-rw-r--r--noncore/net/opietooth/manager/obexdialog.h15
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/obexpopup.cpp8
4 files changed, 35 insertions, 52 deletions
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp
index 8d7b593..4b795b7 100644
--- a/noncore/net/opietooth/manager/obexdialog.cpp
+++ b/noncore/net/opietooth/manager/obexdialog.cpp
@@ -22,3 +22,4 @@ using namespace Opie::Ui;
using namespace Opie::Core;
-ObexDialog::ObexDialog(const QString& device, QWidget* parent, const char* name, bool modal, WFlags fl)
+ObexDialog::ObexDialog(const QString& device, int port,
+ QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog( parent, name, modal, fl ) {
@@ -30,5 +31,6 @@ ObexDialog::ObexDialog(const QString& device, QWidget* parent, const char* name
m_device = device;
+ m_port = port;
layout = new QVBoxLayout( this );
- obexSend = new OProcess();
+ obexSend = new ObexPush();
@@ -64,8 +66,8 @@ ObexDialog::ObexDialog(const QString& device, QWidget* parent, const char* name
- 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)));
+ connect(obexSend, SIGNAL(sendComplete(int)),
+ this, SLOT(slotPushComplete(int)));
+ connect(obexSend, SIGNAL(sendError(int)),
+ this, SLOT(slotPushError(int)));
+ connect(obexSend, SIGNAL(status(QCString&)),
+ this, SLOT(slotPushStatus(QCString&)));
@@ -74,4 +76,2 @@ ObexDialog::ObexDialog(const QString& device, QWidget* parent, const char* name
ObexDialog::~ObexDialog() {
- if (obexSend->isRunning())
- obexSend->kill();
delete obexSend;
@@ -93,20 +93,10 @@ void ObexDialog::browse() {
void ObexDialog::sendData() {
+ int result; //function call result
QString fileURL = cmdLine->text();
- QString file = QFileInfo( fileURL ).fileName();
QString modifiedName = chNameLine->text();
- QString execName = "ussp-push";
-
- if (obexSend->isRunning())
+ result = obexSend->send(m_device, m_port, fileURL, modifiedName);
+ if (result > 0)
return;
- obexSend->clearArguments();
- // vom popupmenu beziehen
- if ( !modifiedName.isEmpty() ) {
- *obexSend << execName << "--timeo 30" << m_device << fileURL << modifiedName;
- } else {
- *obexSend << execName << "--timeo 30" << m_device << fileURL << file;
- }
- obexSend->setUseShell(true);
- if (!obexSend->start(OProcess::NotifyOnExit, OProcess::All) ) {
+ else if (result < 0)
statLine->setText( tr("Error: couln't start process") );
- }
else
@@ -115,4 +105,3 @@ void ObexDialog::sendData() {
-void ObexDialog::slotPushOut(OProcess*, char* buf, int len) {
- QCString str(buf, len);
+void ObexDialog::slotPushStatus(QCString& str) {
status->append(str);
@@ -120,18 +109,11 @@ void ObexDialog::slotPushOut(OProcess*, char* buf, int len) {
-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()) {
+void ObexDialog::slotPushComplete(int result) {
status->append( tr("Finished with result ") );
- status->append( QString::number(obexSend->exitStatus()) );
+ status->append( QString::number(result) );
status->append( tr("\n") );
- odebug << obexSend->exitStatus() << oendl;
- statLine->setText( tr("Finished: ") + tr(strerror(obexSend->exitStatus())) );
+ odebug << result << oendl;
+ statLine->setText( tr("Finished: ") + tr(strerror(result)) );
}
- else {
+
+void ObexDialog::slotPushError(int) {
status->append( tr("Exited abnormally\n") );
@@ -139,2 +121,2 @@ void ObexDialog::slotProcessExited(OProcess*) {
}
-}
+//eof
diff --git a/noncore/net/opietooth/manager/obexdialog.h b/noncore/net/opietooth/manager/obexdialog.h
index 44a26f3..063b7f1 100644
--- a/noncore/net/opietooth/manager/obexdialog.h
+++ b/noncore/net/opietooth/manager/obexdialog.h
@@ -5,5 +5,5 @@
#include <qdialog.h>
-#include <opie2/oprocess.h>
#include <qlabel.h>
#include <qmultilineedit.h>
+#include "obexpush.h"
@@ -22,3 +22,5 @@ namespace OpieTooth {
public:
- ObexDialog( const QString& device = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0);
+ ObexDialog( const QString& device = 0, int port = 0,
+ QWidget* parent = 0, const char* name = 0,
+ bool modal = TRUE, WFlags fl = 0);
~ObexDialog();
@@ -29,5 +31,5 @@ private slots:
void sendData();
- void slotPushOut(Opie::Core::OProcess*, char*, int);
- void slotPushErr(Opie::Core::OProcess*, char*, int);
- void slotProcessExited(Opie::Core::OProcess* proc);
+ void slotPushStatus(QCString&);
+ void slotPushComplete(int);
+ void slotPushError(int);
@@ -44,3 +46,4 @@ private slots:
QString m_device;
- Opie::Core::OProcess *obexSend;
+ int m_port; //Port used
+ ObexPush* obexSend;
};
diff --git a/noncore/net/opietooth/manager/obexftpdialog.cpp b/noncore/net/opietooth/manager/obexftpdialog.cpp
index efb3ff2..2a578ac 100644
--- a/noncore/net/opietooth/manager/obexftpdialog.cpp
+++ b/noncore/net/opietooth/manager/obexftpdialog.cpp
@@ -245,3 +245,3 @@ void ObexFtpDialog::slotCd(QListViewItem* item)
odebug << "Browse " << curdir << oendl;
- if (obexftp_setpath(client, curdir, 0) < 0)
+ if (obexftp_setpath(client, QFile::encodeName(curdir), 0) < 0)
log(tr("CD failed: ") + tr(strerror(errno)));
diff --git a/noncore/net/opietooth/manager/obexpopup.cpp b/noncore/net/opietooth/manager/obexpopup.cpp
index d1d1b4a..759a452 100644
--- a/noncore/net/opietooth/manager/obexpopup.cpp
+++ b/noncore/net/opietooth/manager/obexpopup.cpp
@@ -20,3 +20,3 @@ ObexPopup::ObexPopup(const OpieTooth::Services& service, OpieTooth::BTDeviceIte
{
- owarn << "ObexPopup c'tor" << oendl;
+ odebug << "ObexPopup c'tor" << oendl;
@@ -41,6 +41,4 @@ void ObexPopup::slotPush()
int port = m_service.protocolDescriptorList().last().port();
- device += "@";
- device += QString::number(port);
- owarn << "push something to " << device << oendl;
- ObexDialog obexDialog(device);
+ odebug << "push something to " << device << " " << port << oendl;
+ ObexDialog obexDialog(device, port);
QPEApplication::execDialog( &obexDialog );