-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 @@ #include <qlayout.h> +#include <qcombobox.h> #include <qlabel.h> @@ -21,2 +22,3 @@ PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent, : QDialog( parent, name, modal, fl ) { + int i; //Just an index variable @@ -44,5 +46,12 @@ PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent, connectButton->setText( tr( "Connect" ) ); - + + serPort = new QComboBox(this); + for (i = 0; i < NCONNECTS; i++) { + if (!PPPDialog::conns[i].proc.isRunning()) + serPort->insertItem(tr("rfcomm%1").arg(i)); + } + layout->addWidget(info); layout->addWidget(cmdLine); + layout->addWidget(serPort); layout->addWidget(outPut); @@ -51,12 +60,2 @@ PPPDialog::PPPDialog( const QString& device, int port, QWidget* parent, connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); - - connect(&PPPDialog::conns[0].proc, - SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), - this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int))); - connect( &PPPDialog::conns[0].proc, - SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), - this, SLOT(fillErr(Opie::Core::OProcess*, char*, int))); - connect( &PPPDialog::conns[0].proc, - SIGNAL(processExited(Opie::Core::OProcess*)), - this, SLOT(slotProcessExited(Opie::Core::OProcess*))); } @@ -67,3 +66,4 @@ PPPDialog::~PPPDialog() { void PPPDialog::connectToDevice() { - if (PPPDialog::conns[0].proc.isRunning()) { + int portNum = serPort->currentText().right(1).toInt(); + if (PPPDialog::conns[portNum].proc.isRunning()) { outPut->append(tr("Work in progress")); @@ -72,14 +72,16 @@ void PPPDialog::connectToDevice() { outPut->clear(); - PPPDialog::conns[0].proc.clearArguments(); + PPPDialog::conns[portNum].proc.clearArguments(); // vom popupmenu beziehen if (cmdLine->text().isEmpty()) {//Connect by rfcomm - PPPDialog::conns[0].proc << "rfcomm" << "connect" - << "0" << m_device << QString::number(m_port); + PPPDialog::conns[portNum].proc << "rfcomm" << "connect" + << QString::number(portNum) << m_device << QString::number(m_port); } else { - QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); - PPPDialog::conns[0].proc << "pppd" - << m_device << "call" << connectScript; + PPPDialog::conns[portNum].proc << "pppd" + << tr("/dev/bluetooth/rfcomm/%1").arg(portNum) + << "call" + << cmdLine->text(); } - if (!PPPDialog::conns[0].proc.start(OProcess::NotifyOnExit, OProcess::All)) { + if (!PPPDialog::conns[portNum].proc.start(OProcess::NotifyOnExit, + OProcess::All)) { outPut->append(tr("Couldn't start")); @@ -88,6 +90,15 @@ void PPPDialog::connectToDevice() { { - PPPDialog::conns[0].proc.resume(); + PPPDialog::conns[portNum].proc.resume(); outPut->append(tr("Started")); - PPPDialog::conns[0].btAddr = m_device; - PPPDialog::conns[0].port = m_port; + PPPDialog::conns[portNum].btAddr = m_device; + PPPDialog::conns[portNum].port = m_port; + connect(&PPPDialog::conns[portNum].proc, + SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)), + this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int))); + connect( &PPPDialog::conns[portNum].proc, + SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)), + this, SLOT(fillErr(Opie::Core::OProcess*, char*, int))); + connect( &PPPDialog::conns[portNum].proc, + SIGNAL(processExited(Opie::Core::OProcess*)), + this, SLOT(slotProcessExited(Opie::Core::OProcess*))); } @@ -117,5 +128,10 @@ void PPPDialog::closeEvent(QCloseEvent* e) { - if(PPPDialog::conns[0].proc.isRunning()) - PPPDialog::conns[0].proc.kill(); + int i; //index variable + for (i = 0; i < NCONNECTS; i++) { + if(PPPDialog::conns[i].proc.isRunning()) + PPPDialog::conns[i].proc.kill(); + } QDialog::closeEvent(e); } + +//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; class QLineEdit; +class QComboBox; #define NCONNECTS 10 //Maximal @@ -42,2 +43,3 @@ namespace OpieTooth { QMultiLineEdit* outPut; + QComboBox* serPort; |