summaryrefslogtreecommitdiff
path: root/noncore
authortille <tille>2003-05-24 16:12:02 (UTC)
committer tille <tille>2003-05-24 16:12:02 (UTC)
commitcc1aa3e178dff65854913bd5667579fc33ce707d (patch) (unidiff)
treed37d7fd8fb3b9832c0825b015af862f2cc62f473 /noncore
parent5667ded1d4583cfb79b2ddfd7aaae0e58ed6d552 (diff)
downloadopie-cc1aa3e178dff65854913bd5667579fc33ce707d.zip
opie-cc1aa3e178dff65854913bd5667579fc33ce707d.tar.gz
opie-cc1aa3e178dff65854913bd5667579fc33ce707d.tar.bz2
saves config (still in the kppp way)
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp104
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp180
-rw-r--r--noncore/settings/networksettings/ppp/conwindow.cpp26
-rw-r--r--noncore/settings/networksettings/ppp/debug.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp232
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp42
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp150
-rw-r--r--noncore/settings/networksettings/ppp/modem.cpp30
-rw-r--r--noncore/settings/networksettings/ppp/modemcmds.cpp111
-rw-r--r--noncore/settings/networksettings/ppp/newwidget.cpp17
-rw-r--r--noncore/settings/networksettings/ppp/newwidget.h19
-rw-r--r--noncore/settings/networksettings/ppp/ppp.pro4
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/pppdargs.cpp10
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp211
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h56
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp3
17 files changed, 587 insertions, 614 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index d902517..19db9ef 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -44,48 +44,48 @@
44 44
45#include "pppdata.h" 45#include "pppdata.h"
46#include "accounts.h" 46#include "accounts.h"
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( QWidget *parent, const char *name )
54 : QWidget( parent, name ) 54 : QWidget( parent, name )
55{ 55{
56 int min = 0; 56// int min = 0;
57 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); 57 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
58 58
59 // add a hbox 59 // add a hbox
60// QHBoxLayout *l11 = new QHBoxLayout; 60// QHBoxLayout *l11 = new QHBoxLayout;
61// l1->addLayout(l11); 61// l1->addLayout(l11);
62 62
63 accountlist_l = new QListBox(this); 63 accountlist_l = new QListBox(this);
64 accountlist_l->setMinimumSize(160, 128); 64// accountlist_l->setMinimumSize(160, 128);
65 connect(accountlist_l, SIGNAL(highlighted(int)), 65 connect(accountlist_l, SIGNAL(highlighted(int)),
66 this, SLOT(slotListBoxSelect(int))); 66 this, SLOT(slotListBoxSelect(int)));
67 connect(accountlist_l, SIGNAL(selected(int)), 67 connect(accountlist_l, SIGNAL(selected(int)),
68 this, SLOT(editaccount())); 68 this, SLOT(editaccount()));
69 l1->addWidget(accountlist_l, 10); 69 l1->addWidget(accountlist_l, 10);
70 70
71// QVBoxLayout *l111 = new QVBoxLayout(this); 71// QVBoxLayout *l111 = new QVBoxLayout(this);
72// l11->addLayout(l111, 1); 72// l11->addLayout(l111, 1);
73 edit_b = new QPushButton(i18n("&Edit..."), this); 73 edit_b = new QPushButton(i18n("&Edit..."), this);
74 connect(edit_b, SIGNAL(clicked()), SLOT(editaccount())); 74 connect(edit_b, SIGNAL(clicked()), SLOT(editaccount()));
75 QWhatsThis::add(edit_b, i18n("Allows you to modify the selected account")); 75 QWhatsThis::add(edit_b, i18n("Allows you to modify the selected account"));
76 76
77 min = edit_b->sizeHint().width(); 77// min = edit_b->sizeHint().width();
78 min = QMAX(70,min); 78// min = QMAX(70,min);
79 edit_b->setMinimumWidth(min); 79// edit_b->setMinimumWidth(min);
80 80
81 l1->addWidget(edit_b); 81 l1->addWidget(edit_b);
82 82
83 new_b = new QPushButton(i18n("&New..."), this); 83 new_b = new QPushButton(i18n("&New..."), this);
84 connect(new_b, SIGNAL(clicked()), SLOT(newaccount())); 84 connect(new_b, SIGNAL(clicked()), SLOT(newaccount()));
85 l1->addWidget(new_b); 85 l1->addWidget(new_b);
86 QWhatsThis::add(new_b, i18n("Create a new dialup connection\n" 86 QWhatsThis::add(new_b, i18n("Create a new dialup connection\n"
87 "to the Internet")); 87 "to the Internet"));
88 88
89 copy_b = new QPushButton(i18n("Co&py"), this); 89 copy_b = new QPushButton(i18n("Co&py"), this);
90 connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount())); 90 connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount()));
91 l1->addWidget(copy_b); 91 l1->addWidget(copy_b);
@@ -156,55 +156,55 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
156// reset->setEnabled(FALSE); 156// reset->setEnabled(FALSE);
157// connect(reset, SIGNAL(clicked()), 157// connect(reset, SIGNAL(clicked()),
158 // this, SLOT(resetClicked())); 158 // this, SLOT(resetClicked()));
159// l122->addWidget(reset); 159// l122->addWidget(reset);
160 160
161// log = new QPushButton(i18n("&View Logs"), this); 161// log = new QPushButton(i18n("&View Logs"), this);
162// connect(log, SIGNAL(clicked()), 162// connect(log, SIGNAL(clicked()),
163 // this, SLOT(viewLogClicked())); 163 // this, SLOT(viewLogClicked()));
164// l122->addWidget(log); 164// l122->addWidget(log);
165// l122->addStretch(1); 165// l122->addStretch(1);
166 166
167 //load up account list from gppdata to the list box 167 //load up account list from gppdata to the list box
168 if(gpppdata.count() > 0) { 168 if(PPPData::data()->count() > 0) {
169 for(int i=0; i <= gpppdata.count()-1; i++) { 169 for(int i=0; i <= PPPData::data()->count()-1; i++) {
170 gpppdata.setAccountbyIndex(i); 170 PPPData::data()->setAccountbyIndex(i);
171 accountlist_l->insertItem(gpppdata.accname()); 171 accountlist_l->insertItem(PPPData::data()->accname());
172 } 172 }
173 } 173 }
174 174
175 slotListBoxSelect(accountlist_l->currentItem()); 175 slotListBoxSelect(accountlist_l->currentItem());
176 176
177 l1->activate(); 177 l1->activate();
178} 178}
179 179
180 180
181 181
182void AccountWidget::slotListBoxSelect(int idx) { 182void AccountWidget::slotListBoxSelect(int idx) {
183 delete_b->setEnabled((bool)(idx != -1)); 183 delete_b->setEnabled((bool)(idx != -1));
184 edit_b->setEnabled((bool)(idx != -1)); 184 edit_b->setEnabled((bool)(idx != -1));
185 copy_b->setEnabled((bool)(idx != -1)); 185 copy_b->setEnabled((bool)(idx != -1));
186 if(idx!=-1) { 186 if(idx!=-1) {
187 QString account = gpppdata.accname(); 187 QString account = PPPData::data()->accname();
188 gpppdata.setAccountbyIndex(accountlist_l->currentItem()); 188 PPPData::data()->setAccountbyIndex(accountlist_l->currentItem());
189// reset->setEnabled(TRUE); 189// reset->setEnabled(TRUE);
190// costlabel->setEnabled(TRUE); 190// costlabel->setEnabled(TRUE);
191// costedit->setEnabled(TRUE); 191// costedit->setEnabled(TRUE);
192// costedit->setText(AccountingBase::getCosts(accountlist_l->text(accountlist_l->currentItem()))); 192// costedit->setText(AccountingBase::getCosts(accountlist_l->text(accountlist_l->currentItem())));
193 193
194// vollabel->setEnabled(TRUE); 194// vollabel->setEnabled(TRUE);
195// voledit->setEnabled(TRUE); 195// voledit->setEnabled(TRUE);
196 int bytes = gpppdata.totalBytes(); 196// int bytes = PPPData::data()->totalBytes();
197// voledit->setText(prettyPrintVolume(bytes)); 197// voledit->setText(prettyPrintVolume(bytes));
198 gpppdata.setAccount(account); 198 PPPData::data()->setAccount(account);
199 } else{ 199 } else{
200 // reset->setEnabled(FALSE); 200 // reset->setEnabled(FALSE);
201// costlabel->setEnabled(FALSE); 201// costlabel->setEnabled(FALSE);
202// costedit->setText(""); 202// costedit->setText("");
203// costedit->setEnabled(FALSE); 203// costedit->setEnabled(FALSE);
204// vollabel->setEnabled(FALSE); 204// vollabel->setEnabled(FALSE);
205// voledit->setText(""); 205// voledit->setText("");
206// voledit->setEnabled(FALSE); 206// voledit->setEnabled(FALSE);
207 } 207 }
208} 208}
209 209
210 210
@@ -231,157 +231,161 @@ void AccountWidget::slotListBoxSelect(int idx) {
231// // emit resetCosts(accountlist_l->text(accountlist_l->currentItem())); 231// // emit resetCosts(accountlist_l->text(accountlist_l->currentItem()));
232// // costedit->setText("0"); 232// // costedit->setText("0");
233// // } 233// // }
234 234
235// // if(what && QueryReset::VOLUME) { 235// // if(what && QueryReset::VOLUME) {
236// // emit resetVolume(accountlist_l->text(accountlist_l->currentItem())); 236// // emit resetVolume(accountlist_l->text(accountlist_l->currentItem()));
237// // voledit->setText(prettyPrintVolume(0)); 237// // voledit->setText(prettyPrintVolume(0));
238// // } 238// // }
239// } 239// }
240 240
241 241
242void AccountWidget::editaccount() { 242void AccountWidget::editaccount() {
243 gpppdata.setAccount(accountlist_l->text(accountlist_l->currentItem())); 243 PPPData::data()->setAccount(accountlist_l->text(accountlist_l->currentItem()));
244 244
245 int result = doTab(); 245 int result = doTab();
246 246
247 if(result == QDialog::Accepted) { 247 if(result == QDialog::Accepted) {
248 accountlist_l->changeItem(gpppdata.accname(),accountlist_l->currentItem()); 248 accountlist_l->changeItem(PPPData::data()->accname(),accountlist_l->currentItem());
249// emit resetaccounts(); 249// emit resetaccounts();
250 gpppdata.save(); 250 PPPData::data()->save();
251 } 251 }
252} 252}
253 253
254 254
255void AccountWidget::newaccount() { 255void AccountWidget::newaccount() {
256 if(accountlist_l->count() == MAX_ACCOUNTS) { 256 if(accountlist_l->count() == MAX_ACCOUNTS) {
257 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached.")); 257 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached."));
258 return; 258 return;
259 } 259 }
260 260
261 int result; 261 int result;
262// int query = QMessageBox::information(this, 262// int query = QMessageBox::information(this,
263// i18n("Do you want to use the wizard to create the new account or the " 263// i18n("Do you want to use the wizard to create the new account or the "
264 // "standard, dialog-based setup?\n" 264 // "standard, dialog-based setup?\n"
265 // "The wizard is easier and sufficient in most cases. If you need " 265 // "The wizard is easier and sufficient in most cases. If you need "
266 // "very special settings, you might want to try the standard, " 266 // "very special settings, you might want to try the standard, "
267 // "dialog-based setup."), 267 // "dialog-based setup."),
268 // i18n("Create New Account"), 268 // i18n("Create New Account"),
269 // i18n("Wizard"), i18n("Dialog Setup"), i18n("Cancel")); 269 // i18n("Wizard"), i18n("Dialog Setup"), i18n("Cancel"));
270 270
271// switch(query) { 271// switch(query) {
272// case QMessageBox::Yes: 272// case QMessageBox::Yes:
273// { 273// {
274// if (gpppdata.newaccount() == -1) 274// if (PPPData::data()->newaccount() == -1)
275 // return; 275 // return;
276// // ProviderDB pdb(this); 276// // ProviderDB pdb(this);
277// // result = pdb.exec(); 277// // result = pdb.exec();
278// break; 278// break;
279// } 279// }
280// case QMessageBox::No: 280// case QMessageBox::No:
281 if (gpppdata.newaccount() == -1){ 281 if (PPPData::data()->newaccount() == -1){
282 qDebug("gpppdata.newaccount() == -1"); 282 qDebug("PPPData::data()->newaccount() == -1");
283 return; 283 return;
284 } 284 }
285 result = doTab(); 285 result = doTab();
286// break; 286// break;
287// default: 287// default:
288// return; 288// return;
289// } 289// }
290 290
291 if(result == QDialog::Accepted) { 291 if(result == QDialog::Accepted) {
292 accountlist_l->insertItem(gpppdata.accname()); 292 accountlist_l->insertItem(PPPData::data()->accname());
293 accountlist_l->setSelected(accountlist_l->findItem(gpppdata.accname()), 293 accountlist_l->setSelected(accountlist_l->findItem(PPPData::data()->accname()),
294 true); 294 true);
295// emit resetaccounts(); 295// emit resetaccounts();
296 gpppdata.save(); 296 PPPData::data()->save();
297 } else 297 } else
298 gpppdata.deleteAccount(); 298 PPPData::data()->deleteAccount();
299} 299}
300 300
301 301
302void AccountWidget::copyaccount() { 302void AccountWidget::copyaccount() {
303 if(accountlist_l->count() == MAX_ACCOUNTS) { 303 if(accountlist_l->count() == MAX_ACCOUNTS) {
304 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached.")); 304 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached."));
305 return; 305 return;
306 } 306 }
307 307
308 if(accountlist_l->currentItem()<0) { 308 if(accountlist_l->currentItem()<0) {
309 QMessageBox::information(this, "sorry", i18n("No account selected.")); 309 QMessageBox::information(this, "sorry", i18n("No account selected."));
310 return; 310 return;
311 } 311 }
312 312
313 gpppdata.copyaccount(accountlist_l->currentItem()); 313 PPPData::data()->copyaccount(accountlist_l->currentItem());
314 314
315 accountlist_l->insertItem(gpppdata.accname()); 315 accountlist_l->insertItem(PPPData::data()->accname());
316// emit resetaccounts(); 316// emit resetaccounts();
317 gpppdata.save(); 317 PPPData::data()->save();
318} 318}
319 319
320 320
321void AccountWidget::deleteaccount() { 321void AccountWidget::deleteaccount() {
322 322
323 QString s = i18n("Are you sure you want to delete\nthe account \"%1\"?") 323 QString s = i18n("Are you sure you want to delete\nthe account \"%1\"?")
324 .arg(accountlist_l->text(accountlist_l->currentItem())); 324 .arg(accountlist_l->text(accountlist_l->currentItem()));
325 325
326 if(QMessageBox::warning(this, s, i18n("Confirm")) != QMessageBox::Yes) 326 if(QMessageBox::warning(this, s, i18n("Confirm")) != QMessageBox::Yes)
327 return; 327 return;
328 328
329 if(gpppdata.deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) 329 if(PPPData::data()->deleteAccount(accountlist_l->text(accountlist_l->currentItem())))
330 accountlist_l->removeItem(accountlist_l->currentItem()); 330 accountlist_l->removeItem(accountlist_l->currentItem());
331 331
332 emit resetaccounts(); 332 emit resetaccounts();
333 gpppdata.save(); 333 PPPData::data()->save();
334 334
335 slotListBoxSelect(accountlist_l->currentItem()); 335 slotListBoxSelect(accountlist_l->currentItem());
336 336
337} 337}
338 338
339 339
340int AccountWidget::doTab(){ 340int AccountWidget::doTab(){
341 QDialog *dlg = new QDialog( this ); 341 QDialog *dlg = new QDialog( this, "newAccount", true );
342 tabWindow = new QTabWidget( dlg ); 342 QVBoxLayout *layout = new QVBoxLayout( dlg );
343 // tabWindow = new KDialogBase( KDialogBase::Tabbed, QString::null, 343 layout->setSpacing( 0 );
344// KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, 344 layout->setMargin( 1 );
345// 0, 0, true); 345
346// KWin::setIcons(tabWindow->winId(), kapp->icon(), kapp->miniIcon()); 346 tabWindow = new QTabWidget( dlg, "tabWindow" );
347 layout->addWidget( tabWindow );
348
347 bool isnewaccount; 349 bool isnewaccount;
348 350
349 if(gpppdata.accname().isEmpty()) { 351 if(PPPData::data()->accname().isEmpty()) {
350 tabWindow->setCaption(i18n("New Account")); 352 dlg->setCaption(i18n("New Account"));
351 isnewaccount = true; 353 isnewaccount = true;
352 } else { 354 } else {
353 QString tit = i18n("Edit Account: "); 355 QString tit = i18n("Edit Account: ");
354 tit += gpppdata.accname(); 356 tit += PPPData::data()->accname();
355 tabWindow->setCaption(tit); 357 dlg->setCaption(tit);
356 isnewaccount = false; 358 isnewaccount = false;
357 } 359 }
358 360
359 dial_w = new DialWidget( tabWindow ); 361 dial_w = new DialWidget( tabWindow, isnewaccount, "Dial Setup");
360 tabWindow->addTab( dial_w, i18n("Dial") );//, i18n("Dial Setup")), isnewaccount); 362 tabWindow->addTab( dial_w, i18n("Dial") );
361 ip_w = new IPWidget( tabWindow ); 363 ip_w = new IPWidget( tabWindow, isnewaccount, i18n("IP Setup"));
362 tabWindow->addTab( ip_w, i18n("IP") );//, i18n("IP Setup")), isnewaccount); 364 tabWindow->addTab( ip_w, i18n("IP") );
363 gateway_w = new GatewayWidget( tabWindow ); 365 gateway_w = new GatewayWidget( tabWindow, isnewaccount, i18n("Gateway Setup"));
364 tabWindow->addTab( gateway_w, i18n("Gateway") );//, i18n("Gateway Setup")), isnewaccount); 366 tabWindow->addTab( gateway_w, i18n("Gateway") );
365 dns_w = new DNSWidget( tabWindow ); 367 dns_w = new DNSWidget( tabWindow, isnewaccount, i18n("DNS Servers") );
366 tabWindow->addTab( dns_w, i18n("DNS") );//, i18n("DNS Servers")), isnewaccount); 368 tabWindow->addTab( dns_w, i18n("DNS") );
367 script_w = new ScriptWidget( tabWindow ); 369 script_w = new ScriptWidget( tabWindow, isnewaccount, i18n("Edit Login Script"));
368 tabWindow->addTab( script_w, i18n("Login Script") ); //, i18n("Edit Login Script")), isnewaccount); 370 tabWindow->addTab( script_w, i18n("Login Script") );
369 ExecWidget *exec_w = new ExecWidget( tabWindow ); 371 ExecWidget *exec_w = new ExecWidget( tabWindow, isnewaccount, i18n("Execute Programs"));
370 tabWindow->addTab( exec_w, i18n("Execute") );//, i18n("Execute Programs")), isnewaccount); 372 tabWindow->addTab( exec_w, i18n("Execute") );
371// acct = new AccountingSelector( tabWindow, isnewaccount ); 373// acct = new AccountingSelector( tabWindow, isnewaccount );
372// tabWindow->addTab( acct, i18n("Accounting")); 374// tabWindow->addTab( acct, i18n("Accounting"));
373 375
374 int result = 0; 376 int result = 0;
375 bool ok = false; 377 bool ok = false;
378 qDebug("AccountWidget::doTab dlg->showMinimized");
379 dlg->showMinimized();
376 while (!ok){ 380 while (!ok){
377 381
378 result = dlg->exec(); 382 result = dlg->exec();
379 ok = true; 383 ok = true;
380 384
381 if(result == QDialog::Accepted) { 385 if(result == QDialog::Accepted) {
382 if (script_w->check()) { 386 if (script_w->check()) {
383 if(dial_w->save()) { 387 if(dial_w->save()) {
384 ip_w->save(); 388 ip_w->save();
385 dns_w->save(); 389 dns_w->save();
386 gateway_w->save(); 390 gateway_w->save();
387 script_w->save(); 391 script_w->save();
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index b7e229e..a3eda9d 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -170,59 +170,59 @@ ConnectWidget::~ConnectWidget() {
170} 170}
171 171
172 172
173void ConnectWidget::preinit() { 173void ConnectWidget::preinit() {
174 // this is all just to keep the GUI nice and snappy .... 174 // this is all just to keep the GUI nice and snappy ....
175 // you have to see to believe ... 175 // you have to see to believe ...
176 messg->setText(i18n("Looking for modem...")); 176 messg->setText(i18n("Looking for modem..."));
177 inittimer->start(100); 177 inittimer->start(100);
178} 178}
179 179
180 180
181void ConnectWidget::init() { 181void ConnectWidget::init() {
182 gpppdata.setpppdError(0); 182 PPPData::data()->setpppdError(0);
183 inittimer->stop(); 183 inittimer->stop();
184 vmain = 0; 184 vmain = 0;
185 substate = -1; 185 substate = -1;
186 expecting = false; 186 expecting = false;
187 pausing = false; 187 pausing = false;
188 scriptindex = 0; 188 scriptindex = 0;
189 myreadbuffer = ""; 189 myreadbuffer = "";
190 scanning = false; 190 scanning = false;
191 scanvar = ""; 191 scanvar = "";
192 firstrunID = true; 192 firstrunID = true;
193 firstrunPW = true; 193 firstrunPW = true;
194// stats->totalbytes = 0; 194// stats->totalbytes = 0;
195 dialnumber = 0; 195 dialnumber = 0;
196 196
197 p_kppp->con_speed = ""; 197 p_kppp->con_speed = "";
198 198
199// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || gpppdata.quit_on_disconnect()); 199// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || PPPData::data()->quit_on_disconnect());
200 200
201 comlist = &gpppdata.scriptType(); 201 comlist = &PPPData::data()->scriptType();
202 arglist = &gpppdata.script(); 202 arglist = &PPPData::data()->script();
203 203
204 QString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); 204 QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname());
205 setCaption(tit); 205 setCaption(tit);
206 206
207 qApp->processEvents(); 207 qApp->processEvents();
208 208
209 // run the "before-connect" command 209 // run the "before-connect" command
210 if (!gpppdata.command_before_connect().isEmpty()) { 210 if (!PPPData::data()->command_before_connect().isEmpty()) {
211 messg->setText(i18n("Running pre-startup command...")); 211 messg->setText(i18n("Running pre-startup command..."));
212 emit debugMessage(i18n("Running pre-startup command...")); 212 emit debugMessage(i18n("Running pre-startup command..."));
213 213
214 qApp->processEvents(); 214 qApp->processEvents();
215 QApplication::flushX(); 215 QApplication::flushX();
216 pid_t id = execute_command(gpppdata.command_before_connect()); 216 pid_t id = execute_command(PPPData::data()->command_before_connect());
217// int i, status; 217// int i, status;
218 218
219// do { 219// do {
220// qApp->processEvents(); 220// qApp->processEvents();
221// i = waitpid(id, &status, WNOHANG); 221// i = waitpid(id, &status, WNOHANG);
222// usleep(100000); 222// usleep(100000);
223// } while (i == 0 && errno == 0); 223// } while (i == 0 && errno == 0);
224 } 224 }
225 225
226 int lock = Modem::modem->lockdevice(); 226 int lock = Modem::modem->lockdevice();
227 227
228 if (lock == 1) { 228 if (lock == 1) {
@@ -241,25 +241,25 @@ void ConnectWidget::init() {
241 messg->setText(Modem::modem->modemMessage()); 241 messg->setText(Modem::modem->modemMessage());
242 qApp->processEvents(); 242 qApp->processEvents();
243 if(Modem::modem->hangup()) { 243 if(Modem::modem->hangup()) {
244 244
245 qApp->processEvents(); 245 qApp->processEvents();
246 246
247 semaphore = false; 247 semaphore = false;
248 248
249 Modem::modem->stop(); 249 Modem::modem->stop();
250 Modem::modem->notify(this, SLOT(readChar(unsigned char))); 250 Modem::modem->notify(this, SLOT(readChar(unsigned char)));
251 251
252 // if we are stuck anywhere we will time out 252 // if we are stuck anywhere we will time out
253 timeout_timer->start(gpppdata.modemTimeout()*1000); 253 timeout_timer->start(PPPData::data()->modemTimeout()*1000);
254 254
255 // this timer will run the script etc. 255 // this timer will run the script etc.
256 main_timer_ID = startTimer(10); 256 main_timer_ID = startTimer(10);
257 257
258 return; 258 return;
259 } 259 }
260 } 260 }
261 261
262 // initialization failed 262 // initialization failed
263 messg->setText(Modem::modem->modemMessage()); 263 messg->setText(Modem::modem->modemMessage());
264 vmain = 20; // wait until cancel is pressed 264 vmain = 20; // wait until cancel is pressed
265 Modem::modem->unlockdevice(); 265 Modem::modem->unlockdevice();
@@ -275,198 +275,198 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
275 vmain = 10; 275 vmain = 10;
276 return; 276 return;
277#endif 277#endif
278 278
279 assert(PPPData::NumInitStrings > 0); 279 assert(PPPData::NumInitStrings > 0);
280 // first init string ? 280 // first init string ?
281 if(substate == -1) { 281 if(substate == -1) {
282 messg->setText(i18n("Initializing modem...")); 282 messg->setText(i18n("Initializing modem..."));
283 emit debugMessage(i18n("Initializing modem...")); 283 emit debugMessage(i18n("Initializing modem..."));
284 substate = 0; 284 substate = 0;
285 } 285 }
286 286
287 QString initStr = gpppdata.modemInitStr(substate); 287 QString initStr = PPPData::data()->modemInitStr(substate);
288 if (!initStr.isEmpty()) { 288 if (!initStr.isEmpty()) {
289 // send a carriage return and then wait a bit so that the modem will 289 // send a carriage return and then wait a bit so that the modem will
290 // let us issue commands. 290 // let us issue commands.
291 if(gpppdata.modemPreInitDelay() > 0) { 291 if(PPPData::data()->modemPreInitDelay() > 0) {
292 usleep(gpppdata.modemPreInitDelay() * 5000); 292 usleep(PPPData::data()->modemPreInitDelay() * 5000);
293 writeline(""); 293 writeline("");
294 usleep(gpppdata.modemPreInitDelay() * 5000); 294 usleep(PPPData::data()->modemPreInitDelay() * 5000);
295 } 295 }
296 setExpect(gpppdata.modemInitResp()); 296 setExpect(PPPData::data()->modemInitResp());
297 writeline(initStr); 297 writeline(initStr);
298 usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec 298 usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
299 } 299 }
300 300
301 substate++; 301 substate++;
302 302
303 /* 303 /*
304 * FIXME after 3.0: Make it possible to disable ATS11 since it 304 * FIXME after 3.0: Make it possible to disable ATS11 since it
305 * seems to be incompatible with some ISDN adapters (e.g. DataBox 305 * seems to be incompatible with some ISDN adapters (e.g. DataBox
306 * Speed Dragon). Even better would be to detect this when doing 306 * Speed Dragon). Even better would be to detect this when doing
307 * a "Modem Query" 307 * a "Modem Query"
308 */ 308 */
309 if (MODEM_TONEDURATION != gpppdata.modemToneDuration()) 309 if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration())
310 vmain = 5; 310 vmain = 5;
311 else 311 else
312 vmain = 3; 312 vmain = 3;
313 313
314 return; 314 return;
315 } 315 }
316 316
317 if (vmain == 5) { 317 if (vmain == 5) {
318 if(!expecting) { 318 if(!expecting) {
319 QString sToneDuration = "ATS11=" + QString::number(gpppdata.modemToneDuration()); 319 QString sToneDuration = "ATS11=" + QString::number(PPPData::data()->modemToneDuration());
320 QString msg = i18n("Setting ") + sToneDuration; 320 QString msg = i18n("Setting ") + sToneDuration;
321 messg->setText(msg); 321 messg->setText(msg);
322 emit debugMessage(msg); 322 emit debugMessage(msg);
323 setExpect(gpppdata.modemInitResp()); 323 setExpect(PPPData::data()->modemInitResp());
324 writeline(sToneDuration); 324 writeline(sToneDuration);
325 } 325 }
326 vmain = 3; 326 vmain = 3;
327 return; 327 return;
328 } 328 }
329 329
330 if(vmain == 3) { 330 if(vmain == 3) {
331 if(!expecting) { 331 if(!expecting) {
332 // done with all init strings ? 332 // done with all init strings ?
333 if(substate < PPPData::NumInitStrings) { 333 if(substate < PPPData::NumInitStrings) {
334 vmain = 0; 334 vmain = 0;
335 return; 335 return;
336 } 336 }
337 substate = -1; 337 substate = -1;
338 // skip setting the volume if command is empty 338 // skip setting the volume if command is empty
339 if(gpppdata.volumeInitString().isEmpty()) { 339 if(PPPData::data()->volumeInitString().isEmpty()) {
340 vmain = 4; 340 vmain = 4;
341 return; 341 return;
342 } 342 }
343 messg->setText(i18n("Setting speaker volume...")); 343 messg->setText(i18n("Setting speaker volume..."));
344 emit debugMessage(i18n("Setting speaker volume...")); 344 emit debugMessage(i18n("Setting speaker volume..."));
345 345
346 setExpect(gpppdata.modemInitResp()); 346 setExpect(PPPData::data()->modemInitResp());
347 QString vol("AT"); 347 QString vol("AT");
348 vol += gpppdata.volumeInitString(); 348 vol += PPPData::data()->volumeInitString();
349 writeline(vol); 349 writeline(vol);
350 usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec 350 usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
351 vmain = 4; 351 vmain = 4;
352 return; 352 return;
353 } 353 }
354 } 354 }
355 355
356 if(vmain == 4) { 356 if(vmain == 4) {
357 if(!expecting) { 357 if(!expecting) {
358 if(!gpppdata.waitForDialTone()) { 358 if(!PPPData::data()->waitForDialTone()) {
359 QString msg = i18n("Turning off dial tone waiting..."); 359 QString msg = i18n("Turning off dial tone waiting...");
360 messg->setText(msg); 360 messg->setText(msg);
361 emit debugMessage(msg); 361 emit debugMessage(msg);
362 setExpect(gpppdata.modemInitResp()); 362 setExpect(PPPData::data()->modemInitResp());
363 writeline(gpppdata.modemNoDialToneDetectionStr()); 363 writeline(PPPData::data()->modemNoDialToneDetectionStr());
364 } 364 }
365 vmain = 1; 365 vmain = 1;
366 return; 366 return;
367 } 367 }
368 } 368 }
369 369
370 // dial the number and wait to connect 370 // dial the number and wait to connect
371 if(vmain == 1) { 371 if(vmain == 1) {
372 if(!expecting) { 372 if(!expecting) {
373 373
374 timeout_timer->stop(); 374 timeout_timer->stop();
375 timeout_timer->start(gpppdata.modemTimeout()*1000); 375 timeout_timer->start(PPPData::data()->modemTimeout()*1000);
376 376
377 QStringList &plist = gpppdata.phonenumbers(); 377 QStringList &plist = PPPData::data()->phonenumbers();
378 QString bmarg= gpppdata.dialPrefix(); 378 QString bmarg= PPPData::data()->dialPrefix();
379 bmarg += *plist.at(dialnumber); 379 bmarg += *plist.at(dialnumber);
380 QString bm = i18n("Dialing %1").arg(bmarg); 380 QString bm = i18n("Dialing %1").arg(bmarg);
381 messg->setText(bm); 381 messg->setText(bm);
382 emit debugMessage(bm); 382 emit debugMessage(bm);
383 383
384 QString pn = gpppdata.modemDialStr(); 384 QString pn = PPPData::data()->modemDialStr();
385 pn += gpppdata.dialPrefix(); 385 pn += PPPData::data()->dialPrefix();
386 pn += *plist.at(dialnumber); 386 pn += *plist.at(dialnumber);
387 if(++dialnumber >= plist.count()) 387 if(++dialnumber >= plist.count())
388 dialnumber = 0; 388 dialnumber = 0;
389 writeline(pn); 389 writeline(pn);
390 390
391 setExpect(gpppdata.modemConnectResp()); 391 setExpect(PPPData::data()->modemConnectResp());
392 vmain = 100; 392 vmain = 100;
393 return; 393 return;
394 } 394 }
395 } 395 }
396 396
397 // wait for connect, but redial if BUSY or wait for user cancel 397 // wait for connect, but redial if BUSY or wait for user cancel
398 // if NO CARRIER or NO DIALTONE 398 // if NO CARRIER or NO DIALTONE
399 if(vmain == 100) { 399 if(vmain == 100) {
400 if(!expecting) { 400 if(!expecting) {
401 myreadbuffer = gpppdata.modemConnectResp(); 401 myreadbuffer = PPPData::data()->modemConnectResp();
402 setExpect("\n"); 402 setExpect("\n");
403 vmain = 101; 403 vmain = 101;
404 return; 404 return;
405 } 405 }
406 406
407 if(readbuffer.contains(gpppdata.modemBusyResp())) { 407 if(readbuffer.contains(PPPData::data()->modemBusyResp())) {
408 timeout_timer->stop(); 408 timeout_timer->stop();
409 timeout_timer->start(gpppdata.modemTimeout()*1000); 409 timeout_timer->start(PPPData::data()->modemTimeout()*1000);
410 410
411 messg->setText(i18n("Line busy. Hanging up...")); 411 messg->setText(i18n("Line busy. Hanging up..."));
412 emit debugPutChar('\n'); 412 emit debugPutChar('\n');
413 Modem::modem->hangup(); 413 Modem::modem->hangup();
414 414
415 if(gpppdata.busyWait() > 0) { 415 if(PPPData::data()->busyWait() > 0) {
416 QString bm = i18n("Line busy. Waiting: %1 seconds").arg(gpppdata.busyWait()); 416 QString bm = i18n("Line busy. Waiting: %1 seconds").arg(PPPData::data()->busyWait());
417 messg->setText(bm); 417 messg->setText(bm);
418 emit debugMessage(bm); 418 emit debugMessage(bm);
419 419
420 pausing = true; 420 pausing = true;
421 421
422 pausetimer->start(gpppdata.busyWait()*1000, true); 422 pausetimer->start(PPPData::data()->busyWait()*1000, true);
423 timeout_timer->stop(); 423 timeout_timer->stop();
424 } 424 }
425 425
426 Modem::modem->setDataMode(false); 426 Modem::modem->setDataMode(false);
427 vmain = 0; 427 vmain = 0;
428 substate = -1; 428 substate = -1;
429 return; 429 return;
430 } 430 }
431 431
432 if(readbuffer.contains(gpppdata.modemNoDialtoneResp())) { 432 if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) {
433 timeout_timer->stop(); 433 timeout_timer->stop();
434 434
435 messg->setText(i18n("No Dialtone")); 435 messg->setText(i18n("No Dialtone"));
436 vmain = 20; 436 vmain = 20;
437 Modem::modem->unlockdevice(); 437 Modem::modem->unlockdevice();
438 return; 438 return;
439 } 439 }
440 440
441 if(readbuffer.contains(gpppdata.modemNoCarrierResp())) { 441 if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) {
442 timeout_timer->stop(); 442 timeout_timer->stop();
443 443
444 messg->setText(i18n("No Carrier")); 444 messg->setText(i18n("No Carrier"));
445 vmain = 20; 445 vmain = 20;
446 Modem::modem->unlockdevice(); 446 Modem::modem->unlockdevice();
447 return; 447 return;
448 } 448 }
449 } 449 }
450 450
451 // wait for newline after CONNECT response (so we get the speed) 451 // wait for newline after CONNECT response (so we get the speed)
452 if(vmain == 101) { 452 if(vmain == 101) {
453 if(!expecting) { 453 if(!expecting) {
454 Modem::modem->setDataMode(true); // modem will no longer respond to AT commands 454 Modem::modem->setDataMode(true); // modem will no longer respond to AT commands
455 455
456 emit startAccounting(); 456 emit startAccounting();
457// p_kppp->con_win->startClock(); 457// p_kppp->con_win->startClock();
458 458
459 vmain = 2; 459 vmain = 2;
460 scriptTimeout=gpppdata.modemTimeout()*1000; 460 scriptTimeout=PPPData::data()->modemTimeout()*1000;
461 return; 461 return;
462 } 462 }
463 } 463 }
464 464
465 // execute the script 465 // execute the script
466 if(vmain == 2) { 466 if(vmain == 2) {
467 if(!expecting && !pausing && !scanning) { 467 if(!expecting && !pausing && !scanning) {
468 468
469 timeout_timer->stop(); 469 timeout_timer->stop();
470 timeout_timer->start(scriptTimeout); 470 timeout_timer->start(scriptTimeout);
471 471
472 if((unsigned) scriptindex < comlist->count()) { 472 if((unsigned) scriptindex < comlist->count()) {
@@ -485,45 +485,45 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
485 485
486 setScan(scriptArgument); 486 setScan(scriptArgument);
487 scriptindex++; 487 scriptindex++;
488 return; 488 return;
489 } 489 }
490 490
491 if (scriptCommand == "Save") { 491 if (scriptCommand == "Save") {
492 QString bm = i18n("Saving %1").arg(scriptArgument); 492 QString bm = i18n("Saving %1").arg(scriptArgument);
493 messg->setText(bm); 493 messg->setText(bm);
494 emit debugMessage(bm); 494 emit debugMessage(bm);
495 495
496 if (scriptArgument.lower() == "password") { 496 if (scriptArgument.lower() == "password") {
497 gpppdata.setPassword(scanvar); 497 PPPData::data()->setPassword(scanvar);
498 p_kppp->setPW_Edit(scanvar); 498 p_kppp->setPW_Edit(scanvar);
499 if(gpppdata.storePassword()) 499 if(PPPData::data()->storePassword())
500 gpppdata.setStoredPassword(scanvar); 500 PPPData::data()->setStoredPassword(scanvar);
501 firstrunPW = true; 501 firstrunPW = true;
502 } 502 }
503 503
504 scriptindex++; 504 scriptindex++;
505 return; 505 return;
506 } 506 }
507 507
508 508
509 if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") { 509 if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") {
510 QString bm = i18n("Sending %1"); 510 QString bm = i18n("Sending %1");
511 511
512 // replace %USERNAME% and %PASSWORD% 512 // replace %USERNAME% and %PASSWORD%
513 QString arg = scriptArgument; 513 QString arg = scriptArgument;
514 QRegExp re1("%USERNAME%"); 514 QRegExp re1("%USERNAME%");
515 QRegExp re2("%PASSWORD%"); 515 QRegExp re2("%PASSWORD%");
516 arg = arg.replace(re1, gpppdata.storedUsername()); 516 arg = arg.replace(re1, PPPData::data()->storedUsername());
517 arg = arg.replace(re2, gpppdata.storedPassword()); 517 arg = arg.replace(re2, PPPData::data()->storedPassword());
518 518
519 if (scriptCommand == "Send") 519 if (scriptCommand == "Send")
520 bm = bm.arg(scriptArgument); 520 bm = bm.arg(scriptArgument);
521 else { 521 else {
522 for(uint i = 0; i < scriptArgument.length(); i++) 522 for(uint i = 0; i < scriptArgument.length(); i++)
523 bm = bm.arg("*"); 523 bm = bm.arg("*");
524 } 524 }
525 525
526 messg->setText(bm); 526 messg->setText(bm);
527 emit debugMessage(bm); 527 emit debugMessage(bm);
528 528
529 writeline(scriptArgument); 529 writeline(scriptArgument);
@@ -569,49 +569,49 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
569 569
570 scriptTimeout=scriptArgument.toInt()*1000; 570 scriptTimeout=scriptArgument.toInt()*1000;
571 timeout_timer->start(scriptTimeout); 571 timeout_timer->start(scriptTimeout);
572 572
573 scriptindex++; 573 scriptindex++;
574 return; 574 return;
575 } 575 }
576 576
577 if (scriptCommand == "Hangup") { 577 if (scriptCommand == "Hangup") {
578 messg->setText(i18n("Hangup")); 578 messg->setText(i18n("Hangup"));
579 emit debugMessage(i18n("Hangup")); 579 emit debugMessage(i18n("Hangup"));
580 580
581 writeline(gpppdata.modemHangupStr()); 581 writeline(PPPData::data()->modemHangupStr());
582 setExpect(gpppdata.modemHangupResp()); 582 setExpect(PPPData::data()->modemHangupResp());
583 583
584 scriptindex++; 584 scriptindex++;
585 return; 585 return;
586 } 586 }
587 587
588 if (scriptCommand == "Answer") { 588 if (scriptCommand == "Answer") {
589 589
590 timeout_timer->stop(); 590 timeout_timer->stop();
591 591
592 messg->setText(i18n("Answer")); 592 messg->setText(i18n("Answer"));
593 emit debugMessage(i18n("Answer")); 593 emit debugMessage(i18n("Answer"));
594 594
595 setExpect(gpppdata.modemRingResp()); 595 setExpect(PPPData::data()->modemRingResp());
596 vmain = 150; 596 vmain = 150;
597 return; 597 return;
598 } 598 }
599 599
600 if (scriptCommand == "ID") { 600 if (scriptCommand == "ID") {
601 QString bm = i18n("ID %1").arg(scriptArgument); 601 QString bm = i18n("ID %1").arg(scriptArgument);
602 messg->setText(bm); 602 messg->setText(bm);
603 emit debugMessage(bm); 603 emit debugMessage(bm);
604 604
605 QString idstring = gpppdata.storedUsername(); 605 QString idstring = PPPData::data()->storedUsername();
606 606
607 if(!idstring.isEmpty() && firstrunID) { 607 if(!idstring.isEmpty() && firstrunID) {
608 // the user entered an Id on the main kppp dialog 608 // the user entered an Id on the main kppp dialog
609 writeline(idstring); 609 writeline(idstring);
610 firstrunID = false; 610 firstrunID = false;
611 scriptindex++; 611 scriptindex++;
612 } 612 }
613 else { 613 else {
614 // the user didn't enter and Id on the main kppp dialog 614 // the user didn't enter and Id on the main kppp dialog
615 // let's query for an ID 615 // let's query for an ID
616 /* if not around yet, then post window... */ 616 /* if not around yet, then post window... */
617 if (prompt->Consumed()) { 617 if (prompt->Consumed()) {
@@ -629,25 +629,25 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
629 return; 629 return;
630 } 630 }
631 /* replace timeout value */ 631 /* replace timeout value */
632 } 632 }
633 } 633 }
634 } 634 }
635 635
636 if (scriptCommand == "Password") { 636 if (scriptCommand == "Password") {
637 QString bm = i18n("Password %1").arg(scriptArgument); 637 QString bm = i18n("Password %1").arg(scriptArgument);
638 messg->setText(bm); 638 messg->setText(bm);
639 emit debugMessage(bm); 639 emit debugMessage(bm);
640 640
641 QString pwstring = gpppdata.password(); 641 QString pwstring = PPPData::data()->password();
642 642
643 if(!pwstring.isEmpty() && firstrunPW) { 643 if(!pwstring.isEmpty() && firstrunPW) {
644 // the user entered a password on the main kppp dialog 644 // the user entered a password on the main kppp dialog
645 writeline(pwstring); 645 writeline(pwstring);
646 firstrunPW = false; 646 firstrunPW = false;
647 scriptindex++; 647 scriptindex++;
648 } 648 }
649 else { 649 else {
650 // the user didn't enter a password on the main kppp dialog 650 // the user didn't enter a password on the main kppp dialog
651 // let's query for a password 651 // let's query for a password
652 /* if not around yet, then post window... */ 652 /* if not around yet, then post window... */
653 if (prompt->Consumed()) { 653 if (prompt->Consumed()) {
@@ -776,26 +776,26 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
776 } 776 }
777 messg->setText(bm); 777 messg->setText(bm);
778 emit debugMessage(bm); 778 emit debugMessage(bm);
779 779
780 } 780 }
781 } 781 }
782 } 782 }
783 783
784 // this is a subroutine for the "Answer" script option 784 // this is a subroutine for the "Answer" script option
785 785
786 if(vmain == 150) { 786 if(vmain == 150) {
787 if(!expecting) { 787 if(!expecting) {
788 writeline(gpppdata.modemAnswerStr()); 788 writeline(PPPData::data()->modemAnswerStr());
789 setExpect(gpppdata.modemAnswerResp()); 789 setExpect(PPPData::data()->modemAnswerResp());
790 790
791 vmain = 2; 791 vmain = 2;
792 scriptindex++; 792 scriptindex++;
793 return; 793 return;
794 } 794 }
795 } 795 }
796 796
797 if(vmain == 30) { 797 if(vmain == 30) {
798// if (termwindow->isVisible()) 798// if (termwindow->isVisible())
799// return; 799// return;
800// if (termwindow->pressedContinue()) 800// if (termwindow->pressedContinue())
801// vmain = 10; 801// vmain = 10;
@@ -805,60 +805,60 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
805 805
806 if(vmain == 10) { 806 if(vmain == 10) {
807 if(!expecting) { 807 if(!expecting) {
808 808
809 int result; 809 int result;
810 810
811 timeout_timer->stop(); 811 timeout_timer->stop();
812 if_timeout_timer->stop(); // better be sure. 812 if_timeout_timer->stop(); // better be sure.
813 813
814 // stop reading of data 814 // stop reading of data
815 Modem::modem->stop(); 815 Modem::modem->stop();
816 816
817 if(gpppdata.authMethod() == AUTH_TERMINAL) { 817 if(PPPData::data()->authMethod() == AUTH_TERMINAL) {
818 // if (termwindow) { 818 // if (termwindow) {
819 // delete termwindow; 819 // delete termwindow;
820 // termwindow = 0L; 820 // termwindow = 0L;
821 // this->show(); 821 // this->show();
822 // } else { 822 // } else {
823 // termwindow = new LoginTerm(0L, 0L); 823 // termwindow = new LoginTerm(0L, 0L);
824 // hide(); 824 // hide();
825 // termwindow->show(); 825 // termwindow->show();
826 // vmain = 30; 826 // vmain = 30;
827 // return; 827 // return;
828 // } 828 // }
829 } 829 }
830 830
831 // Close the tty. This prevents the QTimer::singleShot() in 831 // Close the tty. This prevents the QTimer::singleShot() in
832 // Modem::readtty() from re-enabling the socket notifier. 832 // Modem::readtty() from re-enabling the socket notifier.
833 // The port is still held open by the helper process. 833 // The port is still held open by the helper process.
834 Modem::modem->closetty(); 834 Modem::modem->closetty();
835 835
836 killTimer( main_timer_ID ); 836 killTimer( main_timer_ID );
837 837
838 if_timeout_timer->start(gpppdata.pppdTimeout()*1000); 838 if_timeout_timer->start(PPPData::data()->pppdTimeout()*1000);
839 qDebug( "started if timeout timer with %i", gpppdata.pppdTimeout()*1000); 839 qDebug( "started if timeout timer with %i", PPPData::data()->pppdTimeout()*1000);
840 840
841 // find out PPP interface and notify the stats module 841 // find out PPP interface and notify the stats module
842// stats->setUnit(pppInterfaceNumber()); 842// stats->setUnit(pppInterfaceNumber());
843 843
844 qApp->flushX(); 844 qApp->flushX();
845 semaphore = true; 845 semaphore = true;
846 result = execppp(); 846 result = execppp();
847 847
848 emit debugMessage(i18n("Starting pppd...")); 848 emit debugMessage(i18n("Starting pppd..."));
849 qDebug("execppp() returned with return-code %i", result ); 849 qDebug("execppp() returned with return-code %i", result );
850 850
851 if(result) { 851 if(result) {
852 if(!gpppdata.autoDNS()) 852 if(!PPPData::data()->autoDNS())
853 adddns(); 853 adddns();
854 854
855 // O.K we are done here, let's change over to the if_waiting loop 855 // O.K we are done here, let's change over to the if_waiting loop
856 // where we wait for the ppp if (interface) to come up. 856 // where we wait for the ppp if (interface) to come up.
857 857
858 emit if_waiting_signal(); 858 emit if_waiting_signal();
859 } else { 859 } else {
860 860
861 // starting pppd wasn't successful. Error messages were 861 // starting pppd wasn't successful. Error messages were
862 // handled by execppp(); 862 // handled by execppp();
863 if_timeout_timer->stop(); 863 if_timeout_timer->stop();
864 this->hide(); 864 this->hide();
@@ -1054,195 +1054,195 @@ void ConnectWidget::setExpect(const QString &n) {
1054 emit debugMessage(ts); 1054 emit debugMessage(ts);
1055 1055
1056 // check if the expected string is in the read buffer already. 1056 // check if the expected string is in the read buffer already.
1057 checkBuffers(); 1057 checkBuffers();
1058} 1058}
1059 1059
1060 1060
1061void ConnectWidget::if_waiting_timed_out() { 1061void ConnectWidget::if_waiting_timed_out() {
1062 if_timer->stop(); 1062 if_timer->stop();
1063 if_timeout_timer->stop(); 1063 if_timeout_timer->stop();
1064 qDebug("if_waiting_timed_out()"); 1064 qDebug("if_waiting_timed_out()");
1065 1065
1066 gpppdata.setpppdError(E_IF_TIMEOUT); 1066 PPPData::data()->setpppdError(E_IF_TIMEOUT);
1067 1067
1068 // let's kill the stuck pppd 1068 // let's kill the stuck pppd
1069 Modem::modem->killPPPDaemon(); 1069 Modem::modem->killPPPDaemon();
1070 1070
1071 emit stopAccounting(); 1071 emit stopAccounting();
1072// p_kppp->con_win->stopClock(); 1072// p_kppp->con_win->stopClock();
1073 1073
1074 1074
1075 // killing ppp will generate a SIGCHLD which will be caught in pppdie() 1075 // killing ppp will generate a SIGCHLD which will be caught in pppdie()
1076 // in main.cpp what happens next will depend on the boolean 1076 // in main.cpp what happens next will depend on the boolean
1077 // reconnect_on_disconnect which is set in ConnectWidget::init(); 1077 // reconnect_on_disconnect which is set in ConnectWidget::init();
1078} 1078}
1079 1079
1080void ConnectWidget::pppdDied() 1080void ConnectWidget::pppdDied()
1081{ 1081{
1082 if_timer->stop(); 1082 if_timer->stop();
1083 if_timeout_timer->stop(); 1083 if_timeout_timer->stop();
1084} 1084}
1085 1085
1086void ConnectWidget::if_waiting_slot() { 1086void ConnectWidget::if_waiting_slot() {
1087 messg->setText(i18n("Logging on to network...")); 1087 messg->setText(i18n("Logging on to network..."));
1088 1088
1089// if(!stats->ifIsUp()) { 1089// if(!stats->ifIsUp()) {
1090 1090
1091// if(gpppdata.pppdError() != 0) { 1091// if(PPPData::data()->pppdError() != 0) {
1092// // we are here if pppd died immediately after starting it. 1092// // we are here if pppd died immediately after starting it.
1093// pppdDied(); 1093// pppdDied();
1094// // error message handled in main.cpp: sigPPPDDied() 1094// // error message handled in main.cpp: sigPPPDDied()
1095// return; 1095// return;
1096// } 1096// }
1097 1097
1098// if_timer->start(100, TRUE); // single shot 1098// if_timer->start(100, TRUE); // single shot
1099// return; 1099// return;
1100// } 1100// }
1101 1101
1102 // O.K the ppp interface is up and running 1102 // O.K the ppp interface is up and running
1103 // give it a few time to come up completly (0.2 seconds) 1103 // give it a few time to come up completly (0.2 seconds)
1104 if_timeout_timer->stop(); 1104 if_timeout_timer->stop();
1105 if_timer->stop(); 1105 if_timer->stop();
1106 usleep(200000); 1106 usleep(200000);
1107 1107
1108 if(gpppdata.autoDNS()) 1108 if(PPPData::data()->autoDNS())
1109 addpeerdns(); 1109 addpeerdns();
1110 1110
1111 // Close the debugging window. If we are connected, we 1111 // Close the debugging window. If we are connected, we
1112 // are not really interested in debug output 1112 // are not really interested in debug output
1113 emit closeDebugWindow(); 1113 emit closeDebugWindow();
1114// p_kppp->statdlg->take_stats(); // start taking ppp statistics 1114// p_kppp->statdlg->take_stats(); // start taking ppp statistics
1115 auto_hostname(); 1115 auto_hostname();
1116 1116
1117 if(!gpppdata.command_on_connect().isEmpty()) { 1117 if(!PPPData::data()->command_on_connect().isEmpty()) {
1118 messg->setText(i18n("Running startup command...")); 1118 messg->setText(i18n("Running startup command..."));
1119 1119
1120 // make sure that we don't get any async errors 1120 // make sure that we don't get any async errors
1121 qApp->flushX(); 1121 qApp->flushX();
1122 execute_command(gpppdata.command_on_connect()); 1122 execute_command(PPPData::data()->command_on_connect());
1123 messg->setText(i18n("Done")); 1123 messg->setText(i18n("Done"));
1124 } 1124 }
1125 1125
1126 // remove the authentication file 1126 // remove the authentication file
1127 Modem::modem->removeSecret(AUTH_PAP); 1127 Modem::modem->removeSecret(AUTH_PAP);
1128 Modem::modem->removeSecret(AUTH_CHAP); 1128 Modem::modem->removeSecret(AUTH_CHAP);
1129 1129
1130 emit debugMessage(i18n("Done")); 1130 emit debugMessage(i18n("Done"));
1131 set_con_speed_string(); 1131 set_con_speed_string();
1132 1132
1133// p_kppp->con_win->setConnectionSpeed(p_kppp->con_speed); 1133// p_kppp->con_win->setConnectionSpeed(p_kppp->con_speed);
1134 this->hide(); 1134 this->hide();
1135 messg->setText(""); 1135 messg->setText("");
1136 1136
1137 // prepare the con_win so as to have the right size for 1137 // prepare the con_win so as to have the right size for
1138 // accounting / non-accounting mode 1138 // accounting / non-accounting mode
1139// if(p_kppp->acct != 0) 1139// if(p_kppp->acct != 0)
1140// p_kppp->con_win->accounting(p_kppp->acct->running()); 1140// p_kppp->con_win->accounting(p_kppp->acct->running());
1141// else 1141// else
1142// p_kppp->con_win->accounting(false); 1142// p_kppp->con_win->accounting(false);
1143 1143
1144 if (gpppdata.get_dock_into_panel()) { 1144 if (PPPData::data()->get_dock_into_panel()) {
1145// DockWidget::dock_widget->show(); 1145// DockWidget::dock_widget->show();
1146// DockWidget::dock_widget->take_stats(); 1146// DockWidget::dock_widget->take_stats();
1147// this->hide(); 1147// this->hide();
1148 } 1148 }
1149 else { 1149 else {
1150// p_kppp->con_win->show(); 1150// p_kppp->con_win->show();
1151 1151
1152 if(gpppdata.get_iconify_on_connect()) { 1152 if(PPPData::data()->get_iconify_on_connect()) {
1153 // p_kppp->con_win->showMinimized(); 1153 // p_kppp->con_win->showMinimized();
1154 } 1154 }
1155 } 1155 }
1156 1156
1157 Modem::modem->closetty(); 1157 Modem::modem->closetty();
1158} 1158}
1159 1159
1160 1160
1161bool ConnectWidget::execppp() { 1161bool ConnectWidget::execppp() {
1162 QString command; 1162 QString command;
1163 1163
1164 command = "pppd"; 1164 command = "pppd";
1165 1165
1166 // as of version 2.3.6 pppd falls back to the real user rights when 1166 // as of version 2.3.6 pppd falls back to the real user rights when
1167 // opening a device given in a command line. To avoid permission conflicts 1167 // opening a device given in a command line. To avoid permission conflicts
1168 // we'll simply leave this argument away. pppd will then use the default tty 1168 // we'll simply leave this argument away. pppd will then use the default tty
1169 // which is the serial port we connected stdin/stdout to in opener.cpp. 1169 // which is the serial port we connected stdin/stdout to in opener.cpp.
1170 // command += " "; 1170 // command += " ";
1171 // command += gpppdata.modemDevice(); 1171 // command += PPPData::data()->modemDevice();
1172 1172
1173 command += " " + gpppdata.speed(); 1173 command += " " + PPPData::data()->speed();
1174 1174
1175 command += " -detach"; 1175 command += " -detach";
1176 1176
1177 if(gpppdata.ipaddr() != "0.0.0.0" || 1177 if(PPPData::data()->ipaddr() != "0.0.0.0" ||
1178 gpppdata.gateway() != "0.0.0.0") { 1178 PPPData::data()->gateway() != "0.0.0.0") {
1179 if(gpppdata.ipaddr() != "0.0.0.0") { 1179 if(PPPData::data()->ipaddr() != "0.0.0.0") {
1180 command += " "; 1180 command += " ";
1181 command += gpppdata.ipaddr(); 1181 command += PPPData::data()->ipaddr();
1182 command += ":"; 1182 command += ":";
1183 } 1183 }
1184 else { 1184 else {
1185 command += " "; 1185 command += " ";
1186 command += ":"; 1186 command += ":";
1187 } 1187 }
1188 1188
1189 if(gpppdata.gateway() != "0.0.0.0") 1189 if(PPPData::data()->gateway() != "0.0.0.0")
1190 command += gpppdata.gateway(); 1190 command += PPPData::data()->gateway();
1191 } 1191 }
1192 1192
1193 if(gpppdata.subnetmask() != "0.0.0.0") 1193 if(PPPData::data()->subnetmask() != "0.0.0.0")
1194 command += " netmask " + gpppdata.subnetmask(); 1194 command += " netmask " + PPPData::data()->subnetmask();
1195 1195
1196 if(gpppdata.flowcontrol() != "None") { 1196 if(PPPData::data()->flowcontrol() != "None") {
1197 if(gpppdata.flowcontrol() == "CRTSCTS") 1197 if(PPPData::data()->flowcontrol() == "CRTSCTS")
1198 command += " crtscts"; 1198 command += " crtscts";
1199 else 1199 else
1200 command += " xonxoff"; 1200 command += " xonxoff";
1201 } 1201 }
1202 1202
1203 if(gpppdata.defaultroute()) 1203 if(PPPData::data()->defaultroute())
1204 command += " defaultroute"; 1204 command += " defaultroute";
1205 1205
1206 if(gpppdata.autoDNS()) 1206 if(PPPData::data()->autoDNS())
1207 command += " usepeerdns"; 1207 command += " usepeerdns";
1208 1208
1209 QStringList &arglist = gpppdata.pppdArgument(); 1209 QStringList &arglist = PPPData::data()->pppdArgument();
1210 for ( QStringList::Iterator it = arglist.begin(); 1210 for ( QStringList::Iterator it = arglist.begin();
1211 it != arglist.end(); 1211 it != arglist.end();
1212 ++it ) 1212 ++it )
1213 { 1213 {
1214 command += " " + *it; 1214 command += " " + *it;
1215 } 1215 }
1216 1216
1217 // PAP settings 1217 // PAP settings
1218 if(gpppdata.authMethod() == AUTH_PAP) { 1218 if(PPPData::data()->authMethod() == AUTH_PAP) {
1219 command += " -chap user "; 1219 command += " -chap user ";
1220 command = command + "\"" + gpppdata.storedUsername() + "\""; 1220 command = command + "\"" + PPPData::data()->storedUsername() + "\"";
1221 } 1221 }
1222 1222
1223 // CHAP settings 1223 // CHAP settings
1224 if(gpppdata.authMethod() == AUTH_CHAP) { 1224 if(PPPData::data()->authMethod() == AUTH_CHAP) {
1225 command += " -pap user "; 1225 command += " -pap user ";
1226 command = command + "\"" + gpppdata.storedUsername() + "\""; 1226 command = command + "\"" + PPPData::data()->storedUsername() + "\"";
1227 } 1227 }
1228 1228
1229 // PAP/CHAP settings 1229 // PAP/CHAP settings
1230 if(gpppdata.authMethod() == AUTH_PAPCHAP) { 1230 if(PPPData::data()->authMethod() == AUTH_PAPCHAP) {
1231 command += " user "; 1231 command += " user ";
1232 command = command + "\"" + gpppdata.storedUsername() + "\""; 1232 command = command + "\"" + PPPData::data()->storedUsername() + "\"";
1233 } 1233 }
1234 1234
1235 // check for debug 1235 // check for debug
1236 if(gpppdata.getPPPDebug()) 1236 if(PPPData::data()->getPPPDebug())
1237 command += " debug"; 1237 command += " debug";
1238 1238
1239 if (command.length() > MAX_CMDLEN) { 1239 if (command.length() > MAX_CMDLEN) {
1240 QMessageBox::critical(this, "error", i18n( 1240 QMessageBox::critical(this, "error", i18n(
1241 "pppd command + command-line arguments exceed " 1241 "pppd command + command-line arguments exceed "
1242 "2024 characters in length." 1242 "2024 characters in length."
1243 )); 1243 ));
1244 1244
1245 return false; // nonsensically long command which would bust my buffer buf. 1245 return false; // nonsensically long command which would bust my buffer buf.
1246 } 1246 }
1247 1247
1248 qApp->flushX(); 1248 qApp->flushX();
@@ -1268,26 +1268,26 @@ void ConnectWidget::writeline(const QString &s) {
1268// Set the hostname and domain from DNS Server 1268// Set the hostname and domain from DNS Server
1269void auto_hostname() { 1269void auto_hostname() {
1270 struct in_addr local_ip; 1270 struct in_addr local_ip;
1271 struct hostent *hostname_entry; 1271 struct hostent *hostname_entry;
1272 QString new_hostname; 1272 QString new_hostname;
1273 int dot; 1273 int dot;
1274 char tmp_str[100]; // buffer overflow safe 1274 char tmp_str[100]; // buffer overflow safe
1275 1275
1276 gethostname(tmp_str, sizeof(tmp_str)); 1276 gethostname(tmp_str, sizeof(tmp_str));
1277 tmp_str[sizeof(tmp_str)-1]=0; // panic 1277 tmp_str[sizeof(tmp_str)-1]=0; // panic
1278 old_hostname=tmp_str; // copy to QString 1278 old_hostname=tmp_str; // copy to QString
1279 1279
1280 // if (!p_kppp->stats->local_ip_address.isEmpty() && gpppdata.autoname()) { 1280 // if (!p_kppp->stats->local_ip_address.isEmpty() && PPPData::data()->autoname()) {
1281 if ( gpppdata.autoname()) { 1281 if ( PPPData::data()->autoname()) {
1282// local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii()); 1282// local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii());
1283 hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET); 1283 hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET);
1284 1284
1285 if (hostname_entry != 0L) { 1285 if (hostname_entry != 0L) {
1286 new_hostname=hostname_entry->h_name; 1286 new_hostname=hostname_entry->h_name;
1287 dot=new_hostname.find('.'); 1287 dot=new_hostname.find('.');
1288 new_hostname=new_hostname.remove(dot,new_hostname.length()-dot); 1288 new_hostname=new_hostname.remove(dot,new_hostname.length()-dot);
1289 Modem::modem->setHostname(new_hostname); 1289 Modem::modem->setHostname(new_hostname);
1290 modified_hostname = TRUE; 1290 modified_hostname = TRUE;
1291 1291
1292 new_hostname=hostname_entry->h_name; 1292 new_hostname=hostname_entry->h_name;
1293 new_hostname.remove(0,dot+1); 1293 new_hostname.remove(0,dot+1);
@@ -1323,80 +1323,80 @@ void add_domain(const QString &domain) {
1323 close(fd); 1323 close(fd);
1324 if ((c != '\n') && (i < MAX_RESOLVCONF_LINES)) i++; 1324 if ((c != '\n') && (i < MAX_RESOLVCONF_LINES)) i++;
1325 1325
1326 if((fd = Modem::modem->openResolv(O_WRONLY|O_TRUNC)) >= 0) { 1326 if((fd = Modem::modem->openResolv(O_WRONLY|O_TRUNC)) >= 0) {
1327 QCString tmp = "domain " + domain.local8Bit() + 1327 QCString tmp = "domain " + domain.local8Bit() +
1328 " \t\t#kppp temp entry\n"; 1328 " \t\t#kppp temp entry\n";
1329 write(fd, tmp.data(), tmp.length()); 1329 write(fd, tmp.data(), tmp.length());
1330 1330
1331 for(int j=0; j < i; j++) { 1331 for(int j=0; j < i; j++) {
1332 if((resolv[j].contains("domain") || 1332 if((resolv[j].contains("domain") ||
1333 ( resolv[j].contains("nameserver") 1333 ( resolv[j].contains("nameserver")
1334 && !resolv[j].contains("#kppp temp entry") 1334 && !resolv[j].contains("#kppp temp entry")
1335 && gpppdata.exDNSDisabled())) 1335 && PPPData::data()->exDNSDisabled()))
1336 && !resolv[j].contains("#entry disabled by kppp")) { 1336 && !resolv[j].contains("#entry disabled by kppp")) {
1337 QCString tmp = "# " + resolv[j].local8Bit() + 1337 QCString tmp = "# " + resolv[j].local8Bit() +
1338 " \t#entry disabled by kppp\n"; 1338 " \t#entry disabled by kppp\n";
1339 write(fd, tmp, tmp.length()); 1339 write(fd, tmp, tmp.length());
1340 } 1340 }
1341 else { 1341 else {
1342 QCString tmp = resolv[j].local8Bit() + "\n"; 1342 QCString tmp = resolv[j].local8Bit() + "\n";
1343 write(fd, tmp, tmp.length()); 1343 write(fd, tmp, tmp.length());
1344 } 1344 }
1345 } 1345 }
1346 } 1346 }
1347 close(fd); 1347 close(fd);
1348 } 1348 }
1349} 1349}
1350 1350
1351 1351
1352// adds the DNS entries in the /etc/resolv.conf file 1352// adds the DNS entries in the /etc/resolv.conf file
1353void adddns() 1353void adddns()
1354{ 1354{
1355 int fd; 1355 int fd;
1356 1356
1357 if ((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { 1357 if ((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) {
1358 QStringList &dnslist = gpppdata.dns(); 1358 QStringList &dnslist = PPPData::data()->dns();
1359 for ( QStringList::Iterator it = dnslist.begin(); 1359 for ( QStringList::Iterator it = dnslist.begin();
1360 it != dnslist.end(); 1360 it != dnslist.end();
1361 ++it ) 1361 ++it )
1362 { 1362 {
1363 QCString dns = "nameserver " + (*it).local8Bit() + 1363 QCString dns = "nameserver " + (*it).local8Bit() +
1364 " \t#kppp temp entry\n"; 1364 " \t#kppp temp entry\n";
1365 write(fd, dns.data(), dns.length()); 1365 write(fd, dns.data(), dns.length());
1366 } 1366 }
1367 close(fd); 1367 close(fd);
1368 } 1368 }
1369 add_domain(gpppdata.domain()); 1369 add_domain(PPPData::data()->domain());
1370} 1370}
1371 1371
1372void addpeerdns() { 1372void addpeerdns() {
1373 int fd, fd2; 1373 int fd, fd2;
1374 1374
1375 if((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { 1375 if((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) {
1376 if((fd2 = open("/etc/ppp/resolv.conf", O_RDONLY)) >= 0) { 1376 if((fd2 = open("/etc/ppp/resolv.conf", O_RDONLY)) >= 0) {
1377 char c; 1377 char c;
1378 int i = 0; 1378 int i = 0;
1379 while(i++ < 100 && read(fd2, &c, 1) == 1) { 1379 while(i++ < 100 && read(fd2, &c, 1) == 1) {
1380 if(c == '\n') 1380 if(c == '\n')
1381 write(fd, "\t#kppp temp entry\n", 18); 1381 write(fd, "\t#kppp temp entry\n", 18);
1382 else 1382 else
1383 write(fd, &c, 1); 1383 write(fd, &c, 1);
1384 } 1384 }
1385 close(fd2); 1385 close(fd2);
1386 } else 1386 } else
1387 fprintf(stderr, "failed to read from /etc/ppp/resolv.conf\n"); 1387 fprintf(stderr, "failed to read from /etc/ppp/resolv.conf\n");
1388 close(fd); 1388 close(fd);
1389 } 1389 }
1390 add_domain(gpppdata.domain()); 1390 add_domain(PPPData::data()->domain());
1391} 1391}
1392 1392
1393// remove the dns entries from the /etc/resolv.conf file 1393// remove the dns entries from the /etc/resolv.conf file
1394void removedns() { 1394void removedns() {
1395 1395
1396 int fd; 1396 int fd;
1397 char c; 1397 char c;
1398 QString resolv[MAX_RESOLVCONF_LINES]; 1398 QString resolv[MAX_RESOLVCONF_LINES];
1399 1399
1400 if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { 1400 if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) {
1401 1401
1402 int i=0; 1402 int i=0;
diff --git a/noncore/settings/networksettings/ppp/conwindow.cpp b/noncore/settings/networksettings/ppp/conwindow.cpp
index d6b3fbe..ad89005 100644
--- a/noncore/settings/networksettings/ppp/conwindow.cpp
+++ b/noncore/settings/networksettings/ppp/conwindow.cpp
@@ -66,38 +66,38 @@ ConWindow::ConWindow(QWidget *parent, const char *name, QDialog *mainwidget )
66 cancelbutton->setText(i18n("Disconnect")); 66 cancelbutton->setText(i18n("Disconnect"));
67 connect(cancelbutton, SIGNAL(clicked()), mainwidget, SLOT(disconnect())); 67 connect(cancelbutton, SIGNAL(clicked()), mainwidget, SLOT(disconnect()));
68 68
69 // statsbutton = new QPushButton(this); 69 // statsbutton = new QPushButton(this);
70// statsbutton->setText(i18n("Details")); 70// statsbutton->setText(i18n("Details"));
71// statsbutton->setFocus(); 71// statsbutton->setFocus();
72// connect(statsbutton, SIGNAL(clicked()), mainwidget, SLOT(showStats())); 72// connect(statsbutton, SIGNAL(clicked()), mainwidget, SLOT(showStats()));
73 73
74 clocktimer = new QTimer(this); 74 clocktimer = new QTimer(this);
75 connect(clocktimer, SIGNAL(timeout()), SLOT(timeclick())); 75 connect(clocktimer, SIGNAL(timeout()), SLOT(timeclick()));
76 76
77 // read window position from config file 77 // read window position from config file
78 int p_x, p_y; 78// int p_x, p_y;
79 gpppdata.winPosConWin(p_x, p_y); 79// PPPData::data()->winPosConWin(p_x, p_y);
80 setGeometry(p_x, p_y, 320, 110); 80// setGeometry(p_x, p_y, 320, 110);
81} 81}
82 82
83ConWindow::~ConWindow() { 83ConWindow::~ConWindow() {
84 stopClock(); 84 stopClock();
85} 85}
86 86
87// save window position when window was closed 87// save window position when window was closed
88bool ConWindow::event(QEvent *e) { 88bool ConWindow::event(QEvent *e) {
89 if (e->type() == QEvent::Hide) 89 if (e->type() == QEvent::Hide)
90 { 90 {
91 gpppdata.setWinPosConWin(x(), y()); 91// PPPData::data()->setWinPosConWin(x(), y());
92 return true; 92 return true;
93 } 93 }
94 else 94 else
95 return QWidget::event(e); 95 return QWidget::event(e);
96} 96}
97 97
98QString ConWindow::prettyPrintVolume(unsigned int n) { 98QString ConWindow::prettyPrintVolume(unsigned int n) {
99 int idx = 0; 99 int idx = 0;
100 const QString quant[] = {i18n("Byte"), i18n("KB"), 100 const QString quant[] = {i18n("Byte"), i18n("KB"),
101 i18n("MB"), i18n("GB"), QString::null}; 101 i18n("MB"), i18n("GB"), QString::null};
102 102
103 float n1 = n; 103 float n1 = n;
@@ -109,40 +109,40 @@ QString ConWindow::prettyPrintVolume(unsigned int n) {
109 int i = idx; 109 int i = idx;
110 while(i--) 110 while(i--)
111 n1 = n1 / 1024.0; 111 n1 = n1 / 1024.0;
112 112
113 QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); //KGlobal::locale()->formatNumber( n1, idx==0 ? 0 : 1 ); 113 QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); //KGlobal::locale()->formatNumber( n1, idx==0 ? 0 : 1 );
114 s += " " + quant[idx]; 114 s += " " + quant[idx];
115 return s; 115 return s;
116} 116}
117 117
118void ConWindow::accounting(bool on) { 118void ConWindow::accounting(bool on) {
119 // cache accounting settings 119 // cache accounting settings
120 accountingEnabled = on; 120 accountingEnabled = on;
121 volumeAccountingEnabled = gpppdata.VolAcctEnabled(); 121 volumeAccountingEnabled = PPPData::data()->VolAcctEnabled();
122 122
123 // delete old layout 123 // delete old layout
124 if(tl1 != 0) 124 if(tl1 != 0)
125 delete tl1; 125 delete tl1;
126 126
127 // add layout now 127 // add layout now
128 tl1 = new QVBoxLayout(this, 10, 10); 128 tl1 = new QVBoxLayout(this, 10, 10);
129 tl1->addSpacing(5); 129 tl1->addSpacing(5);
130 QHBoxLayout *tl = new QHBoxLayout; 130 QHBoxLayout *tl = new QHBoxLayout;
131 tl1->addLayout(tl); 131 tl1->addLayout(tl);
132 tl->addSpacing(20); 132 tl->addSpacing(20);
133 QGridLayout *l1; 133 QGridLayout *l1;
134 134
135 int vol_lines = 0; 135 int vol_lines = 0;
136 if(gpppdata.VolAcctEnabled()) 136 if(PPPData::data()->VolAcctEnabled())
137 vol_lines = 1; 137 vol_lines = 1;
138 138
139 if(accountingEnabled) 139 if(accountingEnabled)
140 l1 = new QGridLayout(4 + vol_lines, 2, 5); 140 l1 = new QGridLayout(4 + vol_lines, 2, 5);
141 else 141 else
142 l1 = new QGridLayout(2 + vol_lines, 2, 5); 142 l1 = new QGridLayout(2 + vol_lines, 2, 5);
143 tl->addLayout(l1); 143 tl->addLayout(l1);
144 l1->setColStretch(0, 0); 144 l1->setColStretch(0, 0);
145 l1->setColStretch(1, 1); 145 l1->setColStretch(1, 1);
146 146
147 info2->setAlignment(AlignRight|AlignVCenter); 147 info2->setAlignment(AlignRight|AlignVCenter);
148 timelabel2->setAlignment(AlignRight|AlignVCenter); 148 timelabel2->setAlignment(AlignRight|AlignVCenter);
@@ -230,61 +230,61 @@ void ConWindow::accounting(bool on) {
230void ConWindow::dock() { 230void ConWindow::dock() {
231// DockWidget::dock_widget->show(); 231// DockWidget::dock_widget->show();
232 this->hide(); 232 this->hide();
233} 233}
234 234
235 235
236void ConWindow::startClock() { 236void ConWindow::startClock() {
237 minutes = 0; 237 minutes = 0;
238 seconds = 0; 238 seconds = 0;
239 hours = 0; 239 hours = 0;
240 QString title ; 240 QString title ;
241 241
242 title = gpppdata.accname(); 242 title = PPPData::data()->accname();
243 243
244 if(gpppdata.get_show_clock_on_caption()){ 244 if(PPPData::data()->get_show_clock_on_caption()){
245 title += " 00:00" ; 245 title += " 00:00" ;
246 } 246 }
247 this->setCaption(title); 247 this->setCaption(title);
248 248
249 timelabel2->setText("00:00:00"); 249 timelabel2->setText("00:00:00");
250 clocktimer->start(1000); 250 clocktimer->start(1000);
251} 251}
252 252
253 253
254void ConWindow::setConnectionSpeed(const QString &speed) { 254void ConWindow::setConnectionSpeed(const QString &speed) {
255 info2->setText(speed); 255 info2->setText(speed);
256} 256}
257 257
258 258
259void ConWindow::stopClock() { 259void ConWindow::stopClock() {
260 clocktimer->stop(); 260 clocktimer->stop();
261} 261}
262 262
263 263
264void ConWindow::timeclick() { 264void ConWindow::timeclick() {
265 QString tooltip = i18n("Connection: %1\n" 265 QString tooltip = i18n("Connection: %1\n"
266 "Connected at: %2\n" 266 "Connected at: %2\n"
267 "Time connected: %3") 267 "Time connected: %3")
268 .arg(gpppdata.accname()).arg(info2->text()) 268 .arg(PPPData::data()->accname()).arg(info2->text())
269 .arg(time_string2); 269 .arg(time_string2);
270 270
271 if(accountingEnabled) 271 if(accountingEnabled)
272 tooltip += i18n("\nSession Bill: %1\nTotal Bill: %2") 272 tooltip += i18n("\nSession Bill: %1\nTotal Bill: %2")
273 .arg(session_bill->text()).arg(total_bill->text()); 273 .arg(session_bill->text()).arg(total_bill->text());
274 // volume accounting 274 // volume accounting
275 if(volumeAccountingEnabled) { 275 if(volumeAccountingEnabled) {
276 276
277 volinfo->setEnabled(TRUE); 277 volinfo->setEnabled(TRUE);
278 int bytes = gpppdata.totalBytes(); 278 int bytes = PPPData::data()->totalBytes();
279 volinfo->setText(prettyPrintVolume(bytes)); 279 volinfo->setText(prettyPrintVolume(bytes));
280 } 280 }
281 281
282 seconds++; 282 seconds++;
283 283
284 if(seconds >= 60 ) { 284 if(seconds >= 60 ) {
285 minutes ++; 285 minutes ++;
286 seconds = 0; 286 seconds = 0;
287 } 287 }
288 288
289 if (minutes >= 60){ 289 if (minutes >= 60){
290 minutes = 0; 290 minutes = 0;
@@ -296,46 +296,46 @@ void ConWindow::timeclick() {
296 hours = 0; 296 hours = 0;
297 } 297 }
298 298
299 time_string.sprintf("%02d:%02d",hours,minutes); 299 time_string.sprintf("%02d:%02d",hours,minutes);
300 time_string2 = ""; 300 time_string2 = "";
301 if (days) 301 if (days)
302 time_string2.sprintf("%d d %02d:%02d:%02d", 302 time_string2.sprintf("%d d %02d:%02d:%02d",
303 days,hours,minutes,seconds); 303 days,hours,minutes,seconds);
304 304
305 else 305 else
306 time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds); 306 time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
307 307
308 caption_string = gpppdata.accname(); 308 caption_string = PPPData::data()->accname();
309 caption_string += " "; 309 caption_string += " ";
310 caption_string += time_string; 310 caption_string += time_string;
311 311
312 312
313 timelabel2->setText(time_string2); 313 timelabel2->setText(time_string2);
314 314
315 if(gpppdata.get_show_clock_on_caption() && (seconds == 1)){ 315 if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){
316 // we update the Caption only once per minute not every second 316 // we update the Caption only once per minute not every second
317 // otherwise I get a flickering icon 317 // otherwise I get a flickering icon
318 this->setCaption(caption_string); 318 this->setCaption(caption_string);
319 } 319 }
320 320
321// QToolTip::add(DockWidget::dock_widget, tooltip); 321// QToolTip::add(DockWidget::dock_widget, tooltip);
322} 322}
323 323
324 324
325void ConWindow::closeEvent( QCloseEvent *e ){ 325void ConWindow::closeEvent( QCloseEvent *e ){
326 // we don't want to lose the 326 // we don't want to lose the
327 // conwindow since this is our last connection kppp. 327 // conwindow since this is our last connection kppp.
328 // if we lost it we could only kill the program by hand to get on with life. 328 // if we lost it we could only kill the program by hand to get on with life.
329 e->ignore(); 329 e->ignore();
330 330
331 if(gpppdata.get_dock_into_panel()) 331 if(PPPData::data()->get_dock_into_panel())
332 dock(); 332 dock();
333} 333}
334 334
335 335
336void ConWindow::slotAccounting(QString total, QString session) { 336void ConWindow::slotAccounting(QString total, QString session) {
337 total_bill->setText(total); 337 total_bill->setText(total);
338 session_bill->setText(session); 338 session_bill->setText(session);
339} 339}
340 340
341 341
diff --git a/noncore/settings/networksettings/ppp/debug.cpp b/noncore/settings/networksettings/ppp/debug.cpp
index 8652931..447ccf2 100644
--- a/noncore/settings/networksettings/ppp/debug.cpp
+++ b/noncore/settings/networksettings/ppp/debug.cpp
@@ -124,18 +124,18 @@ void DebugWidget::resizeEvent(QResizeEvent *e){
124void DebugWidget::enter() { 124void DebugWidget::enter() {
125 text_window->append("\r\n"); 125 text_window->append("\r\n");
126} 126}
127 127
128 128
129void DebugWidget::toggleVisibility() { 129void DebugWidget::toggleVisibility() {
130 if(isVisible()) 130 if(isVisible())
131 hide(); 131 hide();
132 else 132 else
133 show(); 133 show();
134 134
135 bool showlog = isVisible(); 135 bool showlog = isVisible();
136 gpppdata.set_show_log_window(showlog); 136 PPPData::data()->set_show_log_window(showlog);
137} 137}
138 138
139 139
140 140
141 141
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index 961047b..6132b80 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -32,65 +32,65 @@
32#include <qapplication.h> 32#include <qapplication.h>
33//#include <kiconloader.h> 33//#include <kiconloader.h>
34#include <qbuttongroup.h> 34#include <qbuttongroup.h>
35//#include <klocale.h> 35//#include <klocale.h>
36#define i18n QObject::tr 36#define i18n QObject::tr
37#include <qvgroupbox.h> 37#include <qvgroupbox.h>
38#include <qhbox.h> 38#include <qhbox.h>
39#include <qdialog.h> 39#include <qdialog.h>
40//#include <kwin.h> 40//#include <kwin.h>
41 41
42#include "edit.h" 42#include "edit.h"
43#include "pppdata.h" 43#include "pppdata.h"
44#include "newwidget.h" 44//#include "newwidget.h"
45#include "iplined.h" 45#include "iplined.h"
46#include "auth.h" 46#include "auth.h"
47 47
48DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) 48DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name )
49 : QWidget(parent, name) 49 : QWidget(parent, name)
50{ 50{
51 const int GRIDROWS = 6; 51 const int GRIDROWS = 6;
52 52
53 QGridLayout *tl = new QGridLayout(parent, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); 53 QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint());
54 54
55 connect_label = new QLabel(i18n("Connection name:"), parent); 55 connect_label = new QLabel(i18n("Connection name:"), this);
56 tl->addWidget(connect_label, 0, 0); 56 tl->addWidget(connect_label, 0, 0);
57 57
58 connectname_l = new QLineEdit(parent); 58 connectname_l = new QLineEdit(this);
59 connectname_l->setMaxLength(ACCNAME_SIZE); 59// connectname_l->setMaxLength(ACCNAME_SIZE);
60 tl->addWidget(connectname_l, 0, 1); 60 tl->addWidget(connectname_l, 0, 1);
61 QString tmp = i18n("Type in a unique name for this connection"); 61 QString tmp = i18n("Type in a unique name for this connection");
62 62
63 QWhatsThis::add(connect_label,tmp); 63 QWhatsThis::add(connect_label,tmp);
64 QWhatsThis::add(connectname_l,tmp); 64 QWhatsThis::add(connectname_l,tmp);
65 65
66 66
67 number_label = new QLabel(i18n("Phone number:"), parent); 67 number_label = new QLabel(i18n("Phone number:"), this);
68 number_label->setAlignment(AlignTop|AlignLeft); 68 number_label->setAlignment(AlignTop|AlignLeft);
69 tl->addWidget(number_label, 1, 0); 69 tl->addWidget(number_label, 1, 0);
70 70
71 QHBoxLayout *lpn = new QHBoxLayout(5); 71 QHBoxLayout *lpn = new QHBoxLayout(5);
72 tl->addLayout(lpn, 1, 1); 72 tl->addLayout(lpn, 1, 1);
73 numbers = new QListBox(parent); 73 numbers = new QListBox(this);
74 numbers->setMinimumSize(120, 70); 74 numbers->setMinimumSize(120, 70);
75 lpn->addWidget(numbers); 75 lpn->addWidget(numbers);
76 QVBoxLayout *lpn1 = new QVBoxLayout; 76 QVBoxLayout *lpn1 = new QVBoxLayout;
77 lpn->addLayout(lpn1); 77 lpn->addLayout(lpn1);
78 add = new QPushButton(i18n("&Add..."), parent); 78 add = new QPushButton(i18n("&Add..."), this);
79 del = new QPushButton(i18n("&Remove"), parent); 79 del = new QPushButton(i18n("&Remove"), this);
80 80
81 up = new QPushButton(parent); 81 up = new QPushButton(this);
82//FIXME: QPixmap pm = BarIcon("up"); 82//FIXME: QPixmap pm = BarIcon("up");
83// up->setPixmap(pm); 83// up->setPixmap(pm);
84 down = new QPushButton(parent); 84 down = new QPushButton(this);
85//FIXME: pm = BarIcon("down"); 85//FIXME: pm = BarIcon("down");
86// down->setPixmap(pm); 86// down->setPixmap(pm);
87 lpn1->addWidget(add); 87 lpn1->addWidget(add);
88 lpn1->addWidget(del); 88 lpn1->addWidget(del);
89 lpn1->addStretch(1); 89 lpn1->addStretch(1);
90 lpn1->addWidget(up); 90 lpn1->addWidget(up);
91 lpn1->addWidget(down); 91 lpn1->addWidget(down);
92 connect(add, SIGNAL(clicked()), 92 connect(add, SIGNAL(clicked()),
93 this, SLOT(addNumber())); 93 this, SLOT(addNumber()));
94 connect(del, SIGNAL(clicked()), 94 connect(del, SIGNAL(clicked()),
95 this, SLOT(delNumber())); 95 this, SLOT(delNumber()));
96 connect(up, SIGNAL(clicked()), 96 connect(up, SIGNAL(clicked()),
@@ -103,114 +103,114 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name )
103 103
104 tmp = i18n("<p>Specifies the phone numbers to dial. You\n" 104 tmp = i18n("<p>Specifies the phone numbers to dial. You\n"
105 "can supply multiple numbers here, simply\n" 105 "can supply multiple numbers here, simply\n"
106 "click on \"Add\". You can arrange the\n" 106 "click on \"Add\". You can arrange the\n"
107 "order the numbers are tried by using the\n" 107 "order the numbers are tried by using the\n"
108 "arrow buttons.\n\n" 108 "arrow buttons.\n\n"
109 "When a number is busy or fails, <i>kppp</i> will \n" 109 "When a number is busy or fails, <i>kppp</i> will \n"
110 "try the next number and so on"); 110 "try the next number and so on");
111 111
112 QWhatsThis::add(number_label,tmp); 112 QWhatsThis::add(number_label,tmp);
113 QWhatsThis::add(numbers,tmp); 113 QWhatsThis::add(numbers,tmp);
114 114
115 auth_l = new QLabel(i18n("Authentication:"), parent); 115 auth_l = new QLabel(i18n("Authentication:"), this);
116 tl->addWidget(auth_l, 3, 0); 116 tl->addWidget(auth_l, 3, 0);
117 117
118 auth = new QComboBox(parent); 118 auth = new QComboBox(this);
119 auth->insertItem(i18n("Script-based")); 119 auth->insertItem(i18n("Script-based"));
120 auth->insertItem(i18n("PAP")); 120 auth->insertItem(i18n("PAP"));
121 auth->insertItem(i18n("Terminal-based")); 121 auth->insertItem(i18n("Terminal-based"));
122 auth->insertItem(i18n("CHAP")); 122 auth->insertItem(i18n("CHAP"));
123 auth->insertItem(i18n("PAP/CHAP")); 123 auth->insertItem(i18n("PAP/CHAP"));
124 tl->addWidget(auth, 3, 1); 124 tl->addWidget(auth, 3, 1);
125 tmp = i18n("<p>Specifies the method used to identify yourself to\n" 125 tmp = i18n("<p>Specifies the method used to identify yourself to\n"
126 "the PPP server. Most universities still use\n" 126 "the PPP server. Most universities still use\n"
127 "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" 127 "<b>Terminal</b>- or <b>Script</b>-based authentication,\n"
128 "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" 128 "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n"
129 "unsure, contact your ISP.\n" 129 "unsure, contact your ISP.\n"
130 "\n" 130 "\n"
131 "If you can choose between PAP and CHAP,\n" 131 "If you can choose between PAP and CHAP,\n"
132 "choose CHAP, because it's much safer. If you don't know\n" 132 "choose CHAP, because it's much safer. If you don't know\n"
133 "whether PAP or CHAP is right, choose PAP/CHAP."); 133 "whether PAP or CHAP is right, choose PAP/CHAP.");
134 134
135 QWhatsThis::add(auth_l,tmp); 135 QWhatsThis::add(auth_l,tmp);
136 QWhatsThis::add(auth,tmp); 136 QWhatsThis::add(auth,tmp);
137 137
138 store_password = new QCheckBox(i18n("Store password"), parent); 138 store_password = new QCheckBox(i18n("Store password"), this);
139 store_password->setChecked(true); 139 store_password->setChecked(true);
140 tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); 140 tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight);
141 QWhatsThis::add(store_password, 141 QWhatsThis::add(store_password,
142 i18n("<p>When this is turned on, your ISP password\n" 142 i18n("<p>When this is turned on, your ISP password\n"
143 "will be saved in <i>kppp</i>'s config file, so\n" 143 "will be saved in <i>kppp</i>'s config file, so\n"
144 "you do not need to type it in every time.\n" 144 "you do not need to type it in every time.\n"
145 "\n" 145 "\n"
146 "<b><font color=\"red\">Warning:</font> your password will be stored as\n" 146 "<b><font color=\"red\">Warning:</font> your password will be stored as\n"
147 "plain text in the config file, which is\n" 147 "plain text in the config file, which is\n"
148 "readable only to you. Make sure nobody\n" 148 "readable only to you. Make sure nobody\n"
149 "gains access to this file!")); 149 "gains access to this file!"));
150 150
151 pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), parent); 151 pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this);
152 connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); 152 connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton()));
153 tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); 153 tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter);
154 154
155 // Set defaults if editing an existing connection 155 // Set defaults if editing an existing connection
156 if(!isnewaccount) { 156 if(!isnewaccount) {
157 connectname_l->setText(gpppdata.accname()); 157 connectname_l->setText(PPPData::data()->accname());
158 158
159 // insert the phone numbers into the listbox 159 // insert the phone numbers into the listbox
160 QString n = gpppdata.phonenumber(); 160 QString n = PPPData::data()->phonenumber();
161 QString tmp = ""; 161 QString tmp = "";
162 uint idx = 0; 162 uint idx = 0;
163 while(idx != n.length()) { 163 while(idx != n.length()) {
164 if(n[idx] == ':') { 164 if(n[idx] == ':') {
165 if(tmp.length() > 0) 165 if(tmp.length() > 0)
166 numbers->insertItem(tmp); 166 numbers->insertItem(tmp);
167 tmp = ""; 167 tmp = "";
168 } else 168 } else
169 tmp += n[idx]; 169 tmp += n[idx];
170 idx++; 170 idx++;
171 } 171 }
172 if(tmp.length() > 0) 172 if(tmp.length() > 0)
173 numbers->insertItem(tmp); 173 numbers->insertItem(tmp);
174 174
175 auth->setCurrentItem(gpppdata.authMethod()); 175 auth->setCurrentItem(PPPData::data()->authMethod());
176 store_password->setChecked(gpppdata.storePassword()); 176 store_password->setChecked(PPPData::data()->storePassword());
177 } else { 177 } else {
178 // select PAP/CHAP as default 178 // select PAP/CHAP as default
179 auth->setCurrentItem(AUTH_PAPCHAP); 179 auth->setCurrentItem(AUTH_PAPCHAP);
180 } 180 }
181 181
182 numbersChanged(); 182 numbersChanged();
183 tl->activate(); 183 tl->activate();
184} 184}
185 185
186 186
187bool DialWidget::save() { 187bool DialWidget::save() {
188 //first check to make sure that the account name is unique! 188 //first check to make sure that the account name is unique!
189 if(connectname_l->text().isEmpty() || 189 if(connectname_l->text().isEmpty() ||
190 !gpppdata.isUniqueAccname(connectname_l->text())) { 190 !PPPData::data()->isUniqueAccname(connectname_l->text())) {
191 return false; 191 return false;
192 } else { 192 } else {
193 gpppdata.setAccname(connectname_l->text()); 193 PPPData::data()->setAccname(connectname_l->text());
194 194
195 QString number = ""; 195 QString number = "";
196 for(uint i = 0; i < numbers->count(); i++) { 196 for(uint i = 0; i < numbers->count(); i++) {
197 if(i != 0) 197 if(i != 0)
198 number += ":"; 198 number += ":";
199 number += numbers->text(i); 199 number += numbers->text(i);
200 } 200 }
201 201
202 gpppdata.setPhonenumber(number); 202 PPPData::data()->setPhonenumber(number);
203 gpppdata.setAuthMethod(auth->currentItem()); 203 PPPData::data()->setAuthMethod(auth->currentItem());
204 gpppdata.setStorePassword(store_password->isChecked()); 204 PPPData::data()->setStorePassword(store_password->isChecked());
205 return true; 205 return true;
206 } 206 }
207} 207}
208 208
209 209
210void DialWidget::numbersChanged() { 210void DialWidget::numbersChanged() {
211 int sel = numbers->currentItem(); 211 int sel = numbers->currentItem();
212 212
213 del->setEnabled(sel != -1); 213 del->setEnabled(sel != -1);
214 up->setEnabled(sel != -1 && sel != 0); 214 up->setEnabled(sel != -1 && sel != 0);
215 down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); 215 down->setEnabled(sel != -1 && sel != (int)numbers->count()-1);
216} 216}
@@ -266,142 +266,142 @@ void DialWidget::pppdargsbutton() {
266 PPPdArguments pa(this); 266 PPPdArguments pa(this);
267 pa.exec(); 267 pa.exec();
268} 268}
269 269
270 270
271 271
272///////////////////////////////////////////////////////////////////////////// 272/////////////////////////////////////////////////////////////////////////////
273// ExecWidget 273// ExecWidget
274///////////////////////////////////////////////////////////////////////////// 274/////////////////////////////////////////////////////////////////////////////
275ExecWidget::ExecWidget(QWidget *parent, bool isnewaccount, const char *name) : 275ExecWidget::ExecWidget(QWidget *parent, bool isnewaccount, const char *name) :
276 QWidget(parent, name) 276 QWidget(parent, name)
277{ 277{
278 QVBoxLayout *tl = new QVBoxLayout(parent, 0 );//, KDialog::spacingHint()); 278 QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
279 279
280 QLabel *l = new QLabel(\ 280 QLabel *l = new QLabel(\
281i18n("Here you can select commands to run at certain stages of the\n" 281i18n("Here you can select commands to run at certain stages of the\n"
282 "connection. The commands are run with your real user id, so\n" 282 "connection. The commands are run with your real user id, so\n"
283 "you cannot run any commands here requiring root permissions\n" 283 "you cannot run any commands here requiring root permissions\n"
284 "(unless, of course, you are root).\n\n" 284 "(unless, of course, you are root).\n\n"
285 "Be sure to supply the whole path to the program otherwise\n" 285 "Be sure to supply the whole path to the program otherwise\n"
286 "kppp might be unable to find it."), parent); 286 "kppp might be unable to find it."), this);
287 l->setMinimumHeight(l->sizeHint().height()); 287// l->setMinimumHeight(l->sizeHint().height());
288 tl->addWidget(l); 288 tl->addWidget(l);
289 tl->addStretch(1); 289 tl->addStretch(1);
290 290
291 QGridLayout *l1 = new QGridLayout(4, 2, 10); 291 QGridLayout *l1 = new QGridLayout(4, 2, 10);
292 tl->addLayout(l1); 292 tl->addLayout(l1);
293 l1->setColStretch(0, 0); 293 l1->setColStretch(0, 0);
294 l1->setColStretch(1, 1); 294 l1->setColStretch(1, 1);
295 295
296 before_connect_l = new QLabel(i18n("Before connect:"), parent); 296 before_connect_l = new QLabel(i18n("Before connect:"), this);
297 before_connect_l->setAlignment(AlignVCenter); 297 before_connect_l->setAlignment(AlignVCenter);
298 l1->addWidget(before_connect_l, 0, 0); 298 l1->addWidget(before_connect_l, 0, 0);
299 before_connect = new QLineEdit(parent); 299 before_connect = new QLineEdit(this);
300 before_connect->setMaxLength(COMMAND_SIZE); 300// before_connect->setMaxLength(COMMAND_SIZE);
301 l1->addWidget(before_connect, 0, 1); 301 l1->addWidget(before_connect, 0, 1);
302 QString tmp = i18n("Allows you to run a program <b>before</b> a connection\n" 302 QString tmp = i18n("Allows you to run a program <b>before</b> a connection\n"
303 "is established. It is called immediately before\n" 303 "is established. It is called immediately before\n"
304 "dialing has begun.\n\n" 304 "dialing has begun.\n\n"
305 "This might be useful, e.g. to stop HylaFAX blocking the\n" 305 "This might be useful, e.g. to stop HylaFAX blocking the\n"
306 "modem."); 306 "modem.");
307 307
308 QWhatsThis::add(before_connect_l,tmp); 308 QWhatsThis::add(before_connect_l,tmp);
309 QWhatsThis::add(before_connect,tmp); 309 QWhatsThis::add(before_connect,tmp);
310 310
311 command_label = new QLabel(i18n("Upon connect:"), parent); 311 command_label = new QLabel(i18n("Upon connect:"), this);
312 command_label->setAlignment(AlignVCenter); 312 command_label->setAlignment(AlignVCenter);
313 l1->addWidget(command_label, 1, 0); 313 l1->addWidget(command_label, 1, 0);
314 command = new QLineEdit(parent); 314 command = new QLineEdit(this);
315 command->setMaxLength(COMMAND_SIZE); 315// command->setMaxLength(COMMAND_SIZE);
316 l1->addWidget(command, 1, 1); 316 l1->addWidget(command, 1, 1);
317 tmp = i18n("Allows you to run a program <b>after</b> a connection\n" 317 tmp = i18n("Allows you to run a program <b>after</b> a connection\n"
318 "is established. When your program is called, all\n" 318 "is established. When your program is called, all\n"
319 "preparations for an Internet connection are finished.\n" 319 "preparations for an Internet connection are finished.\n"
320 "\n" 320 "\n"
321 "Very useful for fetching mail and news"); 321 "Very useful for fetching mail and news");
322 322
323 QWhatsThis::add(command_label,tmp); 323 QWhatsThis::add(command_label,tmp);
324 QWhatsThis::add(command,tmp); 324 QWhatsThis::add(command,tmp);
325 325
326 predisconnect_label = new QLabel(i18n("Before disconnect:"), 326 predisconnect_label = new QLabel(i18n("Before disconnect:"),
327 parent); 327 this);
328 predisconnect_label->setAlignment(AlignVCenter); 328 predisconnect_label->setAlignment(AlignVCenter);
329 l1->addWidget(predisconnect_label, 2, 0); 329 l1->addWidget(predisconnect_label, 2, 0);
330 predisconnect = new QLineEdit(parent); 330 predisconnect = new QLineEdit(this);
331 predisconnect->setMaxLength(COMMAND_SIZE); 331// predisconnect->setMaxLength(COMMAND_SIZE);
332 l1->addWidget(predisconnect, 2, 1); 332 l1->addWidget(predisconnect, 2, 1);
333 tmp = i18n("Allows you to run a program <b>before</b> a connection\n" 333 tmp = i18n("Allows you to run a program <b>before</b> a connection\n"
334 "is closed. The connection will stay open until\n" 334 "is closed. The connection will stay open until\n"
335 "the program exits."); 335 "the program exits.");
336 336
337 QWhatsThis::add(predisconnect_label,tmp); 337 QWhatsThis::add(predisconnect_label,tmp);
338 QWhatsThis::add(predisconnect,tmp); 338 QWhatsThis::add(predisconnect,tmp);
339 339
340 discommand_label = new QLabel(i18n("Upon disconnect:"), 340 discommand_label = new QLabel(i18n("Upon disconnect:"),
341 parent); 341 this);
342 discommand_label->setAlignment(AlignVCenter); 342 discommand_label->setAlignment(AlignVCenter);
343 l1->addWidget(discommand_label, 3, 0); 343 l1->addWidget(discommand_label, 3, 0);
344 344
345 discommand = new QLineEdit(parent); 345 discommand = new QLineEdit(this);
346 discommand->setMaxLength(COMMAND_SIZE); 346// discommand->setMaxLength(COMMAND_SIZE);
347 l1->addWidget(discommand, 3, 1); 347 l1->addWidget(discommand, 3, 1);
348 tmp = i18n("Allows you to run a program <b>after</b> a connection\n" 348 tmp = i18n("Allows you to run a program <b>after</b> a connection\n"
349 "has been closed."); 349 "has been closed.");
350 350
351 QWhatsThis::add(discommand_label,tmp); 351 QWhatsThis::add(discommand_label,tmp);
352 QWhatsThis::add(discommand,tmp); 352 QWhatsThis::add(discommand,tmp);
353 353
354 // extra space between entries 354 // extra space between entries
355 l1->addRowSpacing(1, 5); 355 l1->addRowSpacing(1, 5);
356 l1->addRowSpacing(3, 5); 356 l1->addRowSpacing(3, 5);
357 357
358 tl->addStretch(1); 358 tl->addStretch(1);
359 tl->activate(); 359 tl->activate();
360 360
361 // Set defaults if editing an existing connection 361 // Set defaults if editing an existing connection
362 if(!isnewaccount) { 362 if(!isnewaccount) {
363 before_connect->setText(gpppdata.command_before_connect()); 363 before_connect->setText(PPPData::data()->command_before_connect());
364 command->setText(gpppdata.command_on_connect()); 364 command->setText(PPPData::data()->command_on_connect());
365 discommand->setText(gpppdata.command_on_disconnect()); 365 discommand->setText(PPPData::data()->command_on_disconnect());
366 predisconnect->setText(gpppdata.command_before_disconnect()); 366 predisconnect->setText(PPPData::data()->command_before_disconnect());
367 } 367 }
368} 368}
369 369
370 370
371bool ExecWidget::save() { 371bool ExecWidget::save() {
372 gpppdata.setCommand_before_connect(before_connect->text()); 372 PPPData::data()->setCommand_before_connect(before_connect->text());
373 gpppdata.setCommand_on_connect(command->text()); 373 PPPData::data()->setCommand_on_connect(command->text());
374 gpppdata.setCommand_before_disconnect(predisconnect->text()); 374 PPPData::data()->setCommand_before_disconnect(predisconnect->text());
375 gpppdata.setCommand_on_disconnect(discommand->text()); 375 PPPData::data()->setCommand_on_disconnect(discommand->text());
376 return true; 376 return true;
377} 377}
378 378
379 379
380 380
381///////////////////////////////////////////////////////////////////////////// 381/////////////////////////////////////////////////////////////////////////////
382// 382//
383// IPWidget 383// IPWidget
384// 384//
385///////////////////////////////////////////////////////////////////////////// 385/////////////////////////////////////////////////////////////////////////////
386IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) 386IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name )
387 : QWidget(parent, name) 387 : QWidget(parent, name)
388{ 388{
389 QVBoxLayout *topLayout = new QVBoxLayout(parent); 389 QVBoxLayout *topLayout = new QVBoxLayout(this);
390 topLayout->setSpacing( 3 );//KDialog::spacingHint()); 390 topLayout->setSpacing( 3 );//KDialog::spacingHint());
391 391
392 box = new QVGroupBox(i18n("Configuration"), parent); 392 box = new QVGroupBox(i18n("Configuration"), this);
393// box->setInsideSpacing( 1 );//KDialog::spacingHint()); 393// box->setInsideSpacing( 1 );//KDialog::spacingHint());
394 394
395 rb = new QButtonGroup(parent); 395 rb = new QButtonGroup(this);
396 rb->hide(); 396 rb->hide();
397 connect(rb, SIGNAL(clicked(int)), 397 connect(rb, SIGNAL(clicked(int)),
398 SLOT(hitIPSelect(int))); 398 SLOT(hitIPSelect(int)));
399 399
400 dynamicadd_rb = new QRadioButton(box); 400 dynamicadd_rb = new QRadioButton(box);
401 dynamicadd_rb->setText(i18n("Dynamic IP address")); 401 dynamicadd_rb->setText(i18n("Dynamic IP address"));
402 QWhatsThis::add(dynamicadd_rb, 402 QWhatsThis::add(dynamicadd_rb,
403 i18n("Select this option when your computer gets an\n" 403 i18n("Select this option when your computer gets an\n"
404 "internet address (IP) every time a\n" 404 "internet address (IP) every time a\n"
405 "connection is made.\n" 405 "connection is made.\n"
406 "\n" 406 "\n"
407 "Almost every Internet Service Provider uses\n" 407 "Almost every Internet Service Provider uses\n"
@@ -439,54 +439,54 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name )
439 "all cases this netmask will be <b>255.255.255.0</b>,\n" 439 "all cases this netmask will be <b>255.255.255.0</b>,\n"
440 "but your mileage may vary.\n" 440 "but your mileage may vary.\n"
441 "\n" 441 "\n"
442 "If unsure, contact your Internet Service Provider"); 442 "If unsure, contact your Internet Service Provider");
443 ipLayout->addWidget(sub_label, 1, 0); 443 ipLayout->addWidget(sub_label, 1, 0);
444 444
445 subnetmask_l = new IPLineEdit(ipWidget); 445 subnetmask_l = new IPLineEdit(ipWidget);
446 ipLayout->addWidget(subnetmask_l, 1, 1); 446 ipLayout->addWidget(subnetmask_l, 1, 1);
447 447
448 QWhatsThis::add(sub_label,tmp); 448 QWhatsThis::add(sub_label,tmp);
449 QWhatsThis::add(subnetmask_l,tmp); 449 QWhatsThis::add(subnetmask_l,tmp);
450 450
451 autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), parent); 451 autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), this);
452 autoname->setChecked(gpppdata.autoname()); 452 autoname->setChecked(PPPData::data()->autoname());
453 connect(autoname,SIGNAL(toggled(bool)), 453 connect(autoname,SIGNAL(toggled(bool)),
454 this,SLOT(autoname_t(bool))); 454 this,SLOT(autoname_t(bool)));
455 455
456 QWhatsThis::add(autoname, 456 QWhatsThis::add(autoname,
457 i18n("<p>Whenever you connect, this reconfigures\n" 457 i18n("<p>Whenever you connect, this reconfigures\n"
458 "your hostname to match the IP address you\n" 458 "your hostname to match the IP address you\n"
459 "got from the PPP server. This may be useful\n" 459 "got from the PPP server. This may be useful\n"
460 "if you need to use a protocol which depends\n" 460 "if you need to use a protocol which depends\n"
461 "on this information, but it can also cause several\n" 461 "on this information, but it can also cause several\n"
462 "<a href=\"kppp-7.html#autohostname\">problems</a>.\n" 462 "<a href=\"kppp-7.html#autohostname\">problems</a>.\n"
463 "\n" 463 "\n"
464 "Don't enable this unless you really need it.")); 464 "Don't enable this unless you really need it."));
465 465
466 topLayout->addWidget(box); 466 topLayout->addWidget(box);
467 topLayout->addWidget(autoname); 467 topLayout->addWidget(autoname);
468 topLayout->addStretch(); 468 topLayout->addStretch();
469 469
470 //load info from gpppdata 470 //load info from gpppdata
471 if(!isnewaccount) { 471 if(!isnewaccount) {
472 if(gpppdata.ipaddr() == "0.0.0.0" && 472 if(PPPData::data()->ipaddr() == "0.0.0.0" &&
473 gpppdata.subnetmask() == "0.0.0.0") { 473 PPPData::data()->subnetmask() == "0.0.0.0") {
474 dynamicadd_rb->setChecked(true); 474 dynamicadd_rb->setChecked(true);
475 hitIPSelect(0); 475 hitIPSelect(0);
476 autoname->setChecked(gpppdata.autoname()); 476 autoname->setChecked(PPPData::data()->autoname());
477 } 477 }
478 else { 478 else {
479 ipaddress_l->setText(gpppdata.ipaddr()); 479 ipaddress_l->setText(PPPData::data()->ipaddr());
480 subnetmask_l->setText(gpppdata.subnetmask()); 480 subnetmask_l->setText(PPPData::data()->subnetmask());
481 staticadd_rb->setChecked(true); 481 staticadd_rb->setChecked(true);
482 autoname->setChecked(false); 482 autoname->setChecked(false);
483 } 483 }
484 } 484 }
485 else { 485 else {
486 dynamicadd_rb->setChecked(true); 486 dynamicadd_rb->setChecked(true);
487 hitIPSelect(0); 487 hitIPSelect(0);
488 } 488 }
489 489
490} 490}
491 491
492void IPWidget::autoname_t(bool on) { 492void IPWidget::autoname_t(bool on) {
@@ -501,180 +501,180 @@ void IPWidget::autoname_t(bool on) {
501 "you know what you are doing!\n" 501 "you know what you are doing!\n"
502 "For more information take a look at the " 502 "For more information take a look at the "
503 "handbook (or help) in the section \"Frequently " 503 "handbook (or help) in the section \"Frequently "
504 "asked questions\"."), 504 "asked questions\"."),
505 i18n("Warning")); 505 i18n("Warning"));
506 was_warned = true; 506 was_warned = true;
507 } 507 }
508} 508}
509 509
510 510
511void IPWidget::save() { 511void IPWidget::save() {
512 if(dynamicadd_rb->isChecked()) { 512 if(dynamicadd_rb->isChecked()) {
513 gpppdata.setIpaddr("0.0.0.0"); 513 PPPData::data()->setIpaddr("0.0.0.0");
514 gpppdata.setSubnetmask("0.0.0.0"); 514 PPPData::data()->setSubnetmask("0.0.0.0");
515 } else { 515 } else {
516 gpppdata.setIpaddr(ipaddress_l->text()); 516 PPPData::data()->setIpaddr(ipaddress_l->text());
517 gpppdata.setSubnetmask(subnetmask_l->text()); 517 PPPData::data()->setSubnetmask(subnetmask_l->text());
518 } 518 }
519 gpppdata.setAutoname(autoname->isChecked()); 519 PPPData::data()->setAutoname(autoname->isChecked());
520} 520}
521 521
522 522
523void IPWidget::hitIPSelect( int i ) { 523void IPWidget::hitIPSelect( int i ) {
524 if(i == 0) { 524 if(i == 0) {
525 ipaddress_label->setEnabled(false); 525 ipaddress_label->setEnabled(false);
526 sub_label->setEnabled(false); 526 sub_label->setEnabled(false);
527 ipaddress_l->setEnabled(false); 527 ipaddress_l->setEnabled(false);
528 subnetmask_l->setEnabled(false); 528 subnetmask_l->setEnabled(false);
529 } 529 }
530 else { 530 else {
531 ipaddress_label->setEnabled(true); 531 ipaddress_label->setEnabled(true);
532 sub_label->setEnabled(true); 532 sub_label->setEnabled(true);
533 ipaddress_l->setEnabled(true); 533 ipaddress_l->setEnabled(true);
534 subnetmask_l->setEnabled(true); 534 subnetmask_l->setEnabled(true);
535 } 535 }
536} 536}
537 537
538 538
539 539
540DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) 540DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
541 : QWidget(parent, name) 541 : QWidget(parent, name)
542{ 542{
543 // box = new QGroupBox(parent); 543 // box = new QGroupBox(this);
544 QGridLayout *tl = new QGridLayout(parent, 7, 2, 0 );//, KDialog::spacingHint()); 544 QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );//, KDialog::spacingHint());
545 545
546 dnsdomain_label = new QLabel(i18n("Domain name:"), parent); 546 dnsdomain_label = new QLabel(i18n("Domain name:"), this);
547 tl->addWidget(dnsdomain_label, 0, 0); 547 tl->addWidget(dnsdomain_label, 0, 0);
548 548
549 dnsdomain = new QLineEdit(parent); 549 dnsdomain = new QLineEdit(this);
550 dnsdomain->setMaxLength(DOMAIN_SIZE); 550// dnsdomain->setMaxLength(DOMAIN_SIZE);
551 tl->addWidget(dnsdomain, 0, 1); 551 tl->addWidget(dnsdomain, 0, 1);
552 QString tmp = i18n("If you enter a domain name here, this domain\n" 552 QString tmp = i18n("If you enter a domain name here, this domain\n"
553 "name is used for your computer while you are\n" 553 "name is used for your computer while you are\n"
554 "connected. When the connection is closed, the\n" 554 "connected. When the connection is closed, the\n"
555 "original domain name of your computer is\n" 555 "original domain name of your computer is\n"
556 "restored.\n" 556 "restored.\n"
557 "\n" 557 "\n"
558 "If you leave this field blank, no changes are\n" 558 "If you leave this field blank, no changes are\n"
559 "made to the domain name."); 559 "made to the domain name.");
560 560
561 QWhatsThis::add(dnsdomain_label,tmp); 561 QWhatsThis::add(dnsdomain_label,tmp);
562 QWhatsThis::add(dnsdomain,tmp); 562 QWhatsThis::add(dnsdomain,tmp);
563 563
564 conf_label = new QLabel(i18n("Configuration:"), parent); 564 conf_label = new QLabel(i18n("Configuration:"), this);
565 tl->addWidget(conf_label, 1, 0); 565 tl->addWidget(conf_label, 1, 0);
566 566
567 bg = new QButtonGroup("Group", this); 567 bg = new QButtonGroup("Group", this);
568 connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int))); 568 connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int)));
569 bg->hide(); 569 bg->hide();
570 570
571 autodns = new QRadioButton(i18n("Automatic"), parent); 571 autodns = new QRadioButton(i18n("Automatic"), this);
572 bg->insert(autodns, 0); 572 bg->insert(autodns, 0);
573 tl->addWidget(autodns, 1, 1); 573 tl->addWidget(autodns, 1, 1);
574 // no automatic DNS detection for pppd < 2.3.7 574 // no automatic DNS detection for pppd < 2.3.7
575 if(!gpppdata.pppdVersionMin(2, 3, 7)) 575 if(!PPPData::data()->pppdVersionMin(2, 3, 7))
576 autodns->setEnabled(false); 576 autodns->setEnabled(false);
577 577
578 mandns = new QRadioButton(i18n("Manual"), parent); 578 mandns = new QRadioButton(i18n("Manual"), this);
579 bg->insert(mandns, 1); 579 bg->insert(mandns, 1);
580 tl->addWidget(mandns, 2, 1); 580 tl->addWidget(mandns, 2, 1);
581 581
582 dns_label = new QLabel(i18n("DNS IP address:"), parent); 582 dns_label = new QLabel(i18n("DNS IP address:"), this);
583 tl->addWidget(dns_label, 3, 0); 583 tl->addWidget(dns_label, 3, 0);
584 584
585 QHBoxLayout *l2 = new QHBoxLayout; 585 QHBoxLayout *l2 = new QHBoxLayout;
586 tl->addLayout(l2, 3, 1); 586 tl->addLayout(l2, 3, 1);
587 dnsipaddr = new IPLineEdit(parent); 587 dnsipaddr = new IPLineEdit(this);
588 connect(dnsipaddr, SIGNAL(returnPressed()), 588 connect(dnsipaddr, SIGNAL(returnPressed()),
589 SLOT(adddns())); 589 SLOT(adddns()));
590 connect(dnsipaddr, SIGNAL(textChanged(const QString &)), 590 connect(dnsipaddr, SIGNAL(textChanged(const QString &)),
591 SLOT(DNS_Edit_Changed(const QString &))); 591 SLOT(DNS_Edit_Changed(const QString &)));
592 l2->addWidget(dnsipaddr, 1); 592 l2->addWidget(dnsipaddr, 1);
593 l2->addStretch(1); 593 l2->addStretch(1);
594 tmp = i18n("<p>Allows you to specify a new DNS server to be\n" 594 tmp = i18n("<p>Allows you to specify a new DNS server to be\n"
595 "used while you are connected. When the\n" 595 "used while you are connected. When the\n"
596 "connection is closed, this DNS entry will be\n" 596 "connection is closed, this DNS entry will be\n"
597 "removed again.\n" 597 "removed again.\n"
598 "\n" 598 "\n"
599 "To add a DNS server, type in the IP address of\n" 599 "To add a DNS server, type in the IP address of\n"
600 "the DNS server here and click on <b>Add</b>"); 600 "the DNS server here and click on <b>Add</b>");
601 601
602 QWhatsThis::add(dns_label, tmp); 602 QWhatsThis::add(dns_label, tmp);
603 QWhatsThis::add(dnsipaddr, tmp); 603 QWhatsThis::add(dnsipaddr, tmp);
604 604
605 QHBoxLayout *l1 = new QHBoxLayout; 605 QHBoxLayout *l1 = new QHBoxLayout;
606 tl->addLayout(l1, 4, 1); 606 tl->addLayout(l1, 4, 1);
607 add = new QPushButton(i18n("Add"), parent); 607 add = new QPushButton(i18n("Add"), this);
608 connect(add, SIGNAL(clicked()), SLOT(adddns())); 608 connect(add, SIGNAL(clicked()), SLOT(adddns()));
609 int width = add->sizeHint().width(); 609// int width = add->sizeHint().width();
610 width = QMAX(width,60); 610// width = QMAX(width,60);
611 add->setMinimumWidth(width); 611// add->setMinimumWidth(width);
612 l1->addWidget(add); 612 l1->addWidget(add);
613 l1->addStretch(1); 613 l1->addStretch(1);
614 QWhatsThis::add(add, 614 QWhatsThis::add(add,
615 i18n("Click this button to add the DNS server\n" 615 i18n("Click this button to add the DNS server\n"
616 "specified in the field above. The entry\n" 616 "specified in the field above. The entry\n"
617 "will then be added to the list below")); 617 "will then be added to the list below"));
618 618
619 remove = new QPushButton(i18n("Remove"), parent); 619 remove = new QPushButton(i18n("Remove"), this);
620 connect(remove, SIGNAL(clicked()), SLOT(removedns())); 620 connect(remove, SIGNAL(clicked()), SLOT(removedns()));
621 width = remove->sizeHint().width(); 621// width = remove->sizeHint().width();
622 width = QMAX(width,60); 622// width = QMAX(width,60);
623 remove->setMinimumWidth(width); 623// remove->setMinimumWidth(width);
624 l1->addWidget(remove); 624 l1->addWidget(remove);
625 QWhatsThis::add(remove, 625 QWhatsThis::add(remove,
626 i18n("Click this button to remove the selected DNS\n" 626 i18n("Click this button to remove the selected DNS\n"
627 "server entry from the list below")); 627 "server entry from the list below"));
628 628
629 servers_label = new QLabel(i18n("DNS address list:"), parent); 629 servers_label = new QLabel(i18n("DNS address list:"), this);
630 servers_label->setAlignment(AlignTop|AlignLeft); 630 servers_label->setAlignment(AlignTop|AlignLeft);
631 tl->addWidget(servers_label, 5, 0); 631 tl->addWidget(servers_label, 5, 0);
632 632
633 dnsservers = new QListBox(parent); 633 dnsservers = new QListBox(this);
634 dnsservers->setMinimumSize(150, 80); 634 dnsservers->setMinimumSize(150, 80);
635 connect(dnsservers, SIGNAL(highlighted(int)), 635 connect(dnsservers, SIGNAL(highlighted(int)),
636 SLOT(DNS_Entry_Selected(int))); 636 SLOT(DNS_Entry_Selected(int)));
637 tl->addWidget(dnsservers, 5, 1); 637 tl->addWidget(dnsservers, 5, 1);
638 tmp = i18n("<p>This shows all defined DNS servers to use\n" 638 tmp = i18n("<p>This shows all defined DNS servers to use\n"
639 "while you are connected. Use the <b>Add</b> and\n" 639 "while you are connected. Use the <b>Add</b> and\n"
640 "<b>Remove</b> buttons to modify the list"); 640 "<b>Remove</b> buttons to modify the list");
641 641
642 QWhatsThis::add(servers_label,tmp); 642 QWhatsThis::add(servers_label,tmp);
643 QWhatsThis::add(dnsservers,tmp); 643 QWhatsThis::add(dnsservers,tmp);
644 644
645 exdnsdisabled_toggle = new QCheckBox(i18n( \ 645 exdnsdisabled_toggle = new QCheckBox(i18n( \
646"Disable existing DNS servers during connection"), 646"Disable existing DNS servers during connection"),
647 parent); 647 this);
648 exdnsdisabled_toggle->setChecked(gpppdata.exDNSDisabled()); 648 exdnsdisabled_toggle->setChecked(PPPData::data()->exDNSDisabled());
649 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); 649 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter);
650 QWhatsThis::add(exdnsdisabled_toggle, 650 QWhatsThis::add(exdnsdisabled_toggle,
651 i18n("<p>When this option is selected, all DNS\n" 651 i18n("<p>When this option is selected, all DNS\n"
652 "servers specified in <tt>/etc/resolv.conf</tt> are\n" 652 "servers specified in <tt>/etc/resolv.conf</tt> are\n"
653 "temporary disabled while the dialup connection\n" 653 "temporary disabled while the dialup connection\n"
654 "is established. After the connection is\n" 654 "is established. After the connection is\n"
655 "closed, the servers will be re-enabled\n" 655 "closed, the servers will be re-enabled\n"
656 "\n" 656 "\n"
657 "Typically, there is no reason to use this\n" 657 "Typically, there is no reason to use this\n"
658 "option, but it may become useful under \n" 658 "option, but it may become useful under \n"
659 "some circumstances.")); 659 "some circumstances."));
660 660
661 661
662 // restore data if editing 662 // restore data if editing
663 if(!isnewaccount) { 663 if(!isnewaccount) {
664 dnsservers->insertStringList(gpppdata.dns()); 664 dnsservers->insertStringList(PPPData::data()->dns());
665 dnsdomain->setText(gpppdata.domain()); 665 dnsdomain->setText(PPPData::data()->domain());
666 } 666 }
667 667
668 int mode = gpppdata.autoDNS() ? 0 : 1; 668 int mode = PPPData::data()->autoDNS() ? 0 : 1;
669 bg->setButton(mode); 669 bg->setButton(mode);
670 DNS_Mode_Selected(mode); 670 DNS_Mode_Selected(mode);
671 671
672 tl->activate(); 672 tl->activate();
673} 673}
674 674
675void DNSWidget::DNS_Edit_Changed(const QString &text) { 675void DNSWidget::DNS_Edit_Changed(const QString &text) {
676 QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); 676 QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
677 add->setEnabled(text.find(r) != -1); 677 add->setEnabled(text.find(r) != -1);
678} 678}
679 679
680void DNSWidget::DNS_Entry_Selected(int) { 680void DNSWidget::DNS_Entry_Selected(int) {
@@ -686,38 +686,38 @@ void DNSWidget::DNS_Mode_Selected(int mode) {
686 dns_label->setEnabled(on); 686 dns_label->setEnabled(on);
687 servers_label->setEnabled(on); 687 servers_label->setEnabled(on);
688 dnsipaddr->setText(""); 688 dnsipaddr->setText("");
689 dnsipaddr->setEnabled(on); 689 dnsipaddr->setEnabled(on);
690 add->setEnabled(false); 690 add->setEnabled(false);
691 remove->setEnabled(dnsservers->count()>0 && on); 691 remove->setEnabled(dnsservers->count()>0 && on);
692 dnsservers->clearSelection(); 692 dnsservers->clearSelection();
693 dnsservers->setEnabled(on); 693 dnsservers->setEnabled(on);
694 dnsservers->triggerUpdate(false); 694 dnsservers->triggerUpdate(false);
695} 695}
696 696
697void DNSWidget::save() { 697void DNSWidget::save() {
698 gpppdata.setAutoDNS(bg->id(bg->selected()) == 0); 698 PPPData::data()->setAutoDNS(bg->id(bg->selected()) == 0);
699 QStringList serverlist; 699 QStringList serverlist;
700 for(uint i=0; i < dnsservers->count(); i++) 700 for(uint i=0; i < dnsservers->count(); i++)
701 serverlist.append(dnsservers->text(i)); 701 serverlist.append(dnsservers->text(i));
702 gpppdata.setDns(serverlist); 702 PPPData::data()->setDns(serverlist);
703 703
704 // strip leading dot 704 // strip leading dot
705 QString s(dnsdomain->text()); 705 QString s(dnsdomain->text());
706 if(s.left(1) == ".") 706 if(s.left(1) == ".")
707 gpppdata.setDomain(s.mid(1)); 707 PPPData::data()->setDomain(s.mid(1));
708 else 708 else
709 gpppdata.setDomain(dnsdomain->text()); 709 PPPData::data()->setDomain(dnsdomain->text());
710 710
711 gpppdata.setExDNSDisabled(exdnsdisabled_toggle->isChecked()); 711 PPPData::data()->setExDNSDisabled(exdnsdisabled_toggle->isChecked());
712} 712}
713 713
714 714
715void DNSWidget::adddns() { 715void DNSWidget::adddns() {
716 if(dnsservers->count() < MAX_DNS_ENTRIES) { 716 if(dnsservers->count() < MAX_DNS_ENTRIES) {
717 dnsservers->insertItem(dnsipaddr->text()); 717 dnsservers->insertItem(dnsipaddr->text());
718 dnsipaddr->setText(""); 718 dnsipaddr->setText("");
719 } 719 }
720} 720}
721 721
722 722
723void DNSWidget::removedns() { 723void DNSWidget::removedns() {
@@ -726,31 +726,31 @@ void DNSWidget::removedns() {
726 if(i != -1) 726 if(i != -1)
727 dnsservers->removeItem(i); 727 dnsservers->removeItem(i);
728 remove->setEnabled(dnsservers->count()>0); 728 remove->setEnabled(dnsservers->count()>0);
729} 729}
730 730
731 731
732// 732//
733// GatewayWidget 733// GatewayWidget
734// 734//
735GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) 735GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name )
736 : QWidget(parent, name) 736 : QWidget(parent, name)
737{ 737{
738 QVBoxLayout *topLayout = new QVBoxLayout(parent); 738 QVBoxLayout *topLayout = new QVBoxLayout(this);
739 topLayout->setSpacing( 2 );//KDialog::spacingHint()); 739 topLayout->setSpacing( 2 );//KDialog::spacingHint());
740 740
741 box = new QVGroupBox(i18n("Configuration"), parent); 741 box = new QVGroupBox(i18n("Configuration"), this);
742// box->setInsideSpacing( 2 );//KDialog::spacingHint()); 742// box->setInsideSpacing( 2 );//KDialog::spacingHint());
743 743
744 rb = new QButtonGroup(parent); 744 rb = new QButtonGroup(this);
745 rb->hide(); 745 rb->hide();
746 connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int))); 746 connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int)));
747 747
748 defaultgateway = new QRadioButton(box); 748 defaultgateway = new QRadioButton(box);
749 defaultgateway->setText(i18n("Default gateway")); 749 defaultgateway->setText(i18n("Default gateway"));
750 rb->insert(defaultgateway, 0); 750 rb->insert(defaultgateway, 0);
751 QWhatsThis::add(defaultgateway, 751 QWhatsThis::add(defaultgateway,
752 i18n("This makes the PPP peer computer (the computer\n" 752 i18n("This makes the PPP peer computer (the computer\n"
753 "you are connected to with your modem) to act as\n" 753 "you are connected to with your modem) to act as\n"
754 "a gateway. Your computer will send all packets not\n" 754 "a gateway. Your computer will send all packets not\n"
755 "going to a computer inside your local net to this\n" 755 "going to a computer inside your local net to this\n"
756 "computer, which will route these packets.\n" 756 "computer, which will route these packets.\n"
@@ -762,124 +762,124 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na
762 staticgateway = new QRadioButton(box); 762 staticgateway = new QRadioButton(box);
763 staticgateway->setText(i18n("Static gateway")); 763 staticgateway->setText(i18n("Static gateway"));
764 rb->insert(staticgateway, 1); 764 rb->insert(staticgateway, 1);
765 QWhatsThis::add(staticgateway, 765 QWhatsThis::add(staticgateway,
766 i18n("<p>Allows you to specify which computer you want\n" 766 i18n("<p>Allows you to specify which computer you want\n"
767 "to use as gateway (see <i>Default Gateway</i> above)")); 767 "to use as gateway (see <i>Default Gateway</i> above)"));
768 768
769 QHBox *gateBox = new QHBox(box); 769 QHBox *gateBox = new QHBox(box);
770 gate_label = new QLabel(i18n("Gateway IP address:"), gateBox); 770 gate_label = new QLabel(i18n("Gateway IP address:"), gateBox);
771 gatewayaddr = new IPLineEdit(gateBox); 771 gatewayaddr = new IPLineEdit(gateBox);
772 772
773 defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), 773 defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"),
774 parent); 774 this);
775 QWhatsThis::add(defaultroute, 775 QWhatsThis::add(defaultroute,
776 i18n("If this option is enabled, all packets not\n" 776 i18n("If this option is enabled, all packets not\n"
777 "going to the local net are routed through\n" 777 "going to the local net are routed through\n"
778 "the PPP connection.\n" 778 "the PPP connection.\n"
779 "\n" 779 "\n"
780 "Normally, you should turn this on")); 780 "Normally, you should turn this on"));
781 781
782 topLayout->addWidget(box); 782 topLayout->addWidget(box);
783 topLayout->addWidget(defaultroute); 783 topLayout->addWidget(defaultroute);
784 topLayout->addStretch(); 784 topLayout->addStretch();
785 785
786 //load info from gpppdata 786 //load info from gpppdata
787 if(!isnewaccount) { 787 if(!isnewaccount) {
788 if(gpppdata.gateway() == "0.0.0.0") { 788 if(PPPData::data()->gateway() == "0.0.0.0") {
789 defaultgateway->setChecked(true); 789 defaultgateway->setChecked(true);
790 hitGatewaySelect(0); 790 hitGatewaySelect(0);
791 } 791 }
792 else { 792 else {
793 gatewayaddr->setText(gpppdata.gateway()); 793 gatewayaddr->setText(PPPData::data()->gateway());
794 staticgateway->setChecked(true); 794 staticgateway->setChecked(true);
795 } 795 }
796 defaultroute->setChecked(gpppdata.defaultroute()); 796 defaultroute->setChecked(PPPData::data()->defaultroute());
797 } 797 }
798 else { 798 else {
799 defaultgateway->setChecked(true); 799 defaultgateway->setChecked(true);
800 hitGatewaySelect(0); 800 hitGatewaySelect(0);
801 defaultroute->setChecked(true); 801 defaultroute->setChecked(true);
802 } 802 }
803} 803}
804 804
805void GatewayWidget::save() { 805void GatewayWidget::save() {
806 gpppdata.setGateway(gatewayaddr->text()); 806 PPPData::data()->setGateway(gatewayaddr->text());
807 gpppdata.setDefaultroute(defaultroute->isChecked()); 807 PPPData::data()->setDefaultroute(defaultroute->isChecked());
808} 808}
809 809
810 810
811void GatewayWidget::hitGatewaySelect( int i ) { 811void GatewayWidget::hitGatewaySelect( int i ) {
812 if(i == 0) { 812 if(i == 0) {
813 gatewayaddr->setText("0.0.0.0"); 813 gatewayaddr->setText("0.0.0.0");
814 gatewayaddr->setEnabled(false); 814 gatewayaddr->setEnabled(false);
815 gate_label->setEnabled(false); 815 gate_label->setEnabled(false);
816 } 816 }
817 else { 817 else {
818 gatewayaddr->setEnabled(true); 818 gatewayaddr->setEnabled(true);
819 gatewayaddr->setText(""); 819 gatewayaddr->setText("");
820 gate_label->setEnabled(true); 820 gate_label->setEnabled(true);
821 } 821 }
822} 822}
823 823
824 824
825 825
826ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) 826ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name )
827 : QWidget(parent, name) 827 : QWidget(parent, name)
828{ 828{
829 QVBoxLayout *tl = new QVBoxLayout(parent, 0 );//, KDialog::spacingHint()); 829 QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
830 se = new ScriptEdit(parent); 830 se = new ScriptEdit(this);
831 connect(se, SIGNAL(returnPressed()), SLOT(addButton())); 831 connect(se, SIGNAL(returnPressed()), SLOT(addButton()));
832 tl->addWidget(se); 832 tl->addWidget(se);
833 833
834 // insert equal-sized buttons 834 // insert equal-sized buttons
835 QButtonGroup *bbox = new QButtonGroup(parent); 835 QButtonGroup *bbox = new QButtonGroup(this);
836 add = new QPushButton( bbox, i18n("Add") ); 836 add = new QPushButton( bbox, i18n("Add") );
837 bbox->insert(add); 837 bbox->insert(add);
838 connect(add, SIGNAL(clicked()), SLOT(addButton())); 838 connect(add, SIGNAL(clicked()), SLOT(addButton()));
839// bbox->addStretch(1); 839// bbox->addStretch(1);
840 insert = new QPushButton( bbox, i18n("Insert") ); 840 insert = new QPushButton( bbox, i18n("Insert") );
841 bbox->insert(insert); 841 bbox->insert(insert);
842 connect(insert, SIGNAL(clicked()), SLOT(insertButton())); 842 connect(insert, SIGNAL(clicked()), SLOT(insertButton()));
843// bbox->addStretch(1); 843// bbox->addStretch(1);
844 remove = new QPushButton( bbox, i18n("Remove") ); 844 remove = new QPushButton( bbox, i18n("Remove") );
845 bbox->insert(remove); 845 bbox->insert(remove);
846 connect(remove, SIGNAL(clicked()), SLOT(removeButton())); 846 connect(remove, SIGNAL(clicked()), SLOT(removeButton()));
847 bbox->layout(); 847 bbox->layout();
848 tl->addWidget(bbox); 848 tl->addWidget(bbox);
849 849
850 QHBoxLayout *l12 = new QHBoxLayout(0); 850 QHBoxLayout *l12 = new QHBoxLayout(0);
851 tl->addLayout(l12); 851 tl->addLayout(l12);
852 stl = new QListBox(parent); 852 stl = new QListBox(this);
853 stl->setVScrollBarMode( QScrollView::AlwaysOff ); 853 stl->setVScrollBarMode( QScrollView::AlwaysOff );
854 connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int))); 854 connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int)));
855 stl->setMinimumSize(QSize(70, 140)); 855 stl->setMinimumSize(QSize(70, 140));
856 856
857 sl = new QListBox(parent); 857 sl = new QListBox(this);
858 sl->setVScrollBarMode( QScrollView::AlwaysOff ); 858 sl->setVScrollBarMode( QScrollView::AlwaysOff );
859 connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int))); 859 connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int)));
860 sl->setMinimumSize(QSize(150, 140)); 860 sl->setMinimumSize(QSize(150, 140));
861 861
862 slb = new QScrollBar(parent); 862 slb = new QScrollBar(this);
863 slb->setFixedWidth(slb->sizeHint().width()); 863// slb->setFixedWidth(slb->sizeHint().width());
864 connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); 864 connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int)));
865 865
866 l12->addWidget(stl, 1); 866 l12->addWidget(stl, 1);
867 l12->addWidget(sl, 3); 867 l12->addWidget(sl, 3);
868 l12->addWidget(slb, 0); 868 l12->addWidget(slb, 0);
869 869
870 //load data from gpppdata 870 //load data from gpppdata
871 if(!isnewaccount) { 871 if(!isnewaccount) {
872 QStringList &comlist = gpppdata.scriptType(); 872 QStringList &comlist = PPPData::data()->scriptType();
873 QStringList &arglist = gpppdata.script(); 873 QStringList &arglist = PPPData::data()->script();
874 QStringList::Iterator itcom = comlist.begin(); 874 QStringList::Iterator itcom = comlist.begin();
875 QStringList::Iterator itarg = arglist.begin(); 875 QStringList::Iterator itarg = arglist.begin();
876 876
877 for ( ; 877 for ( ;
878 itcom != comlist.end() && itarg != arglist.end(); 878 itcom != comlist.end() && itarg != arglist.end();
879 ++itcom, ++itarg ) 879 ++itcom, ++itarg )
880 { 880 {
881 stl->insertItem(*itcom); 881 stl->insertItem(*itcom);
882 sl->insertItem(*itarg); 882 sl->insertItem(*itarg);
883 } 883 }
884 } 884 }
885 885
@@ -907,26 +907,26 @@ bool ScriptWidget::check() {
907 return ( (errcnt == 0 ) && (lstart == lend) ); 907 return ( (errcnt == 0 ) && (lstart == lend) );
908 } 908 }
909 return true; 909 return true;
910} 910}
911 911
912 912
913void ScriptWidget::save() { 913void ScriptWidget::save() {
914 QStringList typelist, arglist; 914 QStringList typelist, arglist;
915 for(uint i=0; i < sl->count(); i++) { 915 for(uint i=0; i < sl->count(); i++) {
916 typelist.append(stl->text(i)); 916 typelist.append(stl->text(i));
917 arglist.append(sl->text(i)); 917 arglist.append(sl->text(i));
918 } 918 }
919 gpppdata.setScriptType(typelist); 919 PPPData::data()->setScriptType(typelist);
920 gpppdata.setScript(arglist); 920 PPPData::data()->setScript(arglist);
921} 921}
922 922
923 923
924 924
925void ScriptWidget::adjustScrollBar() { 925void ScriptWidget::adjustScrollBar() {
926 if((int)sl->count() <= sl->numItemsVisible()) 926 if((int)sl->count() <= sl->numItemsVisible())
927 slb->setRange(0, 0); 927 slb->setRange(0, 0);
928 else 928 else
929 slb->setRange(0, (sl->count() - sl->numItemsVisible())+1); 929 slb->setRange(0, (sl->count() - sl->numItemsVisible())+1);
930} 930}
931 931
932 932
@@ -1145,37 +1145,37 @@ void ScriptWidget::removeButton() {
1145 remove->setEnabled(sl->currentItem() != -1); 1145 remove->setEnabled(sl->currentItem() != -1);
1146 } 1146 }
1147} 1147}
1148 1148
1149 1149
1150 1150
1151///////////////////////////////////////////////////////////////////////////// 1151/////////////////////////////////////////////////////////////////////////////
1152// 1152//
1153// Used to specify a new phone number 1153// Used to specify a new phone number
1154// 1154//
1155///////////////////////////////////////////////////////////////////////////// 1155/////////////////////////////////////////////////////////////////////////////
1156PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) 1156PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
1157 : QDialog(parent, 0, true ) { 1157 : QDialog(parent,"PhoneNumberDialog",true) {
1158 setCaption( i18n("Add Phone Number") ); 1158 setCaption( i18n("Add Phone Number") );
1159// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 1159// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
1160 1160
1161 QHBox *hbox = new QHBox(this); 1161 QHBox *hbox = new QHBox(this);
1162// setMainWidget(hbox); 1162// setMainWidget(hbox);
1163 1163
1164 hbox->setSpacing( 2 );//KDialog::spacingHint()); 1164 hbox->setSpacing( 2 );//KDialog::spacingHint());
1165 1165
1166 new QLabel(i18n("Enter a phone number:"), hbox); 1166 new QLabel(i18n("Enter a phone number:"), hbox);
1167 1167
1168 le = newLineEdit(14, hbox); 1168 le = new QLineEdit(hbox);
1169 le->setMinimumWidth(125); 1169// le->setMinimumWidth(125);
1170 1170
1171 connect(le, SIGNAL(textChanged(const QString &)), 1171 connect(le, SIGNAL(textChanged(const QString &)),
1172 this, SLOT(textChanged(const QString &))); 1172 this, SLOT(textChanged(const QString &)));
1173 1173
1174 le->setFocus(); 1174 le->setFocus();
1175 textChanged(""); 1175 textChanged("");
1176 1176
1177// enableButtonSeparator(true); 1177// enableButtonSeparator(true);
1178} 1178}
1179 1179
1180 1180
1181QString PhoneNumberDialog::phoneNumber() { 1181QString PhoneNumberDialog::phoneNumber() {
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index f803628..a02ee35 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -155,186 +155,186 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
155 155
156 tmp = i18n("Specifies the speed your modem and the serial\n" 156 tmp = i18n("Specifies the speed your modem and the serial\n"
157 "port talk to each other. You should begin with\n" 157 "port talk to each other. You should begin with\n"
158 "the default of 38400 bits/sec. If everything\n" 158 "the default of 38400 bits/sec. If everything\n"
159 "works you can try to increase this value, but to\n" 159 "works you can try to increase this value, but to\n"
160 "no more than 115200 bits/sec (unless you know\n" 160 "no more than 115200 bits/sec (unless you know\n"
161 "that your serial port supports higher speeds)."); 161 "that your serial port supports higher speeds).");
162 162
163 QWhatsThis::add(baud_label,tmp); 163 QWhatsThis::add(baud_label,tmp);
164 QWhatsThis::add(baud_c,tmp); 164 QWhatsThis::add(baud_c,tmp);
165 165
166 for(int i=0; i <= enter->count()-1; i++) { 166 for(int i=0; i <= enter->count()-1; i++) {
167 if(gpppdata.enter() == enter->text(i)) 167 if(PPPData::data()->enter() == enter->text(i))
168 enter->setCurrentItem(i); 168 enter->setCurrentItem(i);
169 } 169 }
170 170
171 tl->addRowSpacing(4, 10); 171 tl->addRowSpacing(4, 10);
172 172
173 //Modem Lock File 173 //Modem Lock File
174 modemlockfile = new QCheckBox(i18n("&Use lock file"), this); 174 modemlockfile = new QCheckBox(i18n("&Use lock file"), this);
175 175
176 modemlockfile->setChecked(gpppdata.modemLockFile()); 176 modemlockfile->setChecked(PPPData::data()->modemLockFile());
177 connect(modemlockfile, SIGNAL(toggled(bool)), 177 connect(modemlockfile, SIGNAL(toggled(bool)),
178 SLOT(modemlockfilechanged(bool))); 178 SLOT(modemlockfilechanged(bool)));
179 tl->addMultiCellWidget(modemlockfile, 5, 5, 0, 1); 179 tl->addMultiCellWidget(modemlockfile, 5, 5, 0, 1);
180 // l12->addStretch(1); 180 // l12->addStretch(1);
181 QWhatsThis::add(modemlockfile, 181 QWhatsThis::add(modemlockfile,
182 i18n("<p>To prevent other programs from accessing the\n" 182 i18n("<p>To prevent other programs from accessing the\n"
183 "modem while a connection is established, a\n" 183 "modem while a connection is established, a\n"
184 "file can be created to indicate that the modem\n" 184 "file can be created to indicate that the modem\n"
185 "is in use. On Linux an example file would be\n" 185 "is in use. On Linux an example file would be\n"
186 "<tt>/var/lock/LCK..ttyS1</tt>\n" 186 "<tt>/var/lock/LCK..ttyS1</tt>\n"
187 "Here you can select whether this locking will\n" 187 "Here you can select whether this locking will\n"
188 "be done.\n" 188 "be done.\n"
189 "\n" 189 "\n"
190 "<b>Default</b>: On")); 190 "<b>Default</b>: On"));
191 191
192 // Modem Timeout Line Edit Box 192 // Modem Timeout Line Edit Box
193 193
194 modemtimeout = new KIntNumInput(gpppdata.modemTimeout(), this); 194 modemtimeout = new KIntNumInput(PPPData::data()->modemTimeout(), this);
195 modemtimeout->setLabel(i18n("Modem &timeout:")); 195 modemtimeout->setLabel(i18n("Modem &timeout:"));
196 modemtimeout->setRange(1, 120, 1); 196 modemtimeout->setRange(1, 120, 1);
197 modemtimeout->setSuffix(i18n(" sec")); 197 modemtimeout->setSuffix(i18n(" sec"));
198 connect(modemtimeout, SIGNAL(valueChanged(int)), 198 connect(modemtimeout, SIGNAL(valueChanged(int)),
199 SLOT(modemtimeoutchanged(int))); 199 SLOT(modemtimeoutchanged(int)));
200 tl->addMultiCellWidget(modemtimeout, 6, 6, 0, 1); 200 tl->addMultiCellWidget(modemtimeout, 6, 6, 0, 1);
201 201
202 QWhatsThis::add(modemtimeout, 202 QWhatsThis::add(modemtimeout,
203 i18n("This specifies how long <i>kppp</i> waits for a\n" 203 i18n("This specifies how long <i>kppp</i> waits for a\n"
204 "<i>CONNECT</i> response from your modem. The\n" 204 "<i>CONNECT</i> response from your modem. The\n"
205 "recommended value is 30 seconds.")); 205 "recommended value is 30 seconds."));
206 206
207 //set stuff from gpppdata 207 //set stuff from gpppdata
208 for(int i=0; i <= enter->count()-1; i++) { 208 for(int i=0; i <= enter->count()-1; i++) {
209 if(gpppdata.enter() == enter->text(i)) 209 if(PPPData::data()->enter() == enter->text(i))
210 enter->setCurrentItem(i); 210 enter->setCurrentItem(i);
211 } 211 }
212 212
213 for(int i=0; i <= modemdevice->count()-1; i++) { 213 for(int i=0; i <= modemdevice->count()-1; i++) {
214 if(gpppdata.modemDevice() == modemdevice->text(i)) 214 if(PPPData::data()->modemDevice() == modemdevice->text(i))
215 modemdevice->setCurrentItem(i); 215 modemdevice->setCurrentItem(i);
216 } 216 }
217 217
218 for(int i=0; i <= flowcontrol->count()-1; i++) { 218 for(int i=0; i <= flowcontrol->count()-1; i++) {
219 if(gpppdata.flowcontrol() == flowcontrol->text(i)) 219 if(PPPData::data()->flowcontrol() == flowcontrol->text(i))
220 flowcontrol->setCurrentItem(i); 220 flowcontrol->setCurrentItem(i);
221 } 221 }
222 222
223 //set the modem speed 223 //set the modem speed
224 for(int i=0; i < baud_c->count(); i++) 224 for(int i=0; i < baud_c->count(); i++)
225 if(baud_c->text(i) == gpppdata.speed()) 225 if(baud_c->text(i) == PPPData::data()->speed())
226 baud_c->setCurrentItem(i); 226 baud_c->setCurrentItem(i);
227 227
228 tl->setRowStretch(7, 1); 228 tl->setRowStretch(7, 1);
229} 229}
230 230
231 231
232void ModemWidget::speed_selection(int) { 232void ModemWidget::speed_selection(int) {
233 gpppdata.setSpeed(baud_c->text(baud_c->currentItem())); 233 PPPData::data()->setSpeed(baud_c->text(baud_c->currentItem()));
234} 234}
235 235
236 236
237void ModemWidget::setenter(int ) { 237void ModemWidget::setenter(int ) {
238 gpppdata.setEnter(enter->text(enter->currentItem())); 238 PPPData::data()->setEnter(enter->text(enter->currentItem()));
239} 239}
240 240
241 241
242void ModemWidget::setmodemdc(int i) { 242void ModemWidget::setmodemdc(int i) {
243 gpppdata.setModemDevice(modemdevice->text(i)); 243 PPPData::data()->setModemDevice(modemdevice->text(i));
244} 244}
245 245
246 246
247void ModemWidget::setflowcontrol(int i) { 247void ModemWidget::setflowcontrol(int i) {
248 gpppdata.setFlowcontrol(flowcontrol->text(i)); 248 PPPData::data()->setFlowcontrol(flowcontrol->text(i));
249} 249}
250 250
251 251
252void ModemWidget::modemlockfilechanged(bool set) { 252void ModemWidget::modemlockfilechanged(bool set) {
253 gpppdata.setModemLockFile(set); 253 PPPData::data()->setModemLockFile(set);
254} 254}
255 255
256 256
257void ModemWidget::modemtimeoutchanged(int n) { 257void ModemWidget::modemtimeoutchanged(int n) {
258 gpppdata.setModemTimeout(n); 258 PPPData::data()->setModemTimeout(n);
259} 259}
260 260
261 261
262ModemWidget2::ModemWidget2( QWidget *parent, const char *name) 262ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
263 : QWidget(parent, name) 263 : QWidget(parent, name)
264{ 264{
265 QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); 265 QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
266 266
267 267
268 waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this); 268 waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this);
269 waitfordt->setChecked(gpppdata.waitForDialTone()); 269 waitfordt->setChecked(PPPData::data()->waitForDialTone());
270 connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); 270 connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
271 l1->addWidget(waitfordt); 271 l1->addWidget(waitfordt);
272 QWhatsThis::add(waitfordt, 272 QWhatsThis::add(waitfordt,
273 i18n("<p>Normally the modem waits for a dial tone\n" 273 i18n("<p>Normally the modem waits for a dial tone\n"
274 "from your phone line, indicating that it can\n" 274 "from your phone line, indicating that it can\n"
275 "start to dial a number. If your modem does not\n" 275 "start to dial a number. If your modem does not\n"
276 "recognize this sound, or your local phone system\n" 276 "recognize this sound, or your local phone system\n"
277 "does not emit such a tone, uncheck this option\n" 277 "does not emit such a tone, uncheck this option\n"
278 "\n" 278 "\n"
279 "<b>Default:</b>: On")); 279 "<b>Default:</b>: On"));
280 280
281 busywait = new KIntNumInput(gpppdata.busyWait(), this); 281 busywait = new KIntNumInput(PPPData::data()->busyWait(), this);
282 busywait->setLabel(i18n("B&usy wait:")); 282 busywait->setLabel(i18n("B&usy wait:"));
283 busywait->setRange(0, 300, 5, true); 283 busywait->setRange(0, 300, 5, true);
284 busywait->setSuffix(i18n(" sec")); 284 busywait->setSuffix(i18n(" sec"));
285 connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); 285 connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
286 l1->addWidget(busywait); 286 l1->addWidget(busywait);
287 287
288 QWhatsThis::add(busywait, 288 QWhatsThis::add(busywait,
289 i18n("Specifies the number of seconds to wait before\n" 289 i18n("Specifies the number of seconds to wait before\n"
290 "redial if all dialed numbers are busy. This is\n" 290 "redial if all dialed numbers are busy. This is\n"
291 "necessary because some modems get stuck if the\n" 291 "necessary because some modems get stuck if the\n"
292 "same number is busy too often.\n" 292 "same number is busy too often.\n"
293 "\n" 293 "\n"
294 "The default is 0 seconds, you should not change\n" 294 "The default is 0 seconds, you should not change\n"
295 "this unless you need to.")); 295 "this unless you need to."));
296 296
297 l1->addSpacing(10); 297 l1->addSpacing(10);
298 298
299 QHBoxLayout *hbl = new QHBoxLayout; 299 QHBoxLayout *hbl = new QHBoxLayout;
300 hbl->setSpacing(2);//KDialog::spacingHint()); 300 hbl->setSpacing(2);//KDialog::spacingHint());
301 301
302 QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this); 302 QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this);
303 hbl->addWidget(volumeLabel); 303 hbl->addWidget(volumeLabel);
304 volume = new QSlider(0, 2, 1, gpppdata.volume(), QSlider::Horizontal, this); 304 volume = new QSlider(0, 2, 1, PPPData::data()->volume(), QSlider::Horizontal, this);
305 volumeLabel->setBuddy(volume); 305 volumeLabel->setBuddy(volume);
306 volume->setTickmarks(QSlider::Below); 306 volume->setTickmarks(QSlider::Below);
307 hbl->addWidget(volume); 307 hbl->addWidget(volume);
308 308
309 l1->addLayout(hbl); 309 l1->addLayout(hbl);
310 310
311 connect(volume, SIGNAL(valueChanged(int)), 311 connect(volume, SIGNAL(valueChanged(int)),
312 this, SLOT(volumeChanged(int))); 312 this, SLOT(volumeChanged(int)));
313 QString tmp = i18n("Most modems have a speaker which makes\n" 313 QString tmp = i18n("Most modems have a speaker which makes\n"
314 "a lot of noise when dialing. Here you can\n" 314 "a lot of noise when dialing. Here you can\n"
315 "either turn this completely off or select a\n" 315 "either turn this completely off or select a\n"
316 "lower volume.\n" 316 "lower volume.\n"
317 "\n" 317 "\n"
318 "If this does not work for your modem,\n" 318 "If this does not work for your modem,\n"
319 "you must modify the modem volume command."); 319 "you must modify the modem volume command.");
320 320
321 QWhatsThis::add(volumeLabel,tmp); 321 QWhatsThis::add(volumeLabel,tmp);
322 QWhatsThis::add(volume, tmp); 322 QWhatsThis::add(volume, tmp);
323 323
324 l1->addSpacing(20); 324 l1->addSpacing(20);
325 325
326#if 0 326#if 0
327 chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this); 327 chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this);
328 chkbox1->setChecked(gpppdata.UseCDLine()); 328 chkbox1->setChecked(PPPData::data()->UseCDLine());
329 connect(chkbox1,SIGNAL(toggled(bool)), 329 connect(chkbox1,SIGNAL(toggled(bool)),
330 this,SLOT(use_cdline_toggled(bool))); 330 this,SLOT(use_cdline_toggled(bool)));
331 l12->addWidget(chkbox1); 331 l12->addWidget(chkbox1);
332 l12->addStretch(1); 332 l12->addStretch(1);
333 l1->addStretch(1); 333 l1->addStretch(1);
334 QWhatsThis::add(chkbox1, 334 QWhatsThis::add(chkbox1,
335 i18n("This controls how <i>kppp</i> detects that the modem\n" 335 i18n("This controls how <i>kppp</i> detects that the modem\n"
336 "is not responding. Unless you are having\n" 336 "is not responding. Unless you are having\n"
337 "problems with this, do not modify this setting.\n" 337 "problems with this, do not modify this setting.\n"
338 "\n" 338 "\n"
339 "<b>Default</b>: Off")); 339 "<b>Default</b>: Off"));
340#endif 340#endif
@@ -393,29 +393,29 @@ void ModemWidget2::query_modem() {
393 mt.exec(); 393 mt.exec();
394} 394}
395 395
396 396
397// void ModemWidget2::terminal() { 397// void ModemWidget2::terminal() {
398// MiniTerm terminal(NULL,NULL); 398// MiniTerm terminal(NULL,NULL);
399// terminal.exec(); 399// terminal.exec();
400// } 400// }
401 401
402 402
403#if 0 403#if 0
404void ModemWidget2::use_cdline_toggled(bool on) { 404void ModemWidget2::use_cdline_toggled(bool on) {
405 gpppdata.setUseCDLine(on); 405 PPPData::data()->setUseCDLine(on);
406} 406}
407#endif 407#endif
408 408
409void ModemWidget2::waitfordtchanged(bool b) { 409void ModemWidget2::waitfordtchanged(bool b) {
410 gpppdata.setWaitForDialTone((int)b); 410 PPPData::data()->setWaitForDialTone((int)b);
411} 411}
412 412
413void ModemWidget2::busywaitchanged(int n) { 413void ModemWidget2::busywaitchanged(int n) {
414 gpppdata.setbusyWait(n); 414 PPPData::data()->setbusyWait(n);
415} 415}
416 416
417 417
418void ModemWidget2::volumeChanged(int v) { 418void ModemWidget2::volumeChanged(int v) {
419 gpppdata.setVolume(v); 419 PPPData::data()->setVolume(v);
420} 420}
421 421
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index 2f9feda..8d70cd4 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -149,25 +149,25 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
149 149
150// QWhatsThis::add(PW_Label,tmp); 150// QWhatsThis::add(PW_Label,tmp);
151// QWhatsThis::add(PW_Edit,tmp); 151// QWhatsThis::add(PW_Edit,tmp);
152 152
153// QHBoxLayout *l3 = new QHBoxLayout; 153// QHBoxLayout *l3 = new QHBoxLayout;
154// tl->addSpacing(5); 154// tl->addSpacing(5);
155// tl->addLayout(l3); 155// tl->addLayout(l3);
156// tl->addSpacing(5); 156// tl->addSpacing(5);
157// l3->addSpacing(10); 157// l3->addSpacing(10);
158// log = new QCheckBox(i18n("Show lo&g window"), this); 158// log = new QCheckBox(i18n("Show lo&g window"), this);
159// connect(log, SIGNAL(toggled(bool)), 159// connect(log, SIGNAL(toggled(bool)),
160 // this, SLOT(log_window_toggled(bool))); 160 // this, SLOT(log_window_toggled(bool)));
161// log->setChecked(gpppdata.get_show_log_window()); 161// log->setChecked(PPPData::data()->get_show_log_window());
162// l3->addWidget(log); 162// l3->addWidget(log);
163 163
164// QWhatsThis::add(log, 164// QWhatsThis::add(log,
165 // i18n("<p>This controls whether a log window is shown.\n" 165 // i18n("<p>This controls whether a log window is shown.\n"
166 // "A log window shows the communication between\n" 166 // "A log window shows the communication between\n"
167 // "<i>kppp</i> and your modem. This will help you\n" 167 // "<i>kppp</i> and your modem. This will help you\n"
168 // "in tracking down problems.\n" 168 // "in tracking down problems.\n"
169 // "\n" 169 // "\n"
170 // "Turn it off if <i>kppp</i> routinely connects without\n" 170 // "Turn it off if <i>kppp</i> routinely connects without\n"
171 // "problems")); 171 // "problems"));
172 172
173// // fline = new QSeparator( KSeparator::HLine, this); 173// // fline = new QSeparator( KSeparator::HLine, this);
@@ -182,25 +182,25 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
182// connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); 182// connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton()));
183// if(quit_b->sizeHint().width() > minw) 183// if(quit_b->sizeHint().width() > minw)
184// minw = quit_b->sizeHint().width(); 184// minw = quit_b->sizeHint().width();
185 185
186// setup_b = new QPushButton(i18n("&Setup..."), this); 186// setup_b = new QPushButton(i18n("&Setup..."), this);
187// // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); 187// // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) );
188// connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); 188// connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton()));
189// if(setup_b->sizeHint().width() > minw) 189// if(setup_b->sizeHint().width() > minw)
190// minw = setup_b->sizeHint().width(); 190// minw = setup_b->sizeHint().width();
191 191
192 192
193 193
194// if(gpppdata.access() != KConfig::ReadWrite) 194// if(PPPData::data()->access() != KConfig::ReadWrite)
195// setup_b->setEnabled(false); 195// setup_b->setEnabled(false);
196 196
197// help_b = new QPushButton(i18n("&Help"), this); 197// help_b = new QPushButton(i18n("&Help"), this);
198// connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); 198// connect( help_b, SIGNAL(clicked()), SLOT(helpbutton()));
199 199
200// KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); 200// KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true);
201// help_b->setPopup((QPopupMenu*)helpMenu->menu()); 201// help_b->setPopup((QPopupMenu*)helpMenu->menu());
202// help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); 202// help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) );
203 203
204// if(help_b->sizeHint().width() > minw) 204// if(help_b->sizeHint().width() > minw)
205// minw = help_b->sizeHint().width(); 205// minw = help_b->sizeHint().width();
206 206
@@ -282,25 +282,25 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
282 282
283// KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 283// KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
284 284
285// m_strCmdlAccount = args->getOption("c"); 285// m_strCmdlAccount = args->getOption("c");
286// m_bQuitOnDisconnect = args->isSet("q"); 286// m_bQuitOnDisconnect = args->isSet("q");
287 287
288// if(!m_strCmdlAccount.isEmpty()) { 288// if(!m_strCmdlAccount.isEmpty()) {
289// m_bCmdlAccount = true; 289// m_bCmdlAccount = true;
290// kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; 290// kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl;
291// } 291// }
292 292
293// if(m_bCmdlAccount){ 293// if(m_bCmdlAccount){
294// bool result = gpppdata.setAccount(m_strCmdlAccount); 294// bool result = PPPData::data()->setAccount(m_strCmdlAccount);
295// if (!result){ 295// if (!result){
296// QString string; 296// QString string;
297// string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); 297// string = i18n("No such Account:\n%1").arg(m_strCmdlAccount);
298// KMessageBox::error(this, string); 298// KMessageBox::error(this, string);
299// m_bCmdlAccount = false; 299// m_bCmdlAccount = false;
300// this->show(); 300// this->show();
301// } else { 301// } else {
302// beginConnect(); 302// beginConnect();
303// } 303// }
304// } else 304// } else
305// expandbutton(); 305// expandbutton();
306// show(); 306// show();
@@ -354,339 +354,339 @@ KPPPWidget::~KPPPWidget()
354 354
355void KPPPWidget::enterPressedInID() { 355void KPPPWidget::enterPressedInID() {
356 PW_Edit->setFocus(); 356 PW_Edit->setFocus();
357} 357}
358 358
359 359
360void KPPPWidget::enterPressedInPW() { 360void KPPPWidget::enterPressedInPW() {
361 connect_b->setFocus(); 361 connect_b->setFocus();
362} 362}
363 363
364// triggered by the session manager 364// triggered by the session manager
365void KPPPWidget::saveMyself() { 365void KPPPWidget::saveMyself() {
366 gpppdata.save(); 366 PPPData::data()->save();
367} 367}
368 368
369void KPPPWidget::shutDown() { 369void KPPPWidget::shutDown() {
370 interruptConnection(); 370 interruptConnection();
371 saveMyself(); 371 saveMyself();
372} 372}
373 373
374void KPPPWidget::log_window_toggled(bool on) { 374void KPPPWidget::log_window_toggled(bool on) {
375 gpppdata.set_show_log_window(on); 375 PPPData::data()->set_show_log_window(on);
376} 376}
377 377
378 378
379 379
380 380
381// void KPPPWidget::resetaccounts() { 381// void KPPPWidget::resetaccounts() {
382// connectto_c->clear(); 382// connectto_c->clear();
383 383
384// int count = gpppdata.count(); 384// int count = PPPData::data()->count();
385 385
386// // enable/disable controls 386// // enable/disable controls
387// connectto_c->setEnabled(count > 0); 387// connectto_c->setEnabled(count > 0);
388// connect_b->setEnabled(count > 0); 388// connect_b->setEnabled(count > 0);
389// log->setEnabled(count > 0); 389// log->setEnabled(count > 0);
390// ID_Edit->setEnabled(count > 0); 390// ID_Edit->setEnabled(count > 0);
391// PW_Edit->setEnabled(count > 0); 391// PW_Edit->setEnabled(count > 0);
392 392
393// //load the accounts 393// //load the accounts
394// for(int i=0; i < count; i++) { 394// for(int i=0; i < count; i++) {
395// gpppdata.setAccountbyIndex(i); 395// PPPData::data()->setAccountbyIndex(i);
396// connectto_c->insertItem(gpppdata.accname()); 396// connectto_c->insertItem(PPPData::data()->accname());
397// } 397// }
398 398
399// //set the default account 399// //set the default account
400// if(!gpppdata.defaultAccount().isEmpty()) { 400// if(!PPPData::data()->defaultAccount().isEmpty()) {
401// for(int i=0; i < count; i++) 401// for(int i=0; i < count; i++)
402// if(gpppdata.defaultAccount() == connectto_c->text(i)) { 402// if(PPPData::data()->defaultAccount() == connectto_c->text(i)) {
403 // connectto_c->setCurrentItem(i); 403 // connectto_c->setCurrentItem(i);
404 // gpppdata.setAccountbyIndex(i); 404 // PPPData::data()->setAccountbyIndex(i);
405 405
406 // ID_Edit->setText(gpppdata.storedUsername()); 406 // ID_Edit->setText(PPPData::data()->storedUsername());
407 // PW_Edit->setText(gpppdata.storedPassword()); 407 // PW_Edit->setText(PPPData::data()->storedPassword());
408// } 408// }
409// } 409// }
410// else 410// else
411// if(count > 0) { 411// if(count > 0) {
412// gpppdata.setDefaultAccount(connectto_c->text(0)); 412// PPPData::data()->setDefaultAccount(connectto_c->text(0));
413// gpppdata.save(); 413// PPPData::data()->save();
414 // ID_Edit->setText(gpppdata.storedUsername()); 414 // ID_Edit->setText(PPPData::data()->storedUsername());
415 // PW_Edit->setText(gpppdata.storedPassword()); 415 // PW_Edit->setText(PPPData::data()->storedPassword());
416// } 416// }
417 417
418// connect(ID_Edit, SIGNAL(textChanged(const QString &)), 418// connect(ID_Edit, SIGNAL(textChanged(const QString &)),
419 // this, SLOT(usernameChanged(const QString &))); 419 // this, SLOT(usernameChanged(const QString &)));
420 420
421// connect(PW_Edit, SIGNAL(textChanged(const QString &)), 421// connect(PW_Edit, SIGNAL(textChanged(const QString &)),
422 // this, SLOT(passwordChanged(const QString &))); 422 // this, SLOT(passwordChanged(const QString &)));
423 423
424// if (ID_Edit->text().isEmpty()) 424// if (ID_Edit->text().isEmpty())
425// ID_Edit->setFocus(); 425// ID_Edit->setFocus();
426// else if (PW_Edit->text().isEmpty()) 426// else if (PW_Edit->text().isEmpty())
427// PW_Edit->setFocus(); 427// PW_Edit->setFocus();
428// } 428// }
429 429
430 430
431void KPPPWidget::interruptConnection() { 431void KPPPWidget::interruptConnection() {
432 // interrupt dial up 432 // interrupt dial up
433// if (con->isVisible()) 433// if (con->isVisible())
434// emit con->cancelbutton(); 434// emit con->cancelbutton();
435 435
436 // disconnect if online 436 // disconnect if online
437 if (gpppdata.pppdRunning()) 437 if (PPPData::data()->pppdRunning())
438 emit disconnect(); 438 emit disconnect();
439} 439}
440 440
441 441
442void KPPPWidget::sigPPPDDied() { 442void KPPPWidget::sigPPPDDied() {
443 qDebug( "Received a SIGUSR1" ); 443 qDebug( "Received a SIGUSR1" );
444 444
445 // if we are not connected pppdpid is -1 so have have to check for that 445 // if we are not connected pppdpid is -1 so have have to check for that
446 // in the followin line to make sure that we don't raise a false alarm 446 // in the followin line to make sure that we don't raise a false alarm
447 // such as would be the case when the log file viewer exits. 447 // such as would be the case when the log file viewer exits.
448 if(gpppdata.pppdRunning() || gpppdata.pppdError()) { 448 if(PPPData::data()->pppdRunning() || PPPData::data()->pppdError()) {
449 qDebug( "It was pppd that died" ); 449 qDebug( "It was pppd that died" );
450 450
451 // when we killpppd() on Cancel in ConnectWidget 451 // when we killpppd() on Cancel in ConnectWidget
452 // we set pppid to -1 so we won't 452 // we set pppid to -1 so we won't
453 // enter this block 453 // enter this block
454 454
455 // just to be sure 455 // just to be sure
456 456
457 Modem::modem->removeSecret(AUTH_PAP); 457 Modem::modem->removeSecret(AUTH_PAP);
458 Modem::modem->removeSecret(AUTH_CHAP); 458 Modem::modem->removeSecret(AUTH_CHAP);
459 459
460 gpppdata.setpppdRunning(false); 460 PPPData::data()->setpppdRunning(false);
461 461
462 qDebug( "Executing command on disconnect since pppd has died." ); 462 qDebug( "Executing command on disconnect since pppd has died." );
463 QApplication::flushX(); 463 QApplication::flushX();
464 execute_command(gpppdata.command_on_disconnect()); 464 execute_command(PPPData::data()->command_on_disconnect());
465 465
466// stopAccounting(); 466// stopAccounting();
467 467
468// con_win->stopClock(); 468// con_win->stopClock();
469// DockWidget::dock_widget->stop_stats(); 469// DockWidget::dock_widget->stop_stats();
470// DockWidget::dock_widget->hide(); 470// DockWidget::dock_widget->hide();
471 471
472 if(!gpppdata.pppdError()) 472 if(!PPPData::data()->pppdError())
473 gpppdata.setpppdError(E_PPPD_DIED); 473 PPPData::data()->setpppdError(E_PPPD_DIED);
474 removedns(); 474 removedns();
475 Modem::modem->unlockdevice(); 475 Modem::modem->unlockdevice();
476 // con->pppdDied(); 476 // con->pppdDied();
477 477
478 if(!gpppdata.automatic_redial()) { 478 if(!PPPData::data()->automatic_redial()) {
479 quit_b->setFocus(); 479 quit_b->setFocus();
480 show(); 480 show();
481// con_win->stopClock(); 481// con_win->stopClock();
482 //stopAccounting(); 482 //stopAccounting();
483// con_win->hide(); 483// con_win->hide();
484// con->hide(); 484// con->hide();
485 485
486 gpppdata.setpppdRunning(false); 486 PPPData::data()->setpppdRunning(false);
487 // // not in a signal handler !!! KNotifyClient::beep(); 487 // // not in a signal handler !!! KNotifyClient::beep();
488 QString msg; 488 QString msg;
489 if (gpppdata.pppdError() == E_IF_TIMEOUT) 489 if (PPPData::data()->pppdError() == E_IF_TIMEOUT)
490 msg = i18n("Timeout expired while waiting for the PPP interface " 490 msg = i18n("Timeout expired while waiting for the PPP interface "
491 "to come up!"); 491 "to come up!");
492 else { 492 else {
493 msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); 493 msg = i18n("<p>The pppd daemon died unexpectedly!</p>");
494 Modem::modem->pppdExitStatus(); 494 Modem::modem->pppdExitStatus();
495 if (Modem::modem->lastStatus != 99) {// more recent pppds only 495 if (Modem::modem->lastStatus != 99) {// more recent pppds only
496 msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); 496 msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus);
497 msg += i18n("</p><p>See 'man pppd' for an explanation of the error " 497 msg += i18n("</p><p>See 'man pppd' for an explanation of the error "
498 "codes or take a look at the kppp FAQ on " 498 "codes or take a look at the kppp FAQ on "
499 " <a href=http://devel-home.kde.org/~kppp/index.html>" 499 " <a href=http://devel-home.kde.org/~kppp/index.html>"
500 "http://devel-home.kde.org/~kppp/index.html</a></p>"); 500 "http://devel-home.kde.org/~kppp/index.html</a></p>");
501 } 501 }
502 } 502 }
503 503
504 // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) 504 // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No)
505 // // PPPL_ShowLog(); 505 // // PPPL_ShowLog();
506// } else { /* reconnect on disconnect */ 506// } else { /* reconnect on disconnect */
507 if (false){ 507 if (false){
508 qDebug( "Trying to reconnect... " ); 508 qDebug( "Trying to reconnect... " );
509 509
510 if(gpppdata.authMethod() == AUTH_PAP || 510 if(PPPData::data()->authMethod() == AUTH_PAP ||
511 gpppdata.authMethod() == AUTH_CHAP || 511 PPPData::data()->authMethod() == AUTH_CHAP ||
512 gpppdata.authMethod() == AUTH_PAPCHAP) 512 PPPData::data()->authMethod() == AUTH_PAPCHAP)
513 Modem::modem->setSecret(gpppdata.authMethod(), 513 Modem::modem->setSecret(PPPData::data()->authMethod(),
514 encodeWord(gpppdata.storedUsername()), 514 encodeWord(PPPData::data()->storedUsername()),
515 encodeWord(gpppdata.password())); 515 encodeWord(PPPData::data()->password()));
516 516
517// con_win->hide(); 517// con_win->hide();
518 // con_win->stopClock(); 518 // con_win->stopClock();
519 //stopAccounting(); 519 //stopAccounting();
520 gpppdata.setpppdRunning(false); 520 PPPData::data()->setpppdRunning(false);
521 // not in a signal handler !!!KNotifyClient::beep(); 521 // not in a signal handler !!!KNotifyClient::beep();
522 emit cmdl_start(); 522 emit cmdl_start();
523 } 523 }
524 } 524 }
525 gpppdata.setpppdError(0); 525 PPPData::data()->setpppdError(0);
526 } 526 }
527} 527}
528 528
529// void KPPPWidget::sigChld() { 529// void KPPPWidget::sigChld() {
530// qDebug( "sigchld()" ); 530// qDebug( "sigchld()" );
531// // pid_t id = wait(0L); 531// // pid_t id = wait(0L);
532// // if(id == helperPid && helperPid != -1) { 532// // if(id == helperPid && helperPid != -1) {
533// // kdDebug(5002) << "It was the setuid child that died" << endl; 533// // kdDebug(5002) << "It was the setuid child that died" << endl;
534// // helperPid = -1; 534// // helperPid = -1;
535// QString msg = i18n("kppp's helper process just died.\n" 535// QString msg = i18n("kppp's helper process just died.\n"
536// "Since a further execution would be pointless, " 536// "Since a further execution would be pointless, "
537// "kppp will shut down now."); 537// "kppp will shut down now.");
538// QMessageBox::warning(0L,"error", msg); 538// QMessageBox::warning(0L,"error", msg);
539// //remove_pidfile(); 539// //remove_pidfile();
540// exit(1); 540// exit(1);
541// // } 541// // }
542// } 542// }
543 543
544 544
545void KPPPWidget::newdefaultaccount(int i) { 545void KPPPWidget::newdefaultaccount(int i) {
546 gpppdata.setDefaultAccount(connectto_c->text(i)); 546 PPPData::data()->setDefaultAccount(connectto_c->text(i));
547 gpppdata.save(); 547 PPPData::data()->save();
548 ID_Edit->setText(gpppdata.storedUsername()); 548 ID_Edit->setText(PPPData::data()->storedUsername());
549 PW_Edit->setText(gpppdata.storedPassword()); 549 PW_Edit->setText(PPPData::data()->storedPassword());
550} 550}
551 551
552 552
553 553
554 554
555void KPPPWidget::beginConnect() { 555void KPPPWidget::beginConnect() {
556 // make sure to connect to the account that is selected in the combo box 556 // make sure to connect to the account that is selected in the combo box
557 // (exeption: an account given by a command line argument) 557 // (exeption: an account given by a command line argument)
558 // if(!m_bCmdlAccount) { 558 // if(!m_bCmdlAccount) {
559// gpppdata.setAccount(connectto_c->currentText()); 559// PPPData::data()->setAccount(connectto_c->currentText());
560// gpppdata.setPassword(PW_Edit->text()); 560// PPPData::data()->setPassword(PW_Edit->text());
561// } else { 561// } else {
562 gpppdata.setPassword(gpppdata.storedPassword()); 562 PPPData::data()->setPassword(PPPData::data()->storedPassword());
563// } 563// }
564 564
565 QFileInfo info(pppdPath()); 565 QFileInfo info(pppdPath());
566 566
567 if(!info.exists()){ 567 if(!info.exists()){
568 QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" 568 QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n"
569 "Make sure that pppd is installed and " 569 "Make sure that pppd is installed and "
570 "that you have entered the correct path.")); 570 "that you have entered the correct path."));
571 return; 571 return;
572 } 572 }
573#if 0 573#if 0
574 if(!info.isExecutable()){ 574 if(!info.isExecutable()){
575 575
576 QString string; 576 QString string;
577 string = i18n("kppp cannot execute:\n %1\n" 577 string = i18n("kppp cannot execute:\n %1\n"
578 "Please make sure that you have given kppp " 578 "Please make sure that you have given kppp "
579 "setuid permission and that " 579 "setuid permission and that "
580 "pppd is executable.").arg(gpppdata.pppdPath()); 580 "pppd is executable.").arg(PPPData::data()->pppdPath());
581 KMessageBox::error(this, string); 581 KMessageBox::error(this, string);
582 return; 582 return;
583 583
584 } 584 }
585#endif 585#endif
586 586
587 QFileInfo info2(gpppdata.modemDevice()); 587 QFileInfo info2(PPPData::data()->modemDevice());
588 588
589 if(!info2.exists()){ 589 if(!info2.exists()){
590 QString string; 590 QString string;
591 string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " 591 string = i18n("kppp can not find:\n %1\nPlease make sure you have setup "
592 "your modem device properly " 592 "your modem device properly "
593 "and/or adjust the location of the modem device on " 593 "and/or adjust the location of the modem device on "
594 "the modem tab of " 594 "the modem tab of "
595 "the setup dialog.").arg(gpppdata.modemDevice()); 595 "the setup dialog.").arg(PPPData::data()->modemDevice());
596 QMessageBox::warning(this, "error", string); 596 QMessageBox::warning(this, "error", string);
597 return; 597 return;
598 } 598 }
599 599
600 // if this is a PAP or CHAP account, ensure that username is 600 // if this is a PAP or CHAP account, ensure that username is
601 // supplied 601 // supplied
602 if(gpppdata.authMethod() == AUTH_PAP || 602 if(PPPData::data()->authMethod() == AUTH_PAP ||
603 gpppdata.authMethod() == AUTH_CHAP || 603 PPPData::data()->authMethod() == AUTH_CHAP ||
604 gpppdata.authMethod() == AUTH_PAPCHAP ) { 604 PPPData::data()->authMethod() == AUTH_PAPCHAP ) {
605 if(ID_Edit->text().isEmpty()) { 605 if(ID_Edit->text().isEmpty()) {
606 QMessageBox::warning(this,"error", 606 QMessageBox::warning(this,"error",
607 i18n( 607 i18n(
608 "You have selected the authentication " 608 "You have selected the authentication "
609 "method PAP or CHAP. This requires that you " 609 "method PAP or CHAP. This requires that you "
610 "supply a username and a password!")); 610 "supply a username and a password!"));
611 return; 611 return;
612 } else { 612 } else {
613 if(!Modem::modem->setSecret(gpppdata.authMethod(), 613 if(!Modem::modem->setSecret(PPPData::data()->authMethod(),
614 encodeWord(gpppdata.storedUsername()), 614 encodeWord(PPPData::data()->storedUsername()),
615 encodeWord(gpppdata.password()))) { 615 encodeWord(PPPData::data()->password()))) {
616 QString s; 616 QString s;
617 s = i18n("Cannot create PAP/CHAP authentication\n" 617 s = i18n("Cannot create PAP/CHAP authentication\n"
618 "file \"%1\"").arg(PAP_AUTH_FILE); 618 "file \"%1\"").arg(PAP_AUTH_FILE);
619 QMessageBox::warning(this, "error", s); 619 QMessageBox::warning(this, "error", s);
620 return; 620 return;
621 } 621 }
622 } 622 }
623 } 623 }
624 624
625 if (gpppdata.phonenumber().isEmpty()) { 625 if (PPPData::data()->phonenumber().isEmpty()) {
626 QString s = i18n("You must specify a telephone number!"); 626 QString s = i18n("You must specify a telephone number!");
627 QMessageBox::warning(this, "error", s); 627 QMessageBox::warning(this, "error", s);
628 return; 628 return;
629 } 629 }
630 630
631 this->hide(); 631 this->hide();
632 632
633 QString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); 633 QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname());
634// con->setCaption(tit); 634// con->setCaption(tit);
635 635
636// con->show(); 636// con->show();
637 637
638 bool show_debug = gpppdata.get_show_log_window(); 638 bool show_debug = PPPData::data()->get_show_log_window();
639 // con->debug->setOn(show_debug);// toggle button 639 // con->debug->setOn(show_debug);// toggle button
640 debugwindow->clear(); 640 debugwindow->clear();
641 if (!show_debug) 641 if (!show_debug)
642 debugwindow->hide(); 642 debugwindow->hide();
643 else { 643 else {
644 debugwindow->show(); 644 debugwindow->show();
645// con->raise(); 645// con->raise();
646 } 646 }
647 647
648 emit begin_connect(); 648 emit begin_connect();
649} 649}
650 650
651 651
652void KPPPWidget::disconnect() { 652void KPPPWidget::disconnect() {
653 if (!gpppdata.command_before_disconnect().isEmpty()) { 653 if (!PPPData::data()->command_before_disconnect().isEmpty()) {
654// con_win->hide(); 654// con_win->hide();
655// con->show(); 655// con->show();
656// con->setCaption(i18n("Disconnecting...")); 656// con->setCaption(i18n("Disconnecting..."));
657// con->setMsg(i18n("Executing command before disconnection.")); 657// con->setMsg(i18n("Executing command before disconnection."));
658 658
659 qApp->processEvents(); 659 qApp->processEvents();
660 QApplication::flushX(); 660 QApplication::flushX();
661// pid_t id = 661// pid_t id =
662 execute_command(gpppdata.command_before_disconnect()); 662 execute_command(PPPData::data()->command_before_disconnect());
663// int i, status; 663// int i, status;
664 664
665// do { 665// do {
666// kapp->processEvents(); 666// kapp->processEvents();
667// i = waitpid(id, &status, WNOHANG); 667// i = waitpid(id, &status, WNOHANG);
668// usleep(500000); 668// usleep(500000);
669// } while (i == 0 && errno == 0); 669// } while (i == 0 && errno == 0);
670 670
671// con->hide(); 671// con->hide();
672 } 672 }
673 673
674 qApp->processEvents(); 674 qApp->processEvents();
675 675
676// statdlg->stop_stats(); 676// statdlg->stop_stats();
677 Modem::modem->killPPPDaemon(); 677 Modem::modem->killPPPDaemon();
678 678
679 QApplication::flushX(); 679 QApplication::flushX();
680 execute_command(gpppdata.command_on_disconnect()); 680 execute_command(PPPData::data()->command_on_disconnect());
681 681
682 Modem::modem->removeSecret(AUTH_PAP); 682 Modem::modem->removeSecret(AUTH_PAP);
683 Modem::modem->removeSecret(AUTH_CHAP); 683 Modem::modem->removeSecret(AUTH_CHAP);
684 684
685 removedns(); 685 removedns();
686 Modem::modem->unlockdevice(); 686 Modem::modem->unlockdevice();
687 687
688// con_win->stopClock(); 688// con_win->stopClock();
689// p_kppp->stopAccounting(); 689// p_kppp->stopAccounting();
690// con_win->hide(); 690// con_win->hide();
691 691
692// DockWidget::dock_widget->stop_stats(); 692// DockWidget::dock_widget->stop_stats();
@@ -698,119 +698,119 @@ void KPPPWidget::disconnect() {
698 this->quit_b->setFocus(); 698 this->quit_b->setFocus();
699 this->show(); 699 this->show();
700// } 700// }
701} 701}
702 702
703 703
704// void KPPPWidget::helpbutton() { 704// void KPPPWidget::helpbutton() {
705// kapp->invokeHelp(); 705// kapp->invokeHelp();
706// } 706// }
707 707
708 708
709void KPPPWidget::quitbutton() { 709void KPPPWidget::quitbutton() {
710 if(gpppdata.pppdRunning()) { 710 if(PPPData::data()->pppdRunning()) {
711 int ok = QMessageBox::warning(this, 711 int ok = QMessageBox::warning(this,
712 i18n("Exiting kPPP will close your PPP Session."), 712 i18n("Exiting kPPP will close your PPP Session."),
713 i18n("Quit kPPP?")); 713 i18n("Quit kPPP?"));
714 if(ok == QMessageBox::Yes) { 714 if(ok == QMessageBox::Yes) {
715 Modem::modem->killPPPDaemon(); 715 Modem::modem->killPPPDaemon();
716 QApplication::flushX(); 716 QApplication::flushX();
717 execute_command(gpppdata.command_on_disconnect()); 717 execute_command(PPPData::data()->command_on_disconnect());
718 removedns(); 718 removedns();
719 Modem::modem->unlockdevice(); 719 Modem::modem->unlockdevice();
720 } 720 }
721 } else { 721 } else {
722 if (!gpppdata.accname().isEmpty() && !gpppdata.storePassword()) 722 if (!PPPData::data()->accname().isEmpty() && !PPPData::data()->storePassword())
723 gpppdata.setStoredPassword(""); 723 PPPData::data()->setStoredPassword("");
724 } 724 }
725 gpppdata.save(); 725 PPPData::data()->save();
726 qApp->quit(); 726 qApp->quit();
727} 727}
728 728
729 729
730// void KPPPWidget::rulesetLoadError() { 730// void KPPPWidget::rulesetLoadError() {
731// QMessageBox::warning(this,"error", ruleset_load_errmsg); 731// QMessageBox::warning(this,"error", ruleset_load_errmsg);
732// } 732// }
733 733
734 734
735// void KPPPWidget::startAccounting() { 735// void KPPPWidget::startAccounting() {
736// // volume accounting 736// // volume accounting
737// stats->totalbytes = 0; 737// stats->totalbytes = 0;
738 738
739// kdDebug() << "AcctEnabled: " << gpppdata.AcctEnabled() << endl; 739// kdDebug() << "AcctEnabled: " << PPPData::data()->AcctEnabled() << endl;
740 740
741// // load the ruleset 741// // load the ruleset
742// if(!gpppdata.AcctEnabled()) 742// if(!PPPData::data()->AcctEnabled())
743// return; 743// return;
744 744
745// QString d = AccountingBase::getAccountingFile(gpppdata.accountingFile()); 745// QString d = AccountingBase::getAccountingFile(PPPData::data()->accountingFile());
746// // if(::access(d.data(), X_OK) != 0) 746// // if(::access(d.data(), X_OK) != 0)
747// acct = new Accounting(this, stats); 747// acct = new Accounting(this, stats);
748// // else 748// // else
749// // acct = new ExecutableAccounting(this); 749// // acct = new ExecutableAccounting(this);
750 750
751// // connect to the accounting object 751// // connect to the accounting object
752// connect(acct, SIGNAL(changed(QString, QString)), 752// connect(acct, SIGNAL(changed(QString, QString)),
753 // con_win, SLOT(slotAccounting(QString, QString))); 753 // con_win, SLOT(slotAccounting(QString, QString)));
754 754
755// // if(!acct->loadRuleSet(gpppdata.accountingFile())) { 755// // if(!acct->loadRuleSet(PPPData::data()->accountingFile())) {
756// // QString s= i18n("Can not load the accounting " 756// // QString s= i18n("Can not load the accounting "
757 // // "ruleset \"%1\"!").arg(gpppdata.accountingFile()); 757 // // "ruleset \"%1\"!").arg(PPPData::data()->accountingFile());
758 758
759// // starting the messagebox with a timer will prevent us 759// // starting the messagebox with a timer will prevent us
760// // from blocking the calling function ConnectWidget::timerEvent 760// // from blocking the calling function ConnectWidget::timerEvent
761// ruleset_load_errmsg = s; 761// ruleset_load_errmsg = s;
762// QTimer::singleShot(0, this, SLOT(rulesetLoadError())); 762// QTimer::singleShot(0, this, SLOT(rulesetLoadError()));
763// return; 763// return;
764// } 764// }
765// //else 765// //else
766// // acct->slotStart(); 766// // acct->slotStart();
767// } 767// }
768 768
769// void KPPPWidget::stopAccounting() { 769// void KPPPWidget::stopAccounting() {
770// // store volume accounting 770// // store volume accounting
771// // if(stats->totalbytes != 0) 771// // if(stats->totalbytes != 0)
772// // gpppdata.setTotalBytes(stats->totalbytes); 772// // PPPData::data()->setTotalBytes(stats->totalbytes);
773 773
774// if(!gpppdata.AcctEnabled()) 774// if(!PPPData::data()->AcctEnabled())
775// return; 775// return;
776 776
777// // if(acct != 0) { 777// // if(acct != 0) {
778// // acct->slotStop(); 778// // acct->slotStop();
779// // delete acct; 779// // delete acct;
780// // acct = 0; 780// // acct = 0;
781// // } 781// // }
782// } 782// }
783 783
784 784
785// void KPPPWidget::showStats() { 785// void KPPPWidget::showStats() {
786// if(statdlg) { 786// if(statdlg) {
787// statdlg->show(); 787// statdlg->show();
788// statdlg->raise(); 788// statdlg->raise();
789// } 789// }
790// } 790// }
791 791
792 792
793void KPPPWidget::usernameChanged(const QString &) { 793void KPPPWidget::usernameChanged(const QString &) {
794 // store username for later use 794 // store username for later use
795 gpppdata.setStoredUsername(ID_Edit->text()); 795 PPPData::data()->setStoredUsername(ID_Edit->text());
796} 796}
797 797
798 798
799void KPPPWidget::passwordChanged(const QString &) { 799void KPPPWidget::passwordChanged(const QString &) {
800 // store the password if so requested 800 // store the password if so requested
801 if(gpppdata.storePassword()) 801 if(PPPData::data()->storePassword())
802 gpppdata.setStoredPassword(PW_Edit->text()); 802 PPPData::data()->setStoredPassword(PW_Edit->text());
803 else 803 else
804 gpppdata.setStoredPassword(""); 804 PPPData::data()->setStoredPassword("");
805} 805}
806 806
807 807
808void KPPPWidget::setPW_Edit(const QString &pw) { 808void KPPPWidget::setPW_Edit(const QString &pw) {
809 PW_Edit->setText(pw); 809 PW_Edit->setText(pw);
810} 810}
811 811
812 812
813// void KPPPWidget::resetCosts(const QString &s) { 813// void KPPPWidget::resetCosts(const QString &s) {
814// AccountingBase::resetCosts(s); 814// AccountingBase::resetCosts(s);
815// } 815// }
816 816
@@ -832,25 +832,25 @@ QString KPPPWidget::encodeWord(const QString &s) {
832 832
833// void KPPPWidget::setQuitOnDisconnect (bool b) 833// void KPPPWidget::setQuitOnDisconnect (bool b)
834// { 834// {
835// m_bQuitOnDisconnect = b; 835// m_bQuitOnDisconnect = b;
836// } 836// }
837 837
838void KPPPWidget::showNews() { 838void KPPPWidget::showNews() {
839#ifdef KPPP_SHOW_NEWS 839#ifdef KPPP_SHOW_NEWS
840 /* 840 /*
841 * Introduce the QuickHelp feature to new users of this version 841 * Introduce the QuickHelp feature to new users of this version
842 */ 842 */
843 #define QUICKHELP_HINT "Hint_QuickHelp" 843 #define QUICKHELP_HINT "Hint_QuickHelp"
844 if(gpppdata.readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { 844 if(PPPData::data()->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) {
845 QDialog dlg(0, 0, true); 845 QDialog dlg(0, 0, true);
846 dlg.setCaption(i18n("Recent Changes in KPPP")); 846 dlg.setCaption(i18n("Recent Changes in KPPP"));
847 847
848 QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); 848 QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10);
849 QHBoxLayout *l1 = new QHBoxLayout(10); 849 QHBoxLayout *l1 = new QHBoxLayout(10);
850 QVBoxLayout *l2 = new QVBoxLayout(10); 850 QVBoxLayout *l2 = new QVBoxLayout(10);
851 tl->addLayout(l1); 851 tl->addLayout(l1);
852 852
853 QLabel *icon = new QLabel(&dlg); 853 QLabel *icon = new QLabel(&dlg);
854 icon->setPixmap(BarIcon("exclamation")); 854 icon->setPixmap(BarIcon("exclamation"));
855 icon->setFixedSize(icon->sizeHint()); 855 icon->setFixedSize(icon->sizeHint());
856 l1->addWidget(icon); 856 l1->addWidget(icon);
@@ -884,22 +884,22 @@ void KPPPWidget::showNews() {
884 l2->addWidget(cb); 884 l2->addWidget(cb);
885 tl->addWidget(bbox); 885 tl->addWidget(bbox);
886 886
887 QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n" 887 QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n"
888 "This window will stay open until you\n" 888 "This window will stay open until you\n"
889 "click a mouse button or a press a key.\n"); 889 "click a mouse button or a press a key.\n");
890 890
891 QWhatsThis::add(cb,tmp); 891 QWhatsThis::add(cb,tmp);
892 QWhatsThis::add(l, tmp); 892 QWhatsThis::add(l, tmp);
893 893
894 dlg.exec(); 894 dlg.exec();
895 if(cb->isChecked()) { 895 if(cb->isChecked()) {
896 gpppdata.writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); 896 PPPData::data()->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1);
897 gpppdata.save(); 897 PPPData::data()->save();
898 } 898 }
899 } 899 }
900#endif 900#endif
901} 901}
902 902
903 903
904//#include "kpppwidget.moc" 904//#include "kpppwidget.moc"
905 905
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp
index a2f77c5..cd5d21c 100644
--- a/noncore/settings/networksettings/ppp/modem.cpp
+++ b/noncore/settings/networksettings/ppp/modem.cpp
@@ -92,25 +92,25 @@ Modem::Modem()
92} 92}
93 93
94 94
95Modem::~Modem() { 95Modem::~Modem() {
96 modem = 0; 96 modem = 0;
97} 97}
98 98
99 99
100speed_t Modem::modemspeed() { 100speed_t Modem::modemspeed() {
101 // convert the string modem speed int the gpppdata object to a t_speed type 101 // convert the string modem speed int the gpppdata object to a t_speed type
102 // to set the modem. The constants here should all be ifdef'd because 102 // to set the modem. The constants here should all be ifdef'd because
103 // other systems may not have them 103 // other systems may not have them
104 int i = gpppdata.speed().toInt()/100; 104 int i = PPPData::data()->speed().toInt()/100;
105 105
106 switch(i) { 106 switch(i) {
107 case 24: 107 case 24:
108 return B2400; 108 return B2400;
109 break; 109 break;
110 case 96: 110 case 96:
111 return B9600; 111 return B9600;
112 break; 112 break;
113 case 192: 113 case 192:
114 return B19200; 114 return B19200;
115 break; 115 break;
116 case 384: 116 case 384:
@@ -142,35 +142,35 @@ speed_t Modem::modemspeed() {
142 142
143 default: 143 default:
144 return B38400; 144 return B38400;
145 break; 145 break;
146 } 146 }
147} 147}
148 148
149bool Modem::opentty() { 149bool Modem::opentty() {
150 // int flags; 150 // int flags;
151 151
152//begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { 152//begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
153 close(modemfd); 153 close(modemfd);
154// device = "/dev/modem";//deviceByIndex(request.modem.deviceNum); 154 device = PPPData::data()->modemDevice();
155 if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { 155 if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) {
156 qDebug("error opening modem device !"); 156 qDebug("error opening modem device !");
157 errmsg = i18n("Unable to open modem."); 157 errmsg = i18n("Unable to open modem.");
158 return false; 158 return false;
159 } 159 }
160//bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { 160//bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
161//} 161//}
162 162
163#if 0 163#if 0
164 if(gpppdata.UseCDLine()) { 164 if(PPPData::data()->UseCDLine()) {
165 if(ioctl(modemfd, TIOCMGET, &flags) == -1) { 165 if(ioctl(modemfd, TIOCMGET, &flags) == -1) {
166 errmsg = i18n("Unable to detect state of CD line."); 166 errmsg = i18n("Unable to detect state of CD line.");
167 ::close(modemfd); 167 ::close(modemfd);
168 modemfd = -1; 168 modemfd = -1;
169 return false; 169 return false;
170 } 170 }
171 if ((flags&TIOCM_CD) == 0) { 171 if ((flags&TIOCM_CD) == 0) {
172 errmsg = i18n("The modem is not ready."); 172 errmsg = i18n("The modem is not ready.");
173 ::close(modemfd); 173 ::close(modemfd);
174 modemfd = -1; 174 modemfd = -1;
175 return false; 175 return false;
176 } 176 }
@@ -200,26 +200,26 @@ bool Modem::opentty() {
200 tty.c_cc[VTIME] = 0; 200 tty.c_cc[VTIME] = 0;
201 tty.c_oflag = 0; 201 tty.c_oflag = 0;
202 tty.c_lflag = 0; 202 tty.c_lflag = 0;
203 203
204 tty.c_cflag &= ~(CSIZE | CSTOPB | PARENB); 204 tty.c_cflag &= ~(CSIZE | CSTOPB | PARENB);
205 tty.c_cflag |= CS8 | CREAD; 205 tty.c_cflag |= CS8 | CREAD;
206 tty.c_cflag |= CLOCAL; // ignore modem status lines 206 tty.c_cflag |= CLOCAL; // ignore modem status lines
207 tty.c_iflag = IGNBRK | IGNPAR /* | ISTRIP */ ; 207 tty.c_iflag = IGNBRK | IGNPAR /* | ISTRIP */ ;
208 tty.c_lflag &= ~ICANON; // non-canonical mode 208 tty.c_lflag &= ~ICANON; // non-canonical mode
209 tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE); 209 tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE);
210 210
211 211
212 if(gpppdata.flowcontrol() != "None") { 212 if(PPPData::data()->flowcontrol() != "None") {
213 if(gpppdata.flowcontrol() == "CRTSCTS") { 213 if(PPPData::data()->flowcontrol() == "CRTSCTS") {
214 tty.c_cflag |= CRTSCTS; 214 tty.c_cflag |= CRTSCTS;
215 } 215 }
216 else { 216 else {
217 tty.c_iflag |= IXON | IXOFF; 217 tty.c_iflag |= IXON | IXOFF;
218 tty.c_cc[VSTOP] = 0x13; /* DC3 = XOFF = ^S */ 218 tty.c_cc[VSTOP] = 0x13; /* DC3 = XOFF = ^S */
219 tty.c_cc[VSTART] = 0x11; /* DC1 = XON = ^Q */ 219 tty.c_cc[VSTART] = 0x11; /* DC1 = XON = ^Q */
220 } 220 }
221 } 221 }
222 else { 222 else {
223 tty.c_cflag &= ~CRTSCTS; 223 tty.c_cflag &= ~CRTSCTS;
224 tty.c_iflag &= ~(IXON | IXOFF); 224 tty.c_iflag &= ~(IXON | IXOFF);
225 } 225 }
@@ -330,25 +330,25 @@ bool Modem::writeChar(unsigned char c) {
330 } 330 }
331 } while(s == 0); 331 } while(s == 0);
332 332
333 return true; 333 return true;
334} 334}
335 335
336 336
337bool Modem::writeLine(const char *buf) { 337bool Modem::writeLine(const char *buf) {
338 int len = strlen(buf); 338 int len = strlen(buf);
339 char *b = new char[len+2]; 339 char *b = new char[len+2];
340 memcpy(b, buf, len); 340 memcpy(b, buf, len);
341 // different modems seem to need different line terminations 341 // different modems seem to need different line terminations
342 QString term = gpppdata.enter(); 342 QString term = PPPData::data()->enter();
343 if(term == "LF") 343 if(term == "LF")
344 b[len++]='\n'; 344 b[len++]='\n';
345 else if(term == "CR") 345 else if(term == "CR")
346 b[len++]='\r'; 346 b[len++]='\r';
347 else if(term == "CR/LF") { 347 else if(term == "CR/LF") {
348 b[len++]='\r'; 348 b[len++]='\r';
349 b[len++]='\n'; 349 b[len++]='\n';
350 } 350 }
351 int l = len; 351 int l = len;
352 while(l) { 352 while(l) {
353 int wr = write(modemfd, &b[len-l], l); 353 int wr = write(modemfd, &b[len-l], l);
354 if(wr < 0) { 354 if(wr < 0) {
@@ -370,27 +370,27 @@ bool Modem::hangup() {
370 // this is probably the most imporant snippet of code in the whole of 370 // this is probably the most imporant snippet of code in the whole of
371 // kppp. If people complain about kppp being stuck, this piece of code 371 // kppp. If people complain about kppp being stuck, this piece of code
372 // is most likely the reason. 372 // is most likely the reason.
373 struct termios temptty; 373 struct termios temptty;
374 374
375 if(modemfd >= 0) { 375 if(modemfd >= 0) {
376 376
377 // is this Escape & HangupStr stuff really necessary ? (Harri) 377 // is this Escape & HangupStr stuff really necessary ? (Harri)
378 378
379 if (data_mode) escape_to_command_mode(); 379 if (data_mode) escape_to_command_mode();
380 380
381 // Then hangup command 381 // Then hangup command
382 writeLine(gpppdata.modemHangupStr().local8Bit()); 382 writeLine(PPPData::data()->modemHangupStr().local8Bit());
383 383
384 usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec 384 usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
385 385
386#ifndef DEBUG_WO_DIALING 386#ifndef DEBUG_WO_DIALING
387 if (sigsetjmp(jmp_buffer, 1) == 0) { 387 if (sigsetjmp(jmp_buffer, 1) == 0) {
388 // set alarm in case tcsendbreak() hangs 388 // set alarm in case tcsendbreak() hangs
389 signal(SIGALRM, alarm_handler); 389 signal(SIGALRM, alarm_handler);
390 alarm(2); 390 alarm(2);
391 391
392 tcsendbreak(modemfd, 0); 392 tcsendbreak(modemfd, 0);
393 393
394 alarm(0); 394 alarm(0);
395 signal(SIGALRM, SIG_IGN); 395 signal(SIGALRM, SIG_IGN);
396 } else { 396 } else {
@@ -408,52 +408,52 @@ bool Modem::hangup() {
408 cfsetispeed(&temptty, B0); 408 cfsetispeed(&temptty, B0);
409 tcsetattr(modemfd, TCSAFLUSH, &temptty); 409 tcsetattr(modemfd, TCSAFLUSH, &temptty);
410#else 410#else
411 int modemstat; 411 int modemstat;
412 ioctl(modemfd, TIOCMGET, &modemstat); 412 ioctl(modemfd, TIOCMGET, &modemstat);
413 modemstat &= ~TIOCM_DTR; 413 modemstat &= ~TIOCM_DTR;
414 ioctl(modemfd, TIOCMSET, &modemstat); 414 ioctl(modemfd, TIOCMSET, &modemstat);
415 ioctl(modemfd, TIOCMGET, &modemstat); 415 ioctl(modemfd, TIOCMGET, &modemstat);
416 modemstat |= TIOCM_DTR; 416 modemstat |= TIOCM_DTR;
417 ioctl(modemfd, TIOCMSET, &modemstat); 417 ioctl(modemfd, TIOCMSET, &modemstat);
418#endif 418#endif
419 419
420 usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 secs 420 usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 secs
421 421
422 cfsetospeed(&temptty, modemspeed()); 422 cfsetospeed(&temptty, modemspeed());
423 cfsetispeed(&temptty, modemspeed()); 423 cfsetispeed(&temptty, modemspeed());
424 tcsetattr(modemfd, TCSAFLUSH, &temptty); 424 tcsetattr(modemfd, TCSAFLUSH, &temptty);
425#endif 425#endif
426 return true; 426 return true;
427 } else 427 } else
428 return false; 428 return false;
429} 429}
430 430
431 431
432void Modem::escape_to_command_mode() { 432void Modem::escape_to_command_mode() {
433 // Send Properly bracketed escape code to put the modem back into command state. 433 // Send Properly bracketed escape code to put the modem back into command state.
434 // A modem will accept AT commands only when it is in command state. 434 // A modem will accept AT commands only when it is in command state.
435 // When a modem sends the host the CONNECT string, that signals 435 // When a modem sends the host the CONNECT string, that signals
436 // that the modem is now in the connect state (no long accepts AT commands.) 436 // that the modem is now in the connect state (no long accepts AT commands.)
437 // Need to send properly timed escape sequence to put modem in command state. 437 // Need to send properly timed escape sequence to put modem in command state.
438 // Escape codes and guard times are controlled by S2 and S12 values. 438 // Escape codes and guard times are controlled by S2 and S12 values.
439 // 439 //
440 tcflush(modemfd, TCIOFLUSH); 440 tcflush(modemfd, TCIOFLUSH);
441 441
442 // +3 because quiet time must be greater than guard time. 442 // +3 because quiet time must be greater than guard time.
443 usleep((gpppdata.modemEscapeGuardTime()+3)*20000); 443 usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000);
444 QCString tmp = gpppdata.modemEscapeStr().local8Bit(); 444 QCString tmp = PPPData::data()->modemEscapeStr().local8Bit();
445 write(modemfd, tmp.data(), tmp.length()); 445 write(modemfd, tmp.data(), tmp.length());
446 tcflush(modemfd, TCIOFLUSH); 446 tcflush(modemfd, TCIOFLUSH);
447 usleep((gpppdata.modemEscapeGuardTime()+3)*20000); 447 usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000);
448 448
449 data_mode = false; 449 data_mode = false;
450} 450}
451 451
452 452
453const QString Modem::modemMessage() { 453const QString Modem::modemMessage() {
454 return errmsg; 454 return errmsg;
455} 455}
456 456
457 457
458QString Modem::parseModemSpeed(const QString &s) { 458QString Modem::parseModemSpeed(const QString &s) {
459 // this is a small (and bad) parser for modem speeds 459 // this is a small (and bad) parser for modem speeds
@@ -551,34 +551,34 @@ QString Modem::parseModemSpeed(const QString &s) {
551 qDebug( "The parsed result is: %s", result.latin1()); 551 qDebug( "The parsed result is: %s", result.latin1());
552 552
553 return result; 553 return result;
554} 554}
555 555
556 556
557// Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if 557// Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if
558// a lock file can't be created ( permission problem ) 558// a lock file can't be created ( permission problem )
559int Modem::lockdevice() { 559int Modem::lockdevice() {
560 int fd; 560 int fd;
561 char newlock[80]=""; // safe 561 char newlock[80]=""; // safe
562 562
563 if(!gpppdata.modemLockFile()) { 563 if(!PPPData::data()->modemLockFile()) {
564 qDebug("The user doesn't want a lockfile."); 564 qDebug("The user doesn't want a lockfile.");
565 return 0; 565 return 0;
566 } 566 }
567 567
568 if (modem_is_locked) 568 if (modem_is_locked)
569 return 1; 569 return 1;
570 570
571 QString lockfile = LOCK_DIR"/LCK.."; 571 QString lockfile = LOCK_DIR"/LCK..";
572 lockfile += gpppdata.modemDevice().mid(5); // append everything after /dev/ 572 lockfile += PPPData::data()->modemDevice().mid(5); // append everything after /dev/
573 573
574 if(access(QFile::encodeName(lockfile), F_OK) == 0) { 574 if(access(QFile::encodeName(lockfile), F_OK) == 0) {
575// if ((fd = Requester::rq-> 575// if ((fd = Requester::rq->
576if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) { 576if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) {
577 // Mario: it's not necessary to read more than lets say 32 bytes. If 577 // Mario: it's not necessary to read more than lets say 32 bytes. If
578 // file has more than 32 bytes, skip the rest 578 // file has more than 32 bytes, skip the rest
579 char oldlock[33]; // safe 579 char oldlock[33]; // safe
580 int sz = read(fd, &oldlock, 32); 580 int sz = read(fd, &oldlock, 32);
581 close (fd); 581 close (fd);
582 if (sz <= 0) 582 if (sz <= 0)
583 return 1; 583 return 1;
584 oldlock[sz] = '\0'; 584 oldlock[sz] = '\0';
@@ -591,25 +591,25 @@ if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) {
591 // found a pid in lockfile ? 591 // found a pid in lockfile ?
592 if (match < 1 || oldpid <= 0) 592 if (match < 1 || oldpid <= 0)
593 return 1; 593 return 1;
594 594
595 // check if process exists 595 // check if process exists
596 if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH) 596 if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH)
597 return 1; 597 return 1;
598 598
599 qDebug( "lockfile is stale" ); 599 qDebug( "lockfile is stale" );
600 } 600 }
601 } 601 }
602 602
603 fd = openLockfile(gpppdata.modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); 603 fd = openLockfile(PPPData::data()->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT);
604 if(fd >= 0) { 604 if(fd >= 0) {
605 sprintf(newlock,"%010d\n", getpid()); 605 sprintf(newlock,"%010d\n", getpid());
606 qDebug("Locking Device: %s", newlock); 606 qDebug("Locking Device: %s", newlock);
607 607
608 write(fd, newlock, strlen(newlock)); 608 write(fd, newlock, strlen(newlock));
609 close(fd); 609 close(fd);
610 modem_is_locked=true; 610 modem_is_locked=true;
611 611
612 return 0; 612 return 0;
613 } 613 }
614 614
615 return -1; 615 return -1;
diff --git a/noncore/settings/networksettings/ppp/modemcmds.cpp b/noncore/settings/networksettings/ppp/modemcmds.cpp
index 766ba0f..65032e8 100644
--- a/noncore/settings/networksettings/ppp/modemcmds.cpp
+++ b/noncore/settings/networksettings/ppp/modemcmds.cpp
@@ -35,27 +35,24 @@
35#include "pppdata.h" 35#include "pppdata.h"
36//#include <kwin.h> 36//#include <kwin.h>
37 37
38#define ADJUSTEDIT(e) //e->setText("XXXXXXXXqy"); e->setMinimumSize(e->sizeHint()); /*e->setFixedHeight(e->sizeHint().height());*/ e->setText(""); e->setMaxLength(MODEMSTR_SIZE); 38#define ADJUSTEDIT(e) //e->setText("XXXXXXXXqy"); e->setMinimumSize(e->sizeHint()); /*e->setFixedHeight(e->sizeHint().height());*/ e->setText(""); e->setMaxLength(MODEMSTR_SIZE);
39 39
40// a little trick to make the label look like a disabled lineedit 40// a little trick to make the label look like a disabled lineedit
41#define FORMATSLIDERLABEL(l) //l->setFixedWidth(l->sizeHint().width()); l->setFixedHeight(QLineEdit(dummyWidget).sizeHint().height()); l->setAlignment(AlignCenter); l->setFrameStyle(QFrame::WinPanel|QFrame::Sunken); l->setLineWidth(2); 41#define FORMATSLIDERLABEL(l) //l->setFixedWidth(l->sizeHint().width()); l->setFixedHeight(QLineEdit(dummyWidget).sizeHint().height()); l->setAlignment(AlignCenter); l->setFrameStyle(QFrame::WinPanel|QFrame::Sunken); l->setLineWidth(2);
42 42
43ModemCommands::ModemCommands(QWidget *parent, const char *name) 43ModemCommands::ModemCommands(QWidget *parent, const char *name)
44 : QDialog(parent, name, true ) //, i18n("Edit Modem Commands") , Ok|Cancel) 44 : QDialog(parent, name, true ) //, i18n("Edit Modem Commands") , Ok|Cancel)
45{ 45{
46 setCaption(i18n("Edit Modem Commands")); 46 setCaption(i18n("Edit Modem Commands"));
47// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
48 QWidget *dummyWidget = new QWidget(this);
49// setMainWidget(dummyWidget);
50 47
51 const int GRIDROWS = 22; 48 const int GRIDROWS = 22;
52 int row = 0; 49 int row = 0;
53 50
54 // toplevel layout 51 // toplevel layout
55 QVBoxLayout *tl = new QVBoxLayout(this, 10, 4); 52 QVBoxLayout *tl = new QVBoxLayout(this, 10, 4);
56 53
57 // add grid + frame 54 // add grid + frame
58 QGridLayout *l1 = new QGridLayout(GRIDROWS, 4); 55 QGridLayout *l1 = new QGridLayout(GRIDROWS, 4);
59 tl->addLayout(l1); 56 tl->addLayout(l1);
60 box = new QGroupBox(this, "box"); 57 box = new QGroupBox(this, "box");
61 l1->addMultiCellWidget(box, row++, GRIDROWS, 0, 3); 58 l1->addMultiCellWidget(box, row++, GRIDROWS, 0, 3);
@@ -234,88 +231,88 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name)
234 l6->addWidget(volume_off); 231 l6->addWidget(volume_off);
235 l6->addWidget(volume_medium); 232 l6->addWidget(volume_medium);
236 l6->addWidget(volume_high); 233 l6->addWidget(volume_high);
237 234
238 initstr[0]->setFocus(); 235 initstr[0]->setFocus();
239 236
240 l1->addColSpacing(0, 10); 237 l1->addColSpacing(0, 10);
241 l1->addColSpacing(3, 10); 238 l1->addColSpacing(3, 10);
242 l1->addRowSpacing(0, 5); 239 l1->addRowSpacing(0, 5);
243 l1->addRowSpacing(GRIDROWS, 5); 240 l1->addRowSpacing(GRIDROWS, 5);
244 241
245 //set stuff from gpppdata 242 //set stuff from gpppdata
246 preinitslider->setValue(gpppdata.modemPreInitDelay()); 243 preinitslider->setValue(PPPData::data()->modemPreInitDelay());
247 lpreinitslider->setNum(gpppdata.modemPreInitDelay()); 244 lpreinitslider->setNum(PPPData::data()->modemPreInitDelay());
248 for(int i = 0; i < PPPData::NumInitStrings; i++) 245 for(int i = 0; i < PPPData::NumInitStrings; i++)
249 initstr[i]->setText(gpppdata.modemInitStr(i)); 246 initstr[i]->setText(PPPData::data()->modemInitStr(i));
250 initslider->setValue(gpppdata.modemInitDelay()); 247 initslider->setValue(PPPData::data()->modemInitDelay());
251 linitslider->setNum(gpppdata.modemInitDelay()); 248 linitslider->setNum(PPPData::data()->modemInitDelay());
252 initresp->setText(gpppdata.modemInitResp()); 249 initresp->setText(PPPData::data()->modemInitResp());
253 250
254 durationslider->setValue(gpppdata.modemToneDuration()); 251 durationslider->setValue(PPPData::data()->modemToneDuration());
255 ldurationslider->setNum(gpppdata.modemToneDuration()); 252 ldurationslider->setNum(PPPData::data()->modemToneDuration());
256 253
257 nodetectdialtone->setText(gpppdata.modemNoDialToneDetectionStr()); 254 nodetectdialtone->setText(PPPData::data()->modemNoDialToneDetectionStr());
258 dialstr->setText(gpppdata.modemDialStr()); 255 dialstr->setText(PPPData::data()->modemDialStr());
259 connectresp->setText(gpppdata.modemConnectResp()); 256 connectresp->setText(PPPData::data()->modemConnectResp());
260 busyresp->setText(gpppdata.modemBusyResp()); 257 busyresp->setText(PPPData::data()->modemBusyResp());
261 nocarrierresp->setText(gpppdata.modemNoCarrierResp()); 258 nocarrierresp->setText(PPPData::data()->modemNoCarrierResp());
262 nodialtoneresp->setText(gpppdata.modemNoDialtoneResp()); 259 nodialtoneresp->setText(PPPData::data()->modemNoDialtoneResp());
263 260
264 escapestr->setText(gpppdata.modemEscapeStr()); 261 escapestr->setText(PPPData::data()->modemEscapeStr());
265 escaperesp->setText(gpppdata.modemEscapeResp()); 262 escaperesp->setText(PPPData::data()->modemEscapeResp());
266 263
267 hangupstr->setText(gpppdata.modemHangupStr()); 264 hangupstr->setText(PPPData::data()->modemHangupStr());
268 hangupresp->setText(gpppdata.modemHangupResp()); 265 hangupresp->setText(PPPData::data()->modemHangupResp());
269 266
270 answerstr->setText(gpppdata.modemAnswerStr()); 267 answerstr->setText(PPPData::data()->modemAnswerStr());
271 ringresp->setText(gpppdata.modemRingResp()); 268 ringresp->setText(PPPData::data()->modemRingResp());
272 answerresp->setText(gpppdata.modemAnswerResp()); 269 answerresp->setText(PPPData::data()->modemAnswerResp());
273 270
274 slider->setValue(gpppdata.modemEscapeGuardTime()); 271 slider->setValue(PPPData::data()->modemEscapeGuardTime());
275 lslider->setNum(gpppdata.modemEscapeGuardTime()); 272 lslider->setNum(PPPData::data()->modemEscapeGuardTime());
276 273
277 volume_off->setText(gpppdata.volumeOff()); 274 volume_off->setText(PPPData::data()->volumeOff());
278 volume_medium->setText(gpppdata.volumeMedium()); 275 volume_medium->setText(PPPData::data()->volumeMedium());
279 volume_high->setText(gpppdata.volumeHigh()); 276 volume_high->setText(PPPData::data()->volumeHigh());
280} 277}
281 278
282 279
283void ModemCommands::slotOk() { 280void ModemCommands::slotOk() {
284 gpppdata.setModemPreInitDelay(lpreinitslider->text().toInt()); 281 PPPData::data()->setModemPreInitDelay(lpreinitslider->text().toInt());
285 for(int i = 0; i < PPPData::NumInitStrings; i++) 282 for(int i = 0; i < PPPData::NumInitStrings; i++)
286 gpppdata.setModemInitStr(i, initstr[i]->text()); 283 PPPData::data()->setModemInitStr(i, initstr[i]->text());
287 gpppdata.setModemInitResp(initresp->text()); 284 PPPData::data()->setModemInitResp(initresp->text());
288 gpppdata.setModemInitDelay(linitslider->text().toInt()); 285 PPPData::data()->setModemInitDelay(linitslider->text().toInt());
289 286
290 gpppdata.setModemToneDuration(ldurationslider->text().toInt()); 287 PPPData::data()->setModemToneDuration(ldurationslider->text().toInt());
291 gpppdata.setModemNoDialToneDetectionStr(nodetectdialtone->text()); 288 PPPData::data()->setModemNoDialToneDetectionStr(nodetectdialtone->text());
292 gpppdata.setModemDialStr(dialstr->text()); 289 PPPData::data()->setModemDialStr(dialstr->text());
293 gpppdata.setModemConnectResp(connectresp->text()); 290 PPPData::data()->setModemConnectResp(connectresp->text());
294 gpppdata.setModemBusyResp(busyresp->text()); 291 PPPData::data()->setModemBusyResp(busyresp->text());
295 gpppdata.setModemNoCarrierResp(nocarrierresp->text()); 292 PPPData::data()->setModemNoCarrierResp(nocarrierresp->text());
296 gpppdata.setModemNoDialtoneResp(nodialtoneresp->text()); 293 PPPData::data()->setModemNoDialtoneResp(nodialtoneresp->text());
297 294
298 gpppdata.setModemEscapeStr(escapestr->text()); 295 PPPData::data()->setModemEscapeStr(escapestr->text());
299 gpppdata.setModemEscapeResp(escaperesp->text()); 296 PPPData::data()->setModemEscapeResp(escaperesp->text());
300 gpppdata.setModemEscapeGuardTime(lslider->text().toInt()); 297 PPPData::data()->setModemEscapeGuardTime(lslider->text().toInt());
301 gpppdata.setModemHangupStr(hangupstr->text()); 298 PPPData::data()->setModemHangupStr(hangupstr->text());
302 gpppdata.setModemHangupResp(hangupresp->text()); 299 PPPData::data()->setModemHangupResp(hangupresp->text());
303 300
304 gpppdata.setModemAnswerStr(answerstr->text()); 301 PPPData::data()->setModemAnswerStr(answerstr->text());
305 gpppdata.setModemRingResp(ringresp->text()); 302 PPPData::data()->setModemRingResp(ringresp->text());
306 gpppdata.setModemAnswerResp(answerresp->text()); 303 PPPData::data()->setModemAnswerResp(answerresp->text());
307 304
308 gpppdata.setVolumeHigh(volume_high->text()); 305 PPPData::data()->setVolumeHigh(volume_high->text());
309 gpppdata.setVolumeMedium(volume_medium->text()); 306 PPPData::data()->setVolumeMedium(volume_medium->text());
310 gpppdata.setVolumeOff(volume_off->text()); 307 PPPData::data()->setVolumeOff(volume_off->text());
311 308
312 gpppdata.save(); 309 PPPData::data()->save();
313 accept(); 310 accept();
314} 311}
315 312
316 313
317void ModemCommands::slotCancel() { 314void ModemCommands::slotCancel() {
318 reject(); 315 reject();
319} 316}
320 317
321//#include "modemcmds.moc" 318//#include "modemcmds.moc"
diff --git a/noncore/settings/networksettings/ppp/newwidget.cpp b/noncore/settings/networksettings/ppp/newwidget.cpp
deleted file mode 100644
index d2182fb..0000000
--- a/noncore/settings/networksettings/ppp/newwidget.cpp
+++ b/dev/null
@@ -1,17 +0,0 @@
1/////////////////////////////////////////////////////////////////////////////
2//
3// functions generating layout-aware widgets
4//
5/////////////////////////////////////////////////////////////////////////////
6
7#include "newwidget.h"
8
9QLineEdit *newLineEdit(int visiblewidth, QWidget *parent) {
10 QLineEdit *l = new QLineEdit(parent);
11 if(visiblewidth == 0)
12 l->setMinimumWidth(l->sizeHint().width());
13 else
14 l->setFixedWidth(l->fontMetrics().width('H') * visiblewidth);
15
16 return l;
17}
diff --git a/noncore/settings/networksettings/ppp/newwidget.h b/noncore/settings/networksettings/ppp/newwidget.h
deleted file mode 100644
index 52f2ec7..0000000
--- a/noncore/settings/networksettings/ppp/newwidget.h
+++ b/dev/null
@@ -1,19 +0,0 @@
1/////////////////////////////////////////////////////////////////////////////
2//
3// functions generating layout-aware widgets
4//
5/////////////////////////////////////////////////////////////////////////////
6
7#ifndef __NEWWIDGET__H__
8#define __NEWWIDGET__H__
9
10#include <qwidget.h>
11#include <qlineedit.h>
12
13#define L_FIXEDW 1
14#define L_FIXEDH 2
15#define L_FIXED (L_FIXEDW | L_FIXEDH)
16
17QLineEdit *newLineEdit(int visiblewidth, QWidget *parent);
18
19#endif
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro
index a456427..ebfc713 100644
--- a/noncore/settings/networksettings/ppp/ppp.pro
+++ b/noncore/settings/networksettings/ppp/ppp.pro
@@ -1,18 +1,18 @@
1#TEMPLATE = app 1#TEMPLATE = app
2# 2#
3TEMPLATE = lib 3TEMPLATE = lib
4#CONFIG += qt warn_on release 4#CONFIG += qt warn_on release
5 CONFIG += qt warn_on debug 5 CONFIG += qt warn_on debug
6DESTDIR = $(OPIEDIR)/plugins/networksettings 6DESTDIR = $(OPIEDIR)/plugins/networksettings
7 HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h knuminput.h knumvalidator.h kpppwidget.h conwindow.h debug.h accounts.h connect.h edit.h scriptedit.h pppdargs.h newwidget.h iplined.h pwentry.h pppconfig.h 7 HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h knuminput.h knumvalidator.h kpppwidget.h conwindow.h debug.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h
8 SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp knuminput.cpp knumvalidator.cpp kpppwidget.cpp conwindow.cpp debug.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp newwidget.cpp iplined.cpp pwentry.cpp pppconfig.cpp 8 SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp knuminput.cpp knumvalidator.cpp kpppwidget.cpp conwindow.cpp debug.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp
9 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 9 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
10 DEPENDPATH+= $(OPIEDIR)/include 10 DEPENDPATH+= $(OPIEDIR)/include
11LIBS += -lqpe -L../interfaces/ -linterfaces 11LIBS += -lqpe -L../interfaces/ -linterfaces
12 INTERFACES= 12 INTERFACES=
13 TARGET = pppplugin 13 TARGET = pppplugin
14 VERSION = 1.0.0 14 VERSION = 1.0.0
15 15
16 16
17 17
18include ( $(OPIEDIR)/include.pro ) 18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index 7b2b21b..c0f1fef 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -41,22 +41,22 @@ PPPConfigWidget::PPPConfigWidget( QWidget *parent, const char *name,
41// general = new GeneralWidget( tabWindow->addPage( tr("M&isc"), tr("Miscellaneous Settings") ) ); 41// general = new GeneralWidget( tabWindow->addPage( tr("M&isc"), tr("Miscellaneous Settings") ) );
42 42
43} 43}
44 44
45 45
46PPPConfigWidget::~PPPConfigWidget() 46PPPConfigWidget::~PPPConfigWidget()
47{ 47{
48 48
49} 49}
50 50
51void PPPConfigWidget::accept() 51void PPPConfigWidget::accept()
52{ 52{
53 gpppdata.save(); 53 PPPData::data()->save();
54 QDialog::accept(); 54 QDialog::accept();
55} 55}
56 56
57 57
58void PPPConfigWidget::reject() 58void PPPConfigWidget::reject()
59{ 59{
60 gpppdata.cancel(); 60 PPPData::data()->cancel();
61 QDialog::reject(); 61 QDialog::reject();
62} 62}
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp
index 04d0dd0..b7fca3f 100644
--- a/noncore/settings/networksettings/ppp/pppdargs.cpp
+++ b/noncore/settings/networksettings/ppp/pppdargs.cpp
@@ -112,50 +112,50 @@ void PPPdArguments::addbutton() {
112} 112}
113 113
114 114
115void PPPdArguments::removebutton() { 115void PPPdArguments::removebutton() {
116 if(arguments->currentItem() >= 0) 116 if(arguments->currentItem() >= 0)
117 arguments->removeItem(arguments->currentItem()); 117 arguments->removeItem(arguments->currentItem());
118} 118}
119 119
120 120
121void PPPdArguments::defaultsbutton() { 121void PPPdArguments::defaultsbutton() {
122 // all of this is a hack 122 // all of this is a hack
123 // save current list 123 // save current list
124 QStringList arglist(gpppdata.pppdArgument()); 124 QStringList arglist(PPPData::data()->pppdArgument());
125 125
126 // get defaults 126 // get defaults
127 gpppdata.setpppdArgumentDefaults(); 127 PPPData::data()->setpppdArgumentDefaults();
128 init(); 128 init();
129 129
130 // restore old list 130 // restore old list
131 gpppdata.setpppdArgument(arglist); 131 PPPData::data()->setpppdArgument(arglist);
132} 132}
133 133
134 134
135void PPPdArguments::closebutton() { 135void PPPdArguments::closebutton() {
136 QStringList arglist; 136 QStringList arglist;
137 for(uint i=0; i < arguments->count(); i++) 137 for(uint i=0; i < arguments->count(); i++)
138 arglist.append(arguments->text(i)); 138 arglist.append(arguments->text(i));
139 gpppdata.setpppdArgument(arglist); 139 PPPData::data()->setpppdArgument(arglist);
140 140
141 done(0); 141 done(0);
142} 142}
143 143
144 144
145void PPPdArguments::init() { 145void PPPdArguments::init() {
146 while(arguments->count()) 146 while(arguments->count())
147 arguments->removeItem(0); 147 arguments->removeItem(0);
148 148
149 QStringList &arglist = gpppdata.pppdArgument(); 149 QStringList &arglist = PPPData::data()->pppdArgument();
150 for ( QStringList::Iterator it = arglist.begin(); 150 for ( QStringList::Iterator it = arglist.begin();
151 it != arglist.end(); 151 it != arglist.end();
152 ++it ) 152 ++it )
153 arguments->insertItem(*it); 153 arguments->insertItem(*it);
154} 154}
155 155
156 156
157void PPPdArguments::textChanged(const QString &s) { 157void PPPdArguments::textChanged(const QString &s) {
158 add->setEnabled(s.length() > 0); 158 add->setEnabled(s.length() > 0);
159} 159}
160 160
161 161
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index f2386fc..646facd 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -29,61 +29,58 @@
29#include "devices.h" 29#include "devices.h"
30//#include <klocale.h> 30//#include <klocale.h>
31#define i18n QObject::tr 31#define i18n QObject::tr
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qapplication.h> 34#include <qapplication.h>
35// #include <klocale.h> 35// #include <klocale.h>
36// #include <kconfig.h> 36// #include <kconfig.h>
37// #include <kmessagebox.h> 37// #include <kmessagebox.h>
38// #include <kapplication.h> 38// #include <kapplication.h>
39#include <assert.h> 39#include <assert.h>
40 40
41PPPData gpppdata; 41PPPData *PPPData::_data = 0;
42Config *PPPData::config = 0;
42 43
44PPPData* PPPData::data()
45{
46 if (!_data){
47 qDebug("PPPData::data() creates new Instance");
48 _data = new PPPData();
49 }
50 if (!_data->config){
51 qDebug("PPPData::data() opens conffile");
52 _data->open();
53 }
54 return _data;
55}
43 56
44PPPData::PPPData() 57PPPData::PPPData()
45 : config(0L), 58 : //config(0L),
46 highcount(-1), // start out with no entries 59 highcount(-1), // start out with no entries
47 caccount(-1), // set the current account index also 60 caccount(-1), // set the current account index also
48 suidprocessid(-1), // process ID of setuid child 61 suidprocessid(-1), // process ID of setuid child
49 pppdisrunning(false), 62 pppdisrunning(false),
50 pppderror(0) 63 pppderror(0)
51{ 64{
52} 65}
53 66
54 67
55// 68//
56// open configuration file 69// open configuration file
57// 70//
58bool PPPData::open() { 71bool PPPData::open() {
59 72 qDebug("opening configfile NetworkSetupPPP");
60 config = new Config("NetworkSetup"); 73 if (config) return true;
61 /* 74 config = new Config("NetworkSetupPPP");
62 config = kapp->config();
63
64 if (config->getConfigState() == KConfig::NoAccess) {
65 KMessageBox::error(0L,
66 i18n("The application-specific config file could not "
67 "be opened in either read-write or read-only mode.\n"
68 "The superuser might have to change its ownership "
69 "by issuing the following command in your home directory:\n"
70 "chown {YourUsername} .kde/share/config/kppprc"),
71 kapp->name());
72 return false;
73 }
74
75 // don't expand shell variables
76 config->setDollarExpansion(false);
77 */
78 75
79 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; 76 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
80 77
81 if (highcount > MAX_ACCOUNTS) 78 if (highcount > MAX_ACCOUNTS)
82 highcount = MAX_ACCOUNTS; 79 highcount = MAX_ACCOUNTS;
83 80
84 if(highcount >= 0 && defaultAccount().isEmpty()) { 81 if(highcount >= 0 && defaultAccount().isEmpty()) {
85 setAccountbyIndex(0); 82 setAccountbyIndex(0);
86 setDefaultAccount(accname()); 83 setDefaultAccount(accname());
87 } else if(!setAccount(defaultAccount())) 84 } else if(!setAccount(defaultAccount()))
88 setDefaultAccount(accname()); 85 setDefaultAccount(accname());
89 86
@@ -95,54 +92,61 @@ bool PPPData::open() {
95 92
96 return true; 93 return true;
97} 94}
98 95
99 96
100// 97//
101// save configuration 98// save configuration
102// 99//
103void PPPData::save() { 100void PPPData::save() {
104 101
105 if (config) { 102 if (config) {
106 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); 103 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count());
107// config->sync(); 104 delete config;
105 config = 0;
106 qDebug("worte confi NetworkSetupPPP");
107 }
108 if (_data){
109 delete _data;
110 _data = 0;
108 } 111 }
109 112
110} 113}
111 114
112 115
113// 116//
114// cancel changes 117// cancel changes
115// 118//
116void PPPData::cancel() { 119void PPPData::cancel() {
117 120
118// if (config) { 121// if (config) {
119// config->rollback(); 122// config->rollback();
120// config->reparseConfiguration(); 123// config->reparseConfiguration();
121// } 124// }
122 125
123} 126}
124 127
125 128
126// currently differentiates between READWRITE and NONE only 129// // currently differentiates between READWRITE and NONE only
127int PPPData::access() const { 130// int PPPData::access() const {
128 131
129 return 0;//config->getConfigState(); 132// return 1;//config->getConfigState();
130} 133// }
131 134
132 135
133// functions to read/write date to configuration file 136// functions to read/write date to configuration file
134QString PPPData::readConfig(const QString &group, const QString &key, 137QString PPPData::readConfig(const QString &group, const QString &key,
135 const QString &defvalue = "") 138 const QString &defvalue = "")
136{ 139{
140// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
137 if (config) { 141 if (config) {
138 config->setGroup(group); 142 config->setGroup(group);
139 return config->readEntry(key, defvalue); 143 return config->readEntry(key, defvalue);
140 } else 144 } else
141 return defvalue; 145 return defvalue;
142} 146}
143 147
144 148
145int PPPData::readNumConfig(const QString &group, const QString &key, 149int PPPData::readNumConfig(const QString &group, const QString &key,
146 int defvalue) { 150 int defvalue) {
147 if (config) { 151 if (config) {
148 config->setGroup(group); 152 config->setGroup(group);
@@ -709,32 +713,32 @@ bool PPPData::isUniqueAccname(const QString &n) {
709 setAccountbyIndex(i); 713 setAccountbyIndex(i);
710 if(accname() == n && i != current) { 714 if(accname() == n && i != current) {
711 setAccountbyIndex(current); 715 setAccountbyIndex(current);
712 return false; 716 return false;
713 } 717 }
714 } 718 }
715 setAccountbyIndex(current); 719 setAccountbyIndex(current);
716 return true; 720 return true;
717} 721}
718 722
719 723
720bool PPPData::deleteAccount() { 724bool PPPData::deleteAccount() {
721 if(caccount < 0) 725 //FIXME:
726// if(caccount < 0)
722 return false; 727 return false;
723 728
724// QMap <QString, QString> map; 729// QMap <QString, QString> map;
725// QMap <QString, QString>::Iterator it; 730// QMap <QString, QString>::Iterator it;
726 731
727 // set all entries of the current account to "" 732// // set all entries of the current account to ""
728// tille: do not handle the accounts here... (?)
729// map = config->entryMap(cgroup); 733// map = config->entryMap(cgroup);
730// it = map.begin(); 734// it = map.begin();
731// while (it != map.end()) { 735// while (it != map.end()) {
732// config->writeEntry(it.key(), ""); 736// config->writeEntry(it.key(), "");
733// it++; 737// it++;
734// } 738// }
735 739
736// // shift the succeeding accounts 740// // shift the succeeding accounts
737// for(int i = caccount+1; i <= highcount; i++) { 741// for(int i = caccount+1; i <= highcount; i++) {
738// setAccountbyIndex(i); 742// setAccountbyIndex(i);
739// map = config->entryMap(cgroup); 743// map = config->entryMap(cgroup);
740// it = map.begin(); 744// it = map.begin();
@@ -747,98 +751,99 @@ bool PPPData::deleteAccount() {
747// } 751// }
748 752
749// // make sure the top account is cleared 753// // make sure the top account is cleared
750// setAccountbyIndex(highcount); 754// setAccountbyIndex(highcount);
751// map = config->entryMap(cgroup); 755// map = config->entryMap(cgroup);
752// it = map.begin(); 756// it = map.begin();
753// config->setGroup(cgroup); 757// config->setGroup(cgroup);
754// while (it.key() != QString::null) { 758// while (it.key() != QString::null) {
755// config->writeEntry(it.key(), ""); 759// config->writeEntry(it.key(), "");
756// it++; 760// it++;
757// } 761// }
758 762
759 highcount--; 763// highcount--;
760 if(caccount > highcount) 764// if(caccount > highcount)
761 caccount = highcount; 765// caccount = highcount;
762 766
763 setAccountbyIndex(caccount); 767// setAccountbyIndex(caccount);
764 768
765 return true; 769// return true;
766} 770}
767 771
768 772
769bool PPPData::deleteAccount(const QString &aname) { 773bool PPPData::deleteAccount(const QString &aname) {
770 if(!setAccount(aname)) 774 if(!setAccount(aname))
771 return false; 775 return false;
772 776
773 deleteAccount(); 777 deleteAccount();
774 778
775 return true; 779 return true;
776} 780}
777 781
778 782
779int PPPData::newaccount() { 783int PPPData::newaccount() {
780 784
781 if(!config || highcount >= MAX_ACCOUNTS) 785 qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS);
782 return -1; 786 if(!config) open();
787 if (highcount >= MAX_ACCOUNTS) return -1;
783 788
784 highcount++; 789 highcount++;
785 setAccountbyIndex(highcount); 790 setAccountbyIndex(highcount);
786 791
787 setpppdArgumentDefaults(); 792 setpppdArgumentDefaults();
788 793 qDebug("PPPData::newaccount -> %i",caccount);
789 return caccount; 794 return caccount;
790} 795}
791 796
792int PPPData::copyaccount(int i) { 797int PPPData::copyaccount(int i) {
793 798
794 if(highcount >= MAX_ACCOUNTS) 799// if(highcount >= MAX_ACCOUNTS)
795 return -1; 800 return -1;
796 801
797 setAccountbyIndex(i); 802// setAccountbyIndex(i);
798 803
799// QMap <QString, QString> map = config->entryMap(cgroup); 804// QMap <QString, QString> map = config->entryMap(cgroup);
800// QMap <QString, QString>::ConstIterator it = map.begin(); 805// QMap <QString, QString>::ConstIterator it = map.begin();
801 806
802 QString newname = i18n("%1_copy").arg(accname()); 807// QString newname = i18n("%1_copy").arg(accname());
803 808
804 newaccount(); 809// newaccount();
805 810
806// while (it != map.end()) { 811// while (it != map.end()) {
807// config->writeEntry(it.key(), *it); 812// config->writeEntry(it.key(), *it);
808// it++; 813// it++;
809// } 814// }
810 815
811 setAccname(newname); 816// setAccname(newname);
812 817
813 return caccount; 818// return caccount;
814} 819}
815 820
816 821
817const QString PPPData::accname() { 822const QString PPPData::accname() {
818 return readConfig(cgroup, NAME_KEY); 823 return readConfig(cgroup, NAME_KEY);
819} 824}
820 825
821void PPPData::setAccname(const QString &n) { 826void PPPData::setAccname(const QString &n) {
822 if(!cgroup.isNull()) { 827 if(!cgroup.isNull()) {
823 // are we manipulating the default account's name ? then change it, too. 828 // are we manipulating the default account's name ? then change it, too.
824 bool def = accname() == defaultAccount(); 829 bool def = accname() == defaultAccount();
825 writeConfig(cgroup, NAME_KEY, n); 830 writeConfig(cgroup, NAME_KEY, n);
826 if (def) 831 if (def)
827 setDefaultAccount(n); 832 setDefaultAccount(n);
828 } 833 }
829} 834}
830 835
831 836
832#define SEPARATOR_CHAR ':' 837#define SEPARATOR_CHAR '&'
833QStringList &PPPData::phonenumbers() { 838QStringList &PPPData::phonenumbers() {
834 839
835 readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); 840 readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR);
836 return phonelist; 841 return phonelist;
837 842
838} 843}
839 844
840 845
841const QString PPPData::phonenumber() { 846const QString PPPData::phonenumber() {
842 return readConfig(cgroup, PHONENUMBER_KEY); 847 return readConfig(cgroup, PHONENUMBER_KEY);
843} 848}
844 849
@@ -1002,25 +1007,25 @@ bool PPPData::defaultroute() {
1002 // default route is by default 'on'. 1007 // default route is by default 'on'.
1003 return (bool) readNumConfig(cgroup, DEFAULTROUTE_KEY, true); 1008 return (bool) readNumConfig(cgroup, DEFAULTROUTE_KEY, true);
1004} 1009}
1005 1010
1006 1011
1007void PPPData::setDefaultroute(bool set) { 1012void PPPData::setDefaultroute(bool set) {
1008 writeConfig(cgroup, DEFAULTROUTE_KEY, (int) set); 1013 writeConfig(cgroup, DEFAULTROUTE_KEY, (int) set);
1009} 1014}
1010 1015
1011 1016
1012bool PPPData::autoDNS() { 1017bool PPPData::autoDNS() {
1013 bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true); 1018 bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true);
1014 return (set && gpppdata.pppdVersionMin(2, 3, 7)); 1019 return (set && PPPData::data()->pppdVersionMin(2, 3, 7));
1015} 1020}
1016 1021
1017 1022
1018void PPPData::setAutoDNS(bool set) { 1023void PPPData::setAutoDNS(bool set) {
1019 writeConfig(cgroup, AUTODNS_KEY, (int) set); 1024 writeConfig(cgroup, AUTODNS_KEY, (int) set);
1020} 1025}
1021 1026
1022 1027
1023void PPPData::setExDNSDisabled(bool set) { 1028void PPPData::setExDNSDisabled(bool set) {
1024 writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set); 1029 writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set);
1025} 1030}
1026 1031
@@ -1130,100 +1135,100 @@ QStringList &PPPData::pppdArgument() {
1130 1135
1131void PPPData::setpppdArgument(QStringList &args) { 1136void PPPData::setpppdArgument(QStringList &args) {
1132 writeListConfig(cgroup, PPPDARG_KEY, args); 1137 writeListConfig(cgroup, PPPDARG_KEY, args);
1133} 1138}
1134 1139
1135 1140
1136void PPPData::setpppdArgumentDefaults() { 1141void PPPData::setpppdArgumentDefaults() {
1137 QStringList arg; 1142 QStringList arg;
1138 setpppdArgument(arg); 1143 setpppdArgument(arg);
1139} 1144}
1140 1145
1141 1146
1142// graphing widget 1147// // graphing widget
1143void PPPData::setGraphingOptions(bool enable, 1148// void PPPData::setGraphingOptions(bool enable,
1144 QColor bg, 1149 // QColor bg,
1145 QColor text, 1150 // QColor text,
1146 QColor in, 1151 // QColor in,
1147 QColor out) 1152 // QColor out)
1148{ 1153// {
1149 if(config) { 1154// if(config) {
1150 config->setGroup(GRAPH_GRP); 1155// config->setGroup(GRAPH_GRP);
1151 config->writeEntry(GENABLED, enable); 1156// config->writeEntry(GENABLED, enable);
1152// config->writeEntry(GCOLOR_BG, bg); 1157// // config->writeEntry(GCOLOR_BG, bg);
1153// config->writeEntry(GCOLOR_TEXT, text); 1158// // config->writeEntry(GCOLOR_TEXT, text);
1154// config->writeEntry(GCOLOR_IN, in); 1159// // config->writeEntry(GCOLOR_IN, in);
1155// config->writeEntry(GCOLOR_OUT, out); 1160// // config->writeEntry(GCOLOR_OUT, out);
1156 } 1161// }
1157} 1162// }
1158 1163
1159void PPPData::graphingOptions(bool &enable, 1164// void PPPData::graphingOptions(bool &enable,
1160 QColor &bg, 1165 // QColor &bg,
1161 QColor &text, 1166 // QColor &text,
1162 QColor &in, 1167 // QColor &in,
1163 QColor &out) 1168 // QColor &out)
1164{ 1169// {
1165 QColor c; 1170// QColor c;
1166 1171
1167 if(config) { 1172// if(config) {
1168 config->setGroup(GRAPH_GRP); 1173// config->setGroup(GRAPH_GRP);
1169 enable = config->readBoolEntry(GENABLED, true); 1174// enable = config->readBoolEntry(GENABLED, true);
1170 bg = Qt::white; 1175// bg = Qt::white;
1171 //bg = config->readColorEntry(GCOLOR_BG, &c); 1176// //bg = config->readColorEntry(GCOLOR_BG, &c);
1172 text = Qt::black; 1177// text = Qt::black;
1173 //text = config->readColorEntry(GCOLOR_TEXT, &c); 1178// //text = config->readColorEntry(GCOLOR_TEXT, &c);
1174 in = Qt::blue; 1179// in = Qt::blue;
1175 //in = config->readColorEntry(GCOLOR_IN, &c); 1180// //in = config->readColorEntry(GCOLOR_IN, &c);
1176 out = Qt::red; 1181// out = Qt::red;
1177 //out = config->readColorEntry(GCOLOR_OUT, &c); 1182// //out = config->readColorEntry(GCOLOR_OUT, &c);
1178 } 1183// }
1179} 1184// }
1180 1185
1181 1186
1182bool PPPData::graphingEnabled() { 1187// bool PPPData::graphingEnabled() {
1183 return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); 1188// return (bool) readNumConfig(GRAPH_GRP, GENABLED, true);
1184} 1189// }
1185 1190
1186 1191
1187 1192
1188// 1193//
1189//functions to change/set the child pppd process info 1194//functions to change/set the child pppd process info
1190// 1195//
1191bool PPPData::pppdRunning() const { 1196bool PPPData::pppdRunning() const {
1192 return pppdisrunning; 1197 return pppdisrunning;
1193} 1198}
1194 1199
1195void PPPData::setpppdRunning(bool set) { 1200void PPPData::setpppdRunning(bool set) {
1196 pppdisrunning = set; 1201 pppdisrunning = set;
1197} 1202}
1198 1203
1199int PPPData::pppdError() const { 1204int PPPData::pppdError() const {
1200 return pppderror; 1205 return pppderror;
1201} 1206}
1202 1207
1203void PPPData::setpppdError(int err) { 1208void PPPData::setpppdError(int err) {
1204 pppderror = err; 1209 pppderror = err;
1205} 1210}
1206 1211
1207 1212
1208// 1213// //
1209// window position 1214// // window position
1210// 1215// //
1211void PPPData::winPosConWin(int& p_x, int& p_y) { 1216// void PPPData::winPosConWin(int& p_x, int& p_y) {
1212 p_x = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_X, QApplication::desktop()->width()/2-160); 1217// p_x = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_X, QApplication::desktop()->width()/2-160);
1213 p_y = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_Y, QApplication::desktop()->height()/2-55); 1218// p_y = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_Y, QApplication::desktop()->height()/2-55);
1214} 1219// }
1215 1220
1216void PPPData::setWinPosConWin(int p_x, int p_y) { 1221// void PPPData::setWinPosConWin(int p_x, int p_y) {
1217 writeConfig(WINPOS_GRP, WINPOS_CONWIN_X, p_x); 1222// writeConfig(WINPOS_GRP, WINPOS_CONWIN_X, p_x);
1218 writeConfig(WINPOS_GRP, WINPOS_CONWIN_Y, p_y); 1223// writeConfig(WINPOS_GRP, WINPOS_CONWIN_Y, p_y);
1219} 1224// }
1220 1225
1221void PPPData::winPosStatWin(int& p_x, int& p_y) { 1226// void PPPData::winPosStatWin(int& p_x, int& p_y) {
1222 p_x = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_X, QApplication::desktop()->width()/2-160); 1227// p_x = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_X, QApplication::desktop()->width()/2-160);
1223 p_y = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_Y, QApplication::desktop()->height()/2-55); 1228// p_y = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_Y, QApplication::desktop()->height()/2-55);
1224} 1229// }
1225 1230
1226void PPPData::setWinPosStatWin(int p_x, int p_y) { 1231// void PPPData::setWinPosStatWin(int p_x, int p_y) {
1227 writeConfig(WINPOS_GRP, WINPOS_STATWIN_X, p_x); 1232// writeConfig(WINPOS_GRP, WINPOS_STATWIN_X, p_x);
1228 writeConfig(WINPOS_GRP, WINPOS_STATWIN_Y, p_y); 1233// writeConfig(WINPOS_GRP, WINPOS_STATWIN_Y, p_y);
1229} 1234// }
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index e286b70..57ce2fd 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -46,29 +46,29 @@ class Config;
46#define ACCNAME_SIZE 50 46#define ACCNAME_SIZE 50
47#define PHONENUMBER_SIZE 60 47#define PHONENUMBER_SIZE 60
48#define COMMAND_SIZE 255 48#define COMMAND_SIZE 255
49#define IPADDR_SIZE 15 49#define IPADDR_SIZE 15
50#define DOMAIN_SIZE 50 50#define DOMAIN_SIZE 50
51#define TIMEOUT_SIZE 60 51#define TIMEOUT_SIZE 60
52 52
53// 53//
54// keys for config file 54// keys for config file
55// 55//
56 56
57// groups 57// groups
58#define GENERAL_GRP "General" 58#define GENERAL_GRP "PPP_General"
59#define MODEM_GRP "Modem" 59#define MODEM_GRP "PPP_Modem"
60#define ACCOUNT_GRP "Account" 60#define ACCOUNT_GRP "PPP_Account"
61#define GRAPH_GRP "Graph" 61//#define GRAPH_GRP "Graph"
62#define WINPOS_GRP "WindowPosition" 62//#define WINPOS_GRP "WindowPosition"
63 63
64// general 64// general
65#define DEFAULTACCOUNT_KEY "DefaultAccount" 65#define DEFAULTACCOUNT_KEY "DefaultAccount"
66#define PPPDVERSION_KEY "pppdVersion" 66#define PPPDVERSION_KEY "pppdVersion"
67#define PPPDTIMEOUT_KEY "pppdTimeout" 67#define PPPDTIMEOUT_KEY "pppdTimeout"
68#define SHOWCLOCK_KEY "ShowClock" 68#define SHOWCLOCK_KEY "ShowClock"
69#define SHOWLOGWIN_KEY "ShowLogWindow" 69#define SHOWLOGWIN_KEY "ShowLogWindow"
70#define AUTOREDIAL_KEY "AutomaticRedial" 70#define AUTOREDIAL_KEY "AutomaticRedial"
71#define DISCONNECT_KEY "DisconnectOnXServerExit" 71#define DISCONNECT_KEY "DisconnectOnXServerExit"
72#define QUITONDISCONNECT_KEY "QuitOnDisconnect" 72#define QUITONDISCONNECT_KEY "QuitOnDisconnect"
73#define NUMACCOUNTS_KEY "NumberOfAccounts" 73#define NUMACCOUNTS_KEY "NumberOfAccounts"
74 #define ID_KEY "ID" 74 #define ID_KEY "ID"
@@ -152,32 +152,33 @@ class Config;
152#define E_PPPD_DIED 2 152#define E_PPPD_DIED 2
153 153
154// window position 154// window position
155#define WINPOS_CONWIN_X "WindowPositionConWinX" 155#define WINPOS_CONWIN_X "WindowPositionConWinX"
156#define WINPOS_CONWIN_Y "WindowPositionConWinY" 156#define WINPOS_CONWIN_Y "WindowPositionConWinY"
157#define WINPOS_STATWIN_X "WindowPositionStatWinX" 157#define WINPOS_STATWIN_X "WindowPositionStatWinX"
158#define WINPOS_STATWIN_Y "WindowPositionStatWinY" 158#define WINPOS_STATWIN_Y "WindowPositionStatWinY"
159 159
160class PPPData { 160class PPPData {
161public: 161public:
162 PPPData(); 162 PPPData();
163 ~PPPData() {}; 163 ~PPPData() {};
164 static PPPData* data();
164 165
165 enum { NumInitStrings = 2 }; 166 enum { NumInitStrings = 2 };
166 167
167 // general functions 168 // general functions
168 bool open(); 169 bool open();
169 void save(); 170 void save();
170 void cancel(); 171 void cancel();
171 int access() const; // read/write access 172// int access() const; // read/write access
172 173
173 // function to read/write date to configuration file 174 // function to read/write date to configuration file
174 QString readConfig(const QString &, const QString &, const QString &); 175 QString readConfig(const QString &, const QString &, const QString &);
175 int readNumConfig(const QString &, const QString &, int); 176 int readNumConfig(const QString &, const QString &, int);
176 bool readListConfig(const QString &, const QString &, 177 bool readListConfig(const QString &, const QString &,
177 QStringList &, char sep = ','); 178 QStringList &, char sep = ',');
178 void writeConfig(const QString &, const QString &, const QString &); 179 void writeConfig(const QString &, const QString &, const QString &);
179 void writeConfig(const QString &, const QString &, int); 180 void writeConfig(const QString &, const QString &, int);
180 void writeListConfig(const QString &, const QString &, 181 void writeListConfig(const QString &, const QString &,
181 QStringList &, char sep = ','); 182 QStringList &, char sep = ',');
182 183
183 // return the current account group 184 // return the current account group
@@ -417,49 +418,50 @@ public:
417 void setpppdError(int err); 418 void setpppdError(int err);
418 419
419 // functions to set/query the accounting info 420 // functions to set/query the accounting info
420 const QString accountingFile(); 421 const QString accountingFile();
421 void setAccountingFile(const QString &); 422 void setAccountingFile(const QString &);
422 423
423 const QString totalCosts(); 424 const QString totalCosts();
424 void setTotalCosts(const QString &); 425 void setTotalCosts(const QString &);
425 426
426 int totalBytes(); 427 int totalBytes();
427 void setTotalBytes(int); 428 void setTotalBytes(int);
428 429
429 // graphing widget 430// // graphing widget
430 void setGraphingOptions(bool enabled, 431// void setGraphingOptions(bool enabled,
431 QColor bg, 432 // QColor bg,
432 QColor text, 433 // QColor text,
433 QColor in, 434 // QColor in,
434 QColor out); 435 // QColor out);
435 void graphingOptions(bool &enabled, 436// void graphingOptions(bool &enabled,
436 QColor &bg, 437 // QColor &bg,
437 QColor &text, 438 // QColor &text,
438 QColor &in, 439 // QColor &in,
439 QColor &out); 440 // QColor &out);
440 bool graphingEnabled(); 441// bool graphingEnabled();
441 442
442 // window positions 443// // window positions
443 void winPosConWin(int &, int &); 444// void winPosConWin(int &, int &);
444 void setWinPosConWin(int, int); 445// void setWinPosConWin(int, int);
445 void winPosStatWin(int &, int &); 446// void winPosStatWin(int &, int &);
446 void setWinPosStatWin(int, int); 447// void setWinPosStatWin(int, int);
447 448
448private: 449private:
450
451 static PPPData *_data;
452
449 QString passwd; 453 QString passwd;
450 Config* config; // configuration object 454 static Config* config; // configuration object
451 int highcount; // index of highest account 455 int highcount; // index of highest account
452 int caccount; // index of the current account 456 int caccount; // index of the current account
453 QString cgroup; // name of current config group 457 QString cgroup; // name of current config group
454 pid_t suidprocessid; // process ID of setuid child 458 pid_t suidprocessid; // process ID of setuid child
455 bool pppdisrunning; // pppd process 459 bool pppdisrunning; // pppd process
456 // daemon 460 // daemon
457 int pppderror; // error encounterd running pppd 461 int pppderror; // error encounterd running pppd
458 int pppdVer, pppdMod, pppdPatch; // pppd version 462 int pppdVer, pppdMod, pppdPatch; // pppd version
459 463
460 QStringList phonelist; 464 QStringList phonelist;
461}; 465};
462 466
463extern PPPData gpppdata;
464
465#endif 467#endif
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index d6ca88a..da17e26 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -1,15 +1,15 @@
1#include "pppconfig.h" 1#include "pppconfig.h"
2#include "pppmodule.h" 2#include "pppmodule.h"
3//#include "pppimp.h" 3#include "pppdata.h"
4#include "kpppwidget.h" 4#include "kpppwidget.h"
5#include "interfaceinformationimp.h" 5#include "interfaceinformationimp.h"
6//#include "devices.h" 6//#include "devices.h"
7 7
8/** 8/**
9 * Constructor, find all of the possible interfaces 9 * Constructor, find all of the possible interfaces
10 */ 10 */
11PPPModule::PPPModule() : Module() { 11PPPModule::PPPModule() : Module() {
12} 12}
13 13
14/** 14/**
15 * Delete any interfaces that we own. 15 * Delete any interfaces that we own.
@@ -89,24 +89,25 @@ QList<Interface> PPPModule::getInterfaces(){
89 * by possibleNewInterfaces(); 89 * by possibleNewInterfaces();
90 * @return Interface* NULL if it was unable to be created. 90 * @return Interface* NULL if it was unable to be created.
91 */ 91 */
92Interface *PPPModule::addNewInterface(const QString &newInterface){ 92Interface *PPPModule::addNewInterface(const QString &newInterface){
93 93
94 qDebug("try to add iface %s",newInterface.latin1()); 94 qDebug("try to add iface %s",newInterface.latin1());
95 95
96 PPPConfigWidget imp(0, "PPPConfigImp", true); 96 PPPConfigWidget imp(0, "PPPConfigImp", true);
97 imp.showMaximized(); 97 imp.showMaximized();
98 if(imp.exec() == QDialog::Accepted ){ 98 if(imp.exec() == QDialog::Accepted ){
99 qDebug("ACCEPTED"); 99 qDebug("ACCEPTED");
100 return new Interface( 0, newInterface ); 100 return new Interface( 0, newInterface );
101 PPPData::data()->save();
101 } 102 }
102 return NULL; 103 return NULL;
103} 104}
104 105
105/** 106/**
106 * Attempts to remove the interface, doesn't delete i 107 * Attempts to remove the interface, doesn't delete i
107 * @return bool true if successfull, false otherwise. 108 * @return bool true if successfull, false otherwise.
108 */ 109 */
109bool PPPModule::remove(Interface*){ 110bool PPPModule::remove(Interface*){
110 // Can't remove a hardware device, you can stop it though. 111 // Can't remove a hardware device, you can stop it though.
111 return false; 112 return false;
112} 113}