Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

pppdialog.cpp

Go to the documentation of this file.
00001 
00002 #include "pppdialog.h"
00003 #include <qpushbutton.h>
00004 #include <qmultilineedit.h>
00005 #include <qlineedit.h>
00006 #include <qlayout.h>
00007 #include <qlabel.h>
00008 #include <opie2/oprocess.h>
00009 #include <opie2/odebug.h>
00010 using namespace Opie::Core;
00011 
00012 using namespace OpieTooth;
00013 
00014 using namespace Opie::Core;
00015 PPPDialog::PPPDialog( QWidget* parent,  const char* name, bool modal, WFlags fl, const QString& device )
00016     : QDialog( parent, name, modal, fl ) {
00017 
00018     if ( !name )
00019         setName( "PPPDialog" );
00020     setCaption( tr( "ppp connection " ) ) ;
00021 
00022     m_device = device;
00023 
00024     layout = new QVBoxLayout( this );
00025 
00026     QLabel* info = new QLabel( this );
00027     info->setText( tr("Enter an ppp script name:") );
00028 
00029     cmdLine = new QLineEdit( this );
00030 
00031     outPut = new QMultiLineEdit( this );
00032     QFont outPut_font(  outPut->font() );
00033     outPut_font.setPointSize( 8 );
00034     outPut->setFont( outPut_font );
00035     outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
00036 
00037     connectButton = new QPushButton( this );
00038     connectButton->setText( tr( "Connect" ) );
00039 
00040     layout->addWidget(info);
00041     layout->addWidget(cmdLine);
00042     layout->addWidget(outPut);
00043     layout->addWidget(connectButton);
00044 
00045     connect( connectButton, SIGNAL( clicked() ), this,  SLOT( connectToDevice() ) );
00046 
00047 }
00048 
00049 PPPDialog::~PPPDialog() {
00050 }
00051 
00052 void PPPDialog::connectToDevice() {
00053     outPut->clear();
00054     // vom popupmenu beziehen
00055     QString connectScript = "/etc/ppp/peers/" + cmdLine->text();
00056     OProcess* pppDial = new OProcess();
00057     *pppDial << "pppd" << m_device << "call" << connectScript;
00058     connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ),
00059              this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) );
00060      if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) {
00061         owarn << "could not start" << oendl; 
00062         delete pppDial;
00063     }
00064 }
00065 
00066 void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) {
00067     QCString str(cha, len );
00068     outPut->insertLine( str );
00069     delete pppDial;
00070 }
00071 

Generated on Sat Nov 5 16:17:44 2005 for OPIE by  doxygen 1.4.2