Diffstat (limited to 'noncore/settings/networksettings/ppp/accounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/accounts.cpp | 59 |
1 files changed, 15 insertions, 44 deletions
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,20 +87,23 @@ 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()); + slotListBoxSelect( _pppdata->currentAccountID() ); l1->activate(); } @@ -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(); } } } |