summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/accounts.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/accounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp59
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
@@ -37,15 +37,17 @@
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38#include <qvgroupbox.h> 38#include <qvgroupbox.h>
39 39
40#include "pppdata.h"
41#include "accounts.h" 40#include "accounts.h"
41#include "authwidget.h"
42#include "pppdata.h"
42#include "edit.h" 43#include "edit.h"
43 44
44void parseargs(char* buf, char** args); 45void parseargs(char* buf, char** args);
45 46
46AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) 47AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name )
47 : QWidget( parent, name ), _pppdata(pd) 48 : QWidget( parent, name )//, _pppdata(pd)
48{ 49{
50 _pppdata = pd;
49 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); 51 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
50 accountlist_l = new QListBox(this); 52 accountlist_l = new QListBox(this);
51 53
@@ -86,6 +88,9 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name )
86 l1->addStretch(1); 88 l1->addStretch(1);
87 l1->addLayout(l12); 89 l1->addLayout(l12);
88 90
91 int currAccId = _pppdata->currentAccountID();
92 qDebug("currentAccountID %i", currAccId);
93
89 //load up account list from gppdata to the list box 94 //load up account list from gppdata to the list box
90 if(_pppdata->count() > 0) { 95 if(_pppdata->count() > 0) {
91 for(int i=0; i <= _pppdata->count()-1; i++) { 96 for(int i=0; i <= _pppdata->count()-1; i++) {
@@ -93,11 +98,11 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name )
93 accountlist_l->insertItem(_pppdata->accname()); 98 accountlist_l->insertItem(_pppdata->accname());
94 } 99 }
95 } 100 }
96 101 _pppdata->setAccountbyIndex( currAccId );
97 102
98 qDebug("setting listview index to %i",_pppdata->currentAccountID() ); 103 qDebug("setting listview index to %i",_pppdata->currentAccountID() );
99 accountlist_l->setCurrentItem( _pppdata->currentAccountID() ); 104 accountlist_l->setCurrentItem( _pppdata->currentAccountID() );
100 slotListBoxSelect( _pppdata->currentAccountID()); 105 slotListBoxSelect( _pppdata->currentAccountID() );
101 106
102 l1->activate(); 107 l1->activate();
103} 108}
@@ -112,42 +117,9 @@ void AccountWidget::slotListBoxSelect(int idx) {
112 qDebug("setting account to %i", idx); 117 qDebug("setting account to %i", idx);
113 QString account = _pppdata->accname(); 118 QString account = _pppdata->accname();
114 _pppdata->setAccountbyIndex(accountlist_l->currentItem()); 119 _pppdata->setAccountbyIndex(accountlist_l->currentItem());
115 // _pppdata->setAccount(account);
116 } 120 }
117} 121}
118 122
119
120// void AccountWidget::viewLogClicked(){
121
122// QApplication::flushX();
123// if(fork() == 0) {
124// setgid(getgid());
125// setuid(getuid());
126// system("kppplogview -kppp");
127// _exit(0);
128// }
129// }
130
131
132// void AccountWidget::resetClicked(){
133// if(accountlist_l->currentItem() == -1)
134// return;
135
136// // QueryReset dlg(this);
137// // int what = dlg.exec();
138
139// // if(what && QueryReset::COSTS) {
140// // emit resetCosts(accountlist_l->text(accountlist_l->currentItem()));
141// // costedit->setText("0");
142// // }
143
144// // if(what && QueryReset::VOLUME) {
145// // emit resetVolume(accountlist_l->text(accountlist_l->currentItem()));
146// // voledit->setText(prettyPrintVolume(0));
147// // }
148// }
149
150
151void AccountWidget::editaccount() { 123void AccountWidget::editaccount() {
152 _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem())); 124 _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem()));
153 125
@@ -249,6 +221,10 @@ int AccountWidget::doTab(){
249 dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup"); 221 dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup");
250 tabWindow->addTab( dial_w, tr("Dial") ); 222 tabWindow->addTab( dial_w, tr("Dial") );
251 223
224// // AUTH WIDGET
225 auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script"));
226 tabWindow->addTab( auth_w, tr("Authentication") );
227
252// // IP WIDGET 228// // IP WIDGET
253 ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); 229 ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup"));
254 tabWindow->addTab( ip_w, tr("IP") ); 230 tabWindow->addTab( ip_w, tr("IP") );
@@ -261,10 +237,6 @@ int AccountWidget::doTab(){
261 dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") ); 237 dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") );
262 tabWindow->addTab( dns_w, tr("DNS") ); 238 tabWindow->addTab( dns_w, tr("DNS") );
263 239
264// // SCRIPT WIDGET
265 script_w = new ScriptWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script"));
266 tabWindow->addTab( script_w, tr("Login Script") );
267
268// // EXECUTE WIDGET 240// // EXECUTE WIDGET
269 ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs")); 241 ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs"));
270 tabWindow->addTab( exec_w, tr("Execute") ); 242 tabWindow->addTab( exec_w, tr("Execute") );
@@ -278,8 +250,7 @@ int AccountWidget::doTab(){
278 ok = true; 250 ok = true;
279 251
280 if(result == QDialog::Accepted) { 252 if(result == QDialog::Accepted) {
281 if (!script_w->check()){ 253 if (!auth_w->check()){
282 QMessageBox::critical(this, "error", tr("<qt>Login script has unbalanced loop Start/End<qt>"));
283 ok = false; 254 ok = false;
284 } else if(!dial_w->save()) { 255 } else if(!dial_w->save()) {
285 QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); 256 QMessageBox::critical(this, "error", tr( "You must enter a unique account name"));
@@ -288,7 +259,7 @@ int AccountWidget::doTab(){
288 ip_w->save(); 259 ip_w->save();
289 dns_w->save(); 260 dns_w->save();
290 gateway_w->save(); 261 gateway_w->save();
291 script_w->save(); 262 auth_w->save();
292 exec_w->save(); 263 exec_w->save();
293 } 264 }
294 } 265 }