summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/pppdialog.cpp
Unidiff
Diffstat (limited to 'noncore/net/opietooth/manager/pppdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp
new file mode 100644
index 0000000..472da73
--- a/dev/null
+++ b/noncore/net/opietooth/manager/pppdialog.cpp
@@ -0,0 +1,65 @@
1
2#include "pppdialog.h"
3#include <qpushbutton.h>
4#include <qmultilineedit.h>
5#include <qlineedit.h>
6#include <qlayout.h>
7#include <qlabel.h>
8#include <opie/oprocess.h>
9
10PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
11 : QDialog( parent, name, modal, fl ) {
12
13 if ( !name )
14 setName( "PPPDialog" );
15 setCaption( tr( "ppp connection " ) ) ;
16
17 layout = new QVBoxLayout( this );
18
19 QLabel* info = new QLabel( this );
20 info->setText( "Enter an ppp script name:" );
21
22 cmdLine = new QLineEdit( this );
23
24 outPut = new QMultiLineEdit( this );
25 QFont outPut_font( outPut->font() );
26 outPut_font.setPointSize( 8 );
27 outPut->setFont( outPut_font );
28 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
29
30 connectButton = new QPushButton( this );
31 connectButton->setText( tr( "Connect" ) );
32
33 layout->addWidget(info);
34 layout->addWidget(cmdLine);
35 layout->addWidget(outPut);
36 layout->addWidget(connectButton);
37
38 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
39
40}
41
42PPPDialog::~PPPDialog() {
43}
44
45void PPPDialog::connectToDevice() {
46 outPut->clear();
47 // vom popupmenu beziehen
48 QString devName = "/dev/ttyU0";
49 QString connectScript = "/etc/ppp/peers/" + cmdLine->text();
50 OProcess* pppDial = new OProcess();
51 *pppDial << "pppd" << devName << "call" << connectScript;
52 connect( pppDial, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
53 this, SLOT(fillOutPut(OProcess*, char*, int ) ) );
54 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) {
55 qWarning("could not start");
56 delete pppDial;
57 }
58}
59
60void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) {
61 QCString str(cha, len );
62 outPut->insertLine( str );
63 delete pppDial;
64}
65