author | harlekin <harlekin> | 2002-07-13 14:02:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-13 14:02:59 (UTC) |
commit | 9a97566ac38b51e27707342556171af63f6a75b4 (patch) (unidiff) | |
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 @@ | |||
1 | TEMPLATE = app | 1 | 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 |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe -lopietooth -lopie | 9 | LIBS += -lqpe -lopietooth -lopie |
10 | INTERFACES = bluetoothbase.ui devicedialog.ui | 10 | INTERFACES = bluetoothbase.ui devicedialog.ui |
11 | DESTDIR = $(OPIEDIR)/bin | 11 | DESTDIR = $(OPIEDIR)/bin |
12 | TARGET = bluetooth-manager | 12 | TARGET = bluetooth-manager |
13 | 13 | ||
14 | TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ | 14 | TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ |
15 | ../../../../i18n/en/bluetooth-manager.ts \ | 15 | ../../../../i18n/en/bluetooth-manager.ts \ |
16 | ../../../../i18n/es/bluetooth-manager.ts \ | 16 | ../../../../i18n/es/bluetooth-manager.ts \ |
17 | ../../../../i18n/fr/bluetooth-manager.ts \ | 17 | ../../../../i18n/fr/bluetooth-manager.ts \ |
18 | ../../../../i18n/hu/bluetooth-manager.ts \ | 18 | ../../../../i18n/hu/bluetooth-manager.ts \ |
19 | ../../../../i18n/ja/bluetooth-manager.ts \ | 19 | ../../../../i18n/ja/bluetooth-manager.ts \ |
20 | ../../../../i18n/ko/bluetooth-manager.ts \ | 20 | ../../../../i18n/ko/bluetooth-manager.ts \ |
21 | ../../../../i18n/no/bluetooth-manager.ts \ | 21 | ../../../../i18n/no/bluetooth-manager.ts \ |
22 | ../../../../i18n/pl/bluetooth-manager.ts \ | 22 | ../../../../i18n/pl/bluetooth-manager.ts \ |
23 | ../../../../i18n/pt/bluetooth-manager.ts \ | 23 | ../../../../i18n/pt/bluetooth-manager.ts \ |
24 | ../../../../i18n/pt_BR/bluetooth-manager.ts \ | 24 | ../../../../i18n/pt_BR/bluetooth-manager.ts \ |
25 | ../../../../i18n/sl/bluetooth-manager.ts \ | 25 | ../../../../i18n/sl/bluetooth-manager.ts \ |
26 | ../../../../i18n/zh_CN/bluetooth-manager.ts \ | 26 | ../../../../i18n/zh_CN/bluetooth-manager.ts \ |
27 | ../../../../i18n/zh_TW/bluetooth-manager.ts | 27 | ../../../../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 @@ | |||
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 | |||
@@ -1,65 +1,66 @@ | |||
1 | 1 | ||
2 | #include "pppdialog.h" | 2 | #include "pppdialog.h" |
3 | #include <qpushbutton.h> | 3 | #include <qpushbutton.h> |
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
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 | ||
13 | if ( !name ) | 13 | if ( !name ) |
14 | setName( "PPPDialog" ); | 14 | setName( "PPPDialog" ); |
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 ); |
23 | 25 | ||
24 | outPut = new QMultiLineEdit( this ); | 26 | outPut = new QMultiLineEdit( this ); |
25 | QFont outPut_font( outPut->font() ); | 27 | QFont outPut_font( outPut->font() ); |
26 | outPut_font.setPointSize( 8 ); | 28 | outPut_font.setPointSize( 8 ); |
27 | outPut->setFont( outPut_font ); | 29 | outPut->setFont( outPut_font ); |
28 | outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); | 30 | outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); |
29 | 31 | ||
30 | connectButton = new QPushButton( this ); | 32 | connectButton = new QPushButton( this ); |
31 | connectButton->setText( tr( "Connect" ) ); | 33 | connectButton->setText( tr( "Connect" ) ); |
32 | 34 | ||
33 | layout->addWidget(info); | 35 | layout->addWidget(info); |
34 | layout->addWidget(cmdLine); | 36 | layout->addWidget(cmdLine); |
35 | layout->addWidget(outPut); | 37 | layout->addWidget(outPut); |
36 | layout->addWidget(connectButton); | 38 | layout->addWidget(connectButton); |
37 | 39 | ||
38 | connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); | 40 | connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); |
39 | 41 | ||
40 | } | 42 | } |
41 | 43 | ||
42 | PPPDialog::~PPPDialog() { | 44 | PPPDialog::~PPPDialog() { |
43 | } | 45 | } |
44 | 46 | ||
45 | void PPPDialog::connectToDevice() { | 47 | 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 ) ) ); |
54 | if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { | 55 | if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { |
55 | qWarning("could not start"); | 56 | qWarning("could not start"); |
56 | delete pppDial; | 57 | delete pppDial; |
57 | } | 58 | } |
58 | } | 59 | } |
59 | 60 | ||
60 | void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { | 61 | void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { |
61 | QCString str(cha, len ); | 62 | QCString str(cha, len ); |
62 | outPut->insertLine( str ); | 63 | outPut->insertLine( str ); |
63 | delete pppDial; | 64 | delete pppDial; |
64 | } | 65 | } |
65 | 66 | ||
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 @@ | |||
1 | #ifndef PPPDIALOG_H | 1 | #ifndef PPPDIALOG_H |
2 | #define PPPDIALOG_H | 2 | #define PPPDIALOG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qdialog.h> | 5 | #include <qdialog.h> |
6 | #include <opie/oprocess.h> | 6 | #include <opie/oprocess.h> |
7 | 7 | ||
8 | class QVBoxLayout; | 8 | class QVBoxLayout; |
9 | class QPushButton; | 9 | class QPushButton; |
10 | class QMultiLineEdit; | 10 | class QMultiLineEdit; |
11 | class QLineEdit; | 11 | class QLineEdit; |
12 | 12 | ||
13 | class PPPDialog : public QDialog { | 13 | class PPPDialog : public QDialog { |
14 | 14 | ||
15 | Q_OBJECT | 15 | Q_OBJECT |
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 | ||
21 | 21 | ||
22 | private slots: | 22 | private slots: |
23 | void connectToDevice(); | 23 | void connectToDevice(); |
24 | void fillOutPut( OProcess* pppDial, char* cha, int len ); | 24 | void fillOutPut( OProcess* pppDial, char* cha, int len ); |
25 | protected: | 25 | protected: |
26 | QVBoxLayout* layout; | 26 | QVBoxLayout* layout; |
27 | QLineEdit* cmdLine; | 27 | QLineEdit* cmdLine; |
28 | QPushButton* connectButton; | 28 | QPushButton* connectButton; |
29 | QMultiLineEdit* outPut; | 29 | QMultiLineEdit* outPut; |
30 | 30 | ||
31 | private: | ||
32 | QString m_device; | ||
31 | }; | 33 | }; |
32 | #endif | 34 | #endif |