summaryrefslogtreecommitdiff
path: root/noncore
authorkorovkin <korovkin>2006-03-30 20:11:13 (UTC)
committer korovkin <korovkin>2006-03-30 20:11:13 (UTC)
commit2efba75b536877b4138197af4159849e87b12bde (patch) (unidiff)
tree933e2093350d0475e135389231dd681db3ff6289 /noncore
parent8d8474e48d134c6ee64311d47f22753adcd63d10 (diff)
downloadopie-2efba75b536877b4138197af4159849e87b12bde.zip
opie-2efba75b536877b4138197af4159849e87b12bde.tar.gz
opie-2efba75b536877b4138197af4159849e87b12bde.tar.bz2
Added connections to several /dev/bluetooth/rfcomm/* ports.
Fixed typo in pppd command line.
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp64
-rw-r--r--noncore/net/opietooth/manager/pppdialog.h2
2 files changed, 42 insertions, 24 deletions
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp
index b8d800a..11091c4 100644
--- a/noncore/net/opietooth/manager/pppdialog.cpp
+++ b/noncore/net/opietooth/manager/pppdialog.cpp
@@ -5,6 +5,7 @@
5#include <qmultilineedit.h> 5#include <qmultilineedit.h>
6#include <qlineedit.h> 6#include <qlineedit.h>
7#include <qlayout.h> 7#include <qlayout.h>
8#include <qcombobox.h>
8#include <qlabel.h> 9#include <qlabel.h>
9#include <opie2/oprocess.h> 10#include <opie2/oprocess.h>
10#include <opie2/odebug.h> 11#include <opie2/odebug.h>
@@ -19,6 +20,7 @@ Connection PPPDialog::conns[NCONNECTS];
19PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent, 20PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent,
20 const char* name, bool modal, WFlags fl ) 21 const char* name, bool modal, WFlags fl )
21 : QDialog( parent, name, modal, fl ) { 22 : QDialog( parent, name, modal, fl ) {
23 int i; //Just an index variable
22 24
23 if ( !name ) 25 if ( !name )
24 setName( "PPPDialog" ); 26 setName( "PPPDialog" );
@@ -42,54 +44,63 @@ PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent,
42 44
43 connectButton = new QPushButton( this ); 45 connectButton = new QPushButton( this );
44 connectButton->setText( tr( "Connect" ) ); 46 connectButton->setText( tr( "Connect" ) );
45 47
48 serPort = new QComboBox(this);
49 for (i = 0; i < NCONNECTS; i++) {
50 if (!PPPDialog::conns[i].proc.isRunning())
51 serPort->insertItem(tr("rfcomm%1").arg(i));
52 }
53
46 layout->addWidget(info); 54 layout->addWidget(info);
47 layout->addWidget(cmdLine); 55 layout->addWidget(cmdLine);
56 layout->addWidget(serPort);
48 layout->addWidget(outPut); 57 layout->addWidget(outPut);
49 layout->addWidget(connectButton); 58 layout->addWidget(connectButton);
50 59
51 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 60 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
52
53 connect(&PPPDialog::conns[0].proc,
54 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
55 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
56 connect( &PPPDialog::conns[0].proc,
57 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
58 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
59 connect( &PPPDialog::conns[0].proc,
60 SIGNAL(processExited(Opie::Core::OProcess*)),
61 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
62} 61}
63 62
64PPPDialog::~PPPDialog() { 63PPPDialog::~PPPDialog() {
65} 64}
66 65
67void PPPDialog::connectToDevice() { 66void PPPDialog::connectToDevice() {
68 if (PPPDialog::conns[0].proc.isRunning()) { 67 int portNum = serPort->currentText().right(1).toInt();
68 if (PPPDialog::conns[portNum].proc.isRunning()) {
69 outPut->append(tr("Work in progress")); 69 outPut->append(tr("Work in progress"));
70 return; 70 return;
71 } 71 }
72 outPut->clear(); 72 outPut->clear();
73 PPPDialog::conns[0].proc.clearArguments(); 73 PPPDialog::conns[portNum].proc.clearArguments();
74 // vom popupmenu beziehen 74 // vom popupmenu beziehen
75 if (cmdLine->text().isEmpty()) {//Connect by rfcomm 75 if (cmdLine->text().isEmpty()) {//Connect by rfcomm
76 PPPDialog::conns[0].proc << "rfcomm" << "connect" 76 PPPDialog::conns[portNum].proc << "rfcomm" << "connect"
77 << "0" << m_device << QString::number(m_port); 77 << QString::number(portNum) << m_device << QString::number(m_port);
78 } 78 }
79 else { 79 else {
80 QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); 80 PPPDialog::conns[portNum].proc << "pppd"
81 PPPDialog::conns[0].proc << "pppd" 81 << tr("/dev/bluetooth/rfcomm/%1").arg(portNum)
82 << m_device << "call" << connectScript; 82 << "call"
83 << cmdLine->text();
83 } 84 }
84 if (!PPPDialog::conns[0].proc.start(OProcess::NotifyOnExit, OProcess::All)) { 85 if (!PPPDialog::conns[portNum].proc.start(OProcess::NotifyOnExit,
86 OProcess::All)) {
85 outPut->append(tr("Couldn't start")); 87 outPut->append(tr("Couldn't start"));
86 } 88 }
87 else 89 else
88 { 90 {
89 PPPDialog::conns[0].proc.resume(); 91 PPPDialog::conns[portNum].proc.resume();
90 outPut->append(tr("Started")); 92 outPut->append(tr("Started"));
91 PPPDialog::conns[0].btAddr = m_device; 93 PPPDialog::conns[portNum].btAddr = m_device;
92 PPPDialog::conns[0].port = m_port; 94 PPPDialog::conns[portNum].port = m_port;
95 connect(&PPPDialog::conns[portNum].proc,
96 SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
97 this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
98 connect( &PPPDialog::conns[portNum].proc,
99 SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
100 this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
101 connect( &PPPDialog::conns[portNum].proc,
102 SIGNAL(processExited(Opie::Core::OProcess*)),
103 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
93 } 104 }
94} 105}
95 106
@@ -115,7 +126,12 @@ void PPPDialog::slotProcessExited(OProcess* proc) {
115 126
116void PPPDialog::closeEvent(QCloseEvent* e) 127void PPPDialog::closeEvent(QCloseEvent* e)
117{ 128{
118 if(PPPDialog::conns[0].proc.isRunning()) 129 int i; //index variable
119 PPPDialog::conns[0].proc.kill(); 130 for (i = 0; i < NCONNECTS; i++) {
131 if(PPPDialog::conns[i].proc.isRunning())
132 PPPDialog::conns[i].proc.kill();
133 }
120 QDialog::closeEvent(e); 134 QDialog::closeEvent(e);
121} 135}
136
137//eof
diff --git a/noncore/net/opietooth/manager/pppdialog.h b/noncore/net/opietooth/manager/pppdialog.h
index 565fe1e..e0ffc7f 100644
--- a/noncore/net/opietooth/manager/pppdialog.h
+++ b/noncore/net/opietooth/manager/pppdialog.h
@@ -9,6 +9,7 @@ class QVBoxLayout;
9class QPushButton; 9class QPushButton;
10class QMultiLineEdit; 10class QMultiLineEdit;
11class QLineEdit; 11class QLineEdit;
12class QComboBox;
12#define NCONNECTS 10 //Maximal 13#define NCONNECTS 10 //Maximal
13 14
14namespace OpieTooth { 15namespace OpieTooth {
@@ -40,6 +41,7 @@ namespace OpieTooth {
40 QLineEdit* cmdLine; 41 QLineEdit* cmdLine;
41 QPushButton* connectButton; 42 QPushButton* connectButton;
42 QMultiLineEdit* outPut; 43 QMultiLineEdit* outPut;
44 QComboBox* serPort;
43 45
44 private: 46 private:
45 QString m_device; 47 QString m_device;