author | harlekin <harlekin> | 2002-07-13 14:02:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-13 14:02:59 (UTC) |
commit | 9a97566ac38b51e27707342556171af63f6a75b4 (patch) (side-by-side diff) | |
tree | af9b6a746090f6ca243af5c250e688f07c7ea708 | |
parent | c86efeae9e7f7f63dca633f630b571019a5c71b6 (diff) | |
download | opie-9a97566ac38b51e27707342556171af63f6a75b4.zip opie-9a97566ac38b51e27707342556171af63f6a75b4.tar.gz opie-9a97566ac38b51e27707342556171af63f6a75b4.tar.bz2 |
obex dialog added and fixes to ppp dialog
-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,27 +1,27 @@ 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 INTERFACES = bluetoothbase.ui devicedialog.ui DESTDIR = $(OPIEDIR)/bin TARGET = bluetooth-manager TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ ../../../../i18n/en/bluetooth-manager.ts \ ../../../../i18n/es/bluetooth-manager.ts \ ../../../../i18n/fr/bluetooth-manager.ts \ ../../../../i18n/hu/bluetooth-manager.ts \ ../../../../i18n/ja/bluetooth-manager.ts \ ../../../../i18n/ko/bluetooth-manager.ts \ ../../../../i18n/no/bluetooth-manager.ts \ ../../../../i18n/pl/bluetooth-manager.ts \ ../../../../i18n/pt/bluetooth-manager.ts \ ../../../../i18n/pt_BR/bluetooth-manager.ts \ ../../../../i18n/sl/bluetooth-manager.ts \ ../../../../i18n/zh_CN/bluetooth-manager.ts \ ../../../../i18n/zh_TW/bluetooth-manager.ts 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 @@ -1,65 +1,66 @@ #include "pppdialog.h" #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlineedit.h> #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 ); QFont outPut_font( outPut->font() ); outPut_font.setPointSize( 8 ); outPut->setFont( outPut_font ); outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); connectButton = new QPushButton( this ); connectButton->setText( tr( "Connect" ) ); layout->addWidget(info); layout->addWidget(cmdLine); layout->addWidget(outPut); layout->addWidget(connectButton); connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); } 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"); delete pppDial; } } void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { QCString str(cha, len ); outPut->insertLine( str ); delete pppDial; } 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 @@ -1,32 +1,34 @@ #ifndef PPPDIALOG_H #define PPPDIALOG_H #include <qdialog.h> #include <opie/oprocess.h> class QVBoxLayout; class QPushButton; class QMultiLineEdit; class QLineEdit; 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: void connectToDevice(); void fillOutPut( OProcess* pppDial, char* cha, int len ); protected: QVBoxLayout* layout; QLineEdit* cmdLine; QPushButton* connectButton; QMultiLineEdit* outPut; +private: + QString m_device; }; #endif |