summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/dundialog.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth/manager/dundialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/dundialog.cpp15
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
@@ -13,23 +13,29 @@
#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;
@@ -37,13 +43,14 @@ DunDialog::DunDialog( const QString& device, int port, QWidget* parent,
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 );
@@ -62,22 +69,24 @@ DunDialog::DunDialog( const QString& device, int port, QWidget* parent,
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();
@@ -90,13 +99,13 @@ void DunDialog::connectToDevice() {
<< 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;
}