From 60d9f66d2b31c659ac652c15423ecaca89a5f312 Mon Sep 17 00:00:00 2001 From: tille Date: Tue, 03 Jun 2003 14:08:04 +0000 Subject: authentication (except when passwd not stored) and minor things --- (limited to 'noncore') 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 @@ -37,15 +37,17 @@ #include #include -#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); @@ -86,6 +88,9 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) 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++) { @@ -93,11 +98,11 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) 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(); } @@ -112,42 +117,9 @@ void AccountWidget::slotListBoxSelect(int idx) { 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())); @@ -249,6 +221,10 @@ int AccountWidget::doTab(){ 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") ); @@ -261,10 +237,6 @@ int AccountWidget::doTab(){ 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") ); @@ -278,8 +250,7 @@ int AccountWidget::doTab(){ ok = true; if(result == QDialog::Accepted) { - if (!script_w->check()){ - QMessageBox::critical(this, "error", tr("Login script has unbalanced loop Start/End")); + if (!auth_w->check()){ ok = false; } else if(!dial_w->save()) { QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); @@ -288,7 +259,7 @@ int AccountWidget::doTab(){ ip_w->save(); 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 @@ -38,7 +38,7 @@ class QCheckBox; class QLineEdit; class QTabWidget; class DialWidget; -class ScriptWidget; +class AuthWidget; class IPWidget; class DNSWidget; class GatewayWidget; @@ -72,7 +72,7 @@ private: IPWidget *ip_w; DNSWidget *dns_w; GatewayWidget *gateway_w; - ScriptWidget *script_w; + AuthWidget *auth_w; QListBox *accountlist_l; QPushButton *edit_b; @@ -82,19 +82,5 @@ 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 +#include +#include +#include + +#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("

Specifies the method used to identify yourself to\n" + "the PPP server. Most universities still use\n" + "Terminal- or Script-based authentication,\n" + "while most ISP use PAP and/or CHAP. 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("

When this is turned on, your ISP password\n" + "will be saved in kppp's config file, so\n" + "you do not need to type it in every time.\n" + "\n" + "Warning: 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("Login script has unbalanced loop Start/End")); + 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 + +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 @@ -124,6 +124,7 @@ 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())); cancel = new QPushButton(i18n("Cancel"), this); 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 @@ -34,6 +34,7 @@ #include #include #include +#include #include "edit.h" #include "pppdata.h" @@ -46,7 +47,7 @@ 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); tl->addWidget(connect_label, 0, 0); @@ -75,11 +76,9 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount 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); @@ -108,42 +107,6 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount 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("

Specifies the method used to identify yourself to\n" - "the PPP server. Most universities still use\n" - "Terminal- or Script-based authentication,\n" - "while most ISP use PAP and/or CHAP. 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("

When this is turned on, your ISP password\n" - "will be saved in kppp's config file, so\n" - "you do not need to type it in every time.\n" - "\n" - "Warning: 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); @@ -168,11 +131,6 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount 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(); @@ -195,8 +153,6 @@ 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 @@ -70,9 +70,6 @@ private: 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; 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 @@ -5,6 +5,7 @@ #include //#include #include +#include #include "connect.h" #include "conwindow.h" @@ -23,8 +24,12 @@ 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 @@ -45,12 +45,10 @@ bool InterfacePPP::refresh() 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! ;-)"); } @@ -96,7 +94,7 @@ void InterfacePPP::start() 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("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!")); // FIXME: return; @@ -120,13 +118,9 @@ void InterfacePPP::start() 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(); @@ -139,3 +133,8 @@ 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 @@ -23,6 +23,7 @@ public slots: virtual bool refresh(); virtual void start(); virtual void stop(); + void save(); private: Modem *_modemPtr; 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 @@ -600,7 +600,7 @@ void KPPPWidget::beginConnect() { 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()), 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 @@ -4,10 +4,8 @@ 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 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 @@ -42,8 +42,6 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, 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") ) ); } @@ -60,7 +58,7 @@ void PPPConfigWidget::accept() qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); 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 @@ -43,11 +43,12 @@ 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; @@ -217,8 +218,9 @@ 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; } @@ -753,7 +755,7 @@ bool PPPData::isUniqueAccname(const QString &n) { bool PPPData::deleteAccount() { - //FIXME: + //FIXME: PPPData::deleteAccount // if(caccount < 0) return false; @@ -826,7 +828,7 @@ int PPPData::newaccount() { } int PPPData::copyaccount(int i) { -// FIXME +// FIXME: PPPData::copyaccount // if(highcount >= MAX_ACCOUNTS) return -1; @@ -1276,12 +1278,14 @@ void PPPData::setConfiguredInterfaces( QMap ifaces ) QMap::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 ); } 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 @@ -181,10 +181,10 @@ public: 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 &); 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 @@ -80,10 +80,8 @@ QWidget *PPPModule::configure(Interface *i){ 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 ); } /** -- cgit v0.9.0.2