summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp70
-rw-r--r--noncore/settings/networksettings/ppp/accounts.h4
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp326
-rw-r--r--noncore/settings/networksettings/ppp/connect.h22
-rw-r--r--noncore/settings/networksettings/ppp/conwindow.cpp245
-rw-r--r--noncore/settings/networksettings/ppp/conwindow.h12
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp123
-rw-r--r--noncore/settings/networksettings/ppp/edit.h20
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp59
-rw-r--r--noncore/settings/networksettings/ppp/general.h10
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.cpp24
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.h25
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp48
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.h30
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp463
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.h11
-rw-r--r--noncore/settings/networksettings/ppp/modem.cpp45
-rw-r--r--noncore/settings/networksettings/ppp/modem.h7
-rw-r--r--noncore/settings/networksettings/ppp/modemcmds.cpp112
-rw-r--r--noncore/settings/networksettings/ppp/modemcmds.h3
-rw-r--r--noncore/settings/networksettings/ppp/modeminfo.cpp37
-rw-r--r--noncore/settings/networksettings/ppp/modeminfo.h5
-rw-r--r--noncore/settings/networksettings/ppp/ppp.pro8
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp29
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.h7
-rw-r--r--noncore/settings/networksettings/ppp/pppdargs.cpp14
-rw-r--r--noncore/settings/networksettings/ppp/pppdargs.h4
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp250
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h62
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp31
30 files changed, 1125 insertions, 981 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index 11d4739..3fa2f84 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -51,6 +51,6 @@
51void parseargs(char* buf, char** args); 51void parseargs(char* buf, char** args);
52 52
53AccountWidget::AccountWidget( QWidget *parent, const char *name ) 53AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name )
54 : QWidget( parent, name ) 54 : QWidget( parent, name ), _pppdata(pd)
55{ 55{
56 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); 56 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
@@ -153,15 +153,15 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
153 153
154 //load up account list from gppdata to the list box 154 //load up account list from gppdata to the list box
155 if(PPPData::data()->count() > 0) { 155 if(_pppdata->count() > 0) {
156 for(int i=0; i <= PPPData::data()->count()-1; i++) { 156 for(int i=0; i <= _pppdata->count()-1; i++) {
157 PPPData::data()->setAccountbyIndex(i); 157 _pppdata->setAccountbyIndex(i);
158 accountlist_l->insertItem(PPPData::data()->accname()); 158 accountlist_l->insertItem(_pppdata->accname());
159 } 159 }
160 } 160 }
161 161
162// slotListBoxSelect(accountlist_l->currentItem()); 162// slotListBoxSelect(accountlist_l->currentItem());
163 qDebug("setting listview index to %i",PPPData::data()->currentAccountID() ); 163 qDebug("setting listview index to %i",_pppdata->currentAccountID() );
164 accountlist_l->setCurrentItem( PPPData::data()->currentAccountID() ); 164 accountlist_l->setCurrentItem( _pppdata->currentAccountID() );
165// slotListBoxSelect( PPPData::data()->currentAccountID()); 165// slotListBoxSelect( _pppdata->currentAccountID());
166 166
167 l1->activate(); 167 l1->activate();
@@ -176,7 +176,7 @@ void AccountWidget::slotListBoxSelect(int idx) {
176 if(idx!=-1) { 176 if(idx!=-1) {
177 qDebug("setting account to %i", idx); 177 qDebug("setting account to %i", idx);
178 QString account = PPPData::data()->accname(); 178 QString account = _pppdata->accname();
179 PPPData::data()->setAccountbyIndex(accountlist_l->currentItem()); 179 _pppdata->setAccountbyIndex(accountlist_l->currentItem());
180 // PPPData::data()->setAccount(account); 180 // _pppdata->setAccount(account);
181 } 181 }
182} 182}
@@ -215,12 +215,12 @@ void AccountWidget::slotListBoxSelect(int idx) {
215 215
216void AccountWidget::editaccount() { 216void AccountWidget::editaccount() {
217 PPPData::data()->setAccount(accountlist_l->text(accountlist_l->currentItem())); 217 _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem()));
218 218
219 int result = doTab(); 219 int result = doTab();
220 220
221 if(result == QDialog::Accepted) { 221 if(result == QDialog::Accepted) {
222 accountlist_l->changeItem(PPPData::data()->accname(),accountlist_l->currentItem()); 222 accountlist_l->changeItem(_pppdata->accname(),accountlist_l->currentItem());
223// emit resetaccounts(); 223// emit resetaccounts();
224 PPPData::data()->save(); 224 _pppdata->save();
225 } 225 }
226} 226}
@@ -246,5 +246,5 @@ void AccountWidget::newaccount() {
246// case QMessageBox::Yes: 246// case QMessageBox::Yes:
247// { 247// {
248// if (PPPData::data()->newaccount() == -1) 248// if (_pppdata->newaccount() == -1)
249 // return; 249 // return;
250// // ProviderDB pdb(this); 250// // ProviderDB pdb(this);
@@ -253,6 +253,6 @@ void AccountWidget::newaccount() {
253// } 253// }
254// case QMessageBox::No: 254// case QMessageBox::No:
255 if (PPPData::data()->newaccount() == -1){ 255 if (_pppdata->newaccount() == -1){
256 qDebug("PPPData::data()->newaccount() == -1"); 256 qDebug("_pppdata->newaccount() == -1");
257 return; 257 return;
258 } 258 }
@@ -264,11 +264,11 @@ void AccountWidget::newaccount() {
264 264
265 if(result == QDialog::Accepted) { 265 if(result == QDialog::Accepted) {
266 accountlist_l->insertItem(PPPData::data()->accname()); 266 accountlist_l->insertItem(_pppdata->accname());
267 accountlist_l->setSelected(accountlist_l->findItem(PPPData::data()->accname()), 267 accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()),
268 true); 268 true);
269// emit resetaccounts(); 269// emit resetaccounts();
270 PPPData::data()->save(); 270 _pppdata->save();
271 } else 271 } else
272 PPPData::data()->deleteAccount(); 272 _pppdata->deleteAccount();
273} 273}
274 274
@@ -285,9 +285,9 @@ void AccountWidget::copyaccount() {
285 } 285 }
286 286
287 PPPData::data()->copyaccount(accountlist_l->currentItem()); 287 _pppdata->copyaccount(accountlist_l->currentItem());
288 288
289 accountlist_l->insertItem(PPPData::data()->accname()); 289 accountlist_l->insertItem(_pppdata->accname());
290// emit resetaccounts(); 290// emit resetaccounts();
291 PPPData::data()->save(); 291 _pppdata->save();
292} 292}
293 293
@@ -301,9 +301,9 @@ void AccountWidget::deleteaccount() {
301 return; 301 return;
302 302
303 if(PPPData::data()->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) 303 if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem())))
304 accountlist_l->removeItem(accountlist_l->currentItem()); 304 accountlist_l->removeItem(accountlist_l->currentItem());
305 305
306 emit resetaccounts(); 306 emit resetaccounts();
307 PPPData::data()->save(); 307 _pppdata->save();
308 308
309 slotListBoxSelect(accountlist_l->currentItem()); 309 slotListBoxSelect(accountlist_l->currentItem());
@@ -323,25 +323,25 @@ int AccountWidget::doTab(){
323 bool isnewaccount; 323 bool isnewaccount;
324 324
325 if(PPPData::data()->accname().isEmpty()) { 325 if(_pppdata->accname().isEmpty()) {
326 dlg->setCaption(i18n("New Account")); 326 dlg->setCaption(i18n("New Account"));
327 isnewaccount = true; 327 isnewaccount = true;
328 } else { 328 } else {
329 QString tit = i18n("Edit Account: "); 329 QString tit = i18n("Edit Account: ");
330 tit += PPPData::data()->accname(); 330 tit += _pppdata->accname();
331 dlg->setCaption(tit); 331 dlg->setCaption(tit);
332 isnewaccount = false; 332 isnewaccount = false;
333 } 333 }
334 334
335 dial_w = new DialWidget( tabWindow, isnewaccount, "Dial Setup"); 335 dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup");
336 tabWindow->addTab( dial_w, i18n("Dial") ); 336 tabWindow->addTab( dial_w, i18n("Dial") );
337 ip_w = new IPWidget( tabWindow, isnewaccount, i18n("IP Setup")); 337 ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, i18n("IP Setup"));
338 tabWindow->addTab( ip_w, i18n("IP") ); 338 tabWindow->addTab( ip_w, i18n("IP") );
339 gateway_w = new GatewayWidget( tabWindow, isnewaccount, i18n("Gateway Setup")); 339 gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, i18n("Gateway Setup"));
340 tabWindow->addTab( gateway_w, i18n("Gateway") ); 340 tabWindow->addTab( gateway_w, i18n("Gateway") );
341 dns_w = new DNSWidget( tabWindow, isnewaccount, i18n("DNS Servers") ); 341 dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, i18n("DNS Servers") );
342 tabWindow->addTab( dns_w, i18n("DNS") ); 342 tabWindow->addTab( dns_w, i18n("DNS") );
343 script_w = new ScriptWidget( tabWindow, isnewaccount, i18n("Edit Login Script")); 343 script_w = new ScriptWidget( _pppdata, tabWindow, isnewaccount, i18n("Edit Login Script"));
344 tabWindow->addTab( script_w, i18n("Login Script") ); 344 tabWindow->addTab( script_w, i18n("Login Script") );
345 ExecWidget *exec_w = new ExecWidget( tabWindow, isnewaccount, i18n("Execute Programs")); 345 ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, i18n("Execute Programs"));
346 tabWindow->addTab( exec_w, i18n("Execute") ); 346 tabWindow->addTab( exec_w, i18n("Execute") );
347// acct = new AccountingSelector( tabWindow, isnewaccount ); 347// acct = new AccountingSelector( tabWindow, isnewaccount );
diff --git a/noncore/settings/networksettings/ppp/accounts.h b/noncore/settings/networksettings/ppp/accounts.h
index 751a414..5e8509d 100644
--- a/noncore/settings/networksettings/ppp/accounts.h
+++ b/noncore/settings/networksettings/ppp/accounts.h
@@ -43,9 +43,10 @@ class IPWidget;
43class DNSWidget; 43class DNSWidget;
44class GatewayWidget; 44class GatewayWidget;
45class PPPData;
45 46
46class AccountWidget : public QWidget { 47class AccountWidget : public QWidget {
47 Q_OBJECT 48 Q_OBJECT
48public: 49public:
49 AccountWidget( QWidget *parent=0, const char *name=0 ); 50 AccountWidget( PPPData *pd, QWidget *parent=0, const char *name=0 );
50 ~AccountWidget() {} 51 ~AccountWidget() {}
51 52
@@ -70,4 +71,5 @@ private:
70 QString prettyPrintVolume(unsigned int); 71 QString prettyPrintVolume(unsigned int);
71 72
73 PPPData *_pppdata;
72 QTabWidget *tabWindow; 74 QTabWidget *tabWindow;
73 DialWidget *dial_w; 75 DialWidget *dial_w;
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index a3eda9d..2615b60 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -66,5 +66,5 @@
66#include "connect.h" 66#include "connect.h"
67//#include "docking.h" 67//#include "docking.h"
68//#include "main.h" 68#include "interfaceppp.h"
69#include "modem.h" 69#include "modem.h"
70#include "kpppconfig.h" 70#include "kpppconfig.h"
@@ -75,13 +75,10 @@
75#define execute_command system 75#define execute_command system
76 76
77extern KPPPWidget *p_kppp;
78
79QString old_hostname; 77QString old_hostname;
80bool modified_hostname; 78bool modified_hostname;
81 79
82 80
83ConnectWidget::ConnectWidget(QWidget *parent, const char *name) 81ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *name)
84 : QWidget(parent, name), 82 : QWidget(parent, name),
85 // initialize some important variables
86 myreadbuffer(""), 83 myreadbuffer(""),
87 main_timer_ID(0), 84 main_timer_ID(0),
@@ -97,7 +94,6 @@ ConnectWidget::ConnectWidget(QWidget *parent, const char *name)
97 scanning(false), 94 scanning(false),
98 pausing(false), 95 pausing(false),
99// termwindow(0), 96 dialnumber(0),
100// stats(st), 97 _ifaceppp(ifp)
101 dialnumber(0)
102{ 98{
103 modified_hostname = false; 99 modified_hostname = false;
@@ -180,5 +176,5 @@ void ConnectWidget::preinit() {
180 176
181void ConnectWidget::init() { 177void ConnectWidget::init() {
182 PPPData::data()->setpppdError(0); 178 _ifaceppp->data()->setpppdError(0);
183 inittimer->stop(); 179 inittimer->stop();
184 vmain = 0; 180 vmain = 0;
@@ -195,12 +191,12 @@ void ConnectWidget::init() {
195 dialnumber = 0; 191 dialnumber = 0;
196 192
197 p_kppp->con_speed = ""; 193// p_kppp->con_speed = "";
198 194
199// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || PPPData::data()->quit_on_disconnect()); 195// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || _ifaceppp->data()->quit_on_disconnect());
200 196
201 comlist = &PPPData::data()->scriptType(); 197 comlist = &_ifaceppp->data()->scriptType();
202 arglist = &PPPData::data()->script(); 198 arglist = &_ifaceppp->data()->script();
203 199
204 QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); 200 QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname());
205 setCaption(tit); 201 setCaption(tit);
206 202
@@ -208,5 +204,5 @@ void ConnectWidget::init() {
208 204
209 // run the "before-connect" command 205 // run the "before-connect" command
210 if (!PPPData::data()->command_before_connect().isEmpty()) { 206 if (!_ifaceppp->data()->command_before_connect().isEmpty()) {
211 messg->setText(i18n("Running pre-startup command...")); 207 messg->setText(i18n("Running pre-startup command..."));
212 emit debugMessage(i18n("Running pre-startup command...")); 208 emit debugMessage(i18n("Running pre-startup command..."));
@@ -214,5 +210,5 @@ void ConnectWidget::init() {
214 qApp->processEvents(); 210 qApp->processEvents();
215 QApplication::flushX(); 211 QApplication::flushX();
216 pid_t id = execute_command(PPPData::data()->command_before_connect()); 212 pid_t id = execute_command(_ifaceppp->data()->command_before_connect());
217// int i, status; 213// int i, status;
218 214
@@ -224,5 +220,5 @@ void ConnectWidget::init() {
224 } 220 }
225 221
226 int lock = Modem::modem->lockdevice(); 222 int lock = _ifaceppp->modem()->lockdevice();
227 223
228 if (lock == 1) { 224 if (lock == 1) {
@@ -238,8 +234,8 @@ void ConnectWidget::init() {
238 } 234 }
239 235
240 if(Modem::modem->opentty()) { 236 if(_ifaceppp->modem()->opentty()) {
241 messg->setText(Modem::modem->modemMessage()); 237 messg->setText(_ifaceppp->modem()->modemMessage());
242 qApp->processEvents(); 238 qApp->processEvents();
243 if(Modem::modem->hangup()) { 239 if(_ifaceppp->modem()->hangup()) {
244 240
245 qApp->processEvents(); 241 qApp->processEvents();
@@ -247,9 +243,9 @@ void ConnectWidget::init() {
247 semaphore = false; 243 semaphore = false;
248 244
249 Modem::modem->stop(); 245 _ifaceppp->modem()->stop();
250 Modem::modem->notify(this, SLOT(readChar(unsigned char))); 246 _ifaceppp->modem()->notify(this, SLOT(readChar(unsigned char)));
251 247
252 // if we are stuck anywhere we will time out 248 // if we are stuck anywhere we will time out
253 timeout_timer->start(PPPData::data()->modemTimeout()*1000); 249 timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
254 250
255 // this timer will run the script etc. 251 // this timer will run the script etc.
@@ -261,7 +257,7 @@ void ConnectWidget::init() {
261 257
262 // initialization failed 258 // initialization failed
263 messg->setText(Modem::modem->modemMessage()); 259 messg->setText(_ifaceppp->modem()->modemMessage());
264 vmain = 20; // wait until cancel is pressed 260 vmain = 20; // wait until cancel is pressed
265 Modem::modem->unlockdevice(); 261 _ifaceppp->modem()->unlockdevice();
266} 262}
267 263
@@ -285,16 +281,16 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
285 } 281 }
286 282
287 QString initStr = PPPData::data()->modemInitStr(substate); 283 QString initStr = _ifaceppp->data()->modemInitStr(substate);
288 if (!initStr.isEmpty()) { 284 if (!initStr.isEmpty()) {
289 // send a carriage return and then wait a bit so that the modem will 285 // send a carriage return and then wait a bit so that the modem will
290 // let us issue commands. 286 // let us issue commands.
291 if(PPPData::data()->modemPreInitDelay() > 0) { 287 if(_ifaceppp->data()->modemPreInitDelay() > 0) {
292 usleep(PPPData::data()->modemPreInitDelay() * 5000); 288 usleep(_ifaceppp->data()->modemPreInitDelay() * 5000);
293 writeline(""); 289 writeline("");
294 usleep(PPPData::data()->modemPreInitDelay() * 5000); 290 usleep(_ifaceppp->data()->modemPreInitDelay() * 5000);
295 } 291 }
296 setExpect(PPPData::data()->modemInitResp()); 292 setExpect(_ifaceppp->data()->modemInitResp());
297 writeline(initStr); 293 writeline(initStr);
298 usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec 294 usleep(_ifaceppp->data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
299 } 295 }
300 296
@@ -307,5 +303,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
307 * a "Modem Query" 303 * a "Modem Query"
308 */ 304 */
309 if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration()) 305 if (MODEM_TONEDURATION != _ifaceppp->data()->modemToneDuration())
310 vmain = 5; 306 vmain = 5;
311 else 307 else
@@ -317,9 +313,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
317 if (vmain == 5) { 313 if (vmain == 5) {
318 if(!expecting) { 314 if(!expecting) {
319 QString sToneDuration = "ATS11=" + QString::number(PPPData::data()->modemToneDuration()); 315 QString sToneDuration = "ATS11=" + QString::number(_ifaceppp->data()->modemToneDuration());
320 QString msg = i18n("Setting ") + sToneDuration; 316 QString msg = i18n("Setting ") + sToneDuration;
321 messg->setText(msg); 317 messg->setText(msg);
322 emit debugMessage(msg); 318 emit debugMessage(msg);
323 setExpect(PPPData::data()->modemInitResp()); 319 setExpect(_ifaceppp->data()->modemInitResp());
324 writeline(sToneDuration); 320 writeline(sToneDuration);
325 } 321 }
@@ -337,5 +333,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
337 substate = -1; 333 substate = -1;
338 // skip setting the volume if command is empty 334 // skip setting the volume if command is empty
339 if(PPPData::data()->volumeInitString().isEmpty()) { 335 if(_ifaceppp->data()->volumeInitString().isEmpty()) {
340 vmain = 4; 336 vmain = 4;
341 return; 337 return;
@@ -344,9 +340,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
344 emit debugMessage(i18n("Setting speaker volume...")); 340 emit debugMessage(i18n("Setting speaker volume..."));
345 341
346 setExpect(PPPData::data()->modemInitResp()); 342 setExpect(_ifaceppp->data()->modemInitResp());
347 QString vol("AT"); 343 QString vol("AT");
348 vol += PPPData::data()->volumeInitString(); 344 vol += _ifaceppp->data()->volumeInitString();
349 writeline(vol); 345 writeline(vol);
350 usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec 346 usleep(_ifaceppp->data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
351 vmain = 4; 347 vmain = 4;
352 return; 348 return;
@@ -356,10 +352,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
356 if(vmain == 4) { 352 if(vmain == 4) {
357 if(!expecting) { 353 if(!expecting) {
358 if(!PPPData::data()->waitForDialTone()) { 354 if(!_ifaceppp->data()->waitForDialTone()) {
359 QString msg = i18n("Turning off dial tone waiting..."); 355 QString msg = i18n("Turning off dial tone waiting...");
360 messg->setText(msg); 356 messg->setText(msg);
361 emit debugMessage(msg); 357 emit debugMessage(msg);
362 setExpect(PPPData::data()->modemInitResp()); 358 setExpect(_ifaceppp->data()->modemInitResp());
363 writeline(PPPData::data()->modemNoDialToneDetectionStr()); 359 writeline(_ifaceppp->data()->modemNoDialToneDetectionStr());
364 } 360 }
365 vmain = 1; 361 vmain = 1;
@@ -373,8 +369,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
373 369
374 timeout_timer->stop(); 370 timeout_timer->stop();
375 timeout_timer->start(PPPData::data()->modemTimeout()*1000); 371 timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
376 372
377 QStringList &plist = PPPData::data()->phonenumbers(); 373 QStringList &plist = _ifaceppp->data()->phonenumbers();
378 QString bmarg= PPPData::data()->dialPrefix(); 374 QString bmarg= _ifaceppp->data()->dialPrefix();
379 bmarg += *plist.at(dialnumber); 375 bmarg += *plist.at(dialnumber);
380 QString bm = i18n("Dialing %1").arg(bmarg); 376 QString bm = i18n("Dialing %1").arg(bmarg);
@@ -382,6 +378,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
382 emit debugMessage(bm); 378 emit debugMessage(bm);
383 379
384 QString pn = PPPData::data()->modemDialStr(); 380 QString pn = _ifaceppp->data()->modemDialStr();
385 pn += PPPData::data()->dialPrefix(); 381 pn += _ifaceppp->data()->dialPrefix();
386 pn += *plist.at(dialnumber); 382 pn += *plist.at(dialnumber);
387 if(++dialnumber >= plist.count()) 383 if(++dialnumber >= plist.count())
@@ -389,5 +385,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
389 writeline(pn); 385 writeline(pn);
390 386
391 setExpect(PPPData::data()->modemConnectResp()); 387 setExpect(_ifaceppp->data()->modemConnectResp());
392 vmain = 100; 388 vmain = 100;
393 return; 389 return;
@@ -399,5 +395,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
399 if(vmain == 100) { 395 if(vmain == 100) {
400 if(!expecting) { 396 if(!expecting) {
401 myreadbuffer = PPPData::data()->modemConnectResp(); 397 myreadbuffer = _ifaceppp->data()->modemConnectResp();
402 setExpect("\n"); 398 setExpect("\n");
403 vmain = 101; 399 vmain = 101;
@@ -405,14 +401,14 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
405 } 401 }
406 402
407 if(readbuffer.contains(PPPData::data()->modemBusyResp())) { 403 if(readbuffer.contains(_ifaceppp->data()->modemBusyResp())) {
408 timeout_timer->stop(); 404 timeout_timer->stop();
409 timeout_timer->start(PPPData::data()->modemTimeout()*1000); 405 timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
410 406
411 messg->setText(i18n("Line busy. Hanging up...")); 407 messg->setText(i18n("Line busy. Hanging up..."));
412 emit debugPutChar('\n'); 408 emit debugPutChar('\n');
413 Modem::modem->hangup(); 409 _ifaceppp->modem()->hangup();
414 410
415 if(PPPData::data()->busyWait() > 0) { 411 if(_ifaceppp->data()->busyWait() > 0) {
416 QString bm = i18n("Line busy. Waiting: %1 seconds").arg(PPPData::data()->busyWait()); 412 QString bm = i18n("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait());
417 messg->setText(bm); 413 messg->setText(bm);
418 emit debugMessage(bm); 414 emit debugMessage(bm);
@@ -420,9 +416,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
420 pausing = true; 416 pausing = true;
421 417
422 pausetimer->start(PPPData::data()->busyWait()*1000, true); 418 pausetimer->start(_ifaceppp->data()->busyWait()*1000, true);
423 timeout_timer->stop(); 419 timeout_timer->stop();
424 } 420 }
425 421
426 Modem::modem->setDataMode(false); 422 _ifaceppp->modem()->setDataMode(false);
427 vmain = 0; 423 vmain = 0;
428 substate = -1; 424 substate = -1;
@@ -430,19 +426,19 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
430 } 426 }
431 427
432 if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) { 428 if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) {
433 timeout_timer->stop(); 429 timeout_timer->stop();
434 430
435 messg->setText(i18n("No Dialtone")); 431 messg->setText(i18n("No Dialtone"));
436 vmain = 20; 432 vmain = 20;
437 Modem::modem->unlockdevice(); 433 _ifaceppp->modem()->unlockdevice();
438 return; 434 return;
439 } 435 }
440 436
441 if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) { 437 if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) {
442 timeout_timer->stop(); 438 timeout_timer->stop();
443 439
444 messg->setText(i18n("No Carrier")); 440 messg->setText(i18n("No Carrier"));
445 vmain = 20; 441 vmain = 20;
446 Modem::modem->unlockdevice(); 442 _ifaceppp->modem()->unlockdevice();
447 return; 443 return;
448 } 444 }
@@ -452,5 +448,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
452 if(vmain == 101) { 448 if(vmain == 101) {
453 if(!expecting) { 449 if(!expecting) {
454 Modem::modem->setDataMode(true); // modem will no longer respond to AT commands 450 _ifaceppp->modem()->setDataMode(true); // modem will no longer respond to AT commands
455 451
456 emit startAccounting(); 452 emit startAccounting();
@@ -458,5 +454,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
458 454
459 vmain = 2; 455 vmain = 2;
460 scriptTimeout=PPPData::data()->modemTimeout()*1000; 456 scriptTimeout=_ifaceppp->data()->modemTimeout()*1000;
461 return; 457 return;
462 } 458 }
@@ -495,8 +491,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
495 491
496 if (scriptArgument.lower() == "password") { 492 if (scriptArgument.lower() == "password") {
497 PPPData::data()->setPassword(scanvar); 493 _ifaceppp->data()->setPassword(scanvar);
498 p_kppp->setPW_Edit(scanvar); 494 // p_kppp->setPW_Edit(scanvar);
499 if(PPPData::data()->storePassword()) 495 if(_ifaceppp->data()->storePassword())
500 PPPData::data()->setStoredPassword(scanvar); 496 _ifaceppp->data()->setStoredPassword(scanvar);
501 firstrunPW = true; 497 firstrunPW = true;
502 } 498 }
@@ -514,6 +510,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
514 QRegExp re1("%USERNAME%"); 510 QRegExp re1("%USERNAME%");
515 QRegExp re2("%PASSWORD%"); 511 QRegExp re2("%PASSWORD%");
516 arg = arg.replace(re1, PPPData::data()->storedUsername()); 512 arg = arg.replace(re1, _ifaceppp->data()->storedUsername());
517 arg = arg.replace(re2, PPPData::data()->storedPassword()); 513 arg = arg.replace(re2, _ifaceppp->data()->storedPassword());
518 514
519 if (scriptCommand == "Send") 515 if (scriptCommand == "Send")
@@ -579,6 +575,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
579 emit debugMessage(i18n("Hangup")); 575 emit debugMessage(i18n("Hangup"));
580 576
581 writeline(PPPData::data()->modemHangupStr()); 577 writeline(_ifaceppp->data()->modemHangupStr());
582 setExpect(PPPData::data()->modemHangupResp()); 578 setExpect(_ifaceppp->data()->modemHangupResp());
583 579
584 scriptindex++; 580 scriptindex++;
@@ -593,5 +589,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
593 emit debugMessage(i18n("Answer")); 589 emit debugMessage(i18n("Answer"));
594 590
595 setExpect(PPPData::data()->modemRingResp()); 591 setExpect(_ifaceppp->data()->modemRingResp());
596 vmain = 150; 592 vmain = 150;
597 return; 593 return;
@@ -603,5 +599,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
603 emit debugMessage(bm); 599 emit debugMessage(bm);
604 600
605 QString idstring = PPPData::data()->storedUsername(); 601 QString idstring = _ifaceppp->data()->storedUsername();
606 602
607 if(!idstring.isEmpty() && firstrunID) { 603 if(!idstring.isEmpty() && firstrunID) {
@@ -639,5 +635,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
639 emit debugMessage(bm); 635 emit debugMessage(bm);
640 636
641 QString pwstring = PPPData::data()->password(); 637 QString pwstring = _ifaceppp->data()->password();
642 638
643 if(!pwstring.isEmpty() && firstrunPW) { 639 if(!pwstring.isEmpty() && firstrunPW) {
@@ -660,5 +656,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
660 /* if prompt withdrawn ... then, */ 656 /* if prompt withdrawn ... then, */
661 if(!(prompt->isVisible())) { 657 if(!(prompt->isVisible())) {
662 p_kppp->setPW_Edit(prompt->text()); 658 // p_kppp->setPW_Edit(prompt->text());
663 writeline(prompt->text()); 659 writeline(prompt->text());
664 prompt->setConsumed(); 660 prompt->setConsumed();
@@ -786,6 +782,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
786 if(vmain == 150) { 782 if(vmain == 150) {
787 if(!expecting) { 783 if(!expecting) {
788 writeline(PPPData::data()->modemAnswerStr()); 784 writeline(_ifaceppp->data()->modemAnswerStr());
789 setExpect(PPPData::data()->modemAnswerResp()); 785 setExpect(_ifaceppp->data()->modemAnswerResp());
790 786
791 vmain = 2; 787 vmain = 2;
@@ -813,7 +809,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
813 809
814 // stop reading of data 810 // stop reading of data
815 Modem::modem->stop(); 811 _ifaceppp->modem()->stop();
816 812
817 if(PPPData::data()->authMethod() == AUTH_TERMINAL) { 813 if(_ifaceppp->data()->authMethod() == AUTH_TERMINAL) {
818 // if (termwindow) { 814 // if (termwindow) {
819 // delete termwindow; 815 // delete termwindow;
@@ -832,10 +828,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
832 // Modem::readtty() from re-enabling the socket notifier. 828 // Modem::readtty() from re-enabling the socket notifier.
833 // The port is still held open by the helper process. 829 // The port is still held open by the helper process.
834 Modem::modem->closetty(); 830 _ifaceppp->modem()->closetty();
835 831
836 killTimer( main_timer_ID ); 832 killTimer( main_timer_ID );
837 833
838 if_timeout_timer->start(PPPData::data()->pppdTimeout()*1000); 834 if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000);
839 qDebug( "started if timeout timer with %i", PPPData::data()->pppdTimeout()*1000); 835 qDebug( "started if timeout timer with %i", _ifaceppp->data()->pppdTimeout()*1000);
840 836
841 // find out PPP interface and notify the stats module 837 // find out PPP interface and notify the stats module
@@ -850,6 +846,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
850 846
851 if(result) { 847 if(result) {
852 if(!PPPData::data()->autoDNS()) 848 if(!_ifaceppp->data()->autoDNS())
853 adddns(); 849 adddns( _ifaceppp );
854 850
855 // O.K we are done here, let's change over to the if_waiting loop 851 // O.K we are done here, let's change over to the if_waiting loop
@@ -864,12 +860,12 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
864 this->hide(); 860 this->hide();
865 messg->setText(""); 861 messg->setText("");
866 p_kppp->quit_b->setFocus(); 862 //p_kppp->quit_b->setFocus();
867 p_kppp->show(); 863 //p_kppp->show();
868 qApp->processEvents(); 864 qApp->processEvents();
869 Modem::modem->hangup(); 865 _ifaceppp->modem()->hangup();
870 emit stopAccounting(); 866 emit stopAccounting();
871 //p_kppp->con_win->stopClock(); 867 //p_kppp->con_win->stopClock();
872 Modem::modem->closetty(); 868 _ifaceppp->modem()->closetty();
873 Modem::modem->unlockdevice(); 869 _ifaceppp->modem()->unlockdevice();
874 870
875 } 871 }
@@ -891,5 +887,5 @@ void ConnectWidget::set_con_speed_string() {
891 // CONNECT 115200, so all we need to do is find the number after CONNECT 887 // CONNECT 115200, so all we need to do is find the number after CONNECT
892 // or whatever the modemConnectResp() is. 888 // or whatever the modemConnectResp() is.
893 p_kppp->con_speed = Modem::modem->parseModemSpeed(myreadbuffer); 889// p_kppp->con_speed = _ifaceppp->modem()->parseModemSpeed(myreadbuffer);
894} 890}
895 891
@@ -970,5 +966,5 @@ void ConnectWidget::pause() {
970 966
971void ConnectWidget::cancelbutton() { 967void ConnectWidget::cancelbutton() {
972 Modem::modem->stop(); 968 _ifaceppp->modem()->stop();
973 killTimer(main_timer_ID); 969 killTimer(main_timer_ID);
974 timeout_timer->stop(); 970 timeout_timer->stop();
@@ -985,21 +981,21 @@ void ConnectWidget::cancelbutton() {
985 981
986 // just to be sure 982 // just to be sure
987 Modem::modem->removeSecret(AUTH_PAP); 983 _ifaceppp->modem()->removeSecret(AUTH_PAP);
988 Modem::modem->removeSecret(AUTH_CHAP); 984 _ifaceppp->modem()->removeSecret(AUTH_CHAP);
989 removedns(); 985 removedns(_ifaceppp);
990 986
991 qApp->processEvents(); 987 qApp->processEvents();
992 988
993 Modem::modem->killPPPDaemon(); 989 _ifaceppp->modem()->killPPPDaemon();
994 Modem::modem->hangup(); 990 _ifaceppp->modem()->hangup();
995 991
996 this->hide(); 992 this->hide();
997 messg->setText(""); 993 messg->setText("");
998 p_kppp->quit_b->setFocus(); 994// p_kppp->quit_b->setFocus();
999 p_kppp->show(); 995// p_kppp->show();
1000 emit stopAccounting();// just to be sure 996 emit stopAccounting();// just to be sure
1001// p_kppp->con_win->stopClock(); 997// p_kppp->con_win->stopClock();
1002 Modem::modem->closetty(); 998 _ifaceppp->modem()->closetty();
1003 Modem::modem->unlockdevice(); 999 _ifaceppp->modem()->unlockdevice();
1004 1000
1005 //abort prompt window... 1001 //abort prompt window...
@@ -1027,5 +1023,5 @@ void ConnectWidget::script_timed_out() {
1027 prompt->setConsumed(); 1023 prompt->setConsumed();
1028 messg->setText(i18n("Script timed out!")); 1024 messg->setText(i18n("Script timed out!"));
1029 Modem::modem->hangup(); 1025 _ifaceppp->modem()->hangup();
1030 emit stopAccounting(); 1026 emit stopAccounting();
1031// p_kppp->con_win->stopClock(); 1027// p_kppp->con_win->stopClock();
@@ -1064,8 +1060,8 @@ void ConnectWidget::if_waiting_timed_out() {
1064 qDebug("if_waiting_timed_out()"); 1060 qDebug("if_waiting_timed_out()");
1065 1061
1066 PPPData::data()->setpppdError(E_IF_TIMEOUT); 1062 _ifaceppp->data()->setpppdError(E_IF_TIMEOUT);
1067 1063
1068 // let's kill the stuck pppd 1064 // let's kill the stuck pppd
1069 Modem::modem->killPPPDaemon(); 1065 _ifaceppp->modem()->killPPPDaemon();
1070 1066
1071 emit stopAccounting(); 1067 emit stopAccounting();
@@ -1089,5 +1085,5 @@ void ConnectWidget::if_waiting_slot() {
1089// if(!stats->ifIsUp()) { 1085// if(!stats->ifIsUp()) {
1090 1086
1091// if(PPPData::data()->pppdError() != 0) { 1087// if(_ifaceppp->data()->pppdError() != 0) {
1092// // we are here if pppd died immediately after starting it. 1088// // we are here if pppd died immediately after starting it.
1093// pppdDied(); 1089// pppdDied();
@@ -1106,6 +1102,6 @@ void ConnectWidget::if_waiting_slot() {
1106 usleep(200000); 1102 usleep(200000);
1107 1103
1108 if(PPPData::data()->autoDNS()) 1104 if(_ifaceppp->data()->autoDNS())
1109 addpeerdns(); 1105 addpeerdns( _ifaceppp );
1110 1106
1111 // Close the debugging window. If we are connected, we 1107 // Close the debugging window. If we are connected, we
@@ -1113,18 +1109,18 @@ void ConnectWidget::if_waiting_slot() {
1113 emit closeDebugWindow(); 1109 emit closeDebugWindow();
1114// p_kppp->statdlg->take_stats(); // start taking ppp statistics 1110// p_kppp->statdlg->take_stats(); // start taking ppp statistics
1115 auto_hostname(); 1111 auto_hostname(_ifaceppp);
1116 1112
1117 if(!PPPData::data()->command_on_connect().isEmpty()) { 1113 if(!_ifaceppp->data()->command_on_connect().isEmpty()) {
1118 messg->setText(i18n("Running startup command...")); 1114 messg->setText(i18n("Running startup command..."));
1119 1115
1120 // make sure that we don't get any async errors 1116 // make sure that we don't get any async errors
1121 qApp->flushX(); 1117 qApp->flushX();
1122 execute_command(PPPData::data()->command_on_connect()); 1118 execute_command(_ifaceppp->data()->command_on_connect());
1123 messg->setText(i18n("Done")); 1119 messg->setText(i18n("Done"));
1124 } 1120 }
1125 1121
1126 // remove the authentication file 1122 // remove the authentication file
1127 Modem::modem->removeSecret(AUTH_PAP); 1123 _ifaceppp->modem()->removeSecret(AUTH_PAP);
1128 Modem::modem->removeSecret(AUTH_CHAP); 1124 _ifaceppp->modem()->removeSecret(AUTH_CHAP);
1129 1125
1130 emit debugMessage(i18n("Done")); 1126 emit debugMessage(i18n("Done"));
@@ -1142,18 +1138,18 @@ void ConnectWidget::if_waiting_slot() {
1142// p_kppp->con_win->accounting(false); 1138// p_kppp->con_win->accounting(false);
1143 1139
1144 if (PPPData::data()->get_dock_into_panel()) { 1140// if (_ifaceppp->data()->get_dock_into_panel()) {
1145// DockWidget::dock_widget->show(); 1141// // DockWidget::dock_widget->show();
1146// DockWidget::dock_widget->take_stats(); 1142// // DockWidget::dock_widget->take_stats();
1147// this->hide(); 1143// // this->hide();
1148 } 1144// }
1149 else { 1145// else {
1150// p_kppp->con_win->show(); 1146// // p_kppp->con_win->show();
1151 1147
1152 if(PPPData::data()->get_iconify_on_connect()) { 1148// if(_ifaceppp->data()->get_iconify_on_connect()) {
1153 // p_kppp->con_win->showMinimized(); 1149// // p_kppp->con_win->showMinimized();
1154 } 1150// }
1155 } 1151// }
1156 1152
1157 Modem::modem->closetty(); 1153 _ifaceppp->modem()->closetty();
1158} 1154}
1159 1155
@@ -1169,15 +1165,15 @@ bool ConnectWidget::execppp() {
1169 // which is the serial port we connected stdin/stdout to in opener.cpp. 1165 // which is the serial port we connected stdin/stdout to in opener.cpp.
1170 // command += " "; 1166 // command += " ";
1171 // command += PPPData::data()->modemDevice(); 1167 // command += _ifaceppp->data()->modemDevice();
1172 1168
1173 command += " " + PPPData::data()->speed(); 1169 command += " " + _ifaceppp->data()->speed();
1174 1170
1175 command += " -detach"; 1171 command += " -detach";
1176 1172
1177 if(PPPData::data()->ipaddr() != "0.0.0.0" || 1173 if(_ifaceppp->data()->ipaddr() != "0.0.0.0" ||
1178 PPPData::data()->gateway() != "0.0.0.0") { 1174 _ifaceppp->data()->gateway() != "0.0.0.0") {
1179 if(PPPData::data()->ipaddr() != "0.0.0.0") { 1175 if(_ifaceppp->data()->ipaddr() != "0.0.0.0") {
1180 command += " "; 1176 command += " ";
1181 command += PPPData::data()->ipaddr(); 1177 command += _ifaceppp->data()->ipaddr();
1182 command += ":"; 1178 command += ":";
1183 } 1179 }
@@ -1187,13 +1183,13 @@ bool ConnectWidget::execppp() {
1187 } 1183 }
1188 1184
1189 if(PPPData::data()->gateway() != "0.0.0.0") 1185 if(_ifaceppp->data()->gateway() != "0.0.0.0")
1190 command += PPPData::data()->gateway(); 1186 command += _ifaceppp->data()->gateway();
1191 } 1187 }
1192 1188
1193 if(PPPData::data()->subnetmask() != "0.0.0.0") 1189 if(_ifaceppp->data()->subnetmask() != "0.0.0.0")
1194 command += " netmask " + PPPData::data()->subnetmask(); 1190 command += " netmask " + _ifaceppp->data()->subnetmask();
1195 1191
1196 if(PPPData::data()->flowcontrol() != "None") { 1192 if(_ifaceppp->data()->flowcontrol() != "None") {
1197 if(PPPData::data()->flowcontrol() == "CRTSCTS") 1193 if(_ifaceppp->data()->flowcontrol() == "CRTSCTS")
1198 command += " crtscts"; 1194 command += " crtscts";
1199 else 1195 else
@@ -1201,11 +1197,11 @@ bool ConnectWidget::execppp() {
1201 } 1197 }
1202 1198
1203 if(PPPData::data()->defaultroute()) 1199 if(_ifaceppp->data()->defaultroute())
1204 command += " defaultroute"; 1200 command += " defaultroute";
1205 1201
1206 if(PPPData::data()->autoDNS()) 1202 if(_ifaceppp->data()->autoDNS())
1207 command += " usepeerdns"; 1203 command += " usepeerdns";
1208 1204
1209 QStringList &arglist = PPPData::data()->pppdArgument(); 1205 QStringList &arglist = _ifaceppp->data()->pppdArgument();
1210 for ( QStringList::Iterator it = arglist.begin(); 1206 for ( QStringList::Iterator it = arglist.begin();
1211 it != arglist.end(); 1207 it != arglist.end();
@@ -1216,23 +1212,23 @@ bool ConnectWidget::execppp() {
1216 1212
1217 // PAP settings 1213 // PAP settings
1218 if(PPPData::data()->authMethod() == AUTH_PAP) { 1214 if(_ifaceppp->data()->authMethod() == AUTH_PAP) {
1219 command += " -chap user "; 1215 command += " -chap user ";
1220 command = command + "\"" + PPPData::data()->storedUsername() + "\""; 1216 command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
1221 } 1217 }
1222 1218
1223 // CHAP settings 1219 // CHAP settings
1224 if(PPPData::data()->authMethod() == AUTH_CHAP) { 1220 if(_ifaceppp->data()->authMethod() == AUTH_CHAP) {
1225 command += " -pap user "; 1221 command += " -pap user ";
1226 command = command + "\"" + PPPData::data()->storedUsername() + "\""; 1222 command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
1227 } 1223 }
1228 1224
1229 // PAP/CHAP settings 1225 // PAP/CHAP settings
1230 if(PPPData::data()->authMethod() == AUTH_PAPCHAP) { 1226 if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) {
1231 command += " user "; 1227 command += " user ";
1232 command = command + "\"" + PPPData::data()->storedUsername() + "\""; 1228 command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
1233 } 1229 }
1234 1230
1235 // check for debug 1231 // check for debug
1236 if(PPPData::data()->getPPPDebug()) 1232 if(_ifaceppp->data()->getPPPDebug())
1237 command += " debug"; 1233 command += " debug";
1238 1234
@@ -1248,5 +1244,5 @@ bool ConnectWidget::execppp() {
1248 qApp->flushX(); 1244 qApp->flushX();
1249 1245
1250 return Modem::modem->execPPPDaemon(command); 1246 return _ifaceppp->modem()->execPPPDaemon(command);
1251} 1247}
1252 1248
@@ -1263,9 +1259,9 @@ void ConnectWidget::setMsg(const QString &msg) {
1263 1259
1264void ConnectWidget::writeline(const QString &s) { 1260void ConnectWidget::writeline(const QString &s) {
1265 Modem::modem->writeLine(s.local8Bit()); 1261 _ifaceppp->modem()->writeLine(s.local8Bit());
1266} 1262}
1267 1263
1268// Set the hostname and domain from DNS Server 1264// Set the hostname and domain from DNS Server
1269void auto_hostname() { 1265void auto_hostname(InterfacePPP *_ifaceppp) {
1270 struct in_addr local_ip; 1266 struct in_addr local_ip;
1271 struct hostent *hostname_entry; 1267 struct hostent *hostname_entry;
@@ -1278,6 +1274,6 @@ void auto_hostname() {
1278 old_hostname=tmp_str; // copy to QString 1274 old_hostname=tmp_str; // copy to QString
1279 1275
1280 // if (!p_kppp->stats->local_ip_address.isEmpty() && PPPData::data()->autoname()) { 1276 // if (!p_kppp->stats->local_ip_address.isEmpty() && _ifaceppp->data()->autoname()) {
1281 if ( PPPData::data()->autoname()) { 1277 if ( _ifaceppp->data()->autoname()) {
1282// local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii()); 1278// 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); 1279 hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET);
@@ -1287,5 +1283,5 @@ void auto_hostname() {
1287 dot=new_hostname.find('.'); 1283 dot=new_hostname.find('.');
1288 new_hostname=new_hostname.remove(dot,new_hostname.length()-dot); 1284 new_hostname=new_hostname.remove(dot,new_hostname.length()-dot);
1289 Modem::modem->setHostname(new_hostname); 1285 _ifaceppp->modem()->setHostname(new_hostname);
1290 modified_hostname = TRUE; 1286 modified_hostname = TRUE;
1291 1287
@@ -1293,5 +1289,5 @@ void auto_hostname() {
1293 new_hostname.remove(0,dot+1); 1289 new_hostname.remove(0,dot+1);
1294 1290
1295 add_domain(new_hostname); 1291 add_domain(new_hostname, _ifaceppp);
1296 } 1292 }
1297 } 1293 }
@@ -1301,5 +1297,5 @@ void auto_hostname() {
1301// Replace the DNS domain entry in the /etc/resolv.conf file and 1297// Replace the DNS domain entry in the /etc/resolv.conf file and
1302// disable the nameserver entries if option is enabled 1298// disable the nameserver entries if option is enabled
1303void add_domain(const QString &domain) { 1299void add_domain(const QString &domain, InterfacePPP *_ifaceppp) {
1304 1300
1305 int fd; 1301 int fd;
@@ -1310,5 +1306,5 @@ void add_domain(const QString &domain) {
1310 return; 1306 return;
1311 1307
1312 if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { 1308 if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) {
1313 1309
1314 int i=0; 1310 int i=0;
@@ -1324,5 +1320,5 @@ void add_domain(const QString &domain) {
1324 if ((c != '\n') && (i < MAX_RESOLVCONF_LINES)) i++; 1320 if ((c != '\n') && (i < MAX_RESOLVCONF_LINES)) i++;
1325 1321
1326 if((fd = Modem::modem->openResolv(O_WRONLY|O_TRUNC)) >= 0) { 1322 if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_TRUNC)) >= 0) {
1327 QCString tmp = "domain " + domain.local8Bit() + 1323 QCString tmp = "domain " + domain.local8Bit() +
1328 " \t\t#kppp temp entry\n"; 1324 " \t\t#kppp temp entry\n";
@@ -1333,5 +1329,5 @@ void add_domain(const QString &domain) {
1333 ( resolv[j].contains("nameserver") 1329 ( resolv[j].contains("nameserver")
1334 && !resolv[j].contains("#kppp temp entry") 1330 && !resolv[j].contains("#kppp temp entry")
1335 && PPPData::data()->exDNSDisabled())) 1331 && _ifaceppp->data()->exDNSDisabled()))
1336 && !resolv[j].contains("#entry disabled by kppp")) { 1332 && !resolv[j].contains("#entry disabled by kppp")) {
1337 QCString tmp = "# " + resolv[j].local8Bit() + 1333 QCString tmp = "# " + resolv[j].local8Bit() +
@@ -1351,10 +1347,10 @@ void add_domain(const QString &domain) {
1351 1347
1352// adds the DNS entries in the /etc/resolv.conf file 1348// adds the DNS entries in the /etc/resolv.conf file
1353void adddns() 1349void adddns( InterfacePPP *_ifaceppp)
1354{ 1350{
1355 int fd; 1351 int fd;
1356 1352
1357 if ((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { 1353 if ((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_APPEND)) >= 0) {
1358 QStringList &dnslist = PPPData::data()->dns(); 1354 QStringList &dnslist = _ifaceppp->data()->dns();
1359 for ( QStringList::Iterator it = dnslist.begin(); 1355 for ( QStringList::Iterator it = dnslist.begin();
1360 it != dnslist.end(); 1356 it != dnslist.end();
@@ -1367,11 +1363,11 @@ void adddns()
1367 close(fd); 1363 close(fd);
1368 } 1364 }
1369 add_domain(PPPData::data()->domain()); 1365 add_domain(_ifaceppp->data()->domain(), _ifaceppp);
1370} 1366}
1371 1367
1372void addpeerdns() { 1368void addpeerdns(InterfacePPP *_ifaceppp) {
1373 int fd, fd2; 1369 int fd, fd2;
1374 1370
1375 if((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { 1371 if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_APPEND)) >= 0) {
1376 if((fd2 = open("/etc/ppp/resolv.conf", O_RDONLY)) >= 0) { 1372 if((fd2 = open("/etc/ppp/resolv.conf", O_RDONLY)) >= 0) {
1377 char c; 1373 char c;
@@ -1388,9 +1384,9 @@ void addpeerdns() {
1388 close(fd); 1384 close(fd);
1389 } 1385 }
1390 add_domain(PPPData::data()->domain()); 1386 add_domain(_ifaceppp->data()->domain(), _ifaceppp);
1391} 1387}
1392 1388
1393// remove the dns entries from the /etc/resolv.conf file 1389// remove the dns entries from the /etc/resolv.conf file
1394void removedns() { 1390void removedns(InterfacePPP *_ifaceppp) {
1395 1391
1396 int fd; 1392 int fd;
@@ -1398,5 +1394,5 @@ void removedns() {
1398 QString resolv[MAX_RESOLVCONF_LINES]; 1394 QString resolv[MAX_RESOLVCONF_LINES];
1399 1395
1400 if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { 1396 if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) {
1401 1397
1402 int i=0; 1398 int i=0;
@@ -1411,5 +1407,5 @@ void removedns() {
1411 close(fd); 1407 close(fd);
1412 1408
1413 if((fd = Modem::modem->openResolv(O_WRONLY|O_TRUNC)) >= 0) { 1409 if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_TRUNC)) >= 0) {
1414 for(int j=0; j < i; j++) { 1410 for(int j=0; j < i; j++) {
1415 if(resolv[j].contains("#kppp temp entry")) continue; 1411 if(resolv[j].contains("#kppp temp entry")) continue;
@@ -1430,5 +1426,5 @@ void removedns() {
1430 1426
1431 if ( modified_hostname ) { 1427 if ( modified_hostname ) {
1432 Modem::modem->setHostname(old_hostname); 1428 _ifaceppp->modem()->setHostname(old_hostname);
1433 modified_hostname = FALSE; 1429 modified_hostname = FALSE;
1434 } 1430 }
diff --git a/noncore/settings/networksettings/ppp/connect.h b/noncore/settings/networksettings/ppp/connect.h
index 3127236..e7ae5e0 100644
--- a/noncore/settings/networksettings/ppp/connect.h
+++ b/noncore/settings/networksettings/ppp/connect.h
@@ -37,15 +37,15 @@
37#include "kpppconfig.h" 37#include "kpppconfig.h"
38#include "pwentry.h" 38#include "pwentry.h"
39//#include "docking.h" 39
40//#include "loginterm.h"
41 40
42#define MAXLOOPNEST (MAX_SCRIPT_ENTRIES/2) 41#define MAXLOOPNEST (MAX_SCRIPT_ENTRIES/2)
43 42
44class PPPStats; 43class InterfacePPP;
44class PPPData;
45 45
46class ConnectWidget : public QWidget { 46class ConnectWidget : public QWidget {
47 Q_OBJECT 47 Q_OBJECT
48public: 48public:
49 ConnectWidget(QWidget *parent, const char *name); 49 ConnectWidget(InterfacePPP*, QWidget *parent, const char *name);
50 ~ConnectWidget(); 50 ~ConnectWidget();
51 51
@@ -137,15 +137,15 @@ private:
137 unsigned int dialnumber; // the current number to dial 137 unsigned int dialnumber; // the current number to dial
138 138
139// PPPStats *stats; 139 InterfacePPP *_ifaceppp;
140}; 140};
141 141
142 142
143// non-member function to kill&wait on the pppd child process 143// non-member function to kill&wait on the pppd child process
144extern void killppp(); 144extern void killppp(PPPData*);
145void adddns(); 145void adddns(InterfacePPP*);
146void addpeerdns(); 146void addpeerdns(InterfacePPP*);
147void removedns(); 147void removedns(InterfacePPP*);
148void add_domain(const QString & newdomain); 148void add_domain(const QString & newdomain, InterfacePPP*);
149void auto_hostname(); 149void auto_hostname(InterfacePPP*);
150 150
151#endif 151#endif
diff --git a/noncore/settings/networksettings/ppp/conwindow.cpp b/noncore/settings/networksettings/ppp/conwindow.cpp
index 20d705d..9136ca0 100644
--- a/noncore/settings/networksettings/ppp/conwindow.cpp
+++ b/noncore/settings/networksettings/ppp/conwindow.cpp
@@ -32,8 +32,7 @@
32// #include <kglobal.h> 32// #include <kglobal.h>
33 33
34extern PPPData gpppdata;
35 34
36ConWindow::ConWindow(QWidget *parent, const char *name, QDialog *mainwidget ) 35ConWindow::ConWindow(PPPData *pd, QWidget *parent, const char *name,
37 // PPPStats *st) 36 QDialog *mainwidget )
38 : QWidget(parent, name, 0), 37 : QWidget(parent, name, 0),
39 minutes(0), 38 minutes(0),
@@ -42,7 +41,5 @@ ConWindow::ConWindow(QWidget *parent, const char *name, QDialog *mainwidget )
42 days(0), 41 days(0),
43 tl1(0), 42 tl1(0),
44// stats(st), 43 _pppdata(pd)
45 accountingEnabled(false),
46 volumeAccountingEnabled(false)
47{ 44{
48 info1 = new QLabel(i18n("Connected at:"), this); 45 info1 = new QLabel(i18n("Connected at:"), this);
@@ -116,120 +113,120 @@ QString ConWindow::prettyPrintVolume(unsigned int n) {
116} 113}
117 114
118void ConWindow::accounting(bool on) { 115// void ConWindow::accounting(bool on) {
119 // cache accounting settings 116// // cache accounting settings
120 accountingEnabled = on; 117// accountingEnabled = on;
121 volumeAccountingEnabled = PPPData::data()->VolAcctEnabled(); 118// // volumeAccountingEnabled = PPPData::data()->VolAcctEnabled();
122
123 // delete old layout
124 if(tl1 != 0)
125 delete tl1;
126
127 // add layout now
128 tl1 = new QVBoxLayout(this, 10, 10);
129 tl1->addSpacing(5);
130 QHBoxLayout *tl = new QHBoxLayout;
131 tl1->addLayout(tl);
132 tl->addSpacing(20);
133 QGridLayout *l1;
134
135 int vol_lines = 0;
136 if(PPPData::data()->VolAcctEnabled())
137 vol_lines = 1;
138
139 if(accountingEnabled)
140 l1 = new QGridLayout(4 + vol_lines, 2, 5);
141 else
142 l1 = new QGridLayout(2 + vol_lines, 2, 5);
143 tl->addLayout(l1);
144 l1->setColStretch(0, 0);
145 l1->setColStretch(1, 1);
146
147 info2->setAlignment(AlignRight|AlignVCenter);
148 timelabel2->setAlignment(AlignRight|AlignVCenter);
149 session_bill->setAlignment(AlignRight|AlignVCenter);
150 total_bill->setAlignment(AlignRight|AlignVCenter);
151 volinfo->setAlignment(AlignRight|AlignVCenter);
152 // make sure that there's enough space for the bills
153 QString s1 = session_bill->text();
154 QString s2 = total_bill->text();
155 QString s3 = volinfo->text();
156
157 session_bill->setText("888888.88 XXX");
158 total_bill->setText("888888.88 XXX");
159 volinfo->setText("8888.8 MB");
160 session_bill->setFixedSize(session_bill->sizeHint());
161 total_bill->setFixedSize(total_bill->sizeHint());
162 volinfo->setFixedSize(volinfo->sizeHint());
163 session_bill->setText(s1);
164 total_bill->setText(s2);
165 volinfo->setText(s3);
166
167 l1->addWidget(info1, 0, 0);
168 l1->addWidget(info2, 0, 1);
169 l1->addWidget(timelabel1, 1, 0);
170 l1->addWidget(timelabel2, 1, 1);
171 if(accountingEnabled) {
172 session_bill_l->show();
173 session_bill->show();
174 total_bill_l->show();
175 total_bill->show();
176 l1->addWidget(session_bill_l, 2, 0);
177 l1->addWidget(session_bill, 2, 1);
178 l1->addWidget(total_bill_l, 3, 0);
179 l1->addWidget(total_bill, 3, 1);
180
181 if(volumeAccountingEnabled) {
182 vollabel->show();
183 volinfo->show();
184 l1->addWidget(vollabel, 4, 0);
185 l1->addWidget(volinfo, 4, 1);
186 } else {
187 vollabel->hide();
188 volinfo->hide();
189 }
190
191 } else {
192 session_bill_l->hide();
193 session_bill->hide();
194 total_bill_l->hide();
195 total_bill->hide();
196
197 if(volumeAccountingEnabled) {
198 vollabel->show();
199 volinfo->show();
200 l1->addWidget(vollabel, 2, 0);
201 l1->addWidget(volinfo, 2, 1);
202 } else {
203 vollabel->hide();
204 volinfo->hide();
205 }
206 }
207 119
208 tl->addSpacing(10); 120// // delete old layout
209 QVBoxLayout *l2 = new QVBoxLayout(5); 121// if(tl1 != 0)
210 tl->addLayout(l2); 122// delete tl1;
211 l2->addStretch(1);
212// l2->addWidget(statsbutton);
213 l2->addWidget(cancelbutton);
214 123
215 l2->addStretch(1); 124// // add layout now
125// tl1 = new QVBoxLayout(this, 10, 10);
126// tl1->addSpacing(5);
127// QHBoxLayout *tl = new QHBoxLayout;
128// tl1->addLayout(tl);
129// tl->addSpacing(20);
130// QGridLayout *l1;
216 131
217 tl1->addSpacing(5); 132// int vol_lines = 0;
133// // if(_pppdata->VolAcctEnabled())
134// // vol_lines = 1;
218 135
219 setFixedSize(sizeHint()); 136// if(accountingEnabled)
220/* 137// l1 = new QGridLayout(4 + vol_lines, 2, 5);
221 do not overwrite position read from config 138// else
222 setGeometry((QApplication::desktop()->width() - width()) / 2, 139// l1 = new QGridLayout(2 + vol_lines, 2, 5);
223 (QApplication::desktop()->height() - height())/2, 140// tl->addLayout(l1);
224 width(), 141// l1->setColStretch(0, 0);
225 height()); 142// l1->setColStretch(1, 1);
226*/ 143
227} 144// info2->setAlignment(AlignRight|AlignVCenter);
145// timelabel2->setAlignment(AlignRight|AlignVCenter);
146// session_bill->setAlignment(AlignRight|AlignVCenter);
147// total_bill->setAlignment(AlignRight|AlignVCenter);
148// volinfo->setAlignment(AlignRight|AlignVCenter);
149// // make sure that there's enough space for the bills
150// QString s1 = session_bill->text();
151// QString s2 = total_bill->text();
152// QString s3 = volinfo->text();
153
154// session_bill->setText("888888.88 XXX");
155// total_bill->setText("888888.88 XXX");
156// volinfo->setText("8888.8 MB");
157// session_bill->setFixedSize(session_bill->sizeHint());
158// total_bill->setFixedSize(total_bill->sizeHint());
159// volinfo->setFixedSize(volinfo->sizeHint());
160// session_bill->setText(s1);
161// total_bill->setText(s2);
162// volinfo->setText(s3);
163
164// l1->addWidget(info1, 0, 0);
165// l1->addWidget(info2, 0, 1);
166// l1->addWidget(timelabel1, 1, 0);
167// l1->addWidget(timelabel2, 1, 1);
168// if(accountingEnabled) {
169// session_bill_l->show();
170// session_bill->show();
171// total_bill_l->show();
172// total_bill->show();
173// l1->addWidget(session_bill_l, 2, 0);
174// l1->addWidget(session_bill, 2, 1);
175// l1->addWidget(total_bill_l, 3, 0);
176// l1->addWidget(total_bill, 3, 1);
177
178// if(volumeAccountingEnabled) {
179// vollabel->show();
180// volinfo->show();
181// l1->addWidget(vollabel, 4, 0);
182// l1->addWidget(volinfo, 4, 1);
183// } else {
184// vollabel->hide();
185// volinfo->hide();
186// }
187
188// } else {
189// session_bill_l->hide();
190// session_bill->hide();
191// total_bill_l->hide();
192// total_bill->hide();
193
194// if(volumeAccountingEnabled) {
195// vollabel->show();
196// volinfo->show();
197// l1->addWidget(vollabel, 2, 0);
198// l1->addWidget(volinfo, 2, 1);
199// } else {
200// vollabel->hide();
201// volinfo->hide();
202// }
203// }
228 204
205// tl->addSpacing(10);
206// QVBoxLayout *l2 = new QVBoxLayout(5);
207// tl->addLayout(l2);
208// l2->addStretch(1);
209// // l2->addWidget(statsbutton);
210// l2->addWidget(cancelbutton);
229 211
230void ConWindow::dock() { 212// l2->addStretch(1);
231// DockWidget::dock_widget->show(); 213
232 this->hide(); 214// tl1->addSpacing(5);
233} 215
216// setFixedSize(sizeHint());
217// /*
218// do not overwrite position read from config
219// setGeometry((QApplication::desktop()->width() - width()) / 2,
220 // (QApplication::desktop()->height() - height())/2,
221 // width(),
222 // height());
223// */
224// }
225
226
227// void ConWindow::dock() {
228// // DockWidget::dock_widget->show();
229// this->hide();
230// }
234 231
235 232
@@ -240,7 +237,7 @@ void ConWindow::startClock() {
240 QString title ; 237 QString title ;
241 238
242 title = PPPData::data()->accname(); 239 title = _pppdata->accname();
243 240
244 if(PPPData::data()->get_show_clock_on_caption()){ 241 if(_pppdata->get_show_clock_on_caption()){
245 title += " 00:00" ; 242 title += " 00:00" ;
246 } 243 }
@@ -266,5 +263,5 @@ void ConWindow::timeclick() {
266 // "Connected at: %2\n" 263 // "Connected at: %2\n"
267 // "Time connected: %3") 264 // "Time connected: %3")
268 // .arg(PPPData::data()->accname()).arg(info2->text()) 265 // .arg(_pppdata->accname()).arg(info2->text())
269 // .arg(time_string2); 266 // .arg(time_string2);
270 267
@@ -276,5 +273,5 @@ void ConWindow::timeclick() {
276 273
277// volinfo->setEnabled(TRUE); 274// volinfo->setEnabled(TRUE);
278// int bytes = PPPData::data()->totalBytes(); 275// int bytes = _pppdata->totalBytes();
279// volinfo->setText(prettyPrintVolume(bytes)); 276// volinfo->setText(prettyPrintVolume(bytes));
280// } 277// }
@@ -306,5 +303,5 @@ void ConWindow::timeclick() {
306// time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds); 303// time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
307 304
308// caption_string = PPPData::data()->accname(); 305// caption_string = _pppdata->accname();
309// caption_string += " "; 306// caption_string += " ";
310// caption_string += time_string; 307// caption_string += time_string;
@@ -313,5 +310,5 @@ void ConWindow::timeclick() {
313// timelabel2->setText(time_string2); 310// timelabel2->setText(time_string2);
314 311
315// if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){ 312// if(_pppdata->get_show_clock_on_caption() && (seconds == 1)){
316// // we update the Caption only once per minute not every second 313// // we update the Caption only once per minute not every second
317// // otherwise I get a flickering icon 314// // otherwise I get a flickering icon
@@ -329,6 +326,6 @@ void ConWindow::closeEvent( QCloseEvent *e ){
329 e->ignore(); 326 e->ignore();
330 327
331 if(PPPData::data()->get_dock_into_panel()) 328// if(_pppdata->get_dock_into_panel())
332 dock(); 329// dock();
333} 330}
334 331
diff --git a/noncore/settings/networksettings/ppp/conwindow.h b/noncore/settings/networksettings/ppp/conwindow.h
index 20d3579..42c6f35 100644
--- a/noncore/settings/networksettings/ppp/conwindow.h
+++ b/noncore/settings/networksettings/ppp/conwindow.h
@@ -35,5 +35,5 @@
35#include <qlayout.h> 35#include <qlayout.h>
36 36
37//class PPPStats; 37class PPPData;
38 38
39class ConWindow : public QWidget { 39class ConWindow : public QWidget {
@@ -41,5 +41,5 @@ Q_OBJECT
41 41
42public: 42public:
43 ConWindow(QWidget *parent, const char *name, QDialog* ); 43 ConWindow(PPPData*, QWidget *parent, const char *name, QDialog* );
44 ~ConWindow(); 44 ~ConWindow();
45 45
@@ -50,5 +50,5 @@ protected:
50private slots: 50private slots:
51 void timeclick(); 51 void timeclick();
52 void dock(); 52// void dock();
53 53
54public: 54public:
@@ -56,5 +56,5 @@ public:
56 void startClock(); 56 void startClock();
57 void stopClock(); 57 void stopClock();
58 void accounting(bool); // show/ hide accounting info 58// void accounting(bool); // show/ hide accounting info
59 59
60public slots: 60public slots:
@@ -83,7 +83,5 @@ private:
83 QLabel *vollabel; 83 QLabel *vollabel;
84 QLabel *volinfo; 84 QLabel *volinfo;
85// PPPStats *stats; 85 PPPData *_pppdata;
86 bool accountingEnabled;
87 bool volumeAccountingEnabled;
88}; 86};
89 87
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index eee643d..8ae714e 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -46,6 +46,7 @@
46#include "auth.h" 46#include "auth.h"
47 47
48DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) 48DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
49 : QWidget(parent, name) 49 , const char *name )
50 : QWidget(parent, name), _pppdata(pd)
50{ 51{
51 const int GRIDROWS = 6; 52 const int GRIDROWS = 6;
@@ -155,8 +156,8 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name )
155 // Set defaults if editing an existing connection 156 // Set defaults if editing an existing connection
156 if(!isnewaccount) { 157 if(!isnewaccount) {
157 connectname_l->setText(PPPData::data()->accname()); 158 connectname_l->setText(_pppdata->accname());
158 159
159 // insert the phone numbers into the listbox 160 // insert the phone numbers into the listbox
160 QString n = PPPData::data()->phonenumber(); 161 QString n = _pppdata->phonenumber();
161 QString tmp = ""; 162 QString tmp = "";
162 uint idx = 0; 163 uint idx = 0;
@@ -173,6 +174,6 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name )
173 numbers->insertItem(tmp); 174 numbers->insertItem(tmp);
174 175
175 auth->setCurrentItem(PPPData::data()->authMethod()); 176 auth->setCurrentItem(_pppdata->authMethod());
176 store_password->setChecked(PPPData::data()->storePassword()); 177 store_password->setChecked(_pppdata->storePassword());
177 } else { 178 } else {
178 // select PAP/CHAP as default 179 // select PAP/CHAP as default
@@ -188,8 +189,8 @@ bool DialWidget::save() {
188 //first check to make sure that the account name is unique! 189 //first check to make sure that the account name is unique!
189 if(connectname_l->text().isEmpty() || 190 if(connectname_l->text().isEmpty() ||
190 !PPPData::data()->isUniqueAccname(connectname_l->text())) { 191 !_pppdata->isUniqueAccname(connectname_l->text())) {
191 return false; 192 return false;
192 } else { 193 } else {
193 PPPData::data()->setAccname(connectname_l->text()); 194 _pppdata->setAccname(connectname_l->text());
194 195
195 QString number = ""; 196 QString number = "";
@@ -200,7 +201,7 @@ bool DialWidget::save() {
200 } 201 }
201 202
202 PPPData::data()->setPhonenumber(number); 203 _pppdata->setPhonenumber(number);
203 PPPData::data()->setAuthMethod(auth->currentItem()); 204 _pppdata->setAuthMethod(auth->currentItem());
204 PPPData::data()->setStorePassword(store_password->isChecked()); 205 _pppdata->setStorePassword(store_password->isChecked());
205 return true; 206 return true;
206 } 207 }
@@ -223,5 +224,5 @@ void DialWidget::selectionChanged(int) {
223 224
224void DialWidget::addNumber() { 225void DialWidget::addNumber() {
225 PhoneNumberDialog dlg(this); 226 PhoneNumberDialog dlg(this);
226 if(dlg.exec()) { 227 if(dlg.exec()) {
227 numbers->insertItem(dlg.phoneNumber()); 228 numbers->insertItem(dlg.phoneNumber());
@@ -264,5 +265,5 @@ void DialWidget::downNumber() {
264 265
265void DialWidget::pppdargsbutton() { 266void DialWidget::pppdargsbutton() {
266 PPPdArguments pa(this); 267 PPPdArguments pa(_pppdata, this);
267 pa.exec(); 268 pa.exec();
268} 269}
@@ -273,6 +274,6 @@ void DialWidget::pppdargsbutton() {
273// ExecWidget 274// ExecWidget
274///////////////////////////////////////////////////////////////////////////// 275/////////////////////////////////////////////////////////////////////////////
275ExecWidget::ExecWidget(QWidget *parent, bool isnewaccount, const char *name) : 276ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) :
276 QWidget(parent, name) 277 QWidget(parent, name), _pppdata(pd)
277{ 278{
278 QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); 279 QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
@@ -361,8 +362,8 @@ i18n("Here you can select commands to run at certain stages of the\n"
361 // Set defaults if editing an existing connection 362 // Set defaults if editing an existing connection
362 if(!isnewaccount) { 363 if(!isnewaccount) {
363 before_connect->setText(PPPData::data()->command_before_connect()); 364 before_connect->setText(_pppdata->command_before_connect());
364 command->setText(PPPData::data()->command_on_connect()); 365 command->setText(_pppdata->command_on_connect());
365 discommand->setText(PPPData::data()->command_on_disconnect()); 366 discommand->setText(_pppdata->command_on_disconnect());
366 predisconnect->setText(PPPData::data()->command_before_disconnect()); 367 predisconnect->setText(_pppdata->command_before_disconnect());
367 } 368 }
368} 369}
@@ -370,8 +371,8 @@ i18n("Here you can select commands to run at certain stages of the\n"
370 371
371bool ExecWidget::save() { 372bool ExecWidget::save() {
372 PPPData::data()->setCommand_before_connect(before_connect->text()); 373 _pppdata->setCommand_before_connect(before_connect->text());
373 PPPData::data()->setCommand_on_connect(command->text()); 374 _pppdata->setCommand_on_connect(command->text());
374 PPPData::data()->setCommand_before_disconnect(predisconnect->text()); 375 _pppdata->setCommand_before_disconnect(predisconnect->text());
375 PPPData::data()->setCommand_on_disconnect(discommand->text()); 376 _pppdata->setCommand_on_disconnect(discommand->text());
376 return true; 377 return true;
377} 378}
@@ -384,6 +385,6 @@ bool ExecWidget::save() {
384// 385//
385///////////////////////////////////////////////////////////////////////////// 386/////////////////////////////////////////////////////////////////////////////
386IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) 387IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
387 : QWidget(parent, name) 388 : QWidget(parent, name), _pppdata(pd)
388{ 389{
389 QVBoxLayout *topLayout = new QVBoxLayout(this); 390 QVBoxLayout *topLayout = new QVBoxLayout(this);
@@ -450,5 +451,5 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name )
450 451
451 autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), this); 452 autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), this);
452 autoname->setChecked(PPPData::data()->autoname()); 453 autoname->setChecked(_pppdata->autoname());
453 connect(autoname,SIGNAL(toggled(bool)), 454 connect(autoname,SIGNAL(toggled(bool)),
454 this,SLOT(autoname_t(bool))); 455 this,SLOT(autoname_t(bool)));
@@ -470,13 +471,13 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name )
470 //load info from gpppdata 471 //load info from gpppdata
471 if(!isnewaccount) { 472 if(!isnewaccount) {
472 if(PPPData::data()->ipaddr() == "0.0.0.0" && 473 if(_pppdata->ipaddr() == "0.0.0.0" &&
473 PPPData::data()->subnetmask() == "0.0.0.0") { 474 _pppdata->subnetmask() == "0.0.0.0") {
474 dynamicadd_rb->setChecked(true); 475 dynamicadd_rb->setChecked(true);
475 hitIPSelect(0); 476 hitIPSelect(0);
476 autoname->setChecked(PPPData::data()->autoname()); 477 autoname->setChecked(_pppdata->autoname());
477 } 478 }
478 else { 479 else {
479 ipaddress_l->setText(PPPData::data()->ipaddr()); 480 ipaddress_l->setText(_pppdata->ipaddr());
480 subnetmask_l->setText(PPPData::data()->subnetmask()); 481 subnetmask_l->setText(_pppdata->subnetmask());
481 staticadd_rb->setChecked(true); 482 staticadd_rb->setChecked(true);
482 autoname->setChecked(false); 483 autoname->setChecked(false);
@@ -511,11 +512,11 @@ void IPWidget::autoname_t(bool on) {
511void IPWidget::save() { 512void IPWidget::save() {
512 if(dynamicadd_rb->isChecked()) { 513 if(dynamicadd_rb->isChecked()) {
513 PPPData::data()->setIpaddr("0.0.0.0"); 514 _pppdata->setIpaddr("0.0.0.0");
514 PPPData::data()->setSubnetmask("0.0.0.0"); 515 _pppdata->setSubnetmask("0.0.0.0");
515 } else { 516 } else {
516 PPPData::data()->setIpaddr(ipaddress_l->text()); 517 _pppdata->setIpaddr(ipaddress_l->text());
517 PPPData::data()->setSubnetmask(subnetmask_l->text()); 518 _pppdata->setSubnetmask(subnetmask_l->text());
518 } 519 }
519 PPPData::data()->setAutoname(autoname->isChecked()); 520 _pppdata->setAutoname(autoname->isChecked());
520} 521}
521 522
@@ -538,6 +539,6 @@ void IPWidget::hitIPSelect( int i ) {
538 539
539 540
540DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) 541DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
541 : QWidget(parent, name) 542 : QWidget(parent, name), _pppdata(pd)
542{ 543{
543 // box = new QGroupBox(this); 544 // box = new QGroupBox(this);
@@ -573,5 +574,5 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
573 tl->addWidget(autodns, 1, 1); 574 tl->addWidget(autodns, 1, 1);
574 // no automatic DNS detection for pppd < 2.3.7 575 // no automatic DNS detection for pppd < 2.3.7
575 if(!PPPData::data()->pppdVersionMin(2, 3, 7)) 576 if(!_pppdata->pppdVersionMin(2, 3, 7))
576 autodns->setEnabled(false); 577 autodns->setEnabled(false);
577 578
@@ -646,5 +647,5 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
646"Disable existing DNS servers during connection"), 647"Disable existing DNS servers during connection"),
647 this); 648 this);
648 exdnsdisabled_toggle->setChecked(PPPData::data()->exDNSDisabled()); 649 exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled());
649 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); 650 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter);
650 QWhatsThis::add(exdnsdisabled_toggle, 651 QWhatsThis::add(exdnsdisabled_toggle,
@@ -662,9 +663,9 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
662 // restore data if editing 663 // restore data if editing
663 if(!isnewaccount) { 664 if(!isnewaccount) {
664 dnsservers->insertStringList(PPPData::data()->dns()); 665 dnsservers->insertStringList(_pppdata->dns());
665 dnsdomain->setText(PPPData::data()->domain()); 666 dnsdomain->setText(_pppdata->domain());
666 } 667 }
667 668
668 int mode = PPPData::data()->autoDNS() ? 0 : 1; 669 int mode = _pppdata->autoDNS() ? 0 : 1;
669 bg->setButton(mode); 670 bg->setButton(mode);
670 DNS_Mode_Selected(mode); 671 DNS_Mode_Selected(mode);
@@ -696,18 +697,18 @@ void DNSWidget::DNS_Mode_Selected(int mode) {
696 697
697void DNSWidget::save() { 698void DNSWidget::save() {
698 PPPData::data()->setAutoDNS(bg->id(bg->selected()) == 0); 699 _pppdata->setAutoDNS(bg->id(bg->selected()) == 0);
699 QStringList serverlist; 700 QStringList serverlist;
700 for(uint i=0; i < dnsservers->count(); i++) 701 for(uint i=0; i < dnsservers->count(); i++)
701 serverlist.append(dnsservers->text(i)); 702 serverlist.append(dnsservers->text(i));
702 PPPData::data()->setDns(serverlist); 703 _pppdata->setDns(serverlist);
703 704
704 // strip leading dot 705 // strip leading dot
705 QString s(dnsdomain->text()); 706 QString s(dnsdomain->text());
706 if(s.left(1) == ".") 707 if(s.left(1) == ".")
707 PPPData::data()->setDomain(s.mid(1)); 708 _pppdata->setDomain(s.mid(1));
708 else 709 else
709 PPPData::data()->setDomain(dnsdomain->text()); 710 _pppdata->setDomain(dnsdomain->text());
710 711
711 PPPData::data()->setExDNSDisabled(exdnsdisabled_toggle->isChecked()); 712 _pppdata->setExDNSDisabled(exdnsdisabled_toggle->isChecked());
712} 713}
713 714
@@ -733,6 +734,6 @@ void DNSWidget::removedns() {
733// GatewayWidget 734// GatewayWidget
734// 735//
735GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) 736GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
736 : QWidget(parent, name) 737 : QWidget(parent, name), _pppdata(pd)
737{ 738{
738 QVBoxLayout *topLayout = new QVBoxLayout(this); 739 QVBoxLayout *topLayout = new QVBoxLayout(this);
@@ -786,13 +787,13 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na
786 //load info from gpppdata 787 //load info from gpppdata
787 if(!isnewaccount) { 788 if(!isnewaccount) {
788 if(PPPData::data()->gateway() == "0.0.0.0") { 789 if(_pppdata->gateway() == "0.0.0.0") {
789 defaultgateway->setChecked(true); 790 defaultgateway->setChecked(true);
790 hitGatewaySelect(0); 791 hitGatewaySelect(0);
791 } 792 }
792 else { 793 else {
793 gatewayaddr->setText(PPPData::data()->gateway()); 794 gatewayaddr->setText(_pppdata->gateway());
794 staticgateway->setChecked(true); 795 staticgateway->setChecked(true);
795 } 796 }
796 defaultroute->setChecked(PPPData::data()->defaultroute()); 797 defaultroute->setChecked(_pppdata->defaultroute());
797 } 798 }
798 else { 799 else {
@@ -804,6 +805,6 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na
804 805
805void GatewayWidget::save() { 806void GatewayWidget::save() {
806 PPPData::data()->setGateway(gatewayaddr->text()); 807 _pppdata->setGateway(gatewayaddr->text());
807 PPPData::data()->setDefaultroute(defaultroute->isChecked()); 808 _pppdata->setDefaultroute(defaultroute->isChecked());
808} 809}
809 810
@@ -824,6 +825,6 @@ void GatewayWidget::hitGatewaySelect( int i ) {
824 825
825 826
826ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) 827ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
827 : QWidget(parent, name) 828 : QWidget(parent, name),_pppdata(pd)
828{ 829{
829 830
@@ -868,6 +869,6 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name
868 //load data from gpppdata 869 //load data from gpppdata
869 if(!isnewaccount) { 870 if(!isnewaccount) {
870 QStringList &comlist = PPPData::data()->scriptType(); 871 QStringList &comlist = _pppdata->scriptType();
871 QStringList &arglist = PPPData::data()->script(); 872 QStringList &arglist = _pppdata->script();
872 QStringList::Iterator itcom = comlist.begin(); 873 QStringList::Iterator itcom = comlist.begin();
873 QStringList::Iterator itarg = arglist.begin(); 874 QStringList::Iterator itarg = arglist.begin();
@@ -915,6 +916,6 @@ void ScriptWidget::save() {
915 arglist.append(sl->text(i)); 916 arglist.append(sl->text(i));
916 } 917 }
917 PPPData::data()->setScriptType(typelist); 918 _pppdata->setScriptType(typelist);
918 PPPData::data()->setScript(arglist); 919 _pppdata->setScript(arglist);
919} 920}
920 921
diff --git a/noncore/settings/networksettings/ppp/edit.h b/noncore/settings/networksettings/ppp/edit.h
index cd0161f..2cc0fed 100644
--- a/noncore/settings/networksettings/ppp/edit.h
+++ b/noncore/settings/networksettings/ppp/edit.h
@@ -48,9 +48,10 @@
48 48
49class IPLineEdit; 49class IPLineEdit;
50class PPPData;
50 51
51class DialWidget : public QWidget { 52class DialWidget : public QWidget {
52 Q_OBJECT 53 Q_OBJECT
53public: 54public:
54 DialWidget( QWidget *parent=0, bool isnewaccount = true, const char *name=0 ); 55 DialWidget( PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
55 ~DialWidget() {} 56 ~DialWidget() {}
56 57
@@ -77,4 +78,5 @@ private:
77 QPushButton *add, *del, *up, *down; 78 QPushButton *add, *del, *up, *down;
78 QListBox *numbers; 79 QListBox *numbers;
80 PPPData *_pppdata;
79}; 81};
80 82
@@ -88,5 +90,5 @@ class ExecWidget : public QWidget {
88 Q_OBJECT 90 Q_OBJECT
89public: 91public:
90 ExecWidget(QWidget *parent=0, bool isnewaccount=true, const char *name=0); 92 ExecWidget(PPPData*, QWidget *parent=0, bool isnewaccount=true, const char *name=0);
91 93
92public slots: 94public slots:
@@ -105,4 +107,5 @@ private:
105 QLineEdit *discommand; 107 QLineEdit *discommand;
106 QLabel *discommand_label; 108 QLabel *discommand_label;
109 PPPData *_pppdata;
107}; 110};
108 111
@@ -111,5 +114,5 @@ class IPWidget : public QWidget {
111 Q_OBJECT 114 Q_OBJECT
112public: 115public:
113 IPWidget( QWidget *parent=0, bool isnewaccount = true, const char *name=0 ); 116 IPWidget(PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
114 ~IPWidget() {} 117 ~IPWidget() {}
115 118
@@ -135,4 +138,5 @@ private:
135 138
136 QCheckBox *autoname; 139 QCheckBox *autoname;
140 PPPData *_pppdata;
137}; 141};
138 142
@@ -141,5 +145,5 @@ class DNSWidget : public QWidget {
141 Q_OBJECT 145 Q_OBJECT
142public: 146public:
143 DNSWidget( QWidget *parent=0, bool isnewaccount = true, const char *name=0 ); 147 DNSWidget( PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
144 ~DNSWidget() {} 148 ~DNSWidget() {}
145 149
@@ -167,4 +171,5 @@ private:
167 QLabel *dnsdomain_label; 171 QLabel *dnsdomain_label;
168 QCheckBox *exdnsdisabled_toggle; 172 QCheckBox *exdnsdisabled_toggle;
173 PPPData *_pppdata;
169}; 174};
170 175
@@ -173,5 +178,5 @@ class GatewayWidget : public QWidget {
173 Q_OBJECT 178 Q_OBJECT
174public: 179public:
175 GatewayWidget( QWidget *parent=0, bool isnewaccount = true, const char *name=0 ); 180 GatewayWidget(PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
176 ~GatewayWidget() {} 181 ~GatewayWidget() {}
177 182
@@ -191,4 +196,5 @@ private:
191 IPLineEdit *gatewayaddr; 196 IPLineEdit *gatewayaddr;
192 QCheckBox *defaultroute; 197 QCheckBox *defaultroute;
198 PPPData *_pppdata;
193}; 199};
194 200
@@ -197,5 +203,5 @@ class ScriptWidget : public QWidget {
197 Q_OBJECT 203 Q_OBJECT
198public: 204public:
199 ScriptWidget( QWidget *parent=0, bool isnewaccount = true, const char *name=0 ); 205 ScriptWidget(PPPData*, QWidget *parent=0, bool isnewaccount = true, const char *name=0 );
200 ~ScriptWidget() {} 206 ~ScriptWidget() {}
201 207
@@ -226,4 +232,5 @@ private:
226 232
227 QScrollBar *slb; 233 QScrollBar *slb;
234 PPPData *_pppdata;
228}; 235};
229 236
@@ -246,4 +253,5 @@ private slots:
246private: 253private:
247 QLineEdit *le; 254 QLineEdit *le;
255
248}; 256};
249 257
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index 98e035b..f735e49 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -40,5 +40,5 @@
40 40
41#include "general.h" 41#include "general.h"
42//#include "version.h" 42#include "interfaceppp.h"
43//#include "miniterm.h" 43//#include "miniterm.h"
44#include "modeminfo.h" 44#include "modeminfo.h"
@@ -51,6 +51,6 @@
51 51
52 52
53ModemWidget::ModemWidget( QWidget *parent, const char *name) 53ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name )
54 : QWidget(parent, name) 54 : QWidget(parent, name), _ifaceppp(ifppp)
55{ 55{
56 int k; 56 int k;
@@ -173,5 +173,5 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
173 173
174 for(int i=0; i <= enter->count()-1; i++) { 174 for(int i=0; i <= enter->count()-1; i++) {
175 if(PPPData::data()->enter() == enter->text(i)) 175 if(_ifaceppp->data()->enter() == enter->text(i))
176 enter->setCurrentItem(i); 176 enter->setCurrentItem(i);
177 } 177 }
@@ -182,5 +182,5 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
182 modemlockfile = new QCheckBox(i18n("&Use lock file"), this); 182 modemlockfile = new QCheckBox(i18n("&Use lock file"), this);
183 183
184 modemlockfile->setChecked(PPPData::data()->modemLockFile()); 184 modemlockfile->setChecked(_ifaceppp->data()->modemLockFile());
185 connect(modemlockfile, SIGNAL(toggled(bool)), 185 connect(modemlockfile, SIGNAL(toggled(bool)),
186 SLOT(modemlockfilechanged(bool))); 186 SLOT(modemlockfilechanged(bool)));
@@ -202,8 +202,9 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
202 QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" ); 202 QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" );
203 modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" ); 203 modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" );
204// modemtimeout = new KIntNumInput(PPPData::data()->modemTimeout(), this); 204// modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this);
205// modemtimeout->setLabel(i18n("Modem &timeout:")); 205// modemtimeout->setLabel(i18n("Modem &timeout:"));
206// modemtimeout->setRange(1, 120, 1); 206// modemtimeout->setRange(1, 120, 1);
207 modemtimeout->setSuffix(i18n(" sec")); 207 modemtimeout->setSuffix(i18n(" sec"));
208 modemtimeout->setValue( _ifaceppp->data()->modemTimeout() );
208 connect(modemtimeout, SIGNAL(valueChanged(int)), 209 connect(modemtimeout, SIGNAL(valueChanged(int)),
209 SLOT(modemtimeoutchanged(int))); 210 SLOT(modemtimeoutchanged(int)));
@@ -219,15 +220,15 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
219 //set stuff from gpppdata 220 //set stuff from gpppdata
220 for(int i=0; i <= enter->count()-1; i++) { 221 for(int i=0; i <= enter->count()-1; i++) {
221 if(PPPData::data()->enter() == enter->text(i)) 222 if(_ifaceppp->data()->enter() == enter->text(i))
222 enter->setCurrentItem(i); 223 enter->setCurrentItem(i);
223 } 224 }
224 225
225 for(int i=0; i <= modemdevice->count()-1; i++) { 226 for(int i=0; i <= modemdevice->count()-1; i++) {
226 if(PPPData::data()->modemDevice() == modemdevice->text(i)) 227 if(_ifaceppp->data()->modemDevice() == modemdevice->text(i))
227 modemdevice->setCurrentItem(i); 228 modemdevice->setCurrentItem(i);
228 } 229 }
229 230
230 for(int i=0; i <= flowcontrol->count()-1; i++) { 231 for(int i=0; i <= flowcontrol->count()-1; i++) {
231 if(PPPData::data()->flowcontrol() == flowcontrol->text(i)) 232 if(_ifaceppp->data()->flowcontrol() == flowcontrol->text(i))
232 flowcontrol->setCurrentItem(i); 233 flowcontrol->setCurrentItem(i);
233 } 234 }
@@ -235,5 +236,5 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
235 //set the modem speed 236 //set the modem speed
236 for(int i=0; i < baud_c->count(); i++) 237 for(int i=0; i < baud_c->count(); i++)
237 if(baud_c->text(i) == PPPData::data()->speed()) 238 if(baud_c->text(i) == _ifaceppp->data()->speed())
238 baud_c->setCurrentItem(i); 239 baud_c->setCurrentItem(i);
239 240
@@ -243,35 +244,36 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
243 244
244void ModemWidget::speed_selection(int) { 245void ModemWidget::speed_selection(int) {
245 PPPData::data()->setSpeed(baud_c->text(baud_c->currentItem())); 246 _ifaceppp->data()->setSpeed(baud_c->text(baud_c->currentItem()));
246} 247}
247 248
248 249
249void ModemWidget::setenter(int ) { 250void ModemWidget::setenter(int ) {
250 PPPData::data()->setEnter(enter->text(enter->currentItem())); 251 _ifaceppp->data()->setEnter(enter->text(enter->currentItem()));
251} 252}
252 253
253 254
254void ModemWidget::setmodemdc(int i) { 255void ModemWidget::setmodemdc(int i) {
255 PPPData::data()->setModemDevice(modemdevice->text(i)); 256 _ifaceppp->data()->setModemDevice(modemdevice->text(i));
256} 257}
257 258
258 259
259void ModemWidget::setflowcontrol(int i) { 260void ModemWidget::setflowcontrol(int i) {
260 PPPData::data()->setFlowcontrol(flowcontrol->text(i)); 261 _ifaceppp->data()->setFlowcontrol(flowcontrol->text(i));
261} 262}
262 263
263 264
264void ModemWidget::modemlockfilechanged(bool set) { 265void ModemWidget::modemlockfilechanged(bool set) {
265 PPPData::data()->setModemLockFile(set); 266 _ifaceppp->data()->setModemLockFile(set);
266} 267}
267 268
268 269
269void ModemWidget::modemtimeoutchanged(int n) { 270void ModemWidget::modemtimeoutchanged(int n) {
270 PPPData::data()->setModemTimeout(n); 271 _ifaceppp->data()->setModemTimeout(n);
271} 272}
272 273
273 274
274ModemWidget2::ModemWidget2( QWidget *parent, const char *name) 275ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
275 : QWidget(parent, name) 276 const char *name)
277 : QWidget(parent, name), _ifaceppp(ifp)
276{ 278{
277 QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); 279 QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
@@ -279,5 +281,5 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
279 281
280 waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this); 282 waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this);
281 waitfordt->setChecked(PPPData::data()->waitForDialTone()); 283 waitfordt->setChecked(_ifaceppp->data()->waitForDialTone());
282 connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); 284 connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
283 l1->addWidget(waitfordt); 285 l1->addWidget(waitfordt);
@@ -294,5 +296,5 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
294 QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" ); 296 QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" );
295 busywait = new QSpinBox( 0, 300, 5, this, "busyWait" ); 297 busywait = new QSpinBox( 0, 300, 5, this, "busyWait" );
296// busywait = new KIntNumInput(PPPData::data()->busyWait(), this); 298// busywait = new KIntNumInput(_pppdata->busyWait(), this);
297// busywait->setLabel(i18n("B&usy wait:")); 299// busywait->setLabel(i18n("B&usy wait:"));
298// busywait->setRange(0, 300, 5, true); 300// busywait->setRange(0, 300, 5, true);
@@ -319,5 +321,6 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
319 QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this); 321 QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this);
320 hbl->addWidget(volumeLabel); 322 hbl->addWidget(volumeLabel);
321 volume = new QSlider(0, 2, 1, PPPData::data()->volume(), QSlider::Horizontal, this); 323 volume = new QSlider(0, 2, 1, _ifaceppp->data()->volume(),
324 QSlider::Horizontal, this);
322 volumeLabel->setBuddy(volume); 325 volumeLabel->setBuddy(volume);
323 volume->setTickmarks(QSlider::Below); 326 volume->setTickmarks(QSlider::Below);
@@ -343,5 +346,5 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
343#if 0 346#if 0
344 chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this); 347 chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this);
345 chkbox1->setChecked(PPPData::data()->UseCDLine()); 348 chkbox1->setChecked(_ifaceppp->data()->UseCDLine());
346 connect(chkbox1,SIGNAL(toggled(bool)), 349 connect(chkbox1,SIGNAL(toggled(bool)),
347 this,SLOT(use_cdline_toggled(bool))); 350 this,SLOT(use_cdline_toggled(bool)));
@@ -400,5 +403,5 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
400 403
401void ModemWidget2::modemcmdsbutton() { 404void ModemWidget2::modemcmdsbutton() {
402 ModemCommands mc(this); 405 ModemCommands mc(_ifaceppp->data(), this);
403 mc.showMaximized(); 406 mc.showMaximized();
404 mc.exec(); 407 mc.exec();
@@ -407,5 +410,5 @@ void ModemWidget2::modemcmdsbutton() {
407 410
408void ModemWidget2::query_modem() { 411void ModemWidget2::query_modem() {
409 ModemTransfer mt(this); 412 ModemTransfer mt(_ifaceppp->modem(), this);
410 mt.exec(); 413 mt.exec();
411} 414}
@@ -420,19 +423,19 @@ void ModemWidget2::query_modem() {
420#if 0 423#if 0
421void ModemWidget2::use_cdline_toggled(bool on) { 424void ModemWidget2::use_cdline_toggled(bool on) {
422 PPPData::data()->setUseCDLine(on); 425 _ifaceppp->data()->setUseCDLine(on);
423} 426}
424#endif 427#endif
425 428
426void ModemWidget2::waitfordtchanged(bool b) { 429void ModemWidget2::waitfordtchanged(bool b) {
427 PPPData::data()->setWaitForDialTone((int)b); 430 _ifaceppp->data()->setWaitForDialTone((int)b);
428} 431}
429 432
430void ModemWidget2::busywaitchanged(int n) { 433void ModemWidget2::busywaitchanged(int n) {
431 PPPData::data()->setbusyWait(n); 434 _ifaceppp->data()->setbusyWait(n);
432} 435}
433 436
434 437
435void ModemWidget2::volumeChanged(int v) { 438void ModemWidget2::volumeChanged(int v) {
436 PPPData::data()->setVolume(v); 439 _ifaceppp->data()->setVolume(v);
437} 440}
438 441
diff --git a/noncore/settings/networksettings/ppp/general.h b/noncore/settings/networksettings/ppp/general.h
index 4869f6c..3e59b46 100644
--- a/noncore/settings/networksettings/ppp/general.h
+++ b/noncore/settings/networksettings/ppp/general.h
@@ -35,11 +35,11 @@ class QLabel;
35class QCheckBox; 35class QCheckBox;
36class QComboBox; 36class QComboBox;
37 37class PPPData;
38 38class InterfacePPP;
39 39
40class ModemWidget : public QWidget { 40class ModemWidget : public QWidget {
41 Q_OBJECT 41 Q_OBJECT
42public: 42public:
43 ModemWidget( QWidget *parent=0, const char *name=0 ); 43 ModemWidget( InterfacePPP*, QWidget *parent=0, const char *name=0 );
44 44
45private slots: 45private slots:
@@ -65,4 +65,5 @@ private:
65 QSpinBox *modemtimeout; 65 QSpinBox *modemtimeout;
66 QCheckBox *modemlockfile; 66 QCheckBox *modemlockfile;
67 InterfacePPP *_ifaceppp;
67}; 68};
68 69
@@ -71,5 +72,5 @@ class ModemWidget2 : public QWidget {
71 Q_OBJECT 72 Q_OBJECT
72public: 73public:
73 ModemWidget2( QWidget *parent=0, const char *name=0 ); 74 ModemWidget2( InterfacePPP*, QWidget *parent=0, const char *name=0 );
74 75
75private slots: 76private slots:
@@ -92,4 +93,5 @@ private:
92 QCheckBox *chkbox1; 93 QCheckBox *chkbox1;
93 QSlider *volume; 94 QSlider *volume;
95 InterfacePPP *_ifaceppp;
94}; 96};
95 97
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
new file mode 100644
index 0000000..a58858c
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
@@ -0,0 +1,24 @@
1#include "interfaceinformationppp.h"
2
3
4#include <qpushbutton.h>
5#include <qlabel.h>
6//#include <qgroupbox.h>
7#include <qmessagebox.h>
8
9#ifdef QWS
10#else
11 #define showMaximized show
12#endif
13
14/**
15 * Constructor for the InterfaceInformationImp class. This class pretty much
16 * just display's information about the interface that is passed to it.
17 */
18InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f)
19 :InterfaceInformationImp(parent, name, i, f)
20{
21}
22
23
24
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.h b/noncore/settings/networksettings/ppp/interfaceinformationppp.h
new file mode 100644
index 0000000..8c6fc0b
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.h
@@ -0,0 +1,25 @@
1#ifndef INTERFACEINFORMATIONPPP_H
2#define INTERFACEINFORMATIONPPP_H
3
4#include "interfaceinformationimp.h"
5//#include "interface.h"
6
7class QWidget;
8class Interface;
9
10class InterfaceInformationPPP : public InterfaceInformationImp {
11
12Q_OBJECT
13
14public:
15
16 InterfaceInformationPPP(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0);
17 ~InterfaceInformationPPP(){};
18
19
20};
21
22#endif
23
24// addserviceimp.h
25
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp
new file mode 100644
index 0000000..d9ee3ff
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp
@@ -0,0 +1,48 @@
1#include "interfaceppp.h"
2#include "modem.h"
3#include "pppdata.h"
4
5InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
6 : Interface(parent, name, status),
7 _modem(0),
8 _pppdata(0)
9{
10 qDebug("InterfacePPP::InterfacePPP(");
11}
12
13PPPData* InterfacePPP::data()
14{
15 if (!_pppdata){
16 _pppdata = new PPPData();
17 _pppdata->setModemDevice( getInterfaceName() );
18 _pppdata->setAccount( getHardwareName() );
19 }
20 return _pppdata;
21}
22
23Modem* InterfacePPP::modem()
24{
25 if (!_modem){
26 _modem = new Modem( data() );
27 }
28 return _modem;
29}
30
31bool InterfacePPP::refresh()
32{
33 qDebug("InterfacePPP::refresh()");
34 return false;
35}
36
37void InterfacePPP::start()
38{
39 qDebug("InterfacePPP::start");
40
41}
42
43void InterfacePPP::stop()
44{
45 qDebug("InterfacePPP::stop");
46
47}
48
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.h b/noncore/settings/networksettings/ppp/interfaceppp.h
new file mode 100644
index 0000000..b7477c9
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/interfaceppp.h
@@ -0,0 +1,30 @@
1#ifndef INTERFACEPPP_H
2#define INTERFACEPPP_H
3
4#include "interface.h"
5
6class PPPData;
7class Modem;
8
9class InterfacePPP : public Interface
10{
11 Q_OBJECT
12
13public:
14 InterfacePPP(QObject *parent=0, const char *name="PPP", bool status=false);
15
16 PPPData* data();
17 Modem* modem();
18
19public slots:
20 virtual bool refresh();
21 virtual void start();
22 virtual void stop();
23
24 private:
25 Modem *_modem;
26 PPPData *_pppdata;
27};
28
29
30#endif
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index f8a8dc3..289e9f5 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -38,4 +38,5 @@
38#include <qdialog.h> 38#include <qdialog.h>
39#include <qwhatsthis.h> 39#include <qwhatsthis.h>
40#include <qcheckbox.h>
40 41
41// #include <kaboutdata.h> 42// #include <kaboutdata.h>
@@ -71,4 +72,5 @@
71#include "pppdata.h" 72#include "pppdata.h"
72#include "general.h" 73#include "general.h"
74#include "interface.h"
73 75
74#define execute_command system 76#define execute_command system
@@ -76,12 +78,19 @@
76KPPPWidget *p_kppp = 0; 78KPPPWidget *p_kppp = 0;
77 79
78KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl ) 80KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl )
79 : QDialog(parent, name, modal, fl) 81 : QDialog(parent, name, modal, fl), _pppdata(pd)
80// , acct(0)
81// , m_bCmdlAccount (false)
82{ 82{
83// tabWindow = 0; 83// tabWindow = 0;
84 p_kppp = this; 84 p_kppp = this;
85 // before doing anything else, run a few tests 85 // before doing anything else, run a few tests
86 if (!_pppdata->setModemDevice( i->getInterfaceName() ))
87 _pppdata->setModemDevice("/dev/modem");
88 qDebug("PPPConfigWidget::PPPConfigWidget");
89 qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1());
90 if (!_pppdata->setAccount( i->getHardwareName() ))
91 _pppdata->setAccount( 0 );
92
93 qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1());
94 qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID());
86 95
87 int result = runTests(); 96 int result = runTests();
@@ -91,107 +100,107 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
91// installEventFilter(this); 100// installEventFilter(this);
92 101
93// QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); 102 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
94 103
95// QGridLayout *l1 = new QGridLayout(3, 4); 104 QGridLayout *l1 = new QGridLayout(3, 4);
96// tl->addLayout(l1); 105 tl->addLayout(l1);
97// l1->addColSpacing(0, 10); 106 l1->addColSpacing(0, 10);
98// l1->addColSpacing(3, 10); 107 l1->addColSpacing(3, 10);
99// l1->setColStretch(1, 3); 108 l1->setColStretch(1, 3);
100// l1->setColStretch(2, 4); 109 l1->setColStretch(2, 4);
101 110
102// label1 = new QLabel(i18n("C&onnect to: "), this); 111 label1 = new QLabel(i18n("C&onnect to: "), this);
103// l1->addWidget(label1, 0, 1); 112 l1->addWidget(label1, 0, 1);
104 113
105// connectto_c = new QComboBox(false, this); 114 connectto_c = new QComboBox(false, this);
106// label1->setBuddy(connectto_c); 115 label1->setBuddy(connectto_c);
107 116
108// connect(connectto_c, SIGNAL(activated(int)), 117 connect(connectto_c, SIGNAL(activated(int)),
109 // SLOT(newdefaultaccount(int))); 118 SLOT(newdefaultaccount(int)));
110// l1->addWidget(connectto_c, 0, 2); 119 l1->addWidget(connectto_c, 0, 2);
111 120
112// ID_Label = new QLabel(i18n("&Login ID:"), this); 121 ID_Label = new QLabel(i18n("&Login ID:"), this);
113// l1->addWidget(ID_Label, 1, 1); 122 l1->addWidget(ID_Label, 1, 1);
114 123
115// // the entry line for usernames 124 // the entry line for usernames
116// ID_Edit = new QLineEdit(this); 125 ID_Edit = new QLineEdit(this);
117// ID_Label->setBuddy(ID_Edit); 126 ID_Label->setBuddy(ID_Edit);
118// l1->addWidget(ID_Edit, 1, 2); 127 l1->addWidget(ID_Edit, 1, 2);
119// connect(ID_Edit, SIGNAL(returnPressed()), 128 connect(ID_Edit, SIGNAL(returnPressed()),
120 // this, SLOT(enterPressedInID())); 129 this, SLOT(enterPressedInID()));
121// QString tmp = i18n("<p>Type in the username that you got from your\n" 130 QString tmp = i18n("<p>Type in the username that you got from your\n"
122 // "ISP. This is especially important for PAP\n" 131 "ISP. This is especially important for PAP\n"
123 // "and CHAP. You may omit this when you use\n" 132 "and CHAP. You may omit this when you use\n"
124 // "terminal-based or script-based authentication.\n" 133 "terminal-based or script-based authentication.\n"
125 // "\n" 134 "\n"
126 // "<b>Important</b>: case is important here:\n" 135 "<b>Important</b>: case is important here:\n"
127 // "<i>myusername</i> is not the same as <i>MyUserName</i>!"); 136 "<i>myusername</i> is not the same as <i>MyUserName</i>!");
128 137
129// QWhatsThis::add(ID_Label,tmp); 138 QWhatsThis::add(ID_Label,tmp);
130// QWhatsThis::add(ID_Edit,tmp); 139 QWhatsThis::add(ID_Edit,tmp);
131 140
132// PW_Label = new QLabel(i18n("&Password:"), this); 141 PW_Label = new QLabel(i18n("&Password:"), this);
133// l1->addWidget(PW_Label, 2, 1); 142 l1->addWidget(PW_Label, 2, 1);
134 143
135// PW_Edit= new QLineEdit(this); 144 PW_Edit= new QLineEdit(this);
136// PW_Label->setBuddy(PW_Edit); 145 PW_Label->setBuddy(PW_Edit);
137// PW_Edit->setEchoMode(QLineEdit::Password); 146 PW_Edit->setEchoMode(QLineEdit::Password);
138// l1->addWidget(PW_Edit, 2, 2); 147 l1->addWidget(PW_Edit, 2, 2);
139// connect(PW_Edit, SIGNAL(returnPressed()), 148 connect(PW_Edit, SIGNAL(returnPressed()),
140 // this, SLOT(enterPressedInPW())); 149 this, SLOT(enterPressedInPW()));
141 150
142// tmp = i18n("<p>Type in the password that you got from your\n" 151 tmp = i18n("<p>Type in the password that you got from your\n"
143 // "ISP. This is especially important for PAP\n" 152 "ISP. This is especially important for PAP\n"
144 // "and CHAP. You may omit this when you use\n" 153 "and CHAP. You may omit this when you use\n"
145 // "terminal-based or script-based authentication.\n" 154 "terminal-based or script-based authentication.\n"
146 // "\n" 155 "\n"
147 // "<b>Important</b>: case is important here:\n" 156 "<b>Important</b>: case is important here:\n"
148 // "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); 157 "<i>mypassword</i> is not the same as <i>MyPassword</i>!");
149 158
150// QWhatsThis::add(PW_Label,tmp); 159 QWhatsThis::add(PW_Label,tmp);
151// QWhatsThis::add(PW_Edit,tmp); 160 QWhatsThis::add(PW_Edit,tmp);
152 161
153// QHBoxLayout *l3 = new QHBoxLayout; 162 QHBoxLayout *l3 = new QHBoxLayout;
154// tl->addSpacing(5); 163 tl->addSpacing(5);
155// tl->addLayout(l3); 164 tl->addLayout(l3);
156// tl->addSpacing(5); 165 tl->addSpacing(5);
157// l3->addSpacing(10); 166 l3->addSpacing(10);
158// log = new QCheckBox(i18n("Show lo&g window"), this); 167 log = new QCheckBox(i18n("Show lo&g window"), this);
159// connect(log, SIGNAL(toggled(bool)), 168 connect(log, SIGNAL(toggled(bool)),
160 // this, SLOT(log_window_toggled(bool))); 169 this, SLOT(log_window_toggled(bool)));
161// log->setChecked(PPPData::data()->get_show_log_window()); 170 log->setChecked(_pppdata->get_show_log_window());
162// l3->addWidget(log); 171 l3->addWidget(log);
163 172
164// QWhatsThis::add(log, 173 QWhatsThis::add(log,
165 // i18n("<p>This controls whether a log window is shown.\n" 174 i18n("<p>This controls whether a log window is shown.\n"
166 // "A log window shows the communication between\n" 175 "A log window shows the communication between\n"
167 // "<i>kppp</i> and your modem. This will help you\n" 176 "<i>kppp</i> and your modem. This will help you\n"
168 // "in tracking down problems.\n" 177 "in tracking down problems.\n"
169 // "\n" 178 "\n"
170 // "Turn it off if <i>kppp</i> routinely connects without\n" 179 "Turn it off if <i>kppp</i> routinely connects without\n"
171 // "problems")); 180 "problems"));
172 181
173// // fline = new QSeparator( KSeparator::HLine, this); 182// fline = new QSeparator( KSeparator::HLine, this);
174// // tl->addWidget(fline); 183// tl->addWidget(fline);
175 184
176// QHBoxLayout *l2 = new QHBoxLayout(this); 185 QHBoxLayout *l2 = new QHBoxLayout(this);
177// tl->addLayout(l2); 186 tl->addLayout(l2);
178 187
179// int minw = 0; 188 int minw = 0;
180// quit_b = new QPushButton(i18n("&Quit"), this); 189 quit_b = new QPushButton(i18n("&Quit"), this);
181// // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); 190 // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) );
182// connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); 191 connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton()));
183// if(quit_b->sizeHint().width() > minw) 192 if(quit_b->sizeHint().width() > minw)
184// minw = quit_b->sizeHint().width(); 193 minw = quit_b->sizeHint().width();
185 194
186// setup_b = new QPushButton(i18n("&Setup..."), this); 195 setup_b = new QPushButton(i18n("&Setup..."), this);
187// // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); 196// setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) );
188// connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); 197 connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton()));
189// if(setup_b->sizeHint().width() > minw) 198 if(setup_b->sizeHint().width() > minw)
190// minw = setup_b->sizeHint().width(); 199 minw = setup_b->sizeHint().width();
191 200
192 201
193 202
194// if(PPPData::data()->access() != KConfig::ReadWrite) 203// if(_pppdata->access() != KConfig::ReadWrite)
195// setup_b->setEnabled(false); 204 // setup_b->setEnabled(false);
196 205
197// help_b = new QPushButton(i18n("&Help"), this); 206// help_b = new QPushButton(i18n("&Help"), this);
@@ -205,25 +214,25 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
205// minw = help_b->sizeHint().width(); 214// minw = help_b->sizeHint().width();
206 215
207// connect_b = new QPushButton(i18n("&Connect"), this); 216 connect_b = new QPushButton(i18n("&Connect"), this);
208// connect_b->setDefault(true); 217 connect_b->setDefault(true);
209// connect_b->setFocus(); 218 connect_b->setFocus();
210// connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); 219 connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect()));
211// if(connect_b->sizeHint().width() > minw) 220 if(connect_b->sizeHint().width() > minw)
212// minw = connect_b->sizeHint().width(); 221 minw = connect_b->sizeHint().width();
213 222
214// quit_b->setFixedWidth(minw); 223 quit_b->setFixedWidth(minw);
215// setup_b->setFixedWidth(minw); 224 setup_b->setFixedWidth(minw);
216// // help_b->setFixedWidth(help_b->sizeHint().width()); 225// help_b->setFixedWidth(help_b->sizeHint().width());
217// connect_b->setFixedWidth(minw); 226 connect_b->setFixedWidth(minw);
218 227
219// l2->addWidget(quit_b); 228 l2->addWidget(quit_b);
220// l2->addWidget(setup_b); 229 l2->addWidget(setup_b);
221// // l2->addWidget(help_b); 230// l2->addWidget(help_b);
222// l2->addSpacing(20); 231 l2->addSpacing(20);
223// l2->addWidget(connect_b); 232 l2->addWidget(connect_b);
224 233
225 setFixedSize(sizeHint()); 234 setFixedSize(sizeHint());
226 235
227 (void)new Modem; 236 (void)new Modem(_pppdata);
228 237
229 // we also connect cmld_start to the beginConnect so that I can run 238 // we also connect cmld_start to the beginConnect so that I can run
@@ -236,5 +245,5 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
236 245
237 // constructor of con_win reads position from config file 246 // constructor of con_win reads position from config file
238// con_win = new ConWindow(0, "conw", this); 247 con_win = new ConWindow(_pppdata, 0, "conw", this);
239 // KWin::setIcons(con_win->winId(), kapp->icon(), kapp->miniIcon()); 248 // KWin::setIcons(con_win->winId(), kapp->icon(), kapp->miniIcon());
240 249
@@ -245,7 +254,7 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
245 254
246// resetaccounts(); 255// resetaccounts();
247// con = new ConnectWidget(0, "con"); 256 con = new ConnectWidget(_pppdata, 0, "con");
248 //KWin::setIcons(con->winId(), kapp->icon(), kapp->miniIcon() ); 257 //KWin::setIcons(con->winId(), kapp->icon(), kapp->miniIcon() );
249// connect(this, SIGNAL(begin_connect()),con, SLOT(preinit())); 258 connect(this, SIGNAL(begin_connect()),con, SLOT(preinit()));
250 // Is this the best we can do here? it's not right. 259 // Is this the best we can do here? it's not right.
251// QRect desk = QApplication::desktop()->screenGeometry( 260// QRect desk = QApplication::desktop()->screenGeometry(
@@ -254,12 +263,12 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
254 263
255 // connect the ConnectWidgets various signals 264 // connect the ConnectWidgets various signals
256// // connect(con, SIGNAL(startAccounting()), 265 connect(con, SIGNAL(startAccounting()),
257 // // this, SLOT(startAccounting())); 266 this, SLOT(startAccounting()));
258// // connect(con, SIGNAL(stopAccounting()), 267 connect(con, SIGNAL(stopAccounting()),
259 // // this, SLOT(stopAccounting())); 268 this, SLOT(stopAccounting()));
260// connect(qApp, SIGNAL(saveYourself()), 269 connect(qApp, SIGNAL(saveYourself()),
261 // this, SLOT(saveMyself())); 270 this, SLOT(saveMyself()));
262// connect(qApp, SIGNAL(shutDown()), 271 connect(qApp, SIGNAL(shutDown()),
263 // this, SLOT(shutDown())); 272 this, SLOT(shutDown()));
264 273
265 274
@@ -275,5 +284,5 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
275 284
276// if(m_bCmdlAccount){ 285// if(m_bCmdlAccount){
277// bool result = PPPData::data()->setAccount(m_strCmdlAccount); 286// bool result = _pppdata->setAccount(m_strCmdlAccount);
278// if (!result){ 287// if (!result){
279// QString string; 288// QString string;
@@ -347,5 +356,5 @@ void KPPPWidget::enterPressedInPW() {
347// triggered by the session manager 356// triggered by the session manager
348void KPPPWidget::saveMyself() { 357void KPPPWidget::saveMyself() {
349 PPPData::data()->save(); 358 _pppdata->save();
350} 359}
351 360
@@ -356,5 +365,5 @@ void KPPPWidget::shutDown() {
356 365
357void KPPPWidget::log_window_toggled(bool on) { 366void KPPPWidget::log_window_toggled(bool on) {
358 PPPData::data()->set_show_log_window(on); 367 _pppdata->set_show_log_window(on);
359} 368}
360 369
@@ -365,5 +374,5 @@ void KPPPWidget::log_window_toggled(bool on) {
365// connectto_c->clear(); 374// connectto_c->clear();
366 375
367// int count = PPPData::data()->count(); 376// int count = _pppdata->count();
368 377
369// // enable/disable controls 378// // enable/disable controls
@@ -376,25 +385,25 @@ void KPPPWidget::log_window_toggled(bool on) {
376// //load the accounts 385// //load the accounts
377// for(int i=0; i < count; i++) { 386// for(int i=0; i < count; i++) {
378// PPPData::data()->setAccountbyIndex(i); 387// _pppdata->setAccountbyIndex(i);
379// connectto_c->insertItem(PPPData::data()->accname()); 388// connectto_c->insertItem(_pppdata->accname());
380// } 389// }
381 390
382// //set the default account 391// //set the default account
383// if(!PPPData::data()->defaultAccount().isEmpty()) { 392// if(!_pppdata->defaultAccount().isEmpty()) {
384// for(int i=0; i < count; i++) 393// for(int i=0; i < count; i++)
385// if(PPPData::data()->defaultAccount() == connectto_c->text(i)) { 394// if(_pppdata->defaultAccount() == connectto_c->text(i)) {
386 // connectto_c->setCurrentItem(i); 395 // connectto_c->setCurrentItem(i);
387 // PPPData::data()->setAccountbyIndex(i); 396 // _pppdata->setAccountbyIndex(i);
388 397
389 // ID_Edit->setText(PPPData::data()->storedUsername()); 398 // ID_Edit->setText(_pppdata->storedUsername());
390 // PW_Edit->setText(PPPData::data()->storedPassword()); 399 // PW_Edit->setText(_pppdata->storedPassword());
391// } 400// }
392// } 401// }
393// else 402// else
394// if(count > 0) { 403// if(count > 0) {
395// PPPData::data()->setDefaultAccount(connectto_c->text(0)); 404// _pppdata->setDefaultAccount(connectto_c->text(0));
396// PPPData::data()->save(); 405// _pppdata->save();
397 // ID_Edit->setText(PPPData::data()->storedUsername()); 406 // ID_Edit->setText(_pppdata->storedUsername());
398 // PW_Edit->setText(PPPData::data()->storedPassword()); 407 // PW_Edit->setText(_pppdata->storedPassword());
399// } 408// }
400 409
@@ -414,9 +423,11 @@ void KPPPWidget::log_window_toggled(bool on) {
414void KPPPWidget::interruptConnection() { 423void KPPPWidget::interruptConnection() {
415 // interrupt dial up 424 // interrupt dial up
416// if (con->isVisible()) 425//
417// emit con->cancelbutton(); 426
427 if (con->isVisible())
428 emit con->cancelbutton();
418 429
419 // disconnect if online 430 // disconnect if online
420 if (PPPData::data()->pppdRunning()) 431 if (_pppdata->pppdRunning())
421 emit disconnect(); 432 emit disconnect();
422} 433}
@@ -429,5 +440,5 @@ void KPPPWidget::sigPPPDDied() {
429 // in the followin line to make sure that we don't raise a false alarm 440 // in the followin line to make sure that we don't raise a false alarm
430 // such as would be the case when the log file viewer exits. 441 // such as would be the case when the log file viewer exits.
431 if(PPPData::data()->pppdRunning() || PPPData::data()->pppdError()) { 442 if(_pppdata->pppdRunning() || _pppdata->pppdError()) {
432 qDebug( "It was pppd that died" ); 443 qDebug( "It was pppd that died" );
433 444
@@ -441,34 +452,35 @@ void KPPPWidget::sigPPPDDied() {
441 Modem::modem->removeSecret(AUTH_CHAP); 452 Modem::modem->removeSecret(AUTH_CHAP);
442 453
443 PPPData::data()->setpppdRunning(false); 454 _pppdata->setpppdRunning(false);
444 455
445 qDebug( "Executing command on disconnect since pppd has died." ); 456 qDebug( "Executing command on disconnect since pppd has died." );
446 QApplication::flushX(); 457 QApplication::flushX();
447 execute_command(PPPData::data()->command_on_disconnect()); 458 execute_command(_pppdata->command_on_disconnect());
448 459
449// stopAccounting(); 460// stopAccounting();
450 461
451// con_win->stopClock(); 462 con_win->stopClock();
452// DockWidget::dock_widget->stop_stats(); 463// DockWidget::dock_widget->stop_stats();
453// DockWidget::dock_widget->hide(); 464// DockWidget::dock_widget->hide();
454 465
455 if(!PPPData::data()->pppdError()) 466 if(!_pppdata->pppdError())
456 PPPData::data()->setpppdError(E_PPPD_DIED); 467 _pppdata->setpppdError(E_PPPD_DIED);
457 removedns(); 468 removedns();
458 Modem::modem->unlockdevice(); 469 Modem::modem->unlockdevice();
459 // con->pppdDied(); 470 //
471 con->pppdDied();
460 472
461 if(!PPPData::data()->automatic_redial()) { 473 if(!_pppdata->automatic_redial()) {
462 quit_b->setFocus(); 474 quit_b->setFocus();
463 show(); 475 show();
464// con_win->stopClock(); 476 con_win->stopClock();
465 //stopAccounting(); 477 //stopAccounting();
466// con_win->hide(); 478 con_win->hide();
467// con->hide(); 479 con->hide();
468 480
469 PPPData::data()->setpppdRunning(false); 481 _pppdata->setpppdRunning(false);
470 // // not in a signal handler !!! KNotifyClient::beep(); 482 // // not in a signal handler !!! KNotifyClient::beep();
471 QString msg; 483 QString msg;
472 if (PPPData::data()->pppdError() == E_IF_TIMEOUT) 484 if (_pppdata->pppdError() == E_IF_TIMEOUT)
473 msg = i18n("Timeout expired while waiting for the PPP interface " 485 msg = i18n("Timeout expired while waiting for the PPP interface "
474 "to come up!"); 486 "to come up!");
@@ -491,20 +503,20 @@ void KPPPWidget::sigPPPDDied() {
491 qDebug( "Trying to reconnect... " ); 503 qDebug( "Trying to reconnect... " );
492 504
493 if(PPPData::data()->authMethod() == AUTH_PAP || 505 if(_pppdata->authMethod() == AUTH_PAP ||
494 PPPData::data()->authMethod() == AUTH_CHAP || 506 _pppdata->authMethod() == AUTH_CHAP ||
495 PPPData::data()->authMethod() == AUTH_PAPCHAP) 507 _pppdata->authMethod() == AUTH_PAPCHAP)
496 Modem::modem->setSecret(PPPData::data()->authMethod(), 508 Modem::modem->setSecret(_pppdata->authMethod(),
497 encodeWord(PPPData::data()->storedUsername()), 509 encodeWord(_pppdata->storedUsername()),
498 encodeWord(PPPData::data()->password())); 510 encodeWord(_pppdata->password()));
499 511
500// con_win->hide(); 512 con_win->hide();
501 // con_win->stopClock(); 513 con_win->stopClock();
502 //stopAccounting(); 514 //stopAccounting();
503 PPPData::data()->setpppdRunning(false); 515 _pppdata->setpppdRunning(false);
504 // not in a signal handler !!!KNotifyClient::beep(); 516 // not in a signal handler !!!KNotifyClient::beep();
505 emit cmdl_start(); 517 emit cmdl_start();
506 } 518 }
507 } 519 }
508 PPPData::data()->setpppdError(0); 520 _pppdata->setpppdError(0);
509 } 521 }
510} 522}
@@ -527,8 +539,8 @@ void KPPPWidget::sigPPPDDied() {
527 539
528void KPPPWidget::newdefaultaccount(int i) { 540void KPPPWidget::newdefaultaccount(int i) {
529 PPPData::data()->setDefaultAccount(connectto_c->text(i)); 541 _pppdata->setDefaultAccount(connectto_c->text(i));
530 PPPData::data()->save(); 542 _pppdata->save();
531 ID_Edit->setText(PPPData::data()->storedUsername()); 543 ID_Edit->setText(_pppdata->storedUsername());
532 PW_Edit->setText(PPPData::data()->storedPassword()); 544 PW_Edit->setText(_pppdata->storedPassword());
533} 545}
534 546
@@ -540,8 +552,8 @@ void KPPPWidget::beginConnect() {
540 // (exeption: an account given by a command line argument) 552 // (exeption: an account given by a command line argument)
541 // if(!m_bCmdlAccount) { 553 // if(!m_bCmdlAccount) {
542// PPPData::data()->setAccount(connectto_c->currentText()); 554// _pppdata->setAccount(connectto_c->currentText());
543// PPPData::data()->setPassword(PW_Edit->text()); 555// _pppdata->setPassword(PW_Edit->text());
544// } else { 556// } else {
545 PPPData::data()->setPassword(PPPData::data()->storedPassword()); 557 _pppdata->setPassword(_pppdata->storedPassword());
546// } 558// }
547 559
@@ -561,5 +573,5 @@ void KPPPWidget::beginConnect() {
561 "Please make sure that you have given kppp " 573 "Please make sure that you have given kppp "
562 "setuid permission and that " 574 "setuid permission and that "
563 "pppd is executable.").arg(PPPData::data()->pppdPath()); 575 "pppd is executable.").arg(_pppdata->pppdPath());
564 KMessageBox::error(this, string); 576 KMessageBox::error(this, string);
565 return; 577 return;
@@ -568,5 +580,5 @@ void KPPPWidget::beginConnect() {
568#endif 580#endif
569 581
570 QFileInfo info2(PPPData::data()->modemDevice()); 582 QFileInfo info2(_pppdata->modemDevice());
571 583
572 if(!info2.exists()){ 584 if(!info2.exists()){
@@ -576,5 +588,5 @@ void KPPPWidget::beginConnect() {
576 "and/or adjust the location of the modem device on " 588 "and/or adjust the location of the modem device on "
577 "the modem tab of " 589 "the modem tab of "
578 "the setup dialog.").arg(PPPData::data()->modemDevice()); 590 "the setup dialog.").arg(_pppdata->modemDevice());
579 QMessageBox::warning(this, "error", string); 591 QMessageBox::warning(this, "error", string);
580 return; 592 return;
@@ -583,18 +595,15 @@ void KPPPWidget::beginConnect() {
583 // if this is a PAP or CHAP account, ensure that username is 595 // if this is a PAP or CHAP account, ensure that username is
584 // supplied 596 // supplied
585 if(PPPData::data()->authMethod() == AUTH_PAP || 597 if(_pppdata->authMethod() == AUTH_PAP ||
586 PPPData::data()->authMethod() == AUTH_CHAP || 598 _pppdata->authMethod() == AUTH_CHAP ||
587 PPPData::data()->authMethod() == AUTH_PAPCHAP ) { 599 _pppdata->authMethod() == AUTH_PAPCHAP ) {
588 if(ID_Edit->text().isEmpty()) { 600 if(ID_Edit->text().isEmpty()) {
589 QMessageBox::warning(this,"error", 601 QMessageBox::warning(this,"error",
590 i18n( 602 i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!"));
591 "You have selected the authentication " 603// FIXME: return;
592 "method PAP or CHAP. This requires that you "
593 "supply a username and a password!"));
594 return;
595 } else { 604 } else {
596 if(!Modem::modem->setSecret(PPPData::data()->authMethod(), 605 if(!Modem::modem->setSecret(_pppdata->authMethod(),
597 encodeWord(PPPData::data()->storedUsername()), 606 encodeWord(_pppdata->storedUsername()),
598 encodeWord(PPPData::data()->password()))) { 607 encodeWord(_pppdata->password()))) {
599 QString s; 608 QString s;
600 s = i18n("Cannot create PAP/CHAP authentication\n" 609 s = i18n("Cannot create PAP/CHAP authentication\n"
@@ -606,5 +615,5 @@ void KPPPWidget::beginConnect() {
606 } 615 }
607 616
608 if (PPPData::data()->phonenumber().isEmpty()) { 617 if (_pppdata->phonenumber().isEmpty()) {
609 QString s = i18n("You must specify a telephone number!"); 618 QString s = i18n("You must specify a telephone number!");
610 QMessageBox::warning(this, "error", s); 619 QMessageBox::warning(this, "error", s);
@@ -614,5 +623,5 @@ void KPPPWidget::beginConnect() {
614 this->hide(); 623 this->hide();
615 624
616 QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); 625 QString tit = i18n("Connecting to: %1").arg(_pppdata->accname());
617// con->setCaption(tit); 626// con->setCaption(tit);
618 627
@@ -625,14 +634,14 @@ void KPPPWidget::beginConnect() {
625 634
626void KPPPWidget::disconnect() { 635void KPPPWidget::disconnect() {
627 if (!PPPData::data()->command_before_disconnect().isEmpty()) { 636 if (!_pppdata->command_before_disconnect().isEmpty()) {
628// con_win->hide(); 637 con_win->hide();
629// con->show(); 638 con->show();
630// con->setCaption(i18n("Disconnecting...")); 639 con->setCaption(i18n("Disconnecting..."));
631// con->setMsg(i18n("Executing command before disconnection.")); 640 con->setMsg(i18n("Executing command before disconnection."));
632 641
633 qApp->processEvents(); 642 qApp->processEvents();
634 QApplication::flushX(); 643 QApplication::flushX();
635// pid_t id = 644// pid_t id =
636 execute_command(PPPData::data()->command_before_disconnect()); 645 execute_command(_pppdata->command_before_disconnect());
637// int i, status; 646// int i, status;
638 647
@@ -643,5 +652,5 @@ void KPPPWidget::disconnect() {
643// } while (i == 0 && errno == 0); 652// } while (i == 0 && errno == 0);
644 653
645// con->hide(); 654 con->hide();
646 } 655 }
647 656
@@ -652,5 +661,5 @@ void KPPPWidget::disconnect() {
652 661
653 QApplication::flushX(); 662 QApplication::flushX();
654 execute_command(PPPData::data()->command_on_disconnect()); 663 execute_command(_pppdata->command_on_disconnect());
655 664
656 Modem::modem->removeSecret(AUTH_PAP); 665 Modem::modem->removeSecret(AUTH_PAP);
@@ -660,7 +669,7 @@ void KPPPWidget::disconnect() {
660 Modem::modem->unlockdevice(); 669 Modem::modem->unlockdevice();
661 670
662// con_win->stopClock(); 671 con_win->stopClock();
663// p_kppp->stopAccounting(); 672// p_kppp->stopAccounting();
664// con_win->hide(); 673 con_win->hide();
665 674
666// DockWidget::dock_widget->stop_stats(); 675// DockWidget::dock_widget->stop_stats();
@@ -682,5 +691,5 @@ void KPPPWidget::disconnect() {
682 691
683void KPPPWidget::quitbutton() { 692void KPPPWidget::quitbutton() {
684 if(PPPData::data()->pppdRunning()) { 693 if(_pppdata->pppdRunning()) {
685 int ok = QMessageBox::warning(this, 694 int ok = QMessageBox::warning(this,
686 i18n("Exiting kPPP will close your PPP Session."), 695 i18n("Exiting kPPP will close your PPP Session."),
@@ -689,13 +698,13 @@ void KPPPWidget::quitbutton() {
689 Modem::modem->killPPPDaemon(); 698 Modem::modem->killPPPDaemon();
690 QApplication::flushX(); 699 QApplication::flushX();
691 execute_command(PPPData::data()->command_on_disconnect()); 700 execute_command(_pppdata->command_on_disconnect());
692 removedns(); 701 removedns();
693 Modem::modem->unlockdevice(); 702 Modem::modem->unlockdevice();
694 } 703 }
695 } else { 704 } else {
696 if (!PPPData::data()->accname().isEmpty() && !PPPData::data()->storePassword()) 705 if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword())
697 PPPData::data()->setStoredPassword(""); 706 _pppdata->setStoredPassword("");
698 } 707 }
699 PPPData::data()->save(); 708 _pppdata->save();
700 qApp->quit(); 709 qApp->quit();
701} 710}
@@ -711,11 +720,11 @@ void KPPPWidget::quitbutton() {
711// stats->totalbytes = 0; 720// stats->totalbytes = 0;
712 721
713// kdDebug() << "AcctEnabled: " << PPPData::data()->AcctEnabled() << endl; 722// kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl;
714 723
715// // load the ruleset 724// // load the ruleset
716// if(!PPPData::data()->AcctEnabled()) 725// if(!_pppdata->AcctEnabled())
717// return; 726// return;
718 727
719// QString d = AccountingBase::getAccountingFile(PPPData::data()->accountingFile()); 728// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile());
720// // if(::access(d.data(), X_OK) != 0) 729// // if(::access(d.data(), X_OK) != 0)
721// acct = new Accounting(this, stats); 730// acct = new Accounting(this, stats);
@@ -727,7 +736,7 @@ void KPPPWidget::quitbutton() {
727 // con_win, SLOT(slotAccounting(QString, QString))); 736 // con_win, SLOT(slotAccounting(QString, QString)));
728 737
729// // if(!acct->loadRuleSet(PPPData::data()->accountingFile())) { 738// // if(!acct->loadRuleSet(_pppdata->accountingFile())) {
730// // QString s= i18n("Can not load the accounting " 739// // QString s= i18n("Can not load the accounting "
731 // // "ruleset \"%1\"!").arg(PPPData::data()->accountingFile()); 740 // // "ruleset \"%1\"!").arg(_pppdata->accountingFile());
732 741
733// // starting the messagebox with a timer will prevent us 742// // starting the messagebox with a timer will prevent us
@@ -744,7 +753,7 @@ void KPPPWidget::quitbutton() {
744// // store volume accounting 753// // store volume accounting
745// // if(stats->totalbytes != 0) 754// // if(stats->totalbytes != 0)
746// // PPPData::data()->setTotalBytes(stats->totalbytes); 755// // _pppdata->setTotalBytes(stats->totalbytes);
747 756
748// if(!PPPData::data()->AcctEnabled()) 757// if(!_pppdata->AcctEnabled())
749// return; 758// return;
750 759
@@ -767,5 +776,5 @@ void KPPPWidget::quitbutton() {
767void KPPPWidget::usernameChanged(const QString &) { 776void KPPPWidget::usernameChanged(const QString &) {
768 // store username for later use 777 // store username for later use
769 PPPData::data()->setStoredUsername(ID_Edit->text()); 778 _pppdata->setStoredUsername(ID_Edit->text());
770} 779}
771 780
@@ -773,8 +782,8 @@ void KPPPWidget::usernameChanged(const QString &) {
773void KPPPWidget::passwordChanged(const QString &) { 782void KPPPWidget::passwordChanged(const QString &) {
774 // store the password if so requested 783 // store the password if so requested
775 if(PPPData::data()->storePassword()) 784 if(_pppdata->storePassword())
776 PPPData::data()->setStoredPassword(PW_Edit->text()); 785 _pppdata->setStoredPassword(PW_Edit->text());
777 else 786 else
778 PPPData::data()->setStoredPassword(""); 787 _pppdata->setStoredPassword("");
779} 788}
780 789
@@ -816,5 +825,5 @@ void KPPPWidget::showNews() {
816 */ 825 */
817 #define QUICKHELP_HINT "Hint_QuickHelp" 826 #define QUICKHELP_HINT "Hint_QuickHelp"
818 if(PPPData::data()->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { 827 if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) {
819 QDialog dlg(0, 0, true); 828 QDialog dlg(0, 0, true);
820 dlg.setCaption(i18n("Recent Changes in KPPP")); 829 dlg.setCaption(i18n("Recent Changes in KPPP"));
@@ -868,6 +877,6 @@ void KPPPWidget::showNews() {
868 dlg.exec(); 877 dlg.exec();
869 if(cb->isChecked()) { 878 if(cb->isChecked()) {
870 PPPData::data()->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); 879 _pppdata->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1);
871 PPPData::data()->save(); 880 _pppdata->save();
872 } 881 }
873 } 882 }
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.h b/noncore/settings/networksettings/ppp/kpppwidget.h
index d7e74af..b958862 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.h
+++ b/noncore/settings/networksettings/ppp/kpppwidget.h
@@ -35,5 +35,6 @@
35 35
36class QPushButton; 36class QPushButton;
37 37class Interface;
38class PPPData;
38 39
39class KPPPWidget : public QDialog { 40class KPPPWidget : public QDialog {
@@ -41,5 +42,5 @@ class KPPPWidget : public QDialog {
41public: 42public:
42 43
43 KPPPWidget( QWidget *parent=0, const char *name=0, bool modal = false, WFlags fl = 0 ); 44 KPPPWidget(PPPData*, Interface*, QWidget *parent=0, const char *name=0, bool modal = false, WFlags fl = 0 );
44 ~KPPPWidget(); 45 ~KPPPWidget();
45 46
@@ -71,6 +72,6 @@ public:
71 bool connected; 72 bool connected;
72 QString con_speed; 73 QString con_speed;
73 // ConnectWidget *con; 74 ConnectWidget *con;
74 // ConWindow *con_win; 75 ConWindow *con_win;
75 // PPPStatsDlg *statdlg; 76 // PPPStatsDlg *statdlg;
76 // AccountingBase *acct; 77 // AccountingBase *acct;
@@ -87,5 +88,5 @@ private:
87 88
88 QString ruleset_load_errmsg; 89 QString ruleset_load_errmsg;
89 90 PPPData *_pppdata;
90 QPushButton *setup_b; 91 QPushButton *setup_b;
91 QFrame *fline; 92 QFrame *fline;
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp
index 5139482..002c8e7 100644
--- a/noncore/settings/networksettings/ppp/modem.cpp
+++ b/noncore/settings/networksettings/ppp/modem.cpp
@@ -63,5 +63,5 @@
63static sigjmp_buf jmp_buffer; 63static sigjmp_buf jmp_buffer;
64 64
65Modem *Modem::modem = 0; 65//Modem *Modem::modem = 0;
66 66
67 67
@@ -92,7 +92,7 @@ const char* pppdPath() {
92 92
93 93
94Modem::Modem() 94Modem::Modem( PPPData* pd )
95{ 95{
96 if (Modem::modem != 0) return; //CORRECT? 96 _pppdata = pd;
97 modemfd = -1; 97 modemfd = -1;
98 _pppdExitStatus = -1; 98 _pppdExitStatus = -1;
@@ -103,10 +103,9 @@ Modem::Modem()
103 lockfile[0] = '\0'; 103 lockfile[0] = '\0';
104 device = "/dev/modem"; 104 device = "/dev/modem";
105 modem = this;
106} 105}
107 106
108 107
109Modem::~Modem() { 108Modem::~Modem()
110 modem = 0; 109{
111} 110}
112 111
@@ -116,5 +115,5 @@ speed_t Modem::modemspeed() {
116 // to set the modem. The constants here should all be ifdef'd because 115 // to set the modem. The constants here should all be ifdef'd because
117 // other systems may not have them 116 // other systems may not have them
118 int i = PPPData::data()->speed().toInt()/100; 117 int i = _pppdata->speed().toInt()/100;
119 118
120 switch(i) { 119 switch(i) {
@@ -166,5 +165,5 @@ bool Modem::opentty() {
166//begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { 165//begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
167 close(modemfd); 166 close(modemfd);
168 device = PPPData::data()->modemDevice(); 167 device = _pppdata->modemDevice();
169 if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { 168 if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) {
170 qDebug("error opening modem device !"); 169 qDebug("error opening modem device !");
@@ -176,5 +175,5 @@ bool Modem::opentty() {
176 175
177#if 0 176#if 0
178 if(PPPData::data()->UseCDLine()) { 177 if(_pppdata->UseCDLine()) {
179 if(ioctl(modemfd, TIOCMGET, &flags) == -1) { 178 if(ioctl(modemfd, TIOCMGET, &flags) == -1) {
180 errmsg = i18n("Unable to detect state of CD line."); 179 errmsg = i18n("Unable to detect state of CD line.");
@@ -224,6 +223,6 @@ bool Modem::opentty() {
224 223
225 224
226 if(PPPData::data()->flowcontrol() != "None") { 225 if(_pppdata->flowcontrol() != "None") {
227 if(PPPData::data()->flowcontrol() == "CRTSCTS") { 226 if(_pppdata->flowcontrol() == "CRTSCTS") {
228 tty.c_cflag |= CRTSCTS; 227 tty.c_cflag |= CRTSCTS;
229 } 228 }
@@ -354,5 +353,5 @@ bool Modem::writeLine(const char *buf) {
354 memcpy(b, buf, len); 353 memcpy(b, buf, len);
355 // different modems seem to need different line terminations 354 // different modems seem to need different line terminations
356 QString term = PPPData::data()->enter(); 355 QString term = _pppdata->enter();
357 if(term == "LF") 356 if(term == "LF")
358 b[len++]='\n'; 357 b[len++]='\n';
@@ -394,7 +393,7 @@ bool Modem::hangup() {
394 393
395 // Then hangup command 394 // Then hangup command
396 writeLine(PPPData::data()->modemHangupStr().local8Bit()); 395 writeLine(_pppdata->modemHangupStr().local8Bit());
397 396
398 usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec 397 usleep(_pppdata->modemInitDelay() * 10000); // 0.01 - 3.0 sec
399 398
400#ifndef DEBUG_WO_DIALING 399#ifndef DEBUG_WO_DIALING
@@ -432,5 +431,5 @@ bool Modem::hangup() {
432#endif 431#endif
433 432
434 usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 secs 433 usleep(_pppdata->modemInitDelay() * 10000); // 0.01 - 3.0 secs
435 434
436 cfsetospeed(&temptty, modemspeed()); 435 cfsetospeed(&temptty, modemspeed());
@@ -455,9 +454,9 @@ void Modem::escape_to_command_mode() {
455 454
456 // +3 because quiet time must be greater than guard time. 455 // +3 because quiet time must be greater than guard time.
457 usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000); 456 usleep((_pppdata->modemEscapeGuardTime()+3)*20000);
458 QCString tmp = PPPData::data()->modemEscapeStr().local8Bit(); 457 QCString tmp = _pppdata->modemEscapeStr().local8Bit();
459 write(modemfd, tmp.data(), tmp.length()); 458 write(modemfd, tmp.data(), tmp.length());
460 tcflush(modemfd, TCIOFLUSH); 459 tcflush(modemfd, TCIOFLUSH);
461 usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000); 460 usleep((_pppdata->modemEscapeGuardTime()+3)*20000);
462 461
463 data_mode = false; 462 data_mode = false;
@@ -575,5 +574,5 @@ int Modem::lockdevice() {
575 char newlock[80]=""; // safe 574 char newlock[80]=""; // safe
576 575
577 if(!PPPData::data()->modemLockFile()) { 576 if(!_pppdata->modemLockFile()) {
578 qDebug("The user doesn't want a lockfile."); 577 qDebug("The user doesn't want a lockfile.");
579 return 0; 578 return 0;
@@ -584,5 +583,5 @@ int Modem::lockdevice() {
584 583
585 QString lockfile = LOCK_DIR"/LCK.."; 584 QString lockfile = LOCK_DIR"/LCK..";
586 lockfile += PPPData::data()->modemDevice().mid(5); // append everything after /dev/ 585 lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/
587 586
588 if(access(QFile::encodeName(lockfile), F_OK) == 0) { 587 if(access(QFile::encodeName(lockfile), F_OK) == 0) {
@@ -615,5 +614,5 @@ if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) {
615 } 614 }
616 615
617 fd = openLockfile(PPPData::data()->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); 616 fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT);
618 if(fd >= 0) { 617 if(fd >= 0) {
619 sprintf(newlock,"%010d\n", getpid()); 618 sprintf(newlock,"%010d\n", getpid());
@@ -989,5 +988,5 @@ bool Modem::execPPPDaemon(const QString & arguments)
989{ 988{
990 if(execpppd(arguments)==0) { 989 if(execpppd(arguments)==0) {
991 PPPData::data()->setpppdRunning(true); 990 _pppdata->setpppdRunning(true);
992 return true; 991 return true;
993 } else 992 } else
@@ -997,5 +996,5 @@ bool Modem::execPPPDaemon(const QString & arguments)
997void Modem::killPPPDaemon() 996void Modem::killPPPDaemon()
998{ 997{
999 PPPData::data()->setpppdRunning(false); 998 _pppdata->setpppdRunning(false);
1000 killpppd(); 999 killpppd();
1001} 1000}
diff --git a/noncore/settings/networksettings/ppp/modem.h b/noncore/settings/networksettings/ppp/modem.h
index b494977..103cbeb 100644
--- a/noncore/settings/networksettings/ppp/modem.h
+++ b/noncore/settings/networksettings/ppp/modem.h
@@ -36,5 +36,5 @@
36#include <qsocketnotifier.h> 36#include <qsocketnotifier.h>
37 37
38//#include <config.h> 38class PPPData;
39 39
40void alarm_handler(int); 40void alarm_handler(int);
@@ -44,5 +44,5 @@ class Modem : public QObject {
44 Q_OBJECT 44 Q_OBJECT
45public: 45public:
46 Modem(); 46 Modem(PPPData*);
47 ~Modem(); 47 ~Modem();
48 48
@@ -77,5 +77,5 @@ public:
77public: 77public:
78 enum Auth { PAP = 1, CHAP }; 78 enum Auth { PAP = 1, CHAP };
79 static Modem *modem; 79 // static Modem *modem;
80 int lastStatus; 80 int lastStatus;
81 81
@@ -113,4 +113,5 @@ private:
113 struct termios tty; 113 struct termios tty;
114 bool modem_is_locked; 114 bool modem_is_locked;
115 PPPData *_pppdata;
115}; 116};
116 117
diff --git a/noncore/settings/networksettings/ppp/modemcmds.cpp b/noncore/settings/networksettings/ppp/modemcmds.cpp
index 65032e8..1d9db6e 100644
--- a/noncore/settings/networksettings/ppp/modemcmds.cpp
+++ b/noncore/settings/networksettings/ppp/modemcmds.cpp
@@ -41,6 +41,6 @@
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(PPPData *pd, QWidget *parent, const char *name)
44 : QDialog(parent, name, true ) //, i18n("Edit Modem Commands") , Ok|Cancel) 44 : QDialog(parent, name, true ), _pppdata(pd)
45{ 45{
46 setCaption(i18n("Edit Modem Commands")); 46 setCaption(i18n("Edit Modem Commands"));
@@ -241,71 +241,71 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name)
241 241
242 //set stuff from gpppdata 242 //set stuff from gpppdata
243 preinitslider->setValue(PPPData::data()->modemPreInitDelay()); 243 preinitslider->setValue(_pppdata->modemPreInitDelay());
244 lpreinitslider->setNum(PPPData::data()->modemPreInitDelay()); 244 lpreinitslider->setNum(_pppdata->modemPreInitDelay());
245 for(int i = 0; i < PPPData::NumInitStrings; i++) 245 for(int i = 0; i < PPPData::NumInitStrings; i++)
246 initstr[i]->setText(PPPData::data()->modemInitStr(i)); 246 initstr[i]->setText(_pppdata->modemInitStr(i));
247 initslider->setValue(PPPData::data()->modemInitDelay()); 247 initslider->setValue(_pppdata->modemInitDelay());
248 linitslider->setNum(PPPData::data()->modemInitDelay()); 248 linitslider->setNum(_pppdata->modemInitDelay());
249 initresp->setText(PPPData::data()->modemInitResp()); 249 initresp->setText(_pppdata->modemInitResp());
250 250
251 durationslider->setValue(PPPData::data()->modemToneDuration()); 251 durationslider->setValue(_pppdata->modemToneDuration());
252 ldurationslider->setNum(PPPData::data()->modemToneDuration()); 252 ldurationslider->setNum(_pppdata->modemToneDuration());
253 253
254 nodetectdialtone->setText(PPPData::data()->modemNoDialToneDetectionStr()); 254 nodetectdialtone->setText(_pppdata->modemNoDialToneDetectionStr());
255 dialstr->setText(PPPData::data()->modemDialStr()); 255 dialstr->setText(_pppdata->modemDialStr());
256 connectresp->setText(PPPData::data()->modemConnectResp()); 256 connectresp->setText(_pppdata->modemConnectResp());
257 busyresp->setText(PPPData::data()->modemBusyResp()); 257 busyresp->setText(_pppdata->modemBusyResp());
258 nocarrierresp->setText(PPPData::data()->modemNoCarrierResp()); 258 nocarrierresp->setText(_pppdata->modemNoCarrierResp());
259 nodialtoneresp->setText(PPPData::data()->modemNoDialtoneResp()); 259 nodialtoneresp->setText(_pppdata->modemNoDialtoneResp());
260 260
261 escapestr->setText(PPPData::data()->modemEscapeStr()); 261 escapestr->setText(_pppdata->modemEscapeStr());
262 escaperesp->setText(PPPData::data()->modemEscapeResp()); 262 escaperesp->setText(_pppdata->modemEscapeResp());
263 263
264 hangupstr->setText(PPPData::data()->modemHangupStr()); 264 hangupstr->setText(_pppdata->modemHangupStr());
265 hangupresp->setText(PPPData::data()->modemHangupResp()); 265 hangupresp->setText(_pppdata->modemHangupResp());
266 266
267 answerstr->setText(PPPData::data()->modemAnswerStr()); 267 answerstr->setText(_pppdata->modemAnswerStr());
268 ringresp->setText(PPPData::data()->modemRingResp()); 268 ringresp->setText(_pppdata->modemRingResp());
269 answerresp->setText(PPPData::data()->modemAnswerResp()); 269 answerresp->setText(_pppdata->modemAnswerResp());
270 270
271 slider->setValue(PPPData::data()->modemEscapeGuardTime()); 271 slider->setValue(_pppdata->modemEscapeGuardTime());
272 lslider->setNum(PPPData::data()->modemEscapeGuardTime()); 272 lslider->setNum(_pppdata->modemEscapeGuardTime());
273 273
274 volume_off->setText(PPPData::data()->volumeOff()); 274 volume_off->setText(_pppdata->volumeOff());
275 volume_medium->setText(PPPData::data()->volumeMedium()); 275 volume_medium->setText(_pppdata->volumeMedium());
276 volume_high->setText(PPPData::data()->volumeHigh()); 276 volume_high->setText(_pppdata->volumeHigh());
277} 277}
278 278
279 279
280void ModemCommands::slotOk() { 280void ModemCommands::slotOk() {
281 PPPData::data()->setModemPreInitDelay(lpreinitslider->text().toInt()); 281 _pppdata->setModemPreInitDelay(lpreinitslider->text().toInt());
282 for(int i = 0; i < PPPData::NumInitStrings; i++) 282 for(int i = 0; i < PPPData::NumInitStrings; i++)
283 PPPData::data()->setModemInitStr(i, initstr[i]->text()); 283 _pppdata->setModemInitStr(i, initstr[i]->text());
284 PPPData::data()->setModemInitResp(initresp->text()); 284 _pppdata->setModemInitResp(initresp->text());
285 PPPData::data()->setModemInitDelay(linitslider->text().toInt()); 285 _pppdata->setModemInitDelay(linitslider->text().toInt());
286 286
287 PPPData::data()->setModemToneDuration(ldurationslider->text().toInt()); 287 _pppdata->setModemToneDuration(ldurationslider->text().toInt());
288 PPPData::data()->setModemNoDialToneDetectionStr(nodetectdialtone->text()); 288 _pppdata->setModemNoDialToneDetectionStr(nodetectdialtone->text());
289 PPPData::data()->setModemDialStr(dialstr->text()); 289 _pppdata->setModemDialStr(dialstr->text());
290 PPPData::data()->setModemConnectResp(connectresp->text()); 290 _pppdata->setModemConnectResp(connectresp->text());
291 PPPData::data()->setModemBusyResp(busyresp->text()); 291 _pppdata->setModemBusyResp(busyresp->text());
292 PPPData::data()->setModemNoCarrierResp(nocarrierresp->text()); 292 _pppdata->setModemNoCarrierResp(nocarrierresp->text());
293 PPPData::data()->setModemNoDialtoneResp(nodialtoneresp->text()); 293 _pppdata->setModemNoDialtoneResp(nodialtoneresp->text());
294 294
295 PPPData::data()->setModemEscapeStr(escapestr->text()); 295 _pppdata->setModemEscapeStr(escapestr->text());
296 PPPData::data()->setModemEscapeResp(escaperesp->text()); 296 _pppdata->setModemEscapeResp(escaperesp->text());
297 PPPData::data()->setModemEscapeGuardTime(lslider->text().toInt()); 297 _pppdata->setModemEscapeGuardTime(lslider->text().toInt());
298 PPPData::data()->setModemHangupStr(hangupstr->text()); 298 _pppdata->setModemHangupStr(hangupstr->text());
299 PPPData::data()->setModemHangupResp(hangupresp->text()); 299 _pppdata->setModemHangupResp(hangupresp->text());
300 300
301 PPPData::data()->setModemAnswerStr(answerstr->text()); 301 _pppdata->setModemAnswerStr(answerstr->text());
302 PPPData::data()->setModemRingResp(ringresp->text()); 302 _pppdata->setModemRingResp(ringresp->text());
303 PPPData::data()->setModemAnswerResp(answerresp->text()); 303 _pppdata->setModemAnswerResp(answerresp->text());
304 304
305 PPPData::data()->setVolumeHigh(volume_high->text()); 305 _pppdata->setVolumeHigh(volume_high->text());
306 PPPData::data()->setVolumeMedium(volume_medium->text()); 306 _pppdata->setVolumeMedium(volume_medium->text());
307 PPPData::data()->setVolumeOff(volume_off->text()); 307 _pppdata->setVolumeOff(volume_off->text());
308 308
309 PPPData::data()->save(); 309 _pppdata->save();
310 accept(); 310 accept();
311} 311}
diff --git a/noncore/settings/networksettings/ppp/modemcmds.h b/noncore/settings/networksettings/ppp/modemcmds.h
index 9d078ec..ef69fec 100644
--- a/noncore/settings/networksettings/ppp/modemcmds.h
+++ b/noncore/settings/networksettings/ppp/modemcmds.h
@@ -45,5 +45,5 @@ Q_OBJECT
45public: 45public:
46 46
47 ModemCommands(QWidget *parent=0, const char *name=0); 47 ModemCommands(PPPData*, QWidget *parent=0, const char *name=0);
48 ~ModemCommands() {} 48 ~ModemCommands() {}
49 49
@@ -53,4 +53,5 @@ private slots:
53 53
54private: 54private:
55 PPPData *_pppdata;
55 56
56 QGroupBox *box; 57 QGroupBox *box;
diff --git a/noncore/settings/networksettings/ppp/modeminfo.cpp b/noncore/settings/networksettings/ppp/modeminfo.cpp
index 4dbbcf5..0bec186 100644
--- a/noncore/settings/networksettings/ppp/modeminfo.cpp
+++ b/noncore/settings/networksettings/ppp/modeminfo.cpp
@@ -38,6 +38,7 @@
38#define i18n QObject::tr 38#define i18n QObject::tr
39 39
40ModemTransfer::ModemTransfer(QWidget *parent, const char *name) 40ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name)
41 : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder) 41 : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder),
42 _modem(mo)
42{ 43{
43 setCaption(i18n("ATI Query")); 44 setCaption(i18n("ATI Query"));
@@ -98,6 +99,6 @@ void ModemTransfer::ati_done() {
98 scripttimer->stop(); 99 scripttimer->stop();
99 timeout_timer->stop(); 100 timeout_timer->stop();
100 Modem::modem->closetty(); 101 _modem->closetty();
101 Modem::modem->unlockdevice(); 102 _modem->unlockdevice();
102 hide(); 103 hide();
103 104
@@ -127,5 +128,5 @@ void ModemTransfer::init() {
127 qApp->processEvents(); 128 qApp->processEvents();
128 129
129 int lock = Modem::modem->lockdevice(); 130 int lock = _modem->lockdevice();
130 if (lock == 1) { 131 if (lock == 1) {
131 132
@@ -141,8 +142,8 @@ void ModemTransfer::init() {
141 142
142 143
143 if(Modem::modem->opentty()) { 144 if(_modem->opentty()) {
144 if(Modem::modem->hangup()) { 145 if(_modem->hangup()) {
145 usleep(100000); // wait 0.1 secs 146 usleep(100000); // wait 0.1 secs
146 Modem::modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ... 147 _modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ...
147 148
148 statusBar->setText(i18n("Modem Ready")); 149 statusBar->setText(i18n("Modem Ready"));
@@ -153,7 +154,7 @@ void ModemTransfer::init() {
153 154
154 // clear modem buffer 155 // clear modem buffer
155 Modem::modem->flush(); 156 _modem->flush();
156 157
157 Modem::modem->notify(this, SLOT(readChar(unsigned char))); 158 _modem->notify(this, SLOT(readChar(unsigned char)));
158 return; 159 return;
159 } 160 }
@@ -161,7 +162,7 @@ void ModemTransfer::init() {
161 162
162 // opentty() or hangup() failed 163 // opentty() or hangup() failed
163 statusBar->setText(Modem::modem->modemMessage()); 164 statusBar->setText(_modem->modemMessage());
164 step = 99; // wait until cancel is pressed 165 step = 99; // wait until cancel is pressed
165 Modem::modem->unlockdevice(); 166 _modem->unlockdevice();
166} 167}
167 168
@@ -176,5 +177,5 @@ void ModemTransfer::do_script() {
176 statusBar->setText("ATI..."); 177 statusBar->setText("ATI...");
177 progressBar->setProgress( progressBar->progress() + 1); 178 progressBar->setProgress( progressBar->progress() + 1);
178 Modem::modem->writeLine("ATI\n"); 179 _modem->writeLine("ATI\n");
179 break; 180 break;
180 181
@@ -191,5 +192,5 @@ void ModemTransfer::do_script() {
191 statusBar->setText(msg); 192 statusBar->setText(msg);
192 progressBar->setProgress( progressBar->progress() + 1); 193 progressBar->setProgress( progressBar->progress() + 1);
193 Modem::modem->writeLine(query.local8Bit()); 194 _modem->writeLine(query.local8Bit());
194 break; 195 break;
195 196
@@ -224,5 +225,5 @@ void ModemTransfer::readtty() {
224void ModemTransfer::cancelbutton() { 225void ModemTransfer::cancelbutton() {
225 scripttimer->stop(); 226 scripttimer->stop();
226 Modem::modem->stop(); 227 _modem->stop();
227 timeout_timer->stop(); 228 timeout_timer->stop();
228 229
@@ -230,8 +231,8 @@ void ModemTransfer::cancelbutton() {
230 qApp->processEvents(); 231 qApp->processEvents();
231 232
232 Modem::modem->hangup(); 233 _modem->hangup();
233 234
234 Modem::modem->closetty(); 235 _modem->closetty();
235 Modem::modem->unlockdevice(); 236 _modem->unlockdevice();
236 reject(); 237 reject();
237} 238}
diff --git a/noncore/settings/networksettings/ppp/modeminfo.h b/noncore/settings/networksettings/ppp/modeminfo.h
index 7aa2cc0..dfcc841 100644
--- a/noncore/settings/networksettings/ppp/modeminfo.h
+++ b/noncore/settings/networksettings/ppp/modeminfo.h
@@ -38,4 +38,6 @@
38#include <qprogressbar.h> 38#include <qprogressbar.h>
39 39
40class Modem;
41
40const int NUM_OF_ATI = 8; 42const int NUM_OF_ATI = 8;
41 43
@@ -44,5 +46,5 @@ class ModemTransfer : public QDialog {
44 Q_OBJECT 46 Q_OBJECT
45public: 47public:
46 ModemTransfer(QWidget *parent=0, const char *name=0); 48 ModemTransfer(Modem*, QWidget *parent=0, const char *name=0);
47 49
48public slots: 50public slots:
@@ -61,4 +63,5 @@ protected:
61 63
62private: 64private:
65 Modem *_modem;
63 int step; 66 int step;
64 QString readbuffer; 67 QString readbuffer;
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro
index ac438dd..483aa58 100644
--- a/noncore/settings/networksettings/ppp/ppp.pro
+++ b/noncore/settings/networksettings/ppp/ppp.pro
@@ -5,8 +5,8 @@ TEMPLATE = lib
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 kpppwidget.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.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 conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h
8# 8# kpppwidget.h
9 SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp kpppwidget.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp 9 SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp
10# 10# kpppwidget.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
12 DEPENDPATH+= $(OPIEDIR)/include 12 DEPENDPATH+= $(OPIEDIR)/include
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index 4c5f7aa..63f9335 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -6,5 +6,5 @@
6#include "accounts.h" 6#include "accounts.h"
7#include "general.h" 7#include "general.h"
8#include "interface.h" 8#include "interfaceppp.h"
9#include "modem.h" 9#include "modem.h"
10#include "pppconfig.h" 10#include "pppconfig.h"
@@ -12,5 +12,5 @@
12#include "runtests.h" 12#include "runtests.h"
13 13
14PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent, 14PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
15 const char *name, 15 const char *name,
16 bool modal, WFlags fl ) 16 bool modal, WFlags fl )
@@ -25,14 +25,9 @@ PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent,
25 25
26 interface = iface; 26 interface = iface;
27 if (!PPPData::data()->setModemDevice( interface->getInterfaceName() ))
28 PPPData::data()->setModemDevice("/dev/modem");
29 qDebug("PPPConfigWidget::PPPConfigWidget"); 27 qDebug("PPPConfigWidget::PPPConfigWidget");
30 qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); 28 qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
31 if (!PPPData::data()->setAccount( interface->getHardwareName() ))
32 PPPData::data()->setAccount( 0 );
33 29
34 qDebug(" PPPData::data()->accname >%s<",PPPData::data()->accname().latin1()); 30 qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1());
35 qDebug(" PPPData::data()->currentAccountID() >%i<",PPPData::data()->currentAccountID()); 31 qDebug(" _pppdata->currentAccountID() >%i<",interface->data()->currentAccountID());
36 (void)new Modem;
37 32
38 QVBoxLayout *layout = new QVBoxLayout( this ); 33 QVBoxLayout *layout = new QVBoxLayout( this );
@@ -42,9 +37,9 @@ PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent,
42 layout->addWidget( tabWindow ); 37 layout->addWidget( tabWindow );
43 38
44 accounts = new AccountWidget( tabWindow, "accounts" ); 39 accounts = new AccountWidget( interface->data(), tabWindow, "accounts" );
45 tabWindow->addTab( accounts, tr("&Accounts") ); 40 tabWindow->addTab( accounts, tr("&Accounts") );
46 modem1 = new ModemWidget( tabWindow, "modem1" ); 41 modem1 = new ModemWidget( interface, tabWindow, "modem1" );
47 tabWindow->addTab( modem1, tr("&Device") ); 42 tabWindow->addTab( modem1, tr("&Device") );
48 modem2 = new ModemWidget2( tabWindow, "modem2" ); 43 modem2 = new ModemWidget2( interface, tabWindow, "modem2" );
49 tabWindow->addTab( modem2, tr("&Modem") ); 44 tabWindow->addTab( modem2, tr("&Modem") );
50// graph = new GraphSetup( tabWindow->addPage( tr("&Graph"), tr("Throughput Graph" ) ) ); 45// graph = new GraphSetup( tabWindow->addPage( tr("&Graph"), tr("Throughput Graph" ) ) );
@@ -62,9 +57,9 @@ void PPPConfigWidget::accept()
62{ 57{
63 qDebug("PPPConfigWidget::accept"); 58 qDebug("PPPConfigWidget::accept");
64 qDebug(" PPPData::data()->accname >%s<",PPPData::data()->accname().latin1()); 59 qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1());
65 qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); 60 qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
66 interface->setInterfaceName( PPPData::data()->modemDevice() ); 61 interface->setInterfaceName( interface->data()->modemDevice() );
67 interface->setHardwareName( PPPData::data()->accname() ); 62 interface->setHardwareName( interface->data()->accname() );
68 PPPData::data()->save(); 63 interface->data()->save();
69 QDialog::accept(); 64 QDialog::accept();
70} 65}
@@ -73,5 +68,5 @@ void PPPConfigWidget::accept()
73void PPPConfigWidget::reject() 68void PPPConfigWidget::reject()
74{ 69{
75 PPPData::data()->cancel(); 70 interface->data()->cancel();
76 QDialog::reject(); 71 QDialog::reject();
77} 72}
diff --git a/noncore/settings/networksettings/ppp/pppconfig.h b/noncore/settings/networksettings/ppp/pppconfig.h
index b324b6d..9bab6fe 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.h
+++ b/noncore/settings/networksettings/ppp/pppconfig.h
@@ -5,5 +5,6 @@
5 5
6class QTabWidget; 6class QTabWidget;
7class Interface; 7//class Interface;
8class InterfacePPP;
8class AccountWidget; 9class AccountWidget;
9class GeneralWidget; 10class GeneralWidget;
@@ -15,5 +16,5 @@ class PPPConfigWidget : public QDialog {
15public: 16public:
16 17
17 PPPConfigWidget( Interface*, QWidget *parent=0, const char *name=0, 18 PPPConfigWidget( InterfacePPP*, QWidget *parent=0, const char *name=0,
18 bool modal = false, WFlags fl = 0 ); 19 bool modal = false, WFlags fl = 0 );
19 ~PPPConfigWidget(); 20 ~PPPConfigWidget();
@@ -25,5 +26,5 @@ protected slots:
25 26
26 private: 27 private:
27 Interface *interface; 28 InterfacePPP *interface;
28 QTabWidget *tabWindow; 29 QTabWidget *tabWindow;
29 AccountWidget *accounts; 30 AccountWidget *accounts;
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp
index 4039939..d1143cf 100644
--- a/noncore/settings/networksettings/ppp/pppdargs.cpp
+++ b/noncore/settings/networksettings/ppp/pppdargs.cpp
@@ -35,6 +35,6 @@
35#define i18n QObject::tr 35#define i18n QObject::tr
36 36
37PPPdArguments::PPPdArguments(QWidget *parent, const char *name) 37PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name)
38 : QDialog(parent, name, TRUE) 38 : QDialog(parent, name, TRUE), _pppdata(pd)
39{ 39{
40 setCaption(i18n("Customize pppd Arguments")); 40 setCaption(i18n("Customize pppd Arguments"));
@@ -122,12 +122,12 @@ void 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(PPPData::data()->pppdArgument()); 124 QStringList arglist(_pppdata->pppdArgument());
125 125
126 // get defaults 126 // get defaults
127 PPPData::data()->setpppdArgumentDefaults(); 127 _pppdata->setpppdArgumentDefaults();
128 init(); 128 init();
129 129
130 // restore old list 130 // restore old list
131 PPPData::data()->setpppdArgument(arglist); 131 _pppdata->setpppdArgument(arglist);
132} 132}
133 133
@@ -137,5 +137,5 @@ void PPPdArguments::closebutton() {
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 PPPData::data()->setpppdArgument(arglist); 139 _pppdata->setpppdArgument(arglist);
140 140
141 done(0); 141 done(0);
@@ -147,5 +147,5 @@ void PPPdArguments::init() {
147 arguments->removeItem(0); 147 arguments->removeItem(0);
148 148
149 QStringList &arglist = PPPData::data()->pppdArgument(); 149 QStringList &arglist = _pppdata->pppdArgument();
150 for ( QStringList::Iterator it = arglist.begin(); 150 for ( QStringList::Iterator it = arglist.begin();
151 it != arglist.end(); 151 it != arglist.end();
diff --git a/noncore/settings/networksettings/ppp/pppdargs.h b/noncore/settings/networksettings/ppp/pppdargs.h
index c1cd28d..75f0c9d 100644
--- a/noncore/settings/networksettings/ppp/pppdargs.h
+++ b/noncore/settings/networksettings/ppp/pppdargs.h
@@ -34,9 +34,10 @@
34#include <qlistbox.h> 34#include <qlistbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36class PPPData;
36 37
37class PPPdArguments : public QDialog { 38class PPPdArguments : public QDialog {
38Q_OBJECT 39Q_OBJECT
39public: 40public:
40 PPPdArguments(QWidget *parent=0, const char *name=0); 41 PPPdArguments(PPPData*,QWidget *parent=0, const char *name=0);
41 ~PPPdArguments() {} 42 ~PPPdArguments() {}
42 43
@@ -63,4 +64,5 @@ private:
63 64
64 QPushButton *closebtn; 65 QPushButton *closebtn;
66 PPPData *_pppdata;
65}; 67};
66#endif 68#endif
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 3f1675c..59d68c9 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -39,19 +39,6 @@
39#include <assert.h> 39#include <assert.h>
40 40
41PPPData *PPPData::_data = 0; 41#define SEPARATOR -sseepp-
42Config *PPPData::config = 0; 42#define SEP QString("%1SEPARATOR%1")
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}
56 43
57PPPData::PPPData() 44PPPData::PPPData()
@@ -63,15 +50,4 @@ PPPData::PPPData()
63 pppderror(0) 50 pppderror(0)
64{ 51{
65}
66
67
68//
69// open configuration file
70//
71bool PPPData::open() {
72 qDebug("opening configfile NetworkSetupPPP");
73 if (config) return true;
74 config = new Config("NetworkSetupPPP");
75
76 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; 52 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
77 53
@@ -91,24 +67,52 @@ bool PPPData::open() {
91 ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); 67 ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch);
92 68
93 return true;
94} 69}
95 70
71Config PPPData::config()
72{
73 return Config("NetworkSetupPPP");
74}
96 75
97// 76//
98// save configuration 77// save configuration
99// 78//
100void PPPData::save() { 79void PPPData::save()
101 80{
102 if (config) { 81 qDebug("PPPData saving data");
103 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); 82 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count());
104 delete config; 83 QString key;
105 config = 0; 84 QStringList keys;
106 qDebug("worte confi NetworkSetupPPP"); 85 Config cfg = config();
107 } 86 for( QMap<QString,QString>::Iterator it = stringEntries.begin();
108 if (_data){ 87 it != stringEntries.end(); ++it ){
109 delete _data; 88 QString val = it.data();
110 _data = 0; 89 key = it.key();
111 } 90// qDebug("saving %s -> %s", key.latin1(), val.latin1() );
112 91 keys = QStringList::split( "SEPARATOR", key );
92 qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
93 cfg.setGroup(keys[0]);
94 cfg.writeEntry(keys[1], val);
95 }
96 for( QMap<QString,int>::Iterator it = intEntries.begin();
97 it != intEntries.end(); ++it ){
98 int val = it.data();
99 key = it.key();
100// qDebug("saving %s -> %i", key.latin1(), val );
101 keys = QStringList::split( "SEPARATOR", key );
102 qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val );
103 cfg.setGroup(keys[0]);
104 cfg.writeEntry(keys[1], val);
105 }
106 for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
107 it != listEntries.end(); ++it ){
108 QStringList val = it.data();
109 key = it.key();
110 QChar sep = sepEntries[key];
111// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() );
112 keys = QStringList::split( "SEPARATOR", key );
113 qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() );
114 cfg.setGroup(keys[0]);
115 cfg.writeEntry(keys[1], val, sep);
116 }
113} 117}
114 118
@@ -118,20 +122,9 @@ void PPPData::save() {
118// 122//
119void PPPData::cancel() { 123void PPPData::cancel() {
120 124 stringEntries.clear();
121// if (config) { 125 intEntries.clear();
122// config->rollback(); 126 listEntries.clear();
123// config->reparseConfiguration();
124// }
125
126} 127}
127 128
128
129// // currently differentiates between READWRITE and NONE only
130// int PPPData::access() const {
131
132// return 1;//config->getConfigState();
133// }
134
135
136// functions to read/write date to configuration file 129// functions to read/write date to configuration file
137QString PPPData::readConfig(const QString &group, const QString &key, 130QString PPPData::readConfig(const QString &group, const QString &key,
@@ -139,19 +132,28 @@ QString PPPData::readConfig(const QString &group, const QString &key,
139{ 132{
140// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); 133// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
141 if (config) { 134 QString idx = SEP.arg(group).arg(key);
142 config->setGroup(group); 135 if (stringEntries.find(idx) != stringEntries.end())
143 return config->readEntry(key, defvalue); 136 return stringEntries[idx];
144 } else 137 Config cfg = config();
145 return defvalue; 138 cfg.setGroup(group);
139 return cfg.readEntry(key, defvalue);
146} 140}
147 141
148 142
149int PPPData::readNumConfig(const QString &group, const QString &key, 143int PPPData::readNumConfig(const QString &group, const QString &key,
150 int defvalue) { 144 int defvalue)
151 if (config) { 145{
152 config->setGroup(group); 146 QString idx = SEP.arg(group).arg(key);
153 return config->readNumEntry(key, defvalue); 147 if (intEntries.find(idx) != intEntries.end())
154 } else 148 return intEntries[idx];
155 return defvalue; 149 Config cfg = config();
150 cfg.setGroup(group);
151 return cfg.readNumEntry(key, defvalue);
152
153// if (config) {
154// config->setGroup(group);
155// return config->readNumEntry(key, defvalue);
156// } else
157// return defvalue;
156 158
157} 159}
@@ -161,10 +163,21 @@ bool PPPData::readListConfig(const QString &group, const QString &key,
161 QStringList &list, char sep) { 163 QStringList &list, char sep) {
162 list.clear(); 164 list.clear();
163 if (config) { 165 QString idx = SEP.arg(group).arg(key);
164 config->setGroup(group); 166 if (listEntries.find(idx) != listEntries.end()){
165 list = config->readListEntry(key, sep); 167 list = listEntries[idx];
166 return true; 168 return true;
167 } else 169 }
168 return false; 170 Config cfg = config();
171 cfg.setGroup(group);
172 list = cfg.readListEntry(key, sep);
173 if (list.count() > 0) return true;
174 return false;
175
176// if (config) {
177// config->setGroup(group);
178// list = config->readListEntry(key, sep);
179// return true;
180// } else
181// return false;
169} 182}
170 183
@@ -172,25 +185,31 @@ bool PPPData::readListConfig(const QString &group, const QString &key,
172void PPPData::writeConfig(const QString &group, const QString &key, 185void PPPData::writeConfig(const QString &group, const QString &key,
173 const QString &value) { 186 const QString &value) {
174 if (config) { 187 stringEntries.insert( SEP.arg(group).arg(key), value );
175 config->setGroup(group); 188// if (config) {
176 config->writeEntry(key, value); 189// config->setGroup(group);
177 } 190// config->writeEntry(key, value);
191// }
178} 192}
179 193
180 194
181void PPPData::writeConfig(const QString &group, const QString &key, int value) { 195void PPPData::writeConfig(const QString &group, const QString &key, int value)
182 if (config) { 196{
183 config->setGroup(group); 197 intEntries.insert( SEP.arg(group).arg(key), value );
184 config->writeEntry(key, value); 198// if (config) {
185 } 199// config->setGroup(group);
200// config->writeEntry(key, value);
201// }
186} 202}
187 203
188 204
189void PPPData::writeListConfig(const QString &group, const QString &key, 205void PPPData::writeListConfig(const QString &group, const QString &key,
190 QStringList &list, char sep) { 206 QStringList &list, char sep)
191 if (config) { 207{
192 config->setGroup(group); 208 listEntries.insert( SEP.arg(group).arg(key), list );
193 config->writeEntry(key, list, sep); 209 sepEntries.insert( SEP.arg(group).arg(key), sep );
194 } 210// if (config) {
211// config->setGroup(group);
212// config->writeEntry(key, list, sep);
213// }
195} 214}
196 215
@@ -282,22 +301,22 @@ void PPPData::set_automatic_redial(bool set) {
282 301
283 302
284bool PPPData::get_iconify_on_connect() { 303// bool PPPData::get_iconify_on_connect() {
285 return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); 304// return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE);
286} 305// }
287 306
288 307
289void PPPData::set_iconify_on_connect(bool set) { 308// void PPPData::set_iconify_on_connect(bool set) {
290 writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); 309// writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set);
291} 310// }
292 311
293 312
294bool PPPData::get_dock_into_panel() { 313// bool PPPData::get_dock_into_panel() {
295 return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); 314// return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false);
296} 315// }
297 316
298 317
299void PPPData::set_dock_into_panel(bool set) { 318// void PPPData::set_dock_into_panel(bool set) {
300 writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); 319// writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set);
301} 320// }
302 321
303 322
@@ -791,5 +810,5 @@ int PPPData::newaccount() {
791 810
792 qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); 811 qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS);
793 if(!config) open(); 812// if(!config) open();
794 if (highcount >= MAX_ACCOUNTS) return -1; 813 if (highcount >= MAX_ACCOUNTS) return -1;
795 814
@@ -991,12 +1010,12 @@ void PPPData::setAcctEnabled(bool set) {
991 1010
992 1011
993int PPPData::VolAcctEnabled() { 1012// int PPPData::VolAcctEnabled() {
994 return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0); 1013// return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0);
995} 1014// }
996 1015
997 1016
998void PPPData::setVolAcctEnabled(int set) { 1017// void PPPData::setVolAcctEnabled(int set) {
999 writeConfig(cgroup, VOLACCTENABLED_KEY, set); 1018// writeConfig(cgroup, VOLACCTENABLED_KEY, set);
1000} 1019// }
1001 1020
1002 1021
@@ -1024,5 +1043,5 @@ void PPPData::setDefaultroute(bool set) {
1024bool PPPData::autoDNS() { 1043bool PPPData::autoDNS() {
1025 bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true); 1044 bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true);
1026 return (set && PPPData::data()->pppdVersionMin(2, 3, 7)); 1045 return (set && pppdVersionMin(2, 3, 7));
1027} 1046}
1028 1047
@@ -1227,10 +1246,14 @@ QMap<QString,QString> PPPData::getConfiguredInterfaces()
1227{ 1246{
1228 QMap<QString,QString> ifaces; 1247 QMap<QString,QString> ifaces;
1229 int count = readNumConfig( ACCLIST_GRP, ACCOUNTS_COUNT, -1 ); 1248 Config config = PPPData::config();
1230 QString accGrp; 1249 config.setGroup(ACCLIST_GRP);
1250 int count = config.readNumEntry( ACCOUNTS_COUNT, -1 );
1251 QString accGrp, dev, acc;
1231 for (int i = 0; i < count; i++){ 1252 for (int i = 0; i < count; i++){
1232 accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); 1253 accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i);
1233 ifaces.insert( readConfig( accGrp, ACOUNTS_DEV, "error" ), 1254 config.setGroup(accGrp);
1234 readConfig( accGrp, ACOUNTS_ACC, "error" ) ); 1255 dev = config.readEntry( ACOUNTS_DEV, "error" );
1256 acc = config.readEntry( ACOUNTS_ACC, "error" );
1257 ifaces.insert( dev, acc );
1235 } 1258 }
1236 1259
@@ -1241,12 +1264,13 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
1241{ 1264{
1242 QMap<QString,QString>::Iterator it; 1265 QMap<QString,QString>::Iterator it;
1243 QString accGrp;
1244 int i = 0; 1266 int i = 0;
1267 Config cfg = config();
1245 for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){ 1268 for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){
1246 accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); 1269 cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i));
1247 writeConfig( accGrp, ACOUNTS_DEV, it.key() ); 1270 cfg.writeEntry( ACOUNTS_DEV, it.key() );
1248 writeConfig( accGrp, ACOUNTS_ACC, it.data() ); 1271 cfg.writeEntry( ACOUNTS_ACC, it.data() );
1249 } 1272 }
1250 writeConfig( ACCLIST_GRP, ACCOUNTS_COUNT, i ); 1273 cfg.setGroup( ACCLIST_GRP );
1274 cfg.writeEntry( ACCOUNTS_COUNT, i );
1251 1275
1252} 1276}
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index c1c7e69..af960c6 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -156,17 +156,16 @@ public:
156 PPPData(); 156 PPPData();
157 ~PPPData() {}; 157 ~PPPData() {};
158 static PPPData* data();
159 158
160 enum { NumInitStrings = 2 }; 159 enum { NumInitStrings = 2 };
161 160
162 // general functions 161 // general functions
163 bool open();
164 void save(); 162 void save();
165 void cancel(); 163 void cancel();
166 164
167 QMap<QString,QString> getConfiguredInterfaces(); 165 static QMap<QString,QString> getConfiguredInterfaces();
168 void setConfiguredInterfaces( QMap<QString,QString> ); 166 static void setConfiguredInterfaces( QMap<QString,QString> );
169 167
170 // function to read/write date to configuration file 168 // function to read/write date to configuration file
169 static Config config();
171 QString readConfig(const QString &, const QString &, const QString &); 170 QString readConfig(const QString &, const QString &, const QString &);
172 int readNumConfig(const QString &, const QString &, int); 171 int readNumConfig(const QString &, const QString &, int);
@@ -208,9 +207,9 @@ public:
208 bool automatic_redial(); 207 bool automatic_redial();
209 208
210 void set_iconify_on_connect(bool set); 209// void set_iconify_on_connect(bool set);
211 bool get_iconify_on_connect(); 210// bool get_iconify_on_connect();
212 211
213 void set_dock_into_panel(bool set); 212// void set_dock_into_panel(bool set);
214 bool get_dock_into_panel(); 213// bool get_dock_into_panel();
215 214
216 const QString enter(); 215 const QString enter();
@@ -312,9 +311,4 @@ public:
312 void setVolumeHigh(const QString &); 311 void setVolumeHigh(const QString &);
313 312
314#if 0
315 void setUseCDLine(const int n);
316 int UseCDLine();
317#endif
318
319 // functions to set/get account information 313 // functions to set/get account information
320 int count() const; 314 int count() const;
@@ -375,6 +369,6 @@ public:
375 void setAcctEnabled(bool set); 369 void setAcctEnabled(bool set);
376 370
377 int VolAcctEnabled(); 371// int VolAcctEnabled();
378 void setVolAcctEnabled(int set); 372// void setVolAcctEnabled(int set);
379 373
380 bool autoDNS(); 374 bool autoDNS();
@@ -416,39 +410,10 @@ public:
416 void setpppdError(int err); 410 void setpppdError(int err);
417 411
418 // functions to set/query the accounting info
419// const QString accountingFile();
420// void setAccountingFile(const QString &);
421
422// const QString totalCosts();
423// void setTotalCosts(const QString &);
424
425// int totalBytes();
426// void setTotalBytes(int);
427
428// // graphing widget
429// void setGraphingOptions(bool enabled,
430 // QColor bg,
431 // QColor text,
432 // QColor in,
433 // QColor out);
434// void graphingOptions(bool &enabled,
435 // QColor &bg,
436 // QColor &text,
437 // QColor &in,
438 // QColor &out);
439// bool graphingEnabled();
440
441// // window positions
442// void winPosConWin(int &, int &);
443// void setWinPosConWin(int, int);
444// void winPosStatWin(int &, int &);
445// void setWinPosStatWin(int, int);
446
447private: 412private:
448 413
449 static PPPData *_data; 414 //static PPPData *_data;
450 int modemDeviceGroup; 415 int modemDeviceGroup;
451 QString passwd; 416 QString passwd;
452 static Config* config; // configuration object 417 // static Config* config; // configuration object
453 int highcount; // index of highest account 418 int highcount; // index of highest account
454 int caccount; // index of the current account 419 int caccount; // index of the current account
@@ -461,4 +426,9 @@ private:
461 426
462 QStringList phonelist; 427 QStringList phonelist;
428 QMap<QString,QString> stringEntries;
429 QMap<QString,int> intEntries;
430 QMap<QString,QStringList> listEntries;
431 QMap<QString,QChar> sepEntries;
432
463}; 433};
464 434
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index 7cbccc2..95df068 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -1,8 +1,9 @@
1
1#include "pppconfig.h" 2#include "pppconfig.h"
2#include "pppmodule.h" 3#include "pppmodule.h"
3#include "pppdata.h" 4#include "pppdata.h"
4#include "kpppwidget.h" 5#include "interfaceinformationppp.h"
5#include "interfaceinformationimp.h" 6#include "interfaceppp.h"
6//#include "devices.h" 7
7 8
8/** 9/**
@@ -11,13 +12,13 @@
11PPPModule::PPPModule() : Module() 12PPPModule::PPPModule() : Module()
12{ 13{
13 QMap<QString,QString> ifaces = PPPData::data()->getConfiguredInterfaces(); 14 QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces();
14 QMap<QString,QString>::Iterator it; 15 QMap<QString,QString>::Iterator it;
15 Interface *iface; 16 InterfacePPP *iface;
16 qDebug("getting interfaces"); 17 qDebug("getting interfaces");
17 for( it = ifaces.begin(); it != ifaces.end(); ++it ){ 18 for( it = ifaces.begin(); it != ifaces.end(); ++it ){
18 qDebug("ifaces %s", it.key().latin1()); 19 qDebug("ifaces %s", it.key().latin1());
19 iface = new Interface( 0, it.key() ); 20 iface = new InterfacePPP( 0, it.key() );
20 iface->setHardwareName( it.data() ); 21 iface->setHardwareName( it.data() );
21 list.append( iface ); 22 list.append( (Interface*)iface );
22 } 23 }
23} 24}
@@ -33,6 +34,5 @@ PPPModule::~PPPModule(){
33 delete i; 34 delete i;
34 } 35 }
35 PPPData::data()->setConfiguredInterfaces( ifaces ); 36 PPPData::setConfiguredInterfaces( ifaces );
36 PPPData::data()->save();
37} 37}
38 38
@@ -68,6 +68,6 @@ bool PPPModule::isOwner(Interface *i){
68QWidget *PPPModule::configure(Interface *i){ 68QWidget *PPPModule::configure(Interface *i){
69 qDebug("return ModemWidget"); 69 qDebug("return ModemWidget");
70 PPPConfigWidget *pppconfig = new PPPConfigWidget( i, 0, "PPPConfig", 70 PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
71 false, 71 0, "PPPConfig", false,
72 Qt::WDestructiveClose ); 72 Qt::WDestructiveClose );
73 return pppconfig; 73 return pppconfig;
@@ -82,5 +82,6 @@ QWidget *PPPModule::information(Interface *i){
82 // TODO ^ 82 // TODO ^
83 qDebug("return PPPModule::information"); 83 qDebug("return PPPModule::information");
84 InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i); 84// InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i);
85 InterfaceInformationPPP *information = new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
85 return information; 86 return information;
86} 87}
@@ -107,10 +108,12 @@ Interface *PPPModule::addNewInterface(const QString &newInterface){
107 qDebug("try to add iface %s",newInterface.latin1()); 108 qDebug("try to add iface %s",newInterface.latin1());
108 109
110 InterfacePPP *ifaceppp;
109 Interface *iface; 111 Interface *iface;
110 iface = new Interface(); 112 ifaceppp = new InterfacePPP();
111 PPPConfigWidget imp(iface, 0, "PPPConfigImp", true); 113 PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true);
112 imp.showMaximized(); 114 imp.showMaximized();
113 if(imp.exec() == QDialog::Accepted ){ 115 if(imp.exec() == QDialog::Accepted ){
114 iface->setModuleOwner( this ); 116 iface->setModuleOwner( this );
117 iface = ifaceppp;
115 list.append( iface ); 118 list.append( iface );
116 return iface; 119 return iface;