Diffstat (limited to 'noncore/net/opietooth/manager/dundialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/dundialog.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/noncore/net/opietooth/manager/dundialog.cpp b/noncore/net/opietooth/manager/dundialog.cpp index c6d8619..872ab00 100644 --- a/noncore/net/opietooth/manager/dundialog.cpp +++ b/noncore/net/opietooth/manager/dundialog.cpp @@ -11,41 +11,48 @@ #include "dundialog.h" #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlineedit.h> #include <qlayout.h> #include <qcheckbox.h> #include <qlabel.h> #include <qstring.h> +#include <qcombobox.h> +#include <qdir.h> #include <opie2/oprocess.h> #include <opie2/odebug.h> using namespace Opie::Core; using namespace OpieTooth; using namespace Opie::Core; DunDialog::DunDialog( const QString& device, int port, QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { + QDir d("/etc/ppp/peers/"); //Dir we search files in + d.setFilter( QDir::Files); + d.setSorting( QDir::Size | QDir::Reversed ); + if ( !name ) setName( "DUNDialog" ); setCaption( tr( "DUN connection " ) ) ; m_device = device; m_port = port; m_dunConnect = NULL; layout = new QVBoxLayout( this ); QLabel* info = new QLabel( this ); info->setText( tr("Enter an ppp script name:") ); - cmdLine = new QLineEdit( this ); + cmdLine = new QComboBox( this ); + cmdLine->setEditable(true); outPut = new QMultiLineEdit( this ); QFont outPut_font( outPut->font() ); outPut_font.setPointSize( 8 ); outPut->setFont( outPut_font ); outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); connectButton = new QPushButton( this ); @@ -60,26 +67,28 @@ DunDialog::DunDialog( const QString& device, int port, QWidget* parent, layout->addWidget(info); layout->addWidget(cmdLine); layout->addWidget(doEncryption); layout->addWidget(persist); layout->addWidget(outPut); layout->addWidget(connectButton); connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); + //And fill cmdLine with ppp script filenames + cmdLine->insertStringList(d.entryList()); } DunDialog::~DunDialog() { } void DunDialog::connectToDevice() { bool doEnc = doEncryption->isChecked(); bool doPersist = persist->isChecked(); - if (cmdLine->text() == "") + if (cmdLine->currentText() == "") return; if (m_dunConnect) { outPut->append(tr("Work in progress")); return; } m_dunConnect = new OProcess(); outPut->clear(); @@ -88,17 +97,17 @@ void DunDialog::connectToDevice() { << tr("--connect") << m_device << tr("--channel") << QString::number(m_port) << tr("--nodetach"); if (doEnc) *m_dunConnect << tr("--encrypt"); if (doPersist) *m_dunConnect << tr("--persist"); *m_dunConnect << tr("call") - << cmdLine->text(); + << cmdLine->currentText(); if (!m_dunConnect->start(OProcess::NotifyOnExit, OProcess::All)) { outPut->append(tr("Couldn't start")); delete m_dunConnect; m_dunConnect = NULL; } else { |