From 9a97566ac38b51e27707342556171af63f6a75b4 Mon Sep 17 00:00:00 2001 From: harlekin Date: Sat, 13 Jul 2002 14:02:59 +0000 Subject: obex dialog added and fixes to ppp dialog --- (limited to 'noncore/net') 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,8 +1,8 @@ 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 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 +#include +#include +#include +#include +#include + +#include + +#include +#include + +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 +#include + +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 @@ -7,17 +7,19 @@ #include #include -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 ); @@ -45,10 +47,9 @@ 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) ) { 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 @@ -15,7 +15,7 @@ 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(); @@ -28,5 +28,7 @@ protected: QPushButton* connectButton; QMultiLineEdit* outPut; +private: + QString m_device; }; #endif -- cgit v0.9.0.2