-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 | |||
@@ -2,6 +2,6 @@ TEMPLATE = app | |||
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | HEADERS = btconnectionitem.h btdeviceitem.h btserviceitem.h stdpopups.h popuphelper.h bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h pppdialog.h | 4 | 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 |
5 | 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 | 5 | 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 |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib | 7 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib |
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 @@ | |||
1 | |||
2 | #include "obexdialog.h" | ||
3 | #include <qpushbutton.h> | ||
4 | #include <qmultilineedit.h> | ||
5 | #include <qlineedit.h> | ||
6 | #include <qlayout.h> | ||
7 | #include <qlabel.h> | ||
8 | #include <qfileinfo.h> | ||
9 | |||
10 | #include <qpe/resource.h> | ||
11 | |||
12 | #include <opie/oprocess.h> | ||
13 | #include <opie/ofiledialog.h> | ||
14 | |||
15 | ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) | ||
16 | : QDialog( parent, name, modal, fl ) { | ||
17 | |||
18 | if ( !name ) | ||
19 | setName( "ObexDialog" ); | ||
20 | setCaption( tr( "beam files " ) ) ; | ||
21 | |||
22 | m_device = device; | ||
23 | |||
24 | layout = new QVBoxLayout( this ); | ||
25 | |||
26 | QLabel* info = new QLabel( this ); | ||
27 | info->setText( tr("Which file should be beamed?") ); | ||
28 | |||
29 | cmdLine = new QLineEdit( this ); | ||
30 | |||
31 | QPushButton *browserButton; | ||
32 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | ||
33 | connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); | ||
34 | |||
35 | chNameLine = new QLineEdit( this ); | ||
36 | |||
37 | sendButton = new QPushButton( this ); | ||
38 | sendButton->setText( tr( "Send" ) ); | ||
39 | |||
40 | layout->addWidget(info); | ||
41 | layout->addWidget(cmdLine); | ||
42 | layout->addWidget(browserButton); | ||
43 | layout->addWidget(chNameLine); | ||
44 | layout->addWidget(sendButton); | ||
45 | |||
46 | connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); | ||
47 | |||
48 | } | ||
49 | |||
50 | ObexDialog::~ObexDialog() { | ||
51 | } | ||
52 | |||
53 | void ObexDialog::browse() { | ||
54 | |||
55 | MimeTypes types; | ||
56 | QStringList all; | ||
57 | all << "*/*"; | ||
58 | types.insert("All Files", all ); | ||
59 | |||
60 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | ||
61 | cmdLine->setText( str ); | ||
62 | |||
63 | } | ||
64 | |||
65 | void ObexDialog::sendData() { | ||
66 | QString fileURL = cmdLine->text(); | ||
67 | QString file = QFileInfo( fileURL ).fileName(); | ||
68 | QString modifiedName = chNameLine->text(); | ||
69 | |||
70 | // vom popupmenu beziehen | ||
71 | OProcess* obexSend = new OProcess(); | ||
72 | if ( !modifiedName.isEmpty() ) { | ||
73 | *obexSend << "ussp-push" << m_device << fileURL << modifiedName; | ||
74 | } else { | ||
75 | *obexSend << "ussp-push" << m_device << fileURL << file; | ||
76 | } | ||
77 | if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { | ||
78 | qWarning("could not start"); | ||
79 | delete obexSend; | ||
80 | } | ||
81 | |||
82 | |||
83 | |||
84 | } | ||
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 @@ | |||
1 | #ifndef OBEXDIALOG_H | ||
2 | #define OBEXDIALOG_H | ||
3 | |||
4 | |||
5 | #include <qdialog.h> | ||
6 | #include <opie/oprocess.h> | ||
7 | |||
8 | class QVBoxLayout; | ||
9 | class QPushButton; | ||
10 | class QMultiLineEdit; | ||
11 | class QLineEdit; | ||
12 | |||
13 | class ObexDialog : public QDialog { | ||
14 | |||
15 | Q_OBJECT | ||
16 | |||
17 | public: | ||
18 | ObexDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0); | ||
19 | ~ObexDialog(); | ||
20 | |||
21 | |||
22 | private slots: | ||
23 | void browse(); | ||
24 | void sendData(); | ||
25 | |||
26 | protected: | ||
27 | QVBoxLayout* layout; | ||
28 | QLineEdit* cmdLine; | ||
29 | QLineEdit* chNameLine; | ||
30 | QPushButton* sendButton; | ||
31 | private: | ||
32 | // Device that is used | ||
33 | QString m_device; | ||
34 | }; | ||
35 | |||
36 | #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 | |||
@@ -8,5 +8,5 @@ | |||
8 | #include <opie/oprocess.h> | 8 | #include <opie/oprocess.h> |
9 | 9 | ||
10 | PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 10 | PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) |
11 | : QDialog( parent, name, modal, fl ) { | 11 | : QDialog( parent, name, modal, fl ) { |
12 | 12 | ||
@@ -15,8 +15,10 @@ PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl | |||
15 | setCaption( tr( "ppp connection " ) ) ; | 15 | setCaption( tr( "ppp connection " ) ) ; |
16 | 16 | ||
17 | m_device = device; | ||
18 | |||
17 | layout = new QVBoxLayout( this ); | 19 | layout = new QVBoxLayout( this ); |
18 | 20 | ||
19 | QLabel* info = new QLabel( this ); | 21 | QLabel* info = new QLabel( this ); |
20 | info->setText( "Enter an ppp script name:" ); | 22 | info->setText( tr("Enter an ppp script name:") ); |
21 | 23 | ||
22 | cmdLine = new QLineEdit( this ); | 24 | cmdLine = new QLineEdit( this ); |
@@ -46,8 +48,7 @@ void PPPDialog::connectToDevice() { | |||
46 | outPut->clear(); | 48 | outPut->clear(); |
47 | // vom popupmenu beziehen | 49 | // vom popupmenu beziehen |
48 | QString devName = "/dev/ttyU0"; | ||
49 | QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); | 50 | QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); |
50 | OProcess* pppDial = new OProcess(); | 51 | OProcess* pppDial = new OProcess(); |
51 | *pppDial << "pppd" << devName << "call" << connectScript; | 52 | *pppDial << "pppd" << m_device << "call" << connectScript; |
52 | connect( pppDial, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | 53 | connect( pppDial, SIGNAL(receivedStdout(OProcess*, char*, int ) ), |
53 | this, SLOT(fillOutPut(OProcess*, char*, int ) ) ); | 54 | this, SLOT(fillOutPut(OProcess*, char*, int ) ) ); |
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 | |||
@@ -16,5 +16,5 @@ class PPPDialog : public QDialog { | |||
16 | 16 | ||
17 | public: | 17 | public: |
18 | PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); | 18 | PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0); |
19 | ~PPPDialog(); | 19 | ~PPPDialog(); |
20 | 20 | ||
@@ -29,4 +29,6 @@ protected: | |||
29 | QMultiLineEdit* outPut; | 29 | QMultiLineEdit* outPut; |
30 | 30 | ||
31 | private: | ||
32 | QString m_device; | ||
31 | }; | 33 | }; |
32 | #endif | 34 | #endif |