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.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index 11d4739..3fa2f84 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -47,14 +47,14 @@
47//#include "accounting.h" 47//#include "accounting.h"
48//#include "providerdb.h" 48//#include "providerdb.h"
49#include "edit.h" 49#include "edit.h"
50 50
51void parseargs(char* buf, char** args); 51void parseargs(char* buf, char** args);
52 52
53AccountWidget::AccountWidget( QWidget *parent, const char *name ) 53AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name )
54 : QWidget( parent, name ) 54 : QWidget( parent, name ), _pppdata(pd)
55{ 55{
56 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); 56 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
57 accountlist_l = new QListBox(this); 57 accountlist_l = new QListBox(this);
58 58
59 connect(accountlist_l, SIGNAL(highlighted(int)), 59 connect(accountlist_l, SIGNAL(highlighted(int)),
60 this, SLOT(slotListBoxSelect(int))); 60 this, SLOT(slotListBoxSelect(int)));
@@ -149,38 +149,38 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
149// connect(log, SIGNAL(clicked()), 149// connect(log, SIGNAL(clicked()),
150 // this, SLOT(viewLogClicked())); 150 // this, SLOT(viewLogClicked()));
151// l122->addWidget(log); 151// l122->addWidget(log);
152// l122->addStretch(1); 152// l122->addStretch(1);
153 153
154 //load up account list from gppdata to the list box 154 //load up account list from gppdata to the list box
155 if(PPPData::data()->count() > 0) { 155 if(_pppdata->count() > 0) {
156 for(int i=0; i <= PPPData::data()->count()-1; i++) { 156 for(int i=0; i <= _pppdata->count()-1; i++) {
157 PPPData::data()->setAccountbyIndex(i); 157 _pppdata->setAccountbyIndex(i);
158 accountlist_l->insertItem(PPPData::data()->accname()); 158 accountlist_l->insertItem(_pppdata->accname());
159 } 159 }
160 } 160 }
161 161
162// slotListBoxSelect(accountlist_l->currentItem()); 162// slotListBoxSelect(accountlist_l->currentItem());
163 qDebug("setting listview index to %i",PPPData::data()->currentAccountID() ); 163 qDebug("setting listview index to %i",_pppdata->currentAccountID() );
164 accountlist_l->setCurrentItem( PPPData::data()->currentAccountID() ); 164 accountlist_l->setCurrentItem( _pppdata->currentAccountID() );
165// slotListBoxSelect( PPPData::data()->currentAccountID()); 165// slotListBoxSelect( _pppdata->currentAccountID());
166 166
167 l1->activate(); 167 l1->activate();
168} 168}
169 169
170 170
171 171
172void AccountWidget::slotListBoxSelect(int idx) { 172void AccountWidget::slotListBoxSelect(int idx) {
173 delete_b->setEnabled((bool)(idx != -1)); 173 delete_b->setEnabled((bool)(idx != -1));
174 edit_b->setEnabled((bool)(idx != -1)); 174 edit_b->setEnabled((bool)(idx != -1));
175 copy_b->setEnabled((bool)(idx != -1)); 175 copy_b->setEnabled((bool)(idx != -1));
176 if(idx!=-1) { 176 if(idx!=-1) {
177 qDebug("setting account to %i", idx); 177 qDebug("setting account to %i", idx);
178 QString account = PPPData::data()->accname(); 178 QString account = _pppdata->accname();
179 PPPData::data()->setAccountbyIndex(accountlist_l->currentItem()); 179 _pppdata->setAccountbyIndex(accountlist_l->currentItem());
180 // PPPData::data()->setAccount(account); 180 // _pppdata->setAccount(account);
181 } 181 }
182} 182}
183 183
184 184
185// void AccountWidget::viewLogClicked(){ 185// void AccountWidget::viewLogClicked(){
186 186
@@ -211,20 +211,20 @@ void AccountWidget::slotListBoxSelect(int idx) {
211// // voledit->setText(prettyPrintVolume(0)); 211// // voledit->setText(prettyPrintVolume(0));
212// // } 212// // }
213// } 213// }
214 214
215 215
216void AccountWidget::editaccount() { 216void AccountWidget::editaccount() {
217 PPPData::data()->setAccount(accountlist_l->text(accountlist_l->currentItem())); 217 _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem()));
218 218
219 int result = doTab(); 219 int result = doTab();
220 220
221 if(result == QDialog::Accepted) { 221 if(result == QDialog::Accepted) {
222 accountlist_l->changeItem(PPPData::data()->accname(),accountlist_l->currentItem()); 222 accountlist_l->changeItem(_pppdata->accname(),accountlist_l->currentItem());
223// emit resetaccounts(); 223// emit resetaccounts();
224 PPPData::data()->save(); 224 _pppdata->save();
225 } 225 }
226} 226}
227 227
228 228
229void AccountWidget::newaccount() { 229void AccountWidget::newaccount() {
230 if(accountlist_l->count() == MAX_ACCOUNTS) { 230 if(accountlist_l->count() == MAX_ACCOUNTS) {
@@ -242,37 +242,37 @@ void AccountWidget::newaccount() {
242 // i18n("Create New Account"), 242 // i18n("Create New Account"),
243 // i18n("Wizard"), i18n("Dialog Setup"), i18n("Cancel")); 243 // i18n("Wizard"), i18n("Dialog Setup"), i18n("Cancel"));
244 244
245// switch(query) { 245// switch(query) {
246// case QMessageBox::Yes: 246// case QMessageBox::Yes:
247// { 247// {
248// if (PPPData::data()->newaccount() == -1) 248// if (_pppdata->newaccount() == -1)
249 // return; 249 // return;
250// // ProviderDB pdb(this); 250// // ProviderDB pdb(this);
251// // result = pdb.exec(); 251// // result = pdb.exec();
252// break; 252// break;
253// } 253// }
254// case QMessageBox::No: 254// case QMessageBox::No:
255 if (PPPData::data()->newaccount() == -1){ 255 if (_pppdata->newaccount() == -1){
256 qDebug("PPPData::data()->newaccount() == -1"); 256 qDebug("_pppdata->newaccount() == -1");
257 return; 257 return;
258 } 258 }
259 result = doTab(); 259 result = doTab();
260// break; 260// break;
261// default: 261// default:
262// return; 262// return;
263// } 263// }
264 264
265 if(result == QDialog::Accepted) { 265 if(result == QDialog::Accepted) {
266 accountlist_l->insertItem(PPPData::data()->accname()); 266 accountlist_l->insertItem(_pppdata->accname());
267 accountlist_l->setSelected(accountlist_l->findItem(PPPData::data()->accname()), 267 accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()),
268 true); 268 true);
269// emit resetaccounts(); 269// emit resetaccounts();
270 PPPData::data()->save(); 270 _pppdata->save();
271 } else 271 } else
272 PPPData::data()->deleteAccount(); 272 _pppdata->deleteAccount();
273} 273}
274 274
275 275
276void AccountWidget::copyaccount() { 276void AccountWidget::copyaccount() {
277 if(accountlist_l->count() == MAX_ACCOUNTS) { 277 if(accountlist_l->count() == MAX_ACCOUNTS) {
278 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached.")); 278 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached."));
@@ -281,33 +281,33 @@ void AccountWidget::copyaccount() {
281 281
282 if(accountlist_l->currentItem()<0) { 282 if(accountlist_l->currentItem()<0) {
283 QMessageBox::information(this, "sorry", i18n("No account selected.")); 283 QMessageBox::information(this, "sorry", i18n("No account selected."));
284 return; 284 return;
285 } 285 }
286 286
287 PPPData::data()->copyaccount(accountlist_l->currentItem()); 287 _pppdata->copyaccount(accountlist_l->currentItem());
288 288
289 accountlist_l->insertItem(PPPData::data()->accname()); 289 accountlist_l->insertItem(_pppdata->accname());
290// emit resetaccounts(); 290// emit resetaccounts();
291 PPPData::data()->save(); 291 _pppdata->save();
292} 292}
293 293
294 294
295void AccountWidget::deleteaccount() { 295void AccountWidget::deleteaccount() {
296 296
297 QString s = i18n("Are you sure you want to delete\nthe account \"%1\"?") 297 QString s = i18n("Are you sure you want to delete\nthe account \"%1\"?")
298 .arg(accountlist_l->text(accountlist_l->currentItem())); 298 .arg(accountlist_l->text(accountlist_l->currentItem()));
299 299
300 if(QMessageBox::warning(this, s, i18n("Confirm")) != QMessageBox::Yes) 300 if(QMessageBox::warning(this, s, i18n("Confirm")) != QMessageBox::Yes)
301 return; 301 return;
302 302
303 if(PPPData::data()->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) 303 if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem())))
304 accountlist_l->removeItem(accountlist_l->currentItem()); 304 accountlist_l->removeItem(accountlist_l->currentItem());
305 305
306 emit resetaccounts(); 306 emit resetaccounts();
307 PPPData::data()->save(); 307 _pppdata->save();
308 308
309 slotListBoxSelect(accountlist_l->currentItem()); 309 slotListBoxSelect(accountlist_l->currentItem());
310 310
311} 311}
312 312
313 313
@@ -319,33 +319,33 @@ int AccountWidget::doTab(){
319 319
320 tabWindow = new QTabWidget( dlg, "tabWindow" ); 320 tabWindow = new QTabWidget( dlg, "tabWindow" );
321 layout->addWidget( tabWindow ); 321 layout->addWidget( tabWindow );
322 322
323 bool isnewaccount; 323 bool isnewaccount;
324 324
325 if(PPPData::data()->accname().isEmpty()) { 325 if(_pppdata->accname().isEmpty()) {
326 dlg->setCaption(i18n("New Account")); 326 dlg->setCaption(i18n("New Account"));
327 isnewaccount = true; 327 isnewaccount = true;
328 } else { 328 } else {
329 QString tit = i18n("Edit Account: "); 329 QString tit = i18n("Edit Account: ");
330 tit += PPPData::data()->accname(); 330 tit += _pppdata->accname();
331 dlg->setCaption(tit); 331 dlg->setCaption(tit);
332 isnewaccount = false; 332 isnewaccount = false;
333 } 333 }
334 334
335 dial_w = new DialWidget( tabWindow, isnewaccount, "Dial Setup"); 335 dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup");
336 tabWindow->addTab( dial_w, i18n("Dial") ); 336 tabWindow->addTab( dial_w, i18n("Dial") );
337 ip_w = new IPWidget( tabWindow, isnewaccount, i18n("IP Setup")); 337 ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, i18n("IP Setup"));
338 tabWindow->addTab( ip_w, i18n("IP") ); 338 tabWindow->addTab( ip_w, i18n("IP") );
339 gateway_w = new GatewayWidget( tabWindow, isnewaccount, i18n("Gateway Setup")); 339 gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, i18n("Gateway Setup"));
340 tabWindow->addTab( gateway_w, i18n("Gateway") ); 340 tabWindow->addTab( gateway_w, i18n("Gateway") );
341 dns_w = new DNSWidget( tabWindow, isnewaccount, i18n("DNS Servers") ); 341 dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, i18n("DNS Servers") );
342 tabWindow->addTab( dns_w, i18n("DNS") ); 342 tabWindow->addTab( dns_w, i18n("DNS") );
343 script_w = new ScriptWidget( tabWindow, isnewaccount, i18n("Edit Login Script")); 343 script_w = new ScriptWidget( _pppdata, tabWindow, isnewaccount, i18n("Edit Login Script"));
344 tabWindow->addTab( script_w, i18n("Login Script") ); 344 tabWindow->addTab( script_w, i18n("Login Script") );
345 ExecWidget *exec_w = new ExecWidget( tabWindow, isnewaccount, i18n("Execute Programs")); 345 ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, i18n("Execute Programs"));
346 tabWindow->addTab( exec_w, i18n("Execute") ); 346 tabWindow->addTab( exec_w, i18n("Execute") );
347// acct = new AccountingSelector( tabWindow, isnewaccount ); 347// acct = new AccountingSelector( tabWindow, isnewaccount );
348// tabWindow->addTab( acct, i18n("Accounting")); 348// tabWindow->addTab( acct, i18n("Accounting"));
349 349
350 int result = 0; 350 int result = 0;
351 bool ok = false; 351 bool ok = false;