-rw-r--r-- | noncore/net/opietooth/manager/manager.pro | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.cpp | 84 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.h | 36 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/pppdialog.cpp | 9 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/pppdialog.h | 4 |
5 files changed, 130 insertions, 7 deletions
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 2d8ebe3..0bdd6b9 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro @@ -1,9 +1,9 @@ TEMPLATE = app CONFIG = qt warn_on debug #CONFIG = qt warn_on release -HEADERS = btconnectionitem.h btdeviceitem.h btserviceitem.h stdpopups.h popuphelper.h bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h pppdialog.h -SOURCES = btconnectionitem.cpp btdeviceitem.cpp btserviceitem.h stdpopups.cpp popuphelper.cpp main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp pppdialog.cpp +HEADERS = btconnectionitem.h btdeviceitem.h btserviceitem.h stdpopups.h popuphelper.h bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h pppdialog.h obexdialog.h +SOURCES = btconnectionitem.cpp btdeviceitem.cpp btserviceitem.h stdpopups.cpp popuphelper.cpp main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp pppdialog.cpp obexdialog.cpp INCLUDEPATH += $(OPIEDIR)/include INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopietooth -lopie diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp new file mode 100644 index 0000000..cb142eb --- a/dev/null +++ b/noncore/net/opietooth/manager/obexdialog.cpp @@ -0,0 +1,84 @@ + +#include "obexdialog.h" +#include <qpushbutton.h> +#include <qmultilineedit.h> +#include <qlineedit.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qfileinfo.h> + +#include <qpe/resource.h> + +#include <opie/oprocess.h> +#include <opie/ofiledialog.h> + +ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) + : QDialog( parent, name, modal, fl ) { + + if ( !name ) + setName( "ObexDialog" ); + setCaption( tr( "beam files " ) ) ; + + m_device = device; + + layout = new QVBoxLayout( this ); + + QLabel* info = new QLabel( this ); + info->setText( tr("Which file should be beamed?") ); + + cmdLine = new QLineEdit( this ); + + QPushButton *browserButton; + browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); + connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); + + chNameLine = new QLineEdit( this ); + + sendButton = new QPushButton( this ); + sendButton->setText( tr( "Send" ) ); + + layout->addWidget(info); + layout->addWidget(cmdLine); + layout->addWidget(browserButton); + layout->addWidget(chNameLine); + layout->addWidget(sendButton); + + connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); + +} + +ObexDialog::~ObexDialog() { +} + +void ObexDialog::browse() { + + MimeTypes types; + QStringList all; + all << "*/*"; + types.insert("All Files", all ); + + QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); + cmdLine->setText( str ); + +} + +void ObexDialog::sendData() { + QString fileURL = cmdLine->text(); + QString file = QFileInfo( fileURL ).fileName(); + QString modifiedName = chNameLine->text(); + + // vom popupmenu beziehen + OProcess* obexSend = new OProcess(); + if ( !modifiedName.isEmpty() ) { + *obexSend << "ussp-push" << m_device << fileURL << modifiedName; + } else { + *obexSend << "ussp-push" << m_device << fileURL << file; + } + if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { + qWarning("could not start"); + delete obexSend; + } + + + +} diff --git a/noncore/net/opietooth/manager/obexdialog.h b/noncore/net/opietooth/manager/obexdialog.h new file mode 100644 index 0000000..1a73b57 --- a/dev/null +++ b/noncore/net/opietooth/manager/obexdialog.h @@ -0,0 +1,36 @@ +#ifndef OBEXDIALOG_H +#define OBEXDIALOG_H + + +#include <qdialog.h> +#include <opie/oprocess.h> + +class QVBoxLayout; +class QPushButton; +class QMultiLineEdit; +class QLineEdit; + +class ObexDialog : public QDialog { + + Q_OBJECT + +public: + ObexDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0); + ~ObexDialog(); + + +private slots: + void browse(); + void sendData(); + +protected: + QVBoxLayout* layout; + QLineEdit* cmdLine; + QLineEdit* chNameLine; + QPushButton* sendButton; +private: + // Device that is used + QString m_device; +}; + +#endif diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp index 472da73..4d926a5 100644 --- a/noncore/net/opietooth/manager/pppdialog.cpp +++ b/noncore/net/opietooth/manager/pppdialog.cpp @@ -6,19 +6,21 @@ #include <qlayout.h> #include <qlabel.h> #include <opie/oprocess.h> -PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) +PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "PPPDialog" ); setCaption( tr( "ppp connection " ) ) ; + m_device = device; + layout = new QVBoxLayout( this ); QLabel* info = new QLabel( this ); - info->setText( "Enter an ppp script name:" ); + info->setText( tr("Enter an ppp script name:") ); cmdLine = new QLineEdit( this ); outPut = new QMultiLineEdit( this ); @@ -44,12 +46,11 @@ PPPDialog::~PPPDialog() { void PPPDialog::connectToDevice() { outPut->clear(); // vom popupmenu beziehen - QString devName = "/dev/ttyU0"; QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); OProcess* pppDial = new OProcess(); - *pppDial << "pppd" << devName << "call" << connectScript; + *pppDial << "pppd" << m_device << "call" << connectScript; connect( pppDial, SIGNAL(receivedStdout(OProcess*, char*, int ) ), this, SLOT(fillOutPut(OProcess*, char*, int ) ) ); if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { qWarning("could not start"); diff --git a/noncore/net/opietooth/manager/pppdialog.h b/noncore/net/opietooth/manager/pppdialog.h index 2baecca..b80b73d 100644 --- a/noncore/net/opietooth/manager/pppdialog.h +++ b/noncore/net/opietooth/manager/pppdialog.h @@ -14,9 +14,9 @@ class PPPDialog : public QDialog { Q_OBJECT public: - PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); + PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0); ~PPPDialog(); private slots: @@ -27,6 +27,8 @@ protected: QLineEdit* cmdLine; QPushButton* connectButton; QMultiLineEdit* outPut; +private: + QString m_device; }; #endif |