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 @@ -38,6 +38,7 @@ #include <qvgroupbox.h> -#include "pppdata.h" #include "accounts.h" +#include "authwidget.h" +#include "pppdata.h" #include "edit.h" @@ -45,6 +46,7 @@ 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); @@ -87,4 +89,7 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) 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) { @@ -94,9 +99,9 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) } } - + _pppdata->setAccountbyIndex( currAccId ); qDebug("setting listview index to %i",_pppdata->currentAccountID() ); accountlist_l->setCurrentItem( _pppdata->currentAccountID() ); - slotListBoxSelect( _pppdata->currentAccountID()); + slotListBoxSelect( _pppdata->currentAccountID() ); l1->activate(); @@ -113,40 +118,7 @@ void AccountWidget::slotListBoxSelect(int 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())); @@ -250,4 +222,8 @@ int AccountWidget::doTab(){ 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")); @@ -262,8 +238,4 @@ int AccountWidget::doTab(){ 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")); @@ -279,6 +251,5 @@ int AccountWidget::doTab(){ 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()) { @@ -289,5 +260,5 @@ int AccountWidget::doTab(){ dns_w->save(); gateway_w->save(); - script_w->save(); + auth_w->save(); exec_w->save(); } 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 @@ -39,5 +39,5 @@ class QLineEdit; class QTabWidget; class DialWidget; -class ScriptWidget; +class AuthWidget; class IPWidget; class DNSWidget; @@ -73,5 +73,5 @@ private: DNSWidget *dns_w; GatewayWidget *gateway_w; - ScriptWidget *script_w; + AuthWidget *auth_w; QListBox *accountlist_l; @@ -83,18 +83,4 @@ private: -// 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 @@ -125,4 +125,5 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam debug = new QPushButton(i18n("Log"), this); debug->setToggleButton(true); + debug->setEnabled( false ); // FIXME: disable the log button connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow())); 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 @@ -35,4 +35,5 @@ #include <qhbox.h> #include <qdialog.h> +#include <qpe/resource.h> #include "edit.h" @@ -47,5 +48,5 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount 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); @@ -76,9 +77,7 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount 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); @@ -109,40 +108,4 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount 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())); @@ -169,9 +132,4 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount numbers->insertItem(tmp); - auth->setCurrentItem(_pppdata->authMethod()); - store_password->setChecked(_pppdata->storePassword()); - } else { - // select PAP/CHAP as default - auth->setCurrentItem(AUTH_PAPCHAP); } @@ -196,6 +154,4 @@ bool DialWidget::save() { _pppdata->setPhonenumber(number); - _pppdata->setAuthMethod(auth->currentItem()); - _pppdata->setStorePassword(store_password->isChecked()); return true; } 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 @@ -71,7 +71,4 @@ private: QLabel *number_label; QPushButton *pppdargs; - QComboBox *auth; - QLabel *auth_l; - QCheckBox *store_password; // for the phonenumber selection 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 @@ -6,4 +6,5 @@ //#include <qgroupbox.h> #include <qmessagebox.h> +#include <qabstractlayout.h> #include "connect.h" @@ -24,6 +25,10 @@ InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *na 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 @@ -46,10 +46,8 @@ 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! ;-)"); } @@ -97,5 +95,5 @@ void InterfacePPP::start() 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>")); @@ -121,11 +119,7 @@ void InterfacePPP::start() } -// 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(); @@ -140,2 +134,7 @@ void 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 @@ -24,4 +24,5 @@ public slots: virtual void start(); virtual void stop(); + void save(); private: 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 @@ -601,5 +601,5 @@ void KPPPWidget::beginConnect() { 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(), 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 @@ -5,8 +5,6 @@ TEMPLATE = lib 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 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 @@ -43,6 +43,4 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, 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") ) ); } @@ -61,5 +59,5 @@ void PPPConfigWidget::accept() interface->setInterfaceName( interface->data()->modemDevice() ); interface->setHardwareName( interface->data()->accname() ); - interface->data()->save(); + interface->save(); QDialog::accept(); } 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 @@ -44,9 +44,10 @@ 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; @@ -218,6 +219,7 @@ void PPPData::writeListConfig(const QString &group, const QString &key, // functions to set/return general information // -QString PPPData::password() const { - return passwd; +QString PPPData::password(){ + if ( storePassword() ) return storedPassword(); + else return passwd; } @@ -754,5 +756,5 @@ bool PPPData::isUniqueAccname(const QString &n) { bool PPPData::deleteAccount() { - //FIXME: + //FIXME: PPPData::deleteAccount // if(caccount < 0) return false; @@ -827,5 +829,5 @@ int PPPData::newaccount() { int PPPData::copyaccount(int i) { -// FIXME +// FIXME: PPPData::copyaccount // if(highcount >= MAX_ACCOUNTS) return -1; @@ -1277,10 +1279,12 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) 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 ); 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 @@ -182,8 +182,8 @@ public: // 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 &); 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 @@ -81,8 +81,6 @@ 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 ); } |