author | korovkin <korovkin> | 2006-03-30 20:11:13 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-03-30 20:11:13 (UTC) |
commit | 2efba75b536877b4138197af4159849e87b12bde (patch) (unidiff) | |
tree | 933e2093350d0475e135389231dd681db3ff6289 | |
parent | 8d8474e48d134c6ee64311d47f22753adcd63d10 (diff) | |
download | opie-2efba75b536877b4138197af4159849e87b12bde.zip opie-2efba75b536877b4138197af4159849e87b12bde.tar.gz opie-2efba75b536877b4138197af4159849e87b12bde.tar.bz2 |
Added connections to several /dev/bluetooth/rfcomm/* ports.
Fixed typo in pppd command line.
-rw-r--r-- | noncore/net/opietooth/manager/pppdialog.cpp | 64 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/pppdialog.h | 2 |
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 | |||
@@ -7,2 +7,3 @@ | |||
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | #include <qcombobox.h> | ||
8 | #include <qlabel.h> | 9 | #include <qlabel.h> |
@@ -21,2 +22,3 @@ PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent, | |||
21 | : QDialog( parent, name, modal, fl ) { | 22 | : QDialog( parent, name, modal, fl ) { |
23 | int i; //Just an index variable | ||
22 | 24 | ||
@@ -44,5 +46,12 @@ PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent, | |||
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); |
@@ -51,12 +60,2 @@ PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent, | |||
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 | } |
@@ -67,3 +66,4 @@ PPPDialog::~PPPDialog() { | |||
67 | void PPPDialog::connectToDevice() { | 66 | void 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")); |
@@ -72,14 +72,16 @@ void PPPDialog::connectToDevice() { | |||
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")); |
@@ -88,6 +90,15 @@ void PPPDialog::connectToDevice() { | |||
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 | } |
@@ -117,5 +128,10 @@ void 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 | |||
@@ -11,2 +11,3 @@ class QMultiLineEdit; | |||
11 | class QLineEdit; | 11 | class QLineEdit; |
12 | class QComboBox; | ||
12 | #define NCONNECTS 10 //Maximal | 13 | #define NCONNECTS 10 //Maximal |
@@ -42,2 +43,3 @@ namespace OpieTooth { | |||
42 | QMultiLineEdit* outPut; | 43 | QMultiLineEdit* outPut; |
44 | QComboBox* serPort; | ||
43 | 45 | ||