summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/TODO12
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp59
-rw-r--r--noncore/settings/networksettings/ppp/accounts.h18
-rw-r--r--noncore/settings/networksettings/ppp/authwidget.cpp195
-rw-r--r--noncore/settings/networksettings/ppp/authwidget.h46
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp1
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp52
-rw-r--r--noncore/settings/networksettings/ppp/edit.h3
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.cpp9
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp25
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.h1
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/ppp.pro6
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp26
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h4
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp6
17 files changed, 313 insertions, 156 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO
index 5635438..80fc5a6 100644
--- a/noncore/settings/networksettings/ppp/TODO
+++ b/noncore/settings/networksettings/ppp/TODO
@@ -1,7 +1,9 @@
-- add possibility to input username and password ;)
-- impl. PPPData::copyaccount & PPPData::deleteAccount
+- ask for password is non is set
+
+- stop pppd, i.e. fix interfaceinformationppp
+
- update modem attribute inputs when modem has changed
-- fix layout of edit account, i.e. get it shown maximised
-- popup configure modem with the correct account prselected
- not quite shure why it does not work... IMHO it should work
+- impl. PPPData::copyaccount & PPPData::deleteAccount
+- check if the same interface device combination allready exists
+- fix layout of edit account, i.e. get it shown maximised
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index f704c84..7760d5e 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -1,384 +1,355 @@
/*
* kPPP: A pppd front end for the KDE project
*
* $Id$
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <qdir.h>
#include <stdlib.h>
#include <qlayout.h>
#include <qtabwidget.h>
#include <qtabdialog.h>
#include <qwhatsthis.h>
#include <qmessagebox.h>
#include <qapplication.h>
#include <qbuttongroup.h>
#include <qmessagebox.h>
#include <qvgroupbox.h>
-#include "pppdata.h"
#include "accounts.h"
+#include "authwidget.h"
+#include "pppdata.h"
#include "edit.h"
void parseargs(char* buf, char** args);
AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name )
- : QWidget( parent, name ), _pppdata(pd)
+ : QWidget( parent, name )//, _pppdata(pd)
{
+ _pppdata = pd;
QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
accountlist_l = new QListBox(this);
connect(accountlist_l, SIGNAL(highlighted(int)),
this, SLOT(slotListBoxSelect(int)));
connect(accountlist_l, SIGNAL(selected(int)),
this, SLOT(editaccount()));
l1->addWidget(accountlist_l, 10);
edit_b = new QPushButton(tr("&Edit..."), this);
connect(edit_b, SIGNAL(clicked()), SLOT(editaccount()));
QWhatsThis::add(edit_b, tr("Allows you to modify the selected account"));
l1->addWidget(edit_b);
new_b = new QPushButton(tr("&New..."), this);
connect(new_b, SIGNAL(clicked()), SLOT(newaccount()));
l1->addWidget(new_b);
QWhatsThis::add(new_b, tr("Create a new dialup connection\n"
"to the Internet"));
copy_b = new QPushButton(tr("Co&py"), this);
connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount()));
l1->addWidget(copy_b);
QWhatsThis::add(copy_b,
tr("Makes a copy of the selected account. All\n"
"settings of the selected account are copied\n"
"to a new account, that you can modify to fit your\n"
"needs"));
delete_b = new QPushButton(tr("De&lete"), this);
connect(delete_b, SIGNAL(clicked()), SLOT(deleteaccount()));
l1->addWidget(delete_b);
QWhatsThis::add(delete_b,
tr("<p>Deletes the selected account\n\n"
"<font color=\"red\"><b>Use with care!</b></font>"));
QHBoxLayout *l12 = new QHBoxLayout;
l1->addStretch(1);
l1->addLayout(l12);
+ int currAccId = _pppdata->currentAccountID();
+ qDebug("currentAccountID %i", currAccId);
+
//load up account list from gppdata to the list box
if(_pppdata->count() > 0) {
for(int i=0; i <= _pppdata->count()-1; i++) {
_pppdata->setAccountbyIndex(i);
accountlist_l->insertItem(_pppdata->accname());
}
}
-
+ _pppdata->setAccountbyIndex( currAccId );
qDebug("setting listview index to %i",_pppdata->currentAccountID() );
accountlist_l->setCurrentItem( _pppdata->currentAccountID() );
- slotListBoxSelect( _pppdata->currentAccountID());
+ slotListBoxSelect( _pppdata->currentAccountID() );
l1->activate();
}
void AccountWidget::slotListBoxSelect(int idx) {
delete_b->setEnabled((bool)(idx != -1));
edit_b->setEnabled((bool)(idx != -1));
copy_b->setEnabled((bool)(idx != -1));
if(idx!=-1) {
qDebug("setting account to %i", idx);
QString account = _pppdata->accname();
_pppdata->setAccountbyIndex(accountlist_l->currentItem());
- // _pppdata->setAccount(account);
}
}
-
-// void AccountWidget::viewLogClicked(){
-
-// QApplication::flushX();
-// if(fork() == 0) {
-// setgid(getgid());
-// setuid(getuid());
-// system("kppplogview -kppp");
-// _exit(0);
-// }
-// }
-
-
-// void AccountWidget::resetClicked(){
-// if(accountlist_l->currentItem() == -1)
-// return;
-
-// // QueryReset dlg(this);
-// // int what = dlg.exec();
-
-// // if(what && QueryReset::COSTS) {
-// // emit resetCosts(accountlist_l->text(accountlist_l->currentItem()));
-// // costedit->setText("0");
-// // }
-
-// // if(what && QueryReset::VOLUME) {
-// // emit resetVolume(accountlist_l->text(accountlist_l->currentItem()));
-// // voledit->setText(prettyPrintVolume(0));
-// // }
-// }
-
-
void AccountWidget::editaccount() {
_pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem()));
int result = doTab();
if(result == QDialog::Accepted) {
accountlist_l->changeItem(_pppdata->accname(),accountlist_l->currentItem());
// emit resetaccounts();
_pppdata->save();
}
}
void AccountWidget::newaccount() {
if(accountlist_l->count() == MAX_ACCOUNTS) {
QMessageBox::information(this, "sorry",
tr("Maximum number of accounts reached."));
return;
}
int result;
if (_pppdata->newaccount() == -1){
qDebug("_pppdata->newaccount() == -1");
return;
}
result = doTab();
if(result == QDialog::Accepted) {
accountlist_l->insertItem(_pppdata->accname());
accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()),true);
_pppdata->save();
} else
_pppdata->deleteAccount();
}
void AccountWidget::copyaccount() {
if(accountlist_l->count() == MAX_ACCOUNTS) {
QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached."));
return;
}
if(accountlist_l->currentItem()<0) {
QMessageBox::information(this, "sorry", tr("No account selected."));
return;
}
_pppdata->copyaccount(accountlist_l->currentItem());
accountlist_l->insertItem(_pppdata->accname());
// emit resetaccounts();
_pppdata->save();
}
void AccountWidget::deleteaccount() {
QString s = tr("Are you sure you want to delete\nthe account \"%1\"?")
.arg(accountlist_l->text(accountlist_l->currentItem()));
if(QMessageBox::warning(this, s, tr("Confirm")) != QMessageBox::Yes)
return;
if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem())))
accountlist_l->removeItem(accountlist_l->currentItem());
emit resetaccounts();
_pppdata->save();
slotListBoxSelect(accountlist_l->currentItem());
}
int AccountWidget::doTab(){
QDialog *dlg = new QDialog( 0, "newAccount", true );
QVBoxLayout *layout = new QVBoxLayout( dlg );
layout->setSpacing( 0 );
layout->setMargin( 1 );
tabWindow = new QTabWidget( dlg, "tabWindow" );
layout->addWidget( tabWindow );
bool isnewaccount;
if(_pppdata->accname().isEmpty()) {
dlg->setCaption(tr("New Account"));
isnewaccount = true;
} else {
QString tit = tr("Edit Account: ");
tit += _pppdata->accname();
dlg->setCaption(tit);
isnewaccount = false;
}
// // DIAL WIDGET
dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup");
tabWindow->addTab( dial_w, tr("Dial") );
+// // AUTH WIDGET
+ auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script"));
+ tabWindow->addTab( auth_w, tr("Authentication") );
+
// // IP WIDGET
ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup"));
tabWindow->addTab( ip_w, tr("IP") );
// // GATEWAY WIDGET
gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup"));
tabWindow->addTab( gateway_w, tr("Gateway") );
// // DNS WIDGET
dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") );
tabWindow->addTab( dns_w, tr("DNS") );
-// // SCRIPT WIDGET
- script_w = new ScriptWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script"));
- tabWindow->addTab( script_w, tr("Login Script") );
-
// // EXECUTE WIDGET
ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs"));
tabWindow->addTab( exec_w, tr("Execute") );
int result = 0;
bool ok = false;
while (!ok){
// dlg->showMinimized();
result = dlg->exec();
ok = true;
if(result == QDialog::Accepted) {
- if (!script_w->check()){
- QMessageBox::critical(this, "error", tr("<qt>Login script has unbalanced loop Start/End<qt>"));
+ if (!auth_w->check()){
ok = false;
} else if(!dial_w->save()) {
QMessageBox::critical(this, "error", tr( "You must enter a unique account name"));
ok = false;
}else{
ip_w->save();
dns_w->save();
gateway_w->save();
- script_w->save();
+ auth_w->save();
exec_w->save();
}
}
}
delete dlg;
return result;
}
QString AccountWidget::prettyPrintVolume(unsigned int n) {
int idx = 0;
const QString quant[] = {tr("Byte"), tr("KB"),
tr("MB"), tr("GB"), QString::null};
float n1 = n;
while(n >= 1024 && quant[idx] != QString::null) {
idx++;
n /= 1024;
}
int i = idx;
while(i--)
n1 = n1 / 1024.0;
QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 );
s += " " + quant[idx];
return s;
}
/////////////////////////////////////////////////////////////////////////////
//
// Queries the user what to reset: costs, volume or both
//
/////////////////////////////////////////////////////////////////////////////
// QueryReset::QueryReset(QWidget *parent) : QDialog(parent, 0, true) {
// // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
// setCaption(tr("Reset Accounting"));
// QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
// QVGroupBox *f = new QVGroupBox(tr("What to Reset"), this);
// QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
// // costs = new QCheckBox(tr("Reset the accumulated phone costs"), f);
// // costs->setChecked(true);
// // l1->addWidget(costs);
// // QWhatsThis::add(costs, tr("Check this to set the phone costs\n"
// // "to zero. Typically you'll want to\n"
// // "do this once a month."));
// // volume = new QCheckBox(tr("Reset volume accounting"), f);
// // volume->setChecked(true);
// // l1->addWidget(volume);
// // QWhatsThis::add(volume, tr("Check this to set the volume accounting\n"
// // "to zero. Typically you'll want to do this\n"
// // "once a month."));
// l1->activate();
// // this activates the f-layout and sets minimumSize()
// f->show();
// tl->addWidget(f);
// QButtonGroup *bbox = new QButtonGroup(this);
// // bbox->addStretch(1);
// QPushButton *ok = new QPushButton( bbox, tr("OK") );
// bbox->insert(ok);
// ok->setDefault(true);
// QPushButton *cancel = new QPushButton( bbox, tr("Cancel") );
// bbox->insert(cancel);
// connect(ok, SIGNAL(clicked()),
// this, SLOT(accepted()));
// connect(cancel, SIGNAL(clicked()),
// this, SLOT(reject()));
// bbox->layout();
// tl->addWidget(bbox);
// }
// void QueryReset::accepted() {
// int result = costs->isChecked() ? COSTS : 0;
// result += volume->isChecked() ? VOLUME : 0;
// done(result);
// }
diff --git a/noncore/settings/networksettings/ppp/accounts.h b/noncore/settings/networksettings/ppp/accounts.h
index eae3922..8c16a7c 100644
--- a/noncore/settings/networksettings/ppp/accounts.h
+++ b/noncore/settings/networksettings/ppp/accounts.h
@@ -1,100 +1,86 @@
/* -*- C++ -*-
* kPPP: A pppd front end for the KDE project
*
* $Id$
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _ACCOUNTS_H_
#define _ACCOUNTS_H_
#include <qwidget.h>
#include <qdialog.h>
#include <qpushbutton.h>
#include <qlistbox.h>
//#include "acctselect.h"
class QDialog;
class QCheckBox;
class QLineEdit;
class QTabWidget;
class DialWidget;
-class ScriptWidget;
+class AuthWidget;
class IPWidget;
class DNSWidget;
class GatewayWidget;
class PPPData;
class AccountWidget : public QWidget {
Q_OBJECT
public:
AccountWidget( PPPData *pd, QWidget *parent=0, const char *name=0 );
~AccountWidget() {}
private slots:
void editaccount();
void copyaccount();
void newaccount();
void deleteaccount();
void slotListBoxSelect(int);
private:
int doTab();
signals:
void resetaccounts();
private:
QString prettyPrintVolume(unsigned int);
PPPData *_pppdata;
QTabWidget *tabWindow;
DialWidget *dial_w;
IPWidget *ip_w;
DNSWidget *dns_w;
GatewayWidget *gateway_w;
- ScriptWidget *script_w;
+ AuthWidget *auth_w;
QListBox *accountlist_l;
QPushButton *edit_b;
QPushButton *copy_b;
QPushButton *new_b;
QPushButton *delete_b;
};
-// class QueryReset : public QDialog {
-// Q_OBJECT
-// public:
-// QueryReset(QWidget *parent);
-
-// enum {COSTS=1, VOLUME=2};
-
-// private slots:
-// void accepted();
-
-// private:
-// QCheckBox *costs, *volume;
-// };
-
#endif
diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp
new file mode 100644
index 0000000..86bea98
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/authwidget.cpp
@@ -0,0 +1,195 @@
+
+#include <qlayout.h>
+#include <qmessagebox.h>
+#include <qtoolbutton.h>
+#include <qwhatsthis.h>
+
+#include "auth.h"
+#include "authwidget.h"
+#include "edit.h"
+#include "pppdata.h"
+
+
+static const char* const image0_data[] = {
+"16 16 2 1",
+". c None",
+"# c #000000",
+"................",
+"...#...###...##.",
+"..#.#..#..#.##..",
+"..###..###.##...",
+".#...#.#..##....",
+".#...#.#.##.....",
+"........##.#..#.",
+"..##...##...##..",
+".#..#.###...##..",
+".#...##..#.#..#.",
+".#..##..........",
+".#.##.#..#.#..#.",
+"..##...##...##..",
+".##....##...##..",
+".#....#..#.#..#.",
+"................"};
+
+
+AuthWidget::AuthWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
+ : QWidget( parent, name),
+ scriptWidget(0),
+ _pppdata(pd),
+ isNewAccount(isnewaccount)
+{
+ layout = new QGridLayout(this);
+
+ auth_l = new QLabel(tr("Authentication: "), this);
+ layout->addWidget(auth_l, 0, 0);
+
+ auth = new QComboBox(this);
+ auth->insertItem(tr("Script-based"));
+ auth->insertItem(tr("PAP"));
+ auth->insertItem(tr("Terminal-based"));
+ auth->insertItem(tr("CHAP"));
+ auth->insertItem(tr("PAP/CHAP"));
+ layout->addWidget(auth, 0, 1);
+
+ connect( auth, SIGNAL(activated(const QString&)),
+ SLOT(authChanged(const QString&)));
+
+ QString tmp = tr("<p>Specifies the method used to identify yourself to\n"
+ "the PPP server. Most universities still use\n"
+ "<b>Terminal</b>- or <b>Script</b>-based authentication,\n"
+ "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n"
+ "unsure, contact your ISP.\n"
+ "\n"
+ "If you can choose between PAP and CHAP,\n"
+ "choose CHAP, because it's much safer. If you don't know\n"
+ "whether PAP or CHAP is right, choose PAP/CHAP.");
+
+ QWhatsThis::add(auth_l,tmp);
+ QWhatsThis::add(auth,tmp);
+
+ user_l = new QLabel( tr("Username: "), this);
+ layout->addWidget( user_l, 1, 0 );
+ userName = new QLineEdit( this, "usernameEdit" );
+ layout->addWidget( userName, 1, 1 );
+ tmp = tr("Enter your username here...");
+ QWhatsThis::add( user_l, tmp );
+ QWhatsThis::add( userName, tmp );
+
+ pw_l = new QLabel( tr("Password: "), this);
+ layout->addWidget( pw_l, 2, 0 );
+ passWord = new QLineEdit( this, "pw" );
+ passWord->setAutoMask( true );
+ passWord->setEchoMode( QLineEdit::Password );
+ layout->addWidget( passWord, 2, 1 );
+ hidePw = new QToolButton( this );
+ hidePw->setPixmap( QPixmap( ( const char** ) image0_data ) );
+ hidePw->setToggleButton( true );
+ layout->addWidget( hidePw, 2, 2 );
+
+ connect(hidePw, SIGNAL(toggled(bool)), SLOT(toggleEchoMode(bool)));
+
+ tmp = tr("Enter your password here");
+ QWhatsThis::add( pw_l, tmp );
+ QWhatsThis::add( passWord, tmp );
+
+ store_password = new QCheckBox(tr("Store password"), this);
+ layout->addMultiCellWidget(store_password, 3, 3, 0, 1, AlignRight);
+ QWhatsThis::add(store_password,
+ tr("<p>When this is turned on, your ISP password\n"
+ "will be saved in <i>kppp</i>'s config file, so\n"
+ "you do not need to type it in every time.\n"
+ "\n"
+ "<b><font color=\"red\">Warning:</font> your password will be stored as\n"
+ "plain text in the config file, which is\n"
+ "readable only to you. Make sure nobody\n"
+ "gains access to this file!"));
+
+ if (isNewAccount){
+ // select PAP/CHAP as default
+ auth->setCurrentItem(AUTH_PAPCHAP);
+ store_password->setChecked(true);
+ }else{
+ auth->setCurrentItem(_pppdata->authMethod());
+ authChanged( auth->currentText() );
+ userName->setText( _pppdata->storedUsername() );
+ store_password->setChecked(_pppdata->storePassword());
+ if (store_password->isChecked())
+ passWord->setText( _pppdata->storedPassword() );
+ }
+}
+
+bool AuthWidget::check()
+{
+ bool ret = true;
+ if (scriptWidget){
+ if (!scriptWidget->check()){
+ QMessageBox::critical(this, tr("error"), tr("<qt>Login script has unbalanced loop Start/End<qt>"));
+ ret = false;
+ }
+ }
+ return ret;
+}
+
+void AuthWidget::save()
+{
+ _pppdata->setAuthMethod(auth->currentItem());
+ if (scriptWidget) scriptWidget->save();
+ _pppdata->setStoredUsername( userName->text() );
+ _pppdata->setStorePassword(store_password->isChecked());
+ if (store_password->isChecked())
+ _pppdata->setStoredPassword( passWord->text() );
+}
+
+void AuthWidget::authChanged( const QString &authStr )
+{
+ qDebug("AuthWidget::authChanged( %s )", authStr.latin1() );
+ if ( authStr.contains( tr("Script-based") ) ){
+ showUsernamePassword( false );
+ showScriptWindow( true );
+ } else if ( authStr.contains( tr("PAP") ) ||
+ authStr.contains( tr("CHAP") ) ){
+ showUsernamePassword( true );
+ showScriptWindow( false );
+ } else {
+ qDebug("do not really know how to handle");
+ showUsernamePassword( false );
+ showScriptWindow( false );
+ }
+}
+
+
+void AuthWidget::showUsernamePassword( bool show )
+{
+ if (show){
+ user_l->show();
+ userName->show();
+ pw_l->show();
+ passWord->show();
+ store_password->show();
+ }else{//!show
+ user_l->hide();
+ userName->hide();
+ pw_l->hide();
+ passWord->hide();
+ store_password->hide();
+ }
+}
+
+void AuthWidget::showScriptWindow( bool show )
+{
+ if (show){
+ if (!scriptWidget){
+ scriptWidget = new ScriptWidget( _pppdata, this, isNewAccount, "scriptWid");
+ layout->addMultiCellWidget( scriptWidget, 1, 4, 0, 1 );
+ }
+ scriptWidget->show();
+ }else{ // !show
+ if (scriptWidget) scriptWidget->hide();
+ }
+}
+
+void AuthWidget::toggleEchoMode( bool t )
+{
+ passWord->setEchoMode( t ? QLineEdit::Normal : QLineEdit::Password );
+}
+
diff --git a/noncore/settings/networksettings/ppp/authwidget.h b/noncore/settings/networksettings/ppp/authwidget.h
new file mode 100644
index 0000000..33ec4c2
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/authwidget.h
@@ -0,0 +1,46 @@
+#ifndef _AUTHWIDGET_H
+#define _AUTHWIDGET_H
+
+#include <qwidget.h>
+
+class ScriptWidget;
+class PPPData;
+class QCheckBox;
+class QComboBox;
+class QLabel;
+class QGridLayout;
+class QLineEdit;
+class QToolButton;
+
+class AuthWidget : public QWidget {
+ Q_OBJECT
+public:
+ AuthWidget(PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
+ ~AuthWidget() {};
+
+public slots:
+ bool check();
+ void save();
+
+private slots:
+ void authChanged(const QString&);
+ void showUsernamePassword(bool);
+ void showScriptWindow(bool);
+ void toggleEchoMode(bool);
+
+private:
+ ScriptWidget *scriptWidget;
+ PPPData *_pppdata;
+ bool isNewAccount;
+ QGridLayout *layout;
+ QComboBox *auth;
+ QLabel *auth_l;
+ QLabel *user_l;
+ QLineEdit *userName;
+ QLabel *pw_l;
+ QLineEdit *passWord;
+ QToolButton *hidePw;
+ QCheckBox *store_password;
+};
+
+#endif
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index 89d9930..a93f93d 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -1,318 +1,319 @@
/*
* kPPP: A pppd front end for the KDE project
*
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
* Copyright (C) 1998-2001 Harri Porten <porten@kde.org>
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//#include <config.h>
#include <qlayout.h>
#include <qregexp.h>
#include <qapplication.h>
//#include <kdebug.h>
//#include <klocale.h>
#define i18n QObject::tr
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <assert.h>
#ifdef _XPG4_2
#define __xnet_connect connect
#endif
#include <errno.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef __linux__
#include "runtests.h"
#endif
#include "auth.h"
#include "connect.h"
//#include "docking.h"
#include "interfaceppp.h"
#include "modem.h"
#include "kpppconfig.h"
#include "pppdata.h"
#include "kpppwidget.h"
//#include "requester.h"
//#include "utils.h"
#define execute_command system
QString old_hostname;
bool modified_hostname;
ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *name)
: QWidget(parent, name),
myreadbuffer(""),
main_timer_ID(0),
vmain(0),
substate(-1),
scriptindex(0),
loopnest(0),
loopend(false),
semaphore(false),
expecting(false),
readbuffer(""),
scanvar(""),
scanning(false),
pausing(false),
dialnumber(0),
_ifaceppp(ifp)
{
modified_hostname = false;
QVBoxLayout *tl = new QVBoxLayout(this, 8, 10);
QString tit = i18n("Connecting to: ");
setCaption(tit);
QHBoxLayout *l0 = new QHBoxLayout(10);
tl->addLayout(l0);
l0->addSpacing(10);
messg = new QLabel(this, "messg");
messg->setFrameStyle(QFrame::Panel|QFrame::Sunken);
messg->setAlignment(AlignCenter);
messg->setText(i18n("Unable to create modem lock file."));
messg->setMinimumHeight(messg->sizeHint().height() + 5);
// int messw = (messg->sizeHint().width() * 12) / 10;
// messw = QMAX(messw,280);
// messg->setMinimumWidth(messw);
messg->setText(i18n("Offline"));
l0->addSpacing(10);
l0->addWidget(messg);
l0->addSpacing(10);
QHBoxLayout *l1 = new QHBoxLayout(10);
tl->addLayout(l1);
l1->addStretch(1);
debug = new QPushButton(i18n("Log"), this);
debug->setToggleButton(true);
+ debug->setEnabled( false ); // FIXME: disable the log button
connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow()));
cancel = new QPushButton(i18n("Cancel"), this);
cancel->setFocus();
connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton()));
// int maxw = QMAX(cancel->sizeHint().width(),
// debug->sizeHint().width());
// maxw = QMAX(maxw,65);
// debug->setFixedWidth(maxw);
// cancel->setFixedWidth(maxw);
l1->addWidget(debug);
l1->addWidget(cancel);
// setFixedSize(sizeHint());
pausetimer = new QTimer(this);
connect(pausetimer, SIGNAL(timeout()), SLOT(pause()));
qApp->processEvents();
timeout_timer = new QTimer(this);
connect(timeout_timer, SIGNAL(timeout()), SLOT(script_timed_out()));
inittimer = new QTimer(this);
connect(inittimer, SIGNAL(timeout()), SLOT(init()));
if_timeout_timer = new QTimer(this);
connect(if_timeout_timer, SIGNAL(timeout()), SLOT(if_waiting_timed_out()));
connect(this,SIGNAL(if_waiting_signal()),this,SLOT(if_waiting_slot()));
prompt = new PWEntry( this, "pw" );
if_timer = new QTimer(this);
connect(if_timer,SIGNAL(timeout()), SLOT(if_waiting_slot()));
}
ConnectWidget::~ConnectWidget() {
}
void ConnectWidget::preinit() {
// this is all just to keep the GUI nice and snappy ....
// you have to see to believe ...
messg->setText(i18n("Looking for modem..."));
inittimer->start(100);
}
void ConnectWidget::init() {
_ifaceppp->data()->setpppdError(0);
inittimer->stop();
vmain = 0;
substate = -1;
expecting = false;
pausing = false;
scriptindex = 0;
myreadbuffer = "";
scanning = false;
scanvar = "";
firstrunID = true;
firstrunPW = true;
// stats->totalbytes = 0;
dialnumber = 0;
// p_kppp->con_speed = "";
// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || _ifaceppp->data()->quit_on_disconnect());
comlist = &_ifaceppp->data()->scriptType();
arglist = &_ifaceppp->data()->script();
QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname());
setCaption(tit);
qApp->processEvents();
// run the "before-connect" command
if (!_ifaceppp->data()->command_before_connect().isEmpty()) {
messg->setText(i18n("Running pre-startup command..."));
emit debugMessage(i18n("Running pre-startup command..."));
qApp->processEvents();
QApplication::flushX();
pid_t id = execute_command(_ifaceppp->data()->command_before_connect());
// int i, status;
// do {
// qApp->processEvents();
// i = waitpid(id, &status, WNOHANG);
// usleep(100000);
// } while (i == 0 && errno == 0);
}
int lock = _ifaceppp->modem()->lockdevice();
if (lock == 1) {
messg->setText(i18n("Modem device is locked."));
vmain = 20; // wait until cancel is pressed
return;
}
if (lock == -1) {
messg->setText(i18n("Unable to create modem lock file."));
vmain = 20; // wait until cancel is pressed
return;
}
if(_ifaceppp->modem()->opentty()) {
messg->setText(_ifaceppp->modem()->modemMessage());
qApp->processEvents();
if(_ifaceppp->modem()->hangup()) {
qApp->processEvents();
semaphore = false;
_ifaceppp->modem()->stop();
_ifaceppp->modem()->notify(this, SLOT(readChar(unsigned char)));
// if we are stuck anywhere we will time out
timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
// this timer will run the script etc.
main_timer_ID = startTimer(10);
return;
}
}
// initialization failed
messg->setText(_ifaceppp->modem()->modemMessage());
vmain = 20; // wait until cancel is pressed
_ifaceppp->modem()->unlockdevice();
}
void ConnectWidget::timerEvent(QTimerEvent *) {
if (semaphore || pausing)
return;
if(vmain == 0) {
#ifdef DEBUG_WO_DIALING
vmain = 10;
return;
#endif
assert(PPPData::NumInitStrings > 0);
// first init string ?
if(substate == -1) {
messg->setText(i18n("Initializing modem..."));
emit debugMessage(i18n("Initializing modem..."));
substate = 0;
}
QString initStr = _ifaceppp->data()->modemInitStr(substate);
if (!initStr.isEmpty()) {
// send a carriage return and then wait a bit so that the modem will
// let us issue commands.
if(_ifaceppp->data()->modemPreInitDelay() > 0) {
usleep(_ifaceppp->data()->modemPreInitDelay() * 5000);
writeline("");
usleep(_ifaceppp->data()->modemPreInitDelay() * 5000);
}
setExpect(_ifaceppp->data()->modemInitResp());
writeline(initStr);
usleep(_ifaceppp->data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
}
substate++;
/*
* FIXME after 3.0: Make it possible to disable ATS11 since it
* seems to be incompatible with some ISDN adapters (e.g. DataBox
* Speed Dragon). Even better would be to detect this when doing
* a "Modem Query"
*/
if (MODEM_TONEDURATION != _ifaceppp->data()->modemToneDuration())
vmain = 5;
else
vmain = 3;
return;
}
if (vmain == 5) {
if(!expecting) {
QString sToneDuration = "ATS11=" + QString::number(_ifaceppp->data()->modemToneDuration());
QString msg = i18n("Setting ") + sToneDuration;
messg->setText(msg);
emit debugMessage(msg);
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index 45d6e4f..b880978 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -1,391 +1,347 @@
/*
* kPPP: A pppd Front End for the KDE project
*
* $Id$
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string.h>
#include <termios.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qwhatsthis.h>
#include <qregexp.h>
#include <qapplication.h>
#include <qbuttongroup.h>
#include <qvgroupbox.h>
#include <qhbox.h>
#include <qdialog.h>
+#include <qpe/resource.h>
#include "edit.h"
#include "pppdata.h"
#include "iplined.h"
#include "auth.h"
DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
, const char *name )
: QWidget(parent, name), _pppdata(pd)
{
const int GRIDROWS = 6;
- QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint());
+ QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );
connect_label = new QLabel(tr("Connection name:"), this);
tl->addWidget(connect_label, 0, 0);
connectname_l = new QLineEdit(this);
// connectname_l->setMaxLength(ACCNAME_SIZE);
tl->addWidget(connectname_l, 0, 1);
QString tmp = tr("Type in a unique name for this connection");
QWhatsThis::add(connect_label,tmp);
QWhatsThis::add(connectname_l,tmp);
number_label = new QLabel(tr("Phone number:"), this);
number_label->setAlignment(AlignTop|AlignLeft);
tl->addWidget(number_label, 1, 0);
QHBoxLayout *lpn = new QHBoxLayout(5);
tl->addLayout(lpn, 1, 1);
numbers = new QListBox(this);
// numbers->setMinimumSize(120, 70);
lpn->addWidget(numbers);
QVBoxLayout *lpn1 = new QVBoxLayout;
lpn->addLayout(lpn1);
add = new QPushButton(tr("&Add..."), this);
del = new QPushButton(tr("&Remove"), this);
up = new QPushButton(this);
-//FIXME: QPixmap pm = BarIcon("up");
-// up->setPixmap(pm);
+ up->setPixmap( Resource::loadPixmap("inline/up") );
down = new QPushButton(this);
-//FIXME: pm = BarIcon("down");
-// down->setPixmap(pm);
+ down->setPixmap( Resource::loadPixmap("inline/down") );
lpn1->addWidget(add);
lpn1->addWidget(del);
lpn1->addStretch(1);
lpn1->addWidget(up);
lpn1->addWidget(down);
connect(add, SIGNAL(clicked()),
this, SLOT(addNumber()));
connect(del, SIGNAL(clicked()),
this, SLOT(delNumber()));
connect(up, SIGNAL(clicked()),
this, SLOT(upNumber()));
connect(down, SIGNAL(clicked()),
this, SLOT(downNumber()));
connect(numbers, SIGNAL(highlighted(int)),
this, SLOT(selectionChanged(int)));
numbersChanged();
tmp = tr("<p>Specifies the phone numbers to dial. You\n"
"can supply multiple numbers here, simply\n"
"click on \"Add\". You can arrange the\n"
"order the numbers are tried by using the\n"
"arrow buttons.\n\n"
"When a number is busy or fails, <i>kppp</i> will \n"
"try the next number and so on");
QWhatsThis::add(number_label,tmp);
QWhatsThis::add(numbers,tmp);
- auth_l = new QLabel(tr("Authentication:"), this);
- tl->addWidget(auth_l, 3, 0);
-
- auth = new QComboBox(this);
- auth->insertItem(tr("Script-based"));
- auth->insertItem(tr("PAP"));
- auth->insertItem(tr("Terminal-based"));
- auth->insertItem(tr("CHAP"));
- auth->insertItem(tr("PAP/CHAP"));
- tl->addWidget(auth, 3, 1);
- tmp = tr("<p>Specifies the method used to identify yourself to\n"
- "the PPP server. Most universities still use\n"
- "<b>Terminal</b>- or <b>Script</b>-based authentication,\n"
- "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n"
- "unsure, contact your ISP.\n"
- "\n"
- "If you can choose between PAP and CHAP,\n"
- "choose CHAP, because it's much safer. If you don't know\n"
- "whether PAP or CHAP is right, choose PAP/CHAP.");
-
- QWhatsThis::add(auth_l,tmp);
- QWhatsThis::add(auth,tmp);
-
- store_password = new QCheckBox(tr("Store password"), this);
- store_password->setChecked(true);
- tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight);
- QWhatsThis::add(store_password,
- tr("<p>When this is turned on, your ISP password\n"
- "will be saved in <i>kppp</i>'s config file, so\n"
- "you do not need to type it in every time.\n"
- "\n"
- "<b><font color=\"red\">Warning:</font> your password will be stored as\n"
- "plain text in the config file, which is\n"
- "readable only to you. Make sure nobody\n"
- "gains access to this file!"));
-
pppdargs = new QPushButton(tr("Customize pppd Arguments..."), this);
connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton()));
tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter);
// Set defaults if editing an existing connection
if(!isnewaccount) {
connectname_l->setText(_pppdata->accname());
// insert the phone numbers into the listbox
QString n = _pppdata->phonenumber();
QString tmp = "";
uint idx = 0;
while(idx != n.length()) {
if(n[idx] == ':') {
if(tmp.length() > 0)
numbers->insertItem(tmp);
tmp = "";
} else
tmp += n[idx];
idx++;
}
if(tmp.length() > 0)
numbers->insertItem(tmp);
- auth->setCurrentItem(_pppdata->authMethod());
- store_password->setChecked(_pppdata->storePassword());
- } else {
- // select PAP/CHAP as default
- auth->setCurrentItem(AUTH_PAPCHAP);
}
numbersChanged();
tl->activate();
}
bool DialWidget::save() {
//first check to make sure that the account name is unique!
if(connectname_l->text().isEmpty() ||
!_pppdata->isUniqueAccname(connectname_l->text())) {
return false;
} else {
_pppdata->setAccname(connectname_l->text());
QString number = "";
for(uint i = 0; i < numbers->count(); i++) {
if(i != 0)
number += ":";
number += numbers->text(i);
}
_pppdata->setPhonenumber(number);
- _pppdata->setAuthMethod(auth->currentItem());
- _pppdata->setStorePassword(store_password->isChecked());
return true;
}
}
void DialWidget::numbersChanged() {
int sel = numbers->currentItem();
del->setEnabled(sel != -1);
up->setEnabled(sel != -1 && sel != 0);
down->setEnabled(sel != -1 && sel != (int)numbers->count()-1);
}
void DialWidget::selectionChanged(int) {
numbersChanged();
}
void DialWidget::addNumber() {
PhoneNumberDialog dlg(this);
if(dlg.exec()) {
numbers->insertItem(dlg.phoneNumber());
numbersChanged();
}
}
void DialWidget::delNumber() {
if(numbers->currentItem() != -1) {
numbers->removeItem(numbers->currentItem());
numbersChanged();
}
}
void DialWidget::upNumber() {
int idx = numbers->currentItem();
if(idx != -1) {
QString item = numbers->text(idx);
numbers->removeItem(idx);
numbers->insertItem(item, idx-1);
numbers->setCurrentItem(idx-1);
numbersChanged();
}
}
void DialWidget::downNumber() {
int idx = numbers->currentItem();
if(idx != -1) {
QString item = numbers->text(idx);
numbers->removeItem(idx);
numbers->insertItem(item, idx+1);
numbers->setCurrentItem(idx+1);
numbersChanged();
}
}
void DialWidget::pppdargsbutton() {
PPPdArguments pa(_pppdata, this);
pa.exec();
}
/////////////////////////////////////////////////////////////////////////////
// ExecWidget
/////////////////////////////////////////////////////////////////////////////
ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) :
QWidget(parent, name), _pppdata(pd)
{
QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
QLabel *l = new QLabel( tr("Here you can select commands to run at certain stages of the connection. The commands are run with your real user id, so you cannot run any commands here requiring root permissions (unless, of course, you are root).<br><br>Be sure to supply the whole path to the program otherwise we might be unable to find it."), this);
tl->addWidget(l);
tl->addStretch(1);
QGridLayout *l1 = new QGridLayout(4, 2, 10);
tl->addLayout(l1);
l1->setColStretch(0, 0);
l1->setColStretch(1, 1);
before_connect_l = new QLabel(tr("Before connect:"), this);
before_connect_l->setAlignment(AlignVCenter);
l1->addWidget(before_connect_l, 0, 0);
before_connect = new QLineEdit(this);
// before_connect->setMaxLength(COMMAND_SIZE);
l1->addWidget(before_connect, 0, 1);
QString tmp = tr("Allows you to run a program <b>before</b> a connection\n"
"is established. It is called immediately before\n"
"dialing has begun.\n\n"
"This might be useful, e.g. to stop HylaFAX blocking the\n"
"modem.");
QWhatsThis::add(before_connect_l,tmp);
QWhatsThis::add(before_connect,tmp);
command_label = new QLabel(tr("Upon connect:"), this);
command_label->setAlignment(AlignVCenter);
l1->addWidget(command_label, 1, 0);
command = new QLineEdit(this);
// command->setMaxLength(COMMAND_SIZE);
l1->addWidget(command, 1, 1);
tmp = tr("Allows you to run a program <b>after</b> a connection\n"
"is established. When your program is called, all\n"
"preparations for an Internet connection are finished.\n"
"\n"
"Very useful for fetching mail and news");
QWhatsThis::add(command_label,tmp);
QWhatsThis::add(command,tmp);
predisconnect_label = new QLabel(tr("Before disconnect:"),
this);
predisconnect_label->setAlignment(AlignVCenter);
l1->addWidget(predisconnect_label, 2, 0);
predisconnect = new QLineEdit(this);
// predisconnect->setMaxLength(COMMAND_SIZE);
l1->addWidget(predisconnect, 2, 1);
tmp = tr("Allows you to run a program <b>before</b> a connection\n"
"is closed. The connection will stay open until\n"
"the program exits.");
QWhatsThis::add(predisconnect_label,tmp);
QWhatsThis::add(predisconnect,tmp);
discommand_label = new QLabel(tr("Upon disconnect:"),
this);
discommand_label->setAlignment(AlignVCenter);
l1->addWidget(discommand_label, 3, 0);
discommand = new QLineEdit(this);
// discommand->setMaxLength(COMMAND_SIZE);
l1->addWidget(discommand, 3, 1);
tmp = tr("Allows you to run a program <b>after</b> a connection\n"
"has been closed.");
QWhatsThis::add(discommand_label,tmp);
QWhatsThis::add(discommand,tmp);
// extra space between entries
l1->addRowSpacing(1, 5);
l1->addRowSpacing(3, 5);
tl->addStretch(1);
tl->activate();
// Set defaults if editing an existing connection
if(!isnewaccount) {
before_connect->setText(_pppdata->command_before_connect());
command->setText(_pppdata->command_on_connect());
discommand->setText(_pppdata->command_on_disconnect());
predisconnect->setText(_pppdata->command_before_disconnect());
}
}
bool ExecWidget::save() {
_pppdata->setCommand_before_connect(before_connect->text());
_pppdata->setCommand_on_connect(command->text());
_pppdata->setCommand_before_disconnect(predisconnect->text());
_pppdata->setCommand_on_disconnect(discommand->text());
return true;
}
/////////////////////////////////////////////////////////////////////////////
//
// IPWidget
//
/////////////////////////////////////////////////////////////////////////////
IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
: QWidget(parent, name), _pppdata(pd)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setSpacing( 3 );//KDialog::spacingHint());
box = new QVGroupBox(tr("Configuration"), this);
// box->setInsideSpacing( 1 );//KDialog::spacingHint());
rb = new QButtonGroup(this);
rb->hide();
connect(rb, SIGNAL(clicked(int)),
SLOT(hitIPSelect(int)));
dynamicadd_rb = new QRadioButton(box);
dynamicadd_rb->setText(tr("Dynamic IP address"));
QWhatsThis::add(dynamicadd_rb,
diff --git a/noncore/settings/networksettings/ppp/edit.h b/noncore/settings/networksettings/ppp/edit.h
index 2cc0fed..8b5ec03 100644
--- a/noncore/settings/networksettings/ppp/edit.h
+++ b/noncore/settings/networksettings/ppp/edit.h
@@ -1,259 +1,256 @@
/* -*- C++ -*-
*
* kPPP: A pppd Front End for the KDE project
*
* $Id$
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _EDIT_H_
#define _EDIT_H_
#include <qdialog.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qvgroupbox.h>
#include <qscrollbar.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlistbox.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qlabel.h>
//#include <kdialogbase.h>
#include "scriptedit.h"
#include "kpppconfig.h"
#include "pppdargs.h"
class IPLineEdit;
class PPPData;
class DialWidget : public QWidget {
Q_OBJECT
public:
DialWidget( PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
~DialWidget() {}
public slots:
bool save();
void pppdargsbutton();
void numbersChanged();
void selectionChanged(int);
void addNumber();
void delNumber();
void upNumber();
void downNumber();
private:
QLineEdit *connectname_l;
QLabel *connect_label;
QLabel *number_label;
QPushButton *pppdargs;
- QComboBox *auth;
- QLabel *auth_l;
- QCheckBox *store_password;
// for the phonenumber selection
QPushButton *add, *del, *up, *down;
QListBox *numbers;
PPPData *_pppdata;
};
/////////////////////////////////////////////////////////////////////////////
//
// tab-window to select what to execute when
//
/////////////////////////////////////////////////////////////////////////////
class ExecWidget : public QWidget {
Q_OBJECT
public:
ExecWidget(PPPData*, QWidget *parent=0, bool isnewaccount=true, const char *name=0);
public slots:
bool save();
private:
QLineEdit *before_connect;
QLabel *before_connect_l;
QLineEdit *command;
QLabel *command_label;
QLineEdit *predisconnect;
QLabel *predisconnect_label;
QLineEdit *discommand;
QLabel *discommand_label;
PPPData *_pppdata;
};
class IPWidget : public QWidget {
Q_OBJECT
public:
IPWidget(PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
~IPWidget() {}
public slots:
void save();
protected slots:
void hitIPSelect( int );
void autoname_t(bool on);
private:
QLabel *ipaddress_label;
QLabel *sub_label;
QGroupBox *box1;
QVGroupBox *box;
QButtonGroup *rb;
QRadioButton *dynamicadd_rb;
QRadioButton *staticadd_rb;
IPLineEdit *ipaddress_l;
IPLineEdit *subnetmask_l;
QCheckBox *autoname;
PPPData *_pppdata;
};
class DNSWidget : public QWidget {
Q_OBJECT
public:
DNSWidget( PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
~DNSWidget() {}
public slots:
void save();
protected slots:
void adddns();
void removedns();
void DNS_Edit_Changed(const QString &);
void DNS_Entry_Selected(int);
void DNS_Mode_Selected(int);
private:
QLabel *conf_label;
QButtonGroup *bg;
QRadioButton *autodns, *mandns;
QLabel *dns_label;
QLabel *servers_label;
IPLineEdit *dnsipaddr;
QPushButton *add;
QPushButton *remove;
QListBox *dnsservers;
QLineEdit *dnsdomain;
QLabel *dnsdomain_label;
QCheckBox *exdnsdisabled_toggle;
PPPData *_pppdata;
};
class GatewayWidget : public QWidget {
Q_OBJECT
public:
GatewayWidget(PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
~GatewayWidget() {}
public slots:
void save();
private slots:
void hitGatewaySelect( int );
private:
QGroupBox *box;
QLabel *gate_label;
QGroupBox *box1;
QButtonGroup *rb;
QRadioButton *defaultgateway;
QRadioButton *staticgateway;
IPLineEdit *gatewayaddr;
QCheckBox *defaultroute;
PPPData *_pppdata;
};
class ScriptWidget : public QWidget {
Q_OBJECT
public:
ScriptWidget(PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
~ScriptWidget() {}
public slots:
void save();
bool check();
private slots:
void addButton();
void insertButton();
void removeButton();
//signals linked to the scroll bar
void scrolling(int);
//signals to keep the two listboxes highlighted in sync
void slhighlighted(int);
void stlhighlighted(int);
private:
void adjustScrollBar();
ScriptEdit *se;
QPushButton *add;
QPushButton *remove;
QPushButton *insert;
QListBox *sl, *stl;
QScrollBar *slb;
PPPData *_pppdata;
};
/////////////////////////////////////////////////////////////////////////////
//
// Used to specify a new phone number
//
/////////////////////////////////////////////////////////////////////////////
class PhoneNumberDialog : public QDialog {
Q_OBJECT
public:
PhoneNumberDialog(QWidget *parent = 0);
QString phoneNumber();
private slots:
void textChanged(const QString &);
private:
QLineEdit *le;
};
#endif
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
index 3cf1167..553daa2 100644
--- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
@@ -1,32 +1,37 @@
#include "interfaceinformationppp.h"
#include <qpushbutton.h>
#include <qlabel.h>
//#include <qgroupbox.h>
#include <qmessagebox.h>
+#include <qabstractlayout.h>
#include "connect.h"
#include "conwindow.h"
#ifdef QWS
#else
#define showMaximized show
#endif
/**
* Constructor for the InterfaceInformationImp class. This class pretty much
* just display's information about the interface that is passed to it.
*/
InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f)
:InterfaceInformationImp(parent, name, i, f)
{
qDebug("InterfaceInformationPPP::InterfaceInformationPPP");
con = new ConnectWidget( (InterfacePPP*)i, this, "con" );
- // InterfaceInformationLayout->addMultiCellWidget( con, 7, 7, 0, 1 );
- InterfaceInformationLayout->addWidget( con, 7, 0 );
+ con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding,
+ QSizePolicy::Fixed) );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ InterfaceInformationLayout->addItem( spacer, 7, 0 );
+ InterfaceInformationLayout->addMultiCellWidget( con, 8, 8, 0, 1 );
+ // InterfaceInformationLayout->addWidget( con, 7, 0 );
connect(i, SIGNAL(begin_connect()),con, SLOT(preinit()));
}
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp
index dc24824..98bb4da 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp
@@ -1,141 +1,140 @@
#include <qmessagebox.h>
#define i18n QObject::tr
#include "auth.h"
#include "interfaceppp.h"
#include "modem.h"
#include "pppdata.h"
InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
: Interface(parent, name, status),
_modemPtr(0),
_dataPtr(0)
{
qDebug("InterfacePPP::InterfacePPP(");
}
PPPData* InterfacePPP::data()
{
if (!_dataPtr){
qDebug("creating new Data obj");
_dataPtr = new PPPData();
_dataPtr->setModemDevice( getInterfaceName() );
_dataPtr->setAccount( getHardwareName() );
}
return _dataPtr;
}
Modem* InterfacePPP::modem()
{
if (!_modemPtr){
qDebug("creating new modem obj");
_modemPtr = new Modem( data() );
}
return _modemPtr;
}
bool InterfacePPP::refresh()
{
qDebug("InterfacePPP::refresh()");
QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-(");
return false;
}
void InterfacePPP::start()
{
qDebug("InterfacePPP::start");
- if (data()->storedPassword() != "" ){
- data()->setPassword(data()->storedPassword());
- }else{
- //FIXME:
+ if (data()->password().isEmpty() ){
+//FIXME: ask for password
qDebug("using dummy password");
- data()->setPassword( "dummy" );
+ QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)");
}
QFileInfo info(pppdPath());
if(!info.exists()){
QMessageBox::warning(0, tr("Error"),
i18n("<qt>Cannot find the PPP daemon!<br>"
"Make sure that pppd is installed and "
"that you have entered the correct path.</qt>"));
return;
}
//#if 0
if(!info.isExecutable()){
QString string;
string = i18n( "<qt>Cannot execute:<br> %1<br>"
"Please make sure that you have given "
"setuid permission and that "
"pppd is executable.<br>").arg(pppdPath());
QMessageBox::warning(0, tr("Error"), string);
return;
}
//#endif
QFileInfo info2(data()->modemDevice());
if(!info2.exists()){
QString string;
string = i18n( "<qt>Cannot find:<br> %1<br>"
"Please make sure you have setup "
"your modem device properly "
"and/or adjust the location of the modem device on "
"the modem tab of "
"the setup dialog.</qt>").arg(data()->modemDevice());
QMessageBox::warning(0, tr("Error"), string);
return;
}
// if this is a PAP or CHAP account, ensure that username is
// supplied
if(data()->authMethod() == AUTH_PAP ||
data()->authMethod() == AUTH_CHAP ||
data()->authMethod() == AUTH_PAPCHAP ) {
- if(false){ //ID_Edit->text().isEmpty()) {
+ if(false){ //FIXME: ID_Edit->text().isEmpty()) {
QMessageBox::warning(0,tr("Error"),
i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>"));
// FIXME: return;
} else {
if(!modem()->setSecret(data()->authMethod(),
PPPData::encodeWord(data()->storedUsername()),
PPPData::encodeWord(data()->password()))
) {
QString s;
s = i18n("<qt>Cannot create PAP/CHAP authentication<br>"
"file \"%1\"</qt>").arg(PAP_AUTH_FILE);
QMessageBox::warning(0, tr("Error"), s);
return;
}
}
}
if (data()->phonenumber().isEmpty()) {
QString s = i18n("You must specify a telephone number!");
QMessageBox::warning(0, tr("Error"), s);
return;
}
-// this->hide();
-
- QString tit = i18n("Connecting to: %1").arg(data()->accname());
-// con->setCaption(tit);
-
-// con->show();
-
+ // SEGFAULTS:
+// setStatus( true );
+// emit updateInterface((Interface*) this);
emit begin_connect();
qDebug("InterfacePPP::start END");
}
void InterfacePPP::stop()
{
qDebug("InterfacePPP::stop");
}
+void InterfacePPP::save()
+{
+ data()->save();
+ emit updateInterface((Interface*) this);
+}
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.h b/noncore/settings/networksettings/ppp/interfaceppp.h
index 06a4dbf..6eb6a69 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.h
+++ b/noncore/settings/networksettings/ppp/interfaceppp.h
@@ -1,33 +1,34 @@
#ifndef INTERFACEPPP_H
#define INTERFACEPPP_H
#include "interface.h"
class PPPData;
class Modem;
class InterfacePPP : public Interface
{
Q_OBJECT
public:
InterfacePPP(QObject *parent=0, const char *name="PPP", bool status=false);
PPPData* data();
Modem* modem();
signals:
void begin_connect();
public slots:
virtual bool refresh();
virtual void start();
virtual void stop();
+ void save();
private:
Modem *_modemPtr;
PPPData *_dataPtr;
};
#endif
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index 289e9f5..7b5c74d 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -411,385 +411,385 @@ void KPPPWidget::log_window_toggled(bool on) {
// this, SLOT(usernameChanged(const QString &)));
// connect(PW_Edit, SIGNAL(textChanged(const QString &)),
// this, SLOT(passwordChanged(const QString &)));
// if (ID_Edit->text().isEmpty())
// ID_Edit->setFocus();
// else if (PW_Edit->text().isEmpty())
// PW_Edit->setFocus();
// }
void KPPPWidget::interruptConnection() {
// interrupt dial up
//
if (con->isVisible())
emit con->cancelbutton();
// disconnect if online
if (_pppdata->pppdRunning())
emit disconnect();
}
void KPPPWidget::sigPPPDDied() {
qDebug( "Received a SIGUSR1" );
// if we are not connected pppdpid is -1 so have have to check for that
// in the followin line to make sure that we don't raise a false alarm
// such as would be the case when the log file viewer exits.
if(_pppdata->pppdRunning() || _pppdata->pppdError()) {
qDebug( "It was pppd that died" );
// when we killpppd() on Cancel in ConnectWidget
// we set pppid to -1 so we won't
// enter this block
// just to be sure
Modem::modem->removeSecret(AUTH_PAP);
Modem::modem->removeSecret(AUTH_CHAP);
_pppdata->setpppdRunning(false);
qDebug( "Executing command on disconnect since pppd has died." );
QApplication::flushX();
execute_command(_pppdata->command_on_disconnect());
// stopAccounting();
con_win->stopClock();
// DockWidget::dock_widget->stop_stats();
// DockWidget::dock_widget->hide();
if(!_pppdata->pppdError())
_pppdata->setpppdError(E_PPPD_DIED);
removedns();
Modem::modem->unlockdevice();
//
con->pppdDied();
if(!_pppdata->automatic_redial()) {
quit_b->setFocus();
show();
con_win->stopClock();
// stopAccounting();
con_win->hide();
con->hide();
_pppdata->setpppdRunning(false);
// // not in a signal handler !!! KNotifyClient::beep();
QString msg;
if (_pppdata->pppdError() == E_IF_TIMEOUT)
msg = i18n("Timeout expired while waiting for the PPP interface "
"to come up!");
else {
msg = i18n("<p>The pppd daemon died unexpectedly!</p>");
Modem::modem->pppdExitStatus();
if (Modem::modem->lastStatus != 99) { // more recent pppds only
msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus);
msg += i18n("</p><p>See 'man pppd' for an explanation of the error "
"codes or take a look at the kppp FAQ on "
" <a href=http://devel-home.kde.org/~kppp/index.html>"
"http://devel-home.kde.org/~kppp/index.html</a></p>");
}
}
// if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No)
// // PPPL_ShowLog();
// } else { /* reconnect on disconnect */
if (false){
qDebug( "Trying to reconnect... " );
if(_pppdata->authMethod() == AUTH_PAP ||
_pppdata->authMethod() == AUTH_CHAP ||
_pppdata->authMethod() == AUTH_PAPCHAP)
Modem::modem->setSecret(_pppdata->authMethod(),
encodeWord(_pppdata->storedUsername()),
encodeWord(_pppdata->password()));
con_win->hide();
con_win->stopClock();
// stopAccounting();
_pppdata->setpppdRunning(false);
// not in a signal handler !!! KNotifyClient::beep();
emit cmdl_start();
}
}
_pppdata->setpppdError(0);
}
}
// void KPPPWidget::sigChld() {
// qDebug( "sigchld()" );
// // pid_t id = wait(0L);
// // if(id == helperPid && helperPid != -1) {
// // kdDebug(5002) << "It was the setuid child that died" << endl;
// // helperPid = -1;
// QString msg = i18n("kppp's helper process just died.\n"
// "Since a further execution would be pointless, "
// "kppp will shut down now.");
// QMessageBox::warning(0L,"error", msg);
// //remove_pidfile();
// exit(1);
// // }
// }
void KPPPWidget::newdefaultaccount(int i) {
_pppdata->setDefaultAccount(connectto_c->text(i));
_pppdata->save();
ID_Edit->setText(_pppdata->storedUsername());
PW_Edit->setText(_pppdata->storedPassword());
}
void KPPPWidget::beginConnect() {
// make sure to connect to the account that is selected in the combo box
// (exeption: an account given by a command line argument)
// if(!m_bCmdlAccount) {
// _pppdata->setAccount(connectto_c->currentText());
// _pppdata->setPassword(PW_Edit->text());
// } else {
_pppdata->setPassword(_pppdata->storedPassword());
// }
QFileInfo info(pppdPath());
if(!info.exists()){
QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n"
"Make sure that pppd is installed and "
"that you have entered the correct path."));
return;
}
#if 0
if(!info.isExecutable()){
QString string;
string = i18n("kppp cannot execute:\n %1\n"
"Please make sure that you have given kppp "
"setuid permission and that "
"pppd is executable.").arg(_pppdata->pppdPath());
KMessageBox::error(this, string);
return;
}
#endif
QFileInfo info2(_pppdata->modemDevice());
if(!info2.exists()){
QString string;
string = i18n("kppp can not find:\n %1\nPlease make sure you have setup "
"your modem device properly "
"and/or adjust the location of the modem device on "
"the modem tab of "
"the setup dialog.").arg(_pppdata->modemDevice());
QMessageBox::warning(this, "error", string);
return;
}
// if this is a PAP or CHAP account, ensure that username is
// supplied
if(_pppdata->authMethod() == AUTH_PAP ||
_pppdata->authMethod() == AUTH_CHAP ||
_pppdata->authMethod() == AUTH_PAPCHAP ) {
if(ID_Edit->text().isEmpty()) {
QMessageBox::warning(this,"error",
i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!"));
-// FIXME: return;
+ return;
} else {
if(!Modem::modem->setSecret(_pppdata->authMethod(),
encodeWord(_pppdata->storedUsername()),
encodeWord(_pppdata->password()))) {
QString s;
s = i18n("Cannot create PAP/CHAP authentication\n"
"file \"%1\"").arg(PAP_AUTH_FILE);
QMessageBox::warning(this, "error", s);
return;
}
}
}
if (_pppdata->phonenumber().isEmpty()) {
QString s = i18n("You must specify a telephone number!");
QMessageBox::warning(this, "error", s);
return;
}
this->hide();
QString tit = i18n("Connecting to: %1").arg(_pppdata->accname());
// con->setCaption(tit);
// con->show();
emit begin_connect();
}
void KPPPWidget::disconnect() {
if (!_pppdata->command_before_disconnect().isEmpty()) {
con_win->hide();
con->show();
con->setCaption(i18n("Disconnecting..."));
con->setMsg(i18n("Executing command before disconnection."));
qApp->processEvents();
QApplication::flushX();
// pid_t id =
execute_command(_pppdata->command_before_disconnect());
// int i, status;
// do {
// kapp->processEvents();
// i = waitpid(id, &status, WNOHANG);
// usleep(500000);
// } while (i == 0 && errno == 0);
con->hide();
}
qApp->processEvents();
// statdlg->stop_stats();
Modem::modem->killPPPDaemon();
QApplication::flushX();
execute_command(_pppdata->command_on_disconnect());
Modem::modem->removeSecret(AUTH_PAP);
Modem::modem->removeSecret(AUTH_CHAP);
removedns();
Modem::modem->unlockdevice();
con_win->stopClock();
// p_kppp->stopAccounting();
con_win->hide();
// DockWidget::dock_widget->stop_stats();
// DockWidget::dock_widget->hide();
// if(m_bQuitOnDisconnect)
// kapp->exit(0);
// else {
this->quit_b->setFocus();
this->show();
// }
}
// void KPPPWidget::helpbutton() {
// kapp->invokeHelp();
// }
void KPPPWidget::quitbutton() {
if(_pppdata->pppdRunning()) {
int ok = QMessageBox::warning(this,
i18n("Exiting kPPP will close your PPP Session."),
i18n("Quit kPPP?"));
if(ok == QMessageBox::Yes) {
Modem::modem->killPPPDaemon();
QApplication::flushX();
execute_command(_pppdata->command_on_disconnect());
removedns();
Modem::modem->unlockdevice();
}
} else {
if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword())
_pppdata->setStoredPassword("");
}
_pppdata->save();
qApp->quit();
}
// void KPPPWidget::rulesetLoadError() {
// QMessageBox::warning(this,"error", ruleset_load_errmsg);
// }
// void KPPPWidget::startAccounting() {
// // volume accounting
// stats->totalbytes = 0;
// kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl;
// // load the ruleset
// if(!_pppdata->AcctEnabled())
// return;
// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile());
// // if(::access(d.data(), X_OK) != 0)
// acct = new Accounting(this, stats);
// // else
// // acct = new ExecutableAccounting(this);
// // connect to the accounting object
// connect(acct, SIGNAL(changed(QString, QString)),
// con_win, SLOT(slotAccounting(QString, QString)));
// // if(!acct->loadRuleSet(_pppdata->accountingFile())) {
// // QString s= i18n("Can not load the accounting "
// // "ruleset \"%1\"!").arg(_pppdata->accountingFile());
// // starting the messagebox with a timer will prevent us
// // from blocking the calling function ConnectWidget::timerEvent
// ruleset_load_errmsg = s;
// QTimer::singleShot(0, this, SLOT(rulesetLoadError()));
// return;
// }
// //else
// // acct->slotStart();
// }
// void KPPPWidget::stopAccounting() {
// // store volume accounting
// // if(stats->totalbytes != 0)
// // _pppdata->setTotalBytes(stats->totalbytes);
// if(!_pppdata->AcctEnabled())
// return;
// // if(acct != 0) {
// // acct->slotStop();
// // delete acct;
// // acct = 0;
// // }
// }
// void KPPPWidget::showStats() {
// if(statdlg) {
// statdlg->show();
// statdlg->raise();
// }
// }
void KPPPWidget::usernameChanged(const QString &) {
// store username for later use
_pppdata->setStoredUsername(ID_Edit->text());
}
void KPPPWidget::passwordChanged(const QString &) {
// store the password if so requested
if(_pppdata->storePassword())
_pppdata->setStoredPassword(PW_Edit->text());
else
_pppdata->setStoredPassword("");
}
void KPPPWidget::setPW_Edit(const QString &pw) {
PW_Edit->setText(pw);
}
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro
index 483aa58..56a7ace 100644
--- a/noncore/settings/networksettings/ppp/ppp.pro
+++ b/noncore/settings/networksettings/ppp/ppp.pro
@@ -1,20 +1,18 @@
#TEMPLATE = app
#
TEMPLATE = lib
#CONFIG += qt warn_on release
CONFIG += qt warn_on debug
DESTDIR = $(OPIEDIR)/plugins/networksettings
-HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h
-# kpppwidget.h
-SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp
-# kpppwidget.cpp
+HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h
+SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -L../interfaces/ -linterfaces
INTERFACES =
TARGET = pppplugin
VERSION = 1.0.0
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index 63f9335..5fa7d3f 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -1,72 +1,70 @@
#include <qlayout.h>
#include <qmessagebox.h>
#include <qtabwidget.h>
#include "accounts.h"
#include "general.h"
#include "interfaceppp.h"
#include "modem.h"
#include "pppconfig.h"
#include "pppdata.h"
#include "runtests.h"
PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
const char *name,
bool modal, WFlags fl )
: QDialog(parent, name, modal, fl)
{
setCaption(tr("Configure Modem"));
int result = runTests();
if(result == TEST_CRITICAL){
QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") );
return;
}
interface = iface;
qDebug("PPPConfigWidget::PPPConfigWidget");
qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1());
qDebug(" _pppdata->currentAccountID() >%i<",interface->data()->currentAccountID());
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setSpacing( 0 );
layout->setMargin( 1 );
tabWindow = new QTabWidget( this, "tabWidget" );
layout->addWidget( tabWindow );
accounts = new AccountWidget( interface->data(), tabWindow, "accounts" );
tabWindow->addTab( accounts, tr("&Accounts") );
modem1 = new ModemWidget( interface, tabWindow, "modem1" );
tabWindow->addTab( modem1, tr("&Device") );
modem2 = new ModemWidget2( interface, tabWindow, "modem2" );
tabWindow->addTab( modem2, tr("&Modem") );
-// graph = new GraphSetup( tabWindow->addPage( tr("&Graph"), tr("Throughput Graph" ) ) );
-// general = new GeneralWidget( tabWindow->addPage( tr("M&isc"), tr("Miscellaneous Settings") ) );
}
PPPConfigWidget::~PPPConfigWidget()
{
}
void PPPConfigWidget::accept()
{
qDebug("PPPConfigWidget::accept");
qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1());
qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
interface->setInterfaceName( interface->data()->modemDevice() );
interface->setHardwareName( interface->data()->accname() );
- interface->data()->save();
+ interface->save();
QDialog::accept();
}
void PPPConfigWidget::reject()
{
interface->data()->cancel();
QDialog::reject();
}
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 23db409..8f066ff 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -1,413 +1,415 @@
/*
* kPPP: A pppd front end for the KDE project
*
* $Id$
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pppdata.h"
#include "runtests.h"
#include "devices.h"
//#include <klocale.h>
#define i18n QObject::tr
#include <qpe/config.h>
#include <qmessagebox.h>
#include <qapplication.h>
// #include <klocale.h>
// #include <kconfig.h>
// #include <kmessagebox.h>
// #include <kapplication.h>
#include <assert.h>
#define SEPARATOR -sseepp-
#define SEP QString("%1SEPARATOR%1")
PPPData::PPPData()
: modemDeviceGroup(-1),
- highcount(-1), // start out with no entries
- caccount(-1), // set the current account index also
- suidprocessid(-1), // process ID of setuid child
- pppdisrunning(false),
- pppderror(0)
+ passwd(""),
+ highcount(-1), // start out with no entries
+ caccount(-1), // set the current account index also
+ suidprocessid(-1), // process ID of setuid child
+ pppdisrunning(false),
+ pppderror(0)
{
highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
if (highcount > MAX_ACCOUNTS)
highcount = MAX_ACCOUNTS;
if(highcount >= 0 && defaultAccount().isEmpty()) {
setAccountbyIndex(0);
setDefaultAccount(accname());
} else if(!setAccount(defaultAccount()))
setDefaultAccount(accname());
// start out with internal debugging disabled
// the user is still free to specify `debug' on his own
setPPPDebug(false);
::pppdVersion(&pppdVer, &pppdMod, &pppdPatch);
}
Config PPPData::config()
{
return Config("NetworkSetupPPP");
}
//
// save configuration
//
void PPPData::save()
{
qDebug("PPPData saving data");
writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count());
QString key;
QStringList keys;
Config cfg = config();
for( QMap<QString,QString>::Iterator it = stringEntries.begin();
it != stringEntries.end(); ++it ){
QString val = it.data();
key = it.key();
// qDebug("saving %s -> %s", key.latin1(), val.latin1() );
keys = QStringList::split( "SEPARATOR", key );
qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val);
}
for( QMap<QString,int>::Iterator it = intEntries.begin();
it != intEntries.end(); ++it ){
int val = it.data();
key = it.key();
// qDebug("saving %s -> %i", key.latin1(), val );
keys = QStringList::split( "SEPARATOR", key );
qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val );
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val);
}
for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
it != listEntries.end(); ++it ){
QStringList val = it.data();
key = it.key();
QChar sep = sepEntries[key];
// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() );
keys = QStringList::split( "SEPARATOR", key );
qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() );
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val, sep);
}
}
//
// cancel changes
//
void PPPData::cancel() {
stringEntries.clear();
intEntries.clear();
listEntries.clear();
}
// functions to read/write date to configuration file
QString PPPData::readConfig(const QString &group, const QString &key,
const QString &defvalue = "")
{
// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
QString idx = SEP.arg(group).arg(key);
if (stringEntries.find(idx) != stringEntries.end())
return stringEntries[idx];
Config cfg = config();
cfg.setGroup(group);
return cfg.readEntry(key, defvalue);
}
int PPPData::readNumConfig(const QString &group, const QString &key,
int defvalue)
{
QString idx = SEP.arg(group).arg(key);
if (intEntries.find(idx) != intEntries.end())
return intEntries[idx];
Config cfg = config();
cfg.setGroup(group);
return cfg.readNumEntry(key, defvalue);
// if (config) {
// config->setGroup(group);
// return config->readNumEntry(key, defvalue);
// } else
// return defvalue;
}
bool PPPData::readListConfig(const QString &group, const QString &key,
QStringList &list, char sep) {
list.clear();
QString idx = SEP.arg(group).arg(key);
if (listEntries.find(idx) != listEntries.end()){
list = listEntries[idx];
return true;
}
Config cfg = config();
cfg.setGroup(group);
list = cfg.readListEntry(key, sep);
if (list.count() > 0) return true;
return false;
// if (config) {
// config->setGroup(group);
// list = config->readListEntry(key, sep);
// return true;
// } else
// return false;
}
void PPPData::writeConfig(const QString &group, const QString &key,
const QString &value) {
stringEntries.insert( SEP.arg(group).arg(key), value );
// if (config) {
// config->setGroup(group);
// config->writeEntry(key, value);
// }
}
void PPPData::writeConfig(const QString &group, const QString &key, int value)
{
intEntries.insert( SEP.arg(group).arg(key), value );
// if (config) {
// config->setGroup(group);
// config->writeEntry(key, value);
// }
}
void PPPData::writeListConfig(const QString &group, const QString &key,
QStringList &list, char sep)
{
listEntries.insert( SEP.arg(group).arg(key), list );
sepEntries.insert( SEP.arg(group).arg(key), sep );
// if (config) {
// config->setGroup(group);
// config->writeEntry(key, list, sep);
// }
}
//
// functions to set/return general information
//
-QString PPPData::password() const {
- return passwd;
+QString PPPData::password(){
+ if ( storePassword() ) return storedPassword();
+ else return passwd;
}
void PPPData::setPassword(const QString &pw) {
passwd = pw;
}
const QString PPPData::defaultAccount() {
return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY);
}
void PPPData::setDefaultAccount(const QString &n) {
writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n);
//now set the current account index to the default account
setAccount(defaultAccount());
}
bool PPPData::get_show_clock_on_caption() {
return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true);
}
void PPPData::set_show_clock_on_caption(bool set) {
writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set);
}
bool PPPData::get_xserver_exit_disconnect() {
return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true);
}
void PPPData::setPPPDebug(bool set) {
writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set);
}
bool PPPData::getPPPDebug() {
return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false);
}
void PPPData::set_xserver_exit_disconnect(bool set) {
writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set);
}
bool PPPData::quit_on_disconnect() {
return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false);
}
void PPPData::set_quit_on_disconnect(bool set) {
writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set);
}
bool PPPData::get_show_log_window() {
return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false);
}
void PPPData::set_show_log_window(bool set) {
writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set);
}
bool PPPData::automatic_redial() {
return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE);
}
void PPPData::set_automatic_redial(bool set) {
writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set);
}
// bool PPPData::get_iconify_on_connect() {
// return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE);
// }
// void PPPData::set_iconify_on_connect(bool set) {
// writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set);
// }
// bool PPPData::get_dock_into_panel() {
// return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false);
// }
// void PPPData::set_dock_into_panel(bool set) {
// writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set);
// }
QString PPPData::pppdVersion() {
return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch);
}
bool PPPData::pppdVersionMin(int ver, int mod, int patch) {
// check if pppd version fulfills minimum requirement
return (pppdVer > ver
|| (pppdVer == ver && pppdMod > mod)
|| (pppdVer == ver && pppdMod == mod && pppdPatch >= patch));
}
int PPPData::pppdTimeout() {
return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT);
}
void PPPData::setpppdTimeout(int n) {
writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n);
}
const QString PPPData::modemDevice() {
return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]);
}
bool PPPData::setModemDevice(const QString &n) {
qDebug("Setting modem dev to >%s<", n.latin1());
bool ret = false;
for (int i = 0; devices[i]; i++)
if (devices[i] == n){
modemDeviceGroup = i;
writeConfig(modemGroup(), MODEMDEV_KEY, n);
ret = true;
}
qDebug(ret?"SUCCESS":"FAILURE");
return ret;
}
const QString PPPData::flowcontrol() {
return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS");
}
void PPPData::setFlowcontrol(const QString &n) {
writeConfig(modemGroup(), FLOWCONTROL_KEY, n);
}
const QString PPPData::speed() {
QString s = readConfig(modemGroup(), SPEED_KEY, "57600");
// undo the damage of a bug in former versions. It left an empty Speed=
// entry in kppprc. kppp did set the serial port to 57600 as default but
// pppd wouldn't receive the speed via the command line.
if(s.toUInt() == 0)
s = "57600";
return s;
}
void PPPData::setSpeed(const QString &n) {
writeConfig(modemGroup(), SPEED_KEY, n);
}
#if 0
void PPPData::setUseCDLine(const int n) {
writeConfig(modemGroup(),USECDLINE_KEY,n);
}
int PPPData::UseCDLine() {
return readNumConfig(modemGroup(),USECDLINE_KEY,0);
}
#endif
const QString PPPData::modemEscapeStr() {
return readConfig(modemGroup(),ESCAPESTR_KEY,"+++");
}
void PPPData::setModemEscapeStr(const QString &n) {
writeConfig(modemGroup(),ESCAPESTR_KEY,n);
}
const QString PPPData::modemEscapeResp() {
return readConfig(modemGroup(),ESCAPERESP_KEY,"OK");
}
@@ -564,458 +566,458 @@ void PPPData::setModemNoCarrierResp(const QString &n) {
}
const QString PPPData::modemNoDialtoneResp() {
return readConfig(modemGroup(), NODIALTONERESP_KEY, "NO DIALTONE");
}
void PPPData::setModemNoDialtoneResp(const QString &n) {
writeConfig(modemGroup(), NODIALTONERESP_KEY, n);
}
const QString PPPData::modemHangupStr() {
return readConfig(modemGroup(), HANGUPSTR_KEY, "+++ATH");
}
void PPPData::setModemHangupStr(const QString &n) {
writeConfig(modemGroup(), HANGUPSTR_KEY, n);
}
const QString PPPData::modemHangupResp() {
return readConfig(modemGroup(), HANGUPRESP_KEY, "OK");
}
void PPPData::setModemHangupResp(const QString &n) {
writeConfig(modemGroup(), HANGUPRESP_KEY, n);
}
const QString PPPData::modemAnswerStr() {
return readConfig(modemGroup(), ANSWERSTR_KEY, "ATA");
}
QString PPPData::volumeOff() {
return readConfig(modemGroup(), VOLUME_OFF, "M0L0");
}
void PPPData::setVolumeOff(const QString &s) {
writeConfig(modemGroup(), VOLUME_OFF, s);
}
QString PPPData::volumeMedium() {
return readConfig(modemGroup(), VOLUME_MEDIUM, "M1L1");
}
void PPPData::setVolumeMedium(const QString &s) {
writeConfig(modemGroup(), VOLUME_MEDIUM, s);
}
QString PPPData::volumeHigh() {
QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3");
if(tmp == "M1L4")
tmp = "M1L3";
return tmp;
}
void PPPData::setVolumeHigh(const QString &s) {
writeConfig(modemGroup(), VOLUME_HIGH, s);
}
QString PPPData::volumeInitString() {
QString s;
switch(volume()) {
case 0:
s = volumeOff();
break;
case 1:
s = volumeMedium();
break;
case 2:
s = volumeHigh();
break;
default:
s = volumeMedium();
}
return s;
}
int PPPData::volume() {
return readNumConfig(modemGroup(), VOLUME_KEY, 1);
}
void PPPData::setVolume(int i) {
writeConfig(modemGroup(), VOLUME_KEY, i);
}
int PPPData::waitForDialTone() {
return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1);
}
void PPPData::setWaitForDialTone(int i) {
writeConfig(modemGroup(), DIALTONEWAIT_KEY, i);
}
void PPPData::setModemAnswerStr(const QString &n) {
writeConfig(modemGroup(), ANSWERSTR_KEY, n);
}
const QString PPPData::modemRingResp() {
return readConfig(modemGroup(), RINGRESP_KEY, "RING");
}
void PPPData::setModemRingResp(const QString &n) {
writeConfig(modemGroup(), RINGRESP_KEY, n);
}
const QString PPPData::modemAnswerResp() {
return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT");
}
void PPPData::setModemAnswerResp(const QString &n) {
writeConfig(modemGroup(), ANSWERRESP_KEY, n);
}
const QString PPPData::enter() {
return readConfig(modemGroup(), ENTER_KEY, "CR");
}
void PPPData::setEnter(const QString &n) {
writeConfig(modemGroup(), ENTER_KEY, n);
}
//
// functions to set/return account information
//
//returns number of accounts
int PPPData::count() const {
return highcount + 1;
}
bool PPPData::setAccount(const QString &aname) {
qDebug("setting account to >%s<", aname.latin1());
for(int i = 0; i <= highcount; i++) {
setAccountbyIndex(i);
if(accname() == aname) {
caccount = i;
qDebug("SUCCESS");
return true;
}
}
qDebug("FAILURE");
return false;
}
bool PPPData::setAccountbyIndex(int i) {
if(i >= 0 && i <= highcount) {
caccount = i;
cgroup.sprintf("%s%i", ACCOUNT_GRP, i);
return true;
}
return false;
}
bool PPPData::isUniqueAccname(const QString &n) {
int current = caccount;
for(int i=0; i <= highcount; i++) {
setAccountbyIndex(i);
if(accname() == n && i != current) {
setAccountbyIndex(current);
return false;
}
}
setAccountbyIndex(current);
return true;
}
bool PPPData::deleteAccount() {
- //FIXME:
+ //FIXME: PPPData::deleteAccount
// if(caccount < 0)
return false;
// QMap <QString, QString> map;
// QMap <QString, QString>::Iterator it;
// // set all entries of the current account to ""
// map = config->entryMap(cgroup);
// it = map.begin();
// while (it != map.end()) {
// config->writeEntry(it.key(), "");
// it++;
// }
// // shift the succeeding accounts
// for(int i = caccount+1; i <= highcount; i++) {
// setAccountbyIndex(i);
// map = config->entryMap(cgroup);
// it = map.begin();
// setAccountbyIndex(i-1);
// config->setGroup(cgroup);
// while (it != map.end()) {
// config->writeEntry(it.key(), *it);
// it++;
// }
// }
// // make sure the top account is cleared
// setAccountbyIndex(highcount);
// map = config->entryMap(cgroup);
// it = map.begin();
// config->setGroup(cgroup);
// while (it.key() != QString::null) {
// config->writeEntry(it.key(), "");
// it++;
// }
// highcount--;
// if(caccount > highcount)
// caccount = highcount;
// setAccountbyIndex(caccount);
// return true;
}
bool PPPData::deleteAccount(const QString &aname) {
if(!setAccount(aname))
return false;
deleteAccount();
return true;
}
int PPPData::newaccount() {
qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS);
// if(!config) open();
if (highcount >= MAX_ACCOUNTS) return -1;
highcount++;
setAccountbyIndex(highcount);
setpppdArgumentDefaults();
qDebug("PPPData::newaccount -> %i",caccount);
return caccount;
}
int PPPData::copyaccount(int i) {
-// FIXME
+// FIXME: PPPData::copyaccount
// if(highcount >= MAX_ACCOUNTS)
return -1;
// setAccountbyIndex(i);
// QMap <QString, QString> map = config->entryMap(cgroup);
// QMap <QString, QString>::ConstIterator it = map.begin();
// QString newname = i18n("%1_copy").arg(accname());
// newaccount();
// while (it != map.end()) {
// config->writeEntry(it.key(), *it);
// it++;
// }
// setAccname(newname);
// return caccount;
}
const QString PPPData::accname() {
return readConfig(cgroup, NAME_KEY);
}
void PPPData::setAccname(const QString &n) {
if(!cgroup.isNull()) {
// are we manipulating the default account's name ? then change it, too.
bool def = accname() == defaultAccount();
writeConfig(cgroup, NAME_KEY, n);
if (def)
setDefaultAccount(n);
}
}
#define SEPARATOR_CHAR '&'
QStringList &PPPData::phonenumbers() {
readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR);
return phonelist;
}
const QString PPPData::phonenumber() {
return readConfig(cgroup, PHONENUMBER_KEY);
}
void PPPData::setPhonenumber(const QString &n) {
writeConfig(cgroup, PHONENUMBER_KEY, n);
}
const QString PPPData::dialPrefix() {
return readConfig(cgroup, DIAL_PREFIX_KEY, "");
}
void PPPData::setDialPrefix(const QString &s) {
writeConfig(cgroup, DIAL_PREFIX_KEY, s);
}
int PPPData::authMethod() {
return readNumConfig(cgroup, AUTH_KEY, 0);
}
void PPPData::setAuthMethod(int value) {
writeConfig(cgroup, AUTH_KEY, value);
}
const QString PPPData::storedUsername() {
return readConfig(cgroup, STORED_USERNAME_KEY, "");
}
void PPPData::setStoredUsername(const QString &b) {
writeConfig(cgroup, STORED_USERNAME_KEY, b);
}
const QString PPPData::storedPassword() {
qDebug("getting stored pw");
qDebug("g %s", cgroup.latin1() );
qDebug("k %s", STORED_PASSWORD_KEY);
return readConfig(cgroup, STORED_PASSWORD_KEY, "");
}
void PPPData::setStoredPassword(const QString &b) {
writeConfig(cgroup, STORED_PASSWORD_KEY, b);
}
bool PPPData::storePassword() {
return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1);
}
const QString PPPData::command_before_connect() {
return readConfig(cgroup, BEFORE_CONNECT_KEY);
}
void PPPData::setCommand_before_connect(const QString &n) {
writeConfig(cgroup, BEFORE_CONNECT_KEY, n);
}
void PPPData::setStorePassword(bool b) {
writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b);
}
const QString PPPData::command_on_connect() {
return readConfig(cgroup, COMMAND_KEY);
}
void PPPData::setCommand_on_connect(const QString &n) {
writeConfig(cgroup, COMMAND_KEY, n);
}
const QString PPPData::command_on_disconnect() {
return readConfig(cgroup, DISCONNECT_COMMAND_KEY);
}
void PPPData::setCommand_on_disconnect(const QString &n) {
writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n);
}
const QString PPPData::command_before_disconnect() {
return readConfig(cgroup, BEFORE_DISCONNECT_KEY);
}
void PPPData::setCommand_before_disconnect(const QString &n) {
writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n);
}
const QString PPPData::ipaddr() {
return readConfig(cgroup, IPADDR_KEY);
}
void PPPData::setIpaddr(const QString &n) {
writeConfig(cgroup, IPADDR_KEY, n);
}
const QString PPPData::subnetmask() {
return readConfig(cgroup, SUBNETMASK_KEY);
}
void PPPData::setSubnetmask(const QString &n) {
writeConfig(cgroup, SUBNETMASK_KEY, n);
}
bool PPPData::autoname() {
return (bool) readNumConfig(cgroup, AUTONAME_KEY, false);
}
void PPPData::setAutoname(bool set) {
writeConfig(cgroup, AUTONAME_KEY, (int) set);
}
bool PPPData::AcctEnabled() {
return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false);
}
void PPPData::setAcctEnabled(bool set) {
writeConfig(cgroup, ACCTENABLED_KEY, (int) set);
}
// int PPPData::VolAcctEnabled() {
// return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0);
@@ -1087,212 +1089,214 @@ void PPPData::setDns(QStringList &list) {
const QString PPPData::domain() {
return readConfig(cgroup, DOMAIN_KEY);
}
void PPPData::setDomain(const QString &n ) {
writeConfig(cgroup, DOMAIN_KEY, n);
}
QStringList &PPPData::scriptType() {
static QStringList typelist;
readListConfig(cgroup, SCRIPTCOM_KEY, typelist);
while(typelist.count() > MAX_SCRIPT_ENTRIES)
typelist.remove(typelist.last());
return typelist;
}
void PPPData::setScriptType(QStringList &list) {
writeListConfig(cgroup, SCRIPTCOM_KEY, list);
}
QStringList &PPPData::script() {
static QStringList scriptlist;
readListConfig(cgroup, SCRIPTARG_KEY, scriptlist);
while(scriptlist.count() > MAX_SCRIPT_ENTRIES)
scriptlist.remove(scriptlist.last());
return scriptlist;
}
void PPPData::setScript(QStringList &list) {
writeListConfig(cgroup, SCRIPTARG_KEY, list);
}
// const QString PPPData::accountingFile() {
// return readConfig(cgroup, ACCTFILE_KEY);
// }
// void PPPData::setAccountingFile(const QString &n) {
// writeConfig(cgroup, ACCTFILE_KEY, n);
// }
// const QString PPPData::totalCosts() {
// return readConfig(cgroup, TOTALCOSTS_KEY);
// }
// void PPPData::setTotalCosts(const QString &n) {
// writeConfig(cgroup, TOTALCOSTS_KEY, n);
// }
// int PPPData::totalBytes() {
// return readNumConfig(cgroup, TOTALBYTES_KEY, 0);
// }
// void PPPData::setTotalBytes(int n) {
// writeConfig(cgroup, TOTALBYTES_KEY, n);
// }
QStringList &PPPData::pppdArgument() {
static QStringList arglist;
while(arglist.count() > MAX_PPPD_ARGUMENTS)
arglist.remove(arglist.last());
readListConfig(cgroup, PPPDARG_KEY, arglist);
return arglist;
}
void PPPData::setpppdArgument(QStringList &args) {
writeListConfig(cgroup, PPPDARG_KEY, args);
}
void PPPData::setpppdArgumentDefaults() {
QStringList arg;
setpppdArgument(arg);
}
// // graphing widget
// void PPPData::setGraphingOptions(bool enable,
// QColor bg,
// QColor text,
// QColor in,
// QColor out)
// {
// if(config) {
// config->setGroup(GRAPH_GRP);
// config->writeEntry(GENABLED, enable);
// // config->writeEntry(GCOLOR_BG, bg);
// // config->writeEntry(GCOLOR_TEXT, text);
// // config->writeEntry(GCOLOR_IN, in);
// // config->writeEntry(GCOLOR_OUT, out);
// }
// }
// void PPPData::graphingOptions(bool &enable,
// QColor &bg,
// QColor &text,
// QColor &in,
// QColor &out)
// {
// QColor c;
// if(config) {
// config->setGroup(GRAPH_GRP);
// enable = config->readBoolEntry(GENABLED, true);
// bg = Qt::white;
// //bg = config->readColorEntry(GCOLOR_BG, &c);
// text = Qt::black;
// //text = config->readColorEntry(GCOLOR_TEXT, &c);
// in = Qt::blue;
// //in = config->readColorEntry(GCOLOR_IN, &c);
// out = Qt::red;
// //out = config->readColorEntry(GCOLOR_OUT, &c);
// }
// }
// bool PPPData::graphingEnabled() {
// return (bool) readNumConfig(GRAPH_GRP, GENABLED, true);
// }
//
//functions to change/set the child pppd process info
//
bool PPPData::pppdRunning() const {
return pppdisrunning;
}
void PPPData::setpppdRunning(bool set) {
pppdisrunning = set;
}
int PPPData::pppdError() const {
return pppderror;
}
void PPPData::setpppdError(int err) {
pppderror = err;
}
QString PPPData::modemGroup()
{
if (modemDeviceGroup<0){
qDebug("wrong modem %i\n using 0",modemDeviceGroup);
modemDeviceGroup = 0; //FIXME!
}
return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup);
}
QMap<QString,QString> PPPData::getConfiguredInterfaces()
{
QMap<QString,QString> ifaces;
Config config = PPPData::config();
config.setGroup(ACCLIST_GRP);
int count = config.readNumEntry( ACCOUNTS_COUNT, -1 );
QString accGrp, dev, acc;
for (int i = 0; i < count; i++){
accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i);
config.setGroup(accGrp);
dev = config.readEntry( ACOUNTS_DEV, "error" );
acc = config.readEntry( ACOUNTS_ACC, "error" );
ifaces.insert( dev, acc );
}
return ifaces;
}
void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
{
QMap<QString,QString>::Iterator it;
int i = 0;
Config cfg = config();
- for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){
- cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i));
+ for( it = ifaces.begin(); it != ifaces.end(); ++it ){
+ cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++));
cfg.writeEntry( ACOUNTS_DEV, it.key() );
cfg.writeEntry( ACOUNTS_ACC, it.data() );
+ qDebug("I %i",i);
}
cfg.setGroup( ACCLIST_GRP );
+ qDebug("saved %i account settings", i);
cfg.writeEntry( ACCOUNTS_COUNT, i );
}
/**
* pppd's getword() function knows about escape characters.
* If we write the username and password to the secrets file
* we'll therefore have to escape back slashes.
*/
QString PPPData::encodeWord(const QString &s) {
QString r = s;
r.replace(QRegExp("\\"), "\\\\");
return r;
}
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index c9cd482..6e1379d 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -1,379 +1,379 @@
/* -*- C++ -*-
*
* kPPP: A pppd front end for the KDE project
*
* $Id$
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _PPPDATA_H_
#define _PPPDATA_H_
#include <unistd.h>
#include <sys/types.h>
#include <qcolor.h>
#include <qmap.h>
#include <qstring.h>
#include <qstringlist.h>
#include "kpppconfig.h"
class Config;
// string lengths
#define PATH_SIZE 120
#define MODEMSTR_SIZE 80
#define ACCNAME_SIZE 50
#define PHONENUMBER_SIZE 60
#define COMMAND_SIZE 255
#define IPADDR_SIZE 15
#define DOMAIN_SIZE 50
#define TIMEOUT_SIZE 60
//
// keys for config file
//
// groups
#define GENERAL_GRP "PPP_General"
#define MODEM_GRP "PPP_Modem"
#define ACCOUNT_GRP "PPP_Account"
#define ACCLIST_GRP "PPP_Accounts_List"
//#define GRAPH_GRP "Graph"
//#define WINPOS_GRP "WindowPosition"
// general
#define DEFAULTACCOUNT_KEY "DefaultAccount"
#define PPPDVERSION_KEY "pppdVersion"
#define PPPDTIMEOUT_KEY "pppdTimeout"
#define SHOWCLOCK_KEY "ShowClock"
#define SHOWLOGWIN_KEY "ShowLogWindow"
#define AUTOREDIAL_KEY "AutomaticRedial"
#define DISCONNECT_KEY "DisconnectOnXServerExit"
#define QUITONDISCONNECT_KEY "QuitOnDisconnect"
#define NUMACCOUNTS_KEY "NumberOfAccounts"
#define ID_KEY "ID"
// modem
#define MODEMDEV_KEY "Device"
#define LOCKFILE_KEY "UseLockFile"
#define FLOWCONTROL_KEY "FlowControl"
#define SPEED_KEY "Speed"
#define TIMEOUT_KEY "Timeout"
#define TONEDURATION_KEY "ToneDuration"
#define BUSYWAIT_KEY "BusyWait"
#define INITSTR_KEY "InitString"
#define INITRESP_KEY "InitResponse"
#define PREINITDELAY_KEY "PreInitDelay"
#define INITDELAY_KEY "InitDelay"
#define NODTDETECT_KEY "NoDialToneDetection"
#define DIALTONEWAIT_KEY "WaitForDialTone"
#define DIALSTR_KEY "DialString"
#define CONNECTRESP_KEY "ConnectResponse"
#define BUSYRESP_KEY "BusyResponse"
#define NOCARRIERRESP_KEY "NoCarrierResponse"
#define NODIALTONERESP_KEY "NoDialToneResp"
#define HANGUPSTR_KEY "HangupString"
#define HANGUPRESP_KEY "HangUpResponse"
#define ANSWERSTR_KEY "AnswerString"
#define RINGRESP_KEY "RingResponse"
#define ANSWERRESP_KEY "AnswerResponse"
#define ENTER_KEY "Enter"
#define ESCAPESTR_KEY "EscapeString"
#define ESCAPERESP_KEY "EscapeResponse"
#define ESCAPEGUARDTIME_KEY "EscapeGuardTime"
#define USECDLINE_KEY "UseCDLine"
#define VOLUME_HIGH "VolumeHigh"
#define VOLUME_MEDIUM "VolumeMedium"
#define VOLUME_OFF "VolumeOff"
#define VOLUME_KEY "Volume"
// account
#define NAME_KEY "Name"
#define PHONENUMBER_KEY "Phonenumber"
#define DIAL_PREFIX_KEY "DialPrefix"
#define AUTH_KEY "Authentication"
#define STORED_PASSWORD_KEY "Password"
#define STORED_USERNAME_KEY "Username"
#define STORE_PASSWORD_KEY "StorePassword"
#define BEFORE_CONNECT_KEY "BeforeConnect"
#define COMMAND_KEY "Command"
#define DISCONNECT_COMMAND_KEY "DisconnectCommand"
#define BEFORE_DISCONNECT_KEY "BeforeDisconnect"
#define IPADDR_KEY "IPAddr"
#define SUBNETMASK_KEY "SubnetMask"
#define ACCTENABLED_KEY "AccountingEnabled"
#define VOLACCTENABLED_KEY "VolumeAccountingEnabled"
#define ACCTFILE_KEY "AccountingFile"
#define AUTONAME_KEY "AutoName"
#define GATEWAY_KEY "Gateway"
#define DEFAULTROUTE_KEY "DefaultRoute"
#define DOMAIN_KEY "Domain"
#define DNS_KEY "DNS"
#define AUTODNS_KEY "AutoDNS"
#define EXDNSDISABLED_KEY "ExDNSDisabled"
#define SCRIPTCOM_KEY "ScriptCommands"
#define SCRIPTARG_KEY "ScriptArguments"
#define PPPDARG_KEY "pppdArguments"
#define PPP_DEBUG_OPTION "PPPDebug"
#define ICONIFY_ON_CONNECT_KEY "iconifyOnConnect"
#define DOCKING_KEY "DockIntoPanel"
#define TOTALCOSTS_KEY "TotalCosts"
#define TOTALBYTES_KEY "TotalBytes"
// pppd errors
#define E_IF_TIMEOUT 1
#define E_PPPD_DIED 2
// account list
#define ACCOUNTS_COUNT "Accounts_Count"
#define ACOUNTS_DEV "Accounts_Modem"
#define ACOUNTS_ACC "Accounts_Account"
class PPPData {
public:
PPPData();
~PPPData() {};
enum { NumInitStrings = 2 };
// general functions
void save();
void cancel();
static QMap<QString,QString> getConfiguredInterfaces();
static void setConfiguredInterfaces( QMap<QString,QString> );
// function to read/write date to configuration file
static Config config();
QString readConfig(const QString &, const QString &, const QString &);
int readNumConfig(const QString &, const QString &, int);
bool readListConfig(const QString &, const QString &,
QStringList &, char sep = ',');
void writeConfig(const QString &, const QString &, const QString &);
void writeConfig(const QString &, const QString &, int);
void writeListConfig(const QString &, const QString &,
QStringList &, char sep = ',');
// return the current account group
QString currentGroup() { return cgroup; }
QString modemGroup();
// functions to set/get general kppp info
- QString password() const;
+ QString password();
void setPassword(const QString &);
- int currentAccountID() { return caccount; };
+ int currentAccountID() { return caccount; };
const QString defaultAccount();
void setDefaultAccount(const QString &);
void set_xserver_exit_disconnect(bool set);
bool get_xserver_exit_disconnect();
void setPPPDebug(bool set);
bool getPPPDebug();
void set_quit_on_disconnect(bool);
bool quit_on_disconnect();
void set_show_clock_on_caption(bool set);
bool get_show_clock_on_caption();
void set_show_log_window(bool set);
bool get_show_log_window();
void set_automatic_redial(bool set);
bool automatic_redial();
// void set_iconify_on_connect(bool set);
// bool get_iconify_on_connect();
// void set_dock_into_panel(bool set);
// bool get_dock_into_panel();
const QString enter();
void setEnter(const QString &);
QString pppdVersion();
bool pppdVersionMin(int ver, int mod, int patch);
int pppdTimeout();
void setpppdTimeout(int);
int busyWait();
void setbusyWait(int);
bool modemLockFile();
void setModemLockFile(bool set);
int modemEscapeGuardTime();
void setModemEscapeGuardTime(int i);
void setModemEscapeStr(const QString &);
const QString modemEscapeStr();
void setModemEscapeResp(const QString &);
const QString modemEscapeResp();
const QString modemDevice();
bool setModemDevice(const QString &);
const QString flowcontrol();
void setFlowcontrol(const QString &);
int modemTimeout();
void setModemTimeout(int);
int modemToneDuration();
void setModemToneDuration(int);
QString volumeInitString();
int volume();
void setVolume(int);
int waitForDialTone();
void setWaitForDialTone(int i);
// modem command strings/responses
const QString modemInitStr(int i);
void setModemInitStr(int i, const QString &);
const QString modemInitResp();
void setModemInitResp(const QString &);
int modemPreInitDelay();
void setModemPreInitDelay(int);
int modemInitDelay();
void setModemInitDelay(int);
QString modemNoDialToneDetectionStr();
void setModemNoDialToneDetectionStr(const QString &);
const QString modemDialStr();
void setModemDialStr(const QString &);
const QString modemConnectResp();
void setModemConnectResp(const QString &);
const QString modemBusyResp();
void setModemBusyResp(const QString &);
const QString modemNoCarrierResp();
void setModemNoCarrierResp(const QString &);
const QString modemNoDialtoneResp();
void setModemNoDialtoneResp(const QString &);
const QString modemHangupStr();
void setModemHangupStr(const QString &);
const QString modemHangupResp();
void setModemHangupResp(const QString &);
const QString modemAnswerStr();
void setModemAnswerStr(const QString &);
const QString modemRingResp();
void setModemRingResp(const QString &);
const QString modemAnswerResp();
void setModemAnswerResp(const QString &);
QString volumeOff();
void setVolumeOff(const QString &);
QString volumeMedium();
void setVolumeMedium(const QString &);
QString volumeHigh();
void setVolumeHigh(const QString &);
// functions to set/get account information
int count() const;
bool setAccount(const QString &);
bool setAccountbyIndex(int);
bool isUniqueAccname(const QString &);
bool deleteAccount();
bool deleteAccount(const QString &);
int newaccount();
int copyaccount(int i);
const QString accname();
void setAccname(const QString &);
QStringList &phonenumbers();
const QString phonenumber();
void setPhonenumber(const QString &);
const QString dialPrefix();
void setDialPrefix(const QString &);
int authMethod();
void setAuthMethod(int);
const QString storedUsername();
void setStoredUsername(const QString &);
const QString storedPassword();
void setStoredPassword(const QString &);
bool storePassword();
void setStorePassword(bool);
const QString speed();
void setSpeed(const QString &);
const QString command_before_connect();
void setCommand_before_connect(const QString &);
const QString command_on_connect();
void setCommand_on_connect(const QString &);
const QString command_on_disconnect();
void setCommand_on_disconnect(const QString &);
const QString command_before_disconnect();
void setCommand_before_disconnect(const QString &);
const QString ipaddr();
void setIpaddr(const QString &);
const QString subnetmask();
void setSubnetmask(const QString &);
bool AcctEnabled();
void setAcctEnabled(bool set);
// int VolAcctEnabled();
// void setVolAcctEnabled(int set);
bool autoDNS();
void setAutoDNS(bool set);
bool exDNSDisabled();
void setExDNSDisabled(bool set);
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index 8c401a9..d4c137b 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -1,139 +1,137 @@
#include "pppconfig.h"
#include "pppmodule.h"
#include "pppdata.h"
#include "interfaceinformationppp.h"
#include "interfaceppp.h"
/**
* Constructor, find all of the possible interfaces
*/
PPPModule::PPPModule() : Module()
{
QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces();
QMap<QString,QString>::Iterator it;
InterfacePPP *iface;
qDebug("getting interfaces");
for( it = ifaces.begin(); it != ifaces.end(); ++it ){
qDebug("ifaces %s", it.key().latin1());
iface = new InterfacePPP( 0, it.key() );
iface->setHardwareName( it.data() );
list.append( (Interface*)iface );
}
}
/**
* Delete any interfaces that we own.
*/
PPPModule::~PPPModule(){
QMap<QString,QString> ifaces;
Interface *i;
for ( i=list.first(); i != 0; i=list.next() ){
ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
delete i;
}
PPPData::setConfiguredInterfaces( ifaces );
}
/**
* Change the current profile
*/
void PPPModule::setProfile(const QString &newProfile){
profile = newProfile;
}
/**
* get the icon name for this device.
* @param Interface* can be used in determining the icon.
* @return QString the icon name (minus .png, .gif etc)
*/
QString PPPModule::getPixmapName(Interface* ){
return "ppp";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool PPPModule::isOwner(Interface *i){
return list.find( i ) != -1;
}
/**
* Create, and return the WLANConfigure Module
* @return QWidget* pointer to this modules configure.
*/
QWidget *PPPModule::configure(Interface *i){
qDebug("return ModemWidget");
PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
0, "PPPConfig", false,
Qt::WDestructiveClose );
return pppconfig;
}
/**
* Create, and return the Information Module
* @return QWidget* pointer to this modules info.
*/
QWidget *PPPModule::information(Interface *i){
// We don't have any advanced pppd information widget yet :-D
// TODO ^
- qDebug("return PPPModule::information");
-// InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i);
- InterfaceInformationPPP *information = new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
- return information;
+
+ return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
}
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
*/
QList<Interface> PPPModule::getInterfaces(){
// List all of the files in the peer directory
qDebug("PPPModule::getInterfaces");
return list;
}
/**
* Attempt to add a new interface as defined by name
* @param name the name of the type of interface that should be created given
* by possibleNewInterfaces();
* @return Interface* NULL if it was unable to be created.
*/
Interface *PPPModule::addNewInterface(const QString &newInterface){
InterfacePPP *ifaceppp;
Interface *iface;
ifaceppp = new InterfacePPP();
PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true);
imp.showMaximized();
if(imp.exec() == QDialog::Accepted ){
iface = (InterfacePPP*) ifaceppp;
iface->setModuleOwner( this );
list.append( iface );
return iface;
}else {
delete ifaceppp;
iface = NULL;
}
return iface;
}
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
*/
bool PPPModule::remove(Interface *i){
return list.remove(i);
}
void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)
{
newIfaces.insert(QObject::tr("PPP") ,
QObject::tr("generic ppp device"));
}