author | tille <tille> | 2003-06-03 14:08:04 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-03 14:08:04 (UTC) |
commit | 60d9f66d2b31c659ac652c15423ecaca89a5f312 (patch) (side-by-side diff) | |
tree | bfda269b58eb1c72893057d9d7fae5a6a2e45abc | |
parent | aaf7709f64dda5a6cb81eeb96e421ba4189654d6 (diff) | |
download | opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.zip opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.tar.gz opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.tar.bz2 |
authentication (except when passwd not stored)
and minor things
17 files changed, 306 insertions, 149 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 @@ -36,17 +36,19 @@ #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)), @@ -85,16 +87,19 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) 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()); @@ -111,44 +116,11 @@ void AccountWidget::slotListBoxSelect(int idx) { 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(); @@ -248,8 +220,12 @@ int AccountWidget::doTab(){ // // 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") ); @@ -260,12 +236,8 @@ int AccountWidget::doTab(){ // // 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") ); @@ -277,19 +249,18 @@ int AccountWidget::doTab(){ 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(); } } } 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 @@ -37,9 +37,9 @@ class QDialog; class QCheckBox; class QLineEdit; class QTabWidget; class DialWidget; -class ScriptWidget; +class AuthWidget; class IPWidget; class DNSWidget; class GatewayWidget; class PPPData; @@ -71,9 +71,9 @@ private: 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; @@ -81,20 +81,6 @@ private: 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 @@ -123,8 +123,9 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam 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(); 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 @@ -33,8 +33,9 @@ #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" @@ -45,9 +46,9 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount : 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); @@ -74,13 +75,11 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount 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); @@ -107,44 +106,8 @@ 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("<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); @@ -167,13 +130,8 @@ 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(); tl->activate(); @@ -194,10 +152,8 @@ bool DialWidget::save() { number += numbers->text(i); } _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 @@ -69,11 +69,8 @@ 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; 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 @@ -4,8 +4,9 @@ #include <qpushbutton.h> #include <qlabel.h> //#include <qgroupbox.h> #include <qmessagebox.h> +#include <qabstractlayout.h> #include "connect.h" #include "conwindow.h" @@ -22,10 +23,14 @@ InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *na :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 @@ -44,14 +44,12 @@ 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! ;-)"); } QFileInfo info(pppdPath()); @@ -95,9 +93,9 @@ void InterfacePPP::start() // 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 { @@ -119,15 +117,11 @@ void InterfacePPP::start() 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"); @@ -138,4 +132,9 @@ 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 @@ -22,8 +22,9 @@ signals: public slots: virtual bool refresh(); virtual void start(); virtual void stop(); + void save(); private: Modem *_modemPtr; PPPData *_dataPtr; 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 @@ -599,9 +599,9 @@ void KPPPWidget::beginConnect() { _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()))) { 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 @@ -3,12 +3,10 @@ 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 = 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 @@ -41,10 +41,8 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, 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") ) ); } @@ -59,9 +57,9 @@ void 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(); } 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 @@ -42,8 +42,9 @@ #define SEP QString("%1SEPARATOR%1") PPPData::PPPData() : modemDeviceGroup(-1), + 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), @@ -216,10 +217,11 @@ 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; } void PPPData::setPassword(const QString &pw) { @@ -752,9 +754,9 @@ bool PPPData::isUniqueAccname(const QString &n) { } bool PPPData::deleteAccount() { - //FIXME: + //FIXME: PPPData::deleteAccount // if(caccount < 0) return false; // QMap <QString, QString> map; @@ -825,9 +827,9 @@ int PPPData::newaccount() { return caccount; } int PPPData::copyaccount(int i) { -// FIXME +// FIXME: PPPData::copyaccount // if(highcount >= MAX_ACCOUNTS) return -1; // setAccountbyIndex(i); @@ -1275,14 +1277,16 @@ 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 ); } 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 @@ -180,9 +180,9 @@ public: 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; }; const QString defaultAccount(); 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 @@ -79,12 +79,10 @@ 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 ); } /** * Get all active (up or down) interfaces |