summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp
authortille <tille>2003-05-30 15:06:17 (UTC)
committer tille <tille>2003-05-30 15:06:17 (UTC)
commit8699d02f6c152afed9490e7e7a4315044261e6e8 (patch) (unidiff)
treed2ee2ba401c7a9db0e33beaf0617a1456fe01d50 /noncore/settings/networksettings/ppp
parentd8cec07fe5e54a68afe4feca574f9f4d2433e0c1 (diff)
downloadopie-8699d02f6c152afed9490e7e7a4315044261e6e8.zip
opie-8699d02f6c152afed9490e7e7a4315044261e6e8.tar.gz
opie-8699d02f6c152afed9490e7e7a4315044261e6e8.tar.bz2
modem and pppdata is now member of interfaceppp
Diffstat (limited to 'noncore/settings/networksettings/ppp') (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
@@ -52,4 +52,4 @@ void 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{
@@ -154,6 +154,6 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
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 }
@@ -162,5 +162,5 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
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
@@ -177,5 +177,5 @@ void AccountWidget::slotListBoxSelect(int idx) {
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 }
@@ -216,3 +216,3 @@ void AccountWidget::slotListBoxSelect(int idx) {
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
@@ -221,5 +221,5 @@ void AccountWidget::editaccount() {
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 }
@@ -247,3 +247,3 @@ void AccountWidget::newaccount() {
247// { 247// {
248// if (PPPData::data()->newaccount() == -1) 248// if (_pppdata->newaccount() == -1)
249 // return; 249 // return;
@@ -254,4 +254,4 @@ void AccountWidget::newaccount() {
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;
@@ -265,9 +265,9 @@ void AccountWidget::newaccount() {
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}
@@ -286,7 +286,7 @@ void AccountWidget::copyaccount() {
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}
@@ -302,3 +302,3 @@ void AccountWidget::deleteaccount() {
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());
@@ -306,3 +306,3 @@ void AccountWidget::deleteaccount() {
306 emit resetaccounts(); 306 emit resetaccounts();
307 PPPData::data()->save(); 307 _pppdata->save();
308 308
@@ -324,3 +324,3 @@ int AccountWidget::doTab(){
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"));
@@ -329,3 +329,3 @@ int AccountWidget::doTab(){
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);
@@ -334,13 +334,13 @@ int AccountWidget::doTab(){
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") );
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
@@ -44,2 +44,3 @@ class DNSWidget;
44class GatewayWidget; 44class GatewayWidget;
45class PPPData;
45 46
@@ -48,3 +49,3 @@ class AccountWidget : public QWidget {
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() {}
@@ -71,2 +72,3 @@ private:
71 72
73 PPPData *_pppdata;
72 QTabWidget *tabWindow; 74 QTabWidget *tabWindow;
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
@@ -67,3 +67,3 @@
67//#include "docking.h" 67//#include "docking.h"
68//#include "main.h" 68#include "interfaceppp.h"
69#include "modem.h" 69#include "modem.h"
@@ -76,4 +76,2 @@
76 76
77extern KPPPWidget *p_kppp;
78
79QString old_hostname; 77QString old_hostname;
@@ -82,5 +80,4 @@ bool modified_hostname;
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(""),
@@ -98,5 +95,4 @@ ConnectWidget::ConnectWidget(QWidget *parent, const char *name)
98 pausing(false), 95 pausing(false),
99// termwindow(0), 96 dialnumber(0),
100// stats(st), 97 _ifaceppp(ifp)
101 dialnumber(0)
102{ 98{
@@ -181,3 +177,3 @@ void ConnectWidget::preinit() {
181void ConnectWidget::init() { 177void ConnectWidget::init() {
182 PPPData::data()->setpppdError(0); 178 _ifaceppp->data()->setpppdError(0);
183 inittimer->stop(); 179 inittimer->stop();
@@ -196,10 +192,10 @@ void ConnectWidget::init() {
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);
@@ -209,3 +205,3 @@ void ConnectWidget::init() {
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..."));
@@ -215,3 +211,3 @@ void ConnectWidget::init() {
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;
@@ -225,3 +221,3 @@ void ConnectWidget::init() {
225 221
226 int lock = Modem::modem->lockdevice(); 222 int lock = _ifaceppp->modem()->lockdevice();
227 223
@@ -239,6 +235,6 @@ void ConnectWidget::init() {
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
@@ -248,7 +244,7 @@ void ConnectWidget::init() {
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
@@ -262,5 +258,5 @@ void ConnectWidget::init() {
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}
@@ -286,3 +282,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
286 282
287 QString initStr = PPPData::data()->modemInitStr(substate); 283 QString initStr = _ifaceppp->data()->modemInitStr(substate);
288 if (!initStr.isEmpty()) { 284 if (!initStr.isEmpty()) {
@@ -290,10 +286,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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 }
@@ -308,3 +304,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
308 */ 304 */
309 if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration()) 305 if (MODEM_TONEDURATION != _ifaceppp->data()->modemToneDuration())
310 vmain = 5; 306 vmain = 5;
@@ -318,3 +314,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -322,3 +318,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
322 emit debugMessage(msg); 318 emit debugMessage(msg);
323 setExpect(PPPData::data()->modemInitResp()); 319 setExpect(_ifaceppp->data()->modemInitResp());
324 writeline(sToneDuration); 320 writeline(sToneDuration);
@@ -338,3 +334,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -345,7 +341,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -357,3 +353,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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...");
@@ -361,4 +357,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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 }
@@ -374,6 +370,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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);
@@ -383,4 +379,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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);
@@ -390,3 +386,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
390 386
391 setExpect(PPPData::data()->modemConnectResp()); 387 setExpect(_ifaceppp->data()->modemConnectResp());
392 vmain = 100; 388 vmain = 100;
@@ -400,3 +396,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
400 if(!expecting) { 396 if(!expecting) {
401 myreadbuffer = PPPData::data()->modemConnectResp(); 397 myreadbuffer = _ifaceppp->data()->modemConnectResp();
402 setExpect("\n"); 398 setExpect("\n");
@@ -406,5 +402,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -412,6 +408,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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);
@@ -421,3 +417,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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();
@@ -425,3 +421,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
425 421
426 Modem::modem->setDataMode(false); 422 _ifaceppp->modem()->setDataMode(false);
427 vmain = 0; 423 vmain = 0;
@@ -431,3 +427,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
431 427
432 if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) { 428 if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) {
433 timeout_timer->stop(); 429 timeout_timer->stop();
@@ -436,3 +432,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
436 vmain = 20; 432 vmain = 20;
437 Modem::modem->unlockdevice(); 433 _ifaceppp->modem()->unlockdevice();
438 return; 434 return;
@@ -440,3 +436,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
440 436
441 if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) { 437 if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) {
442 timeout_timer->stop(); 438 timeout_timer->stop();
@@ -445,3 +441,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
445 vmain = 20; 441 vmain = 20;
446 Modem::modem->unlockdevice(); 442 _ifaceppp->modem()->unlockdevice();
447 return; 443 return;
@@ -453,3 +449,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -459,3 +455,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
459 vmain = 2; 455 vmain = 2;
460 scriptTimeout=PPPData::data()->modemTimeout()*1000; 456 scriptTimeout=_ifaceppp->data()->modemTimeout()*1000;
461 return; 457 return;
@@ -496,6 +492,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -515,4 +511,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -580,4 +576,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
580 576
581 writeline(PPPData::data()->modemHangupStr()); 577 writeline(_ifaceppp->data()->modemHangupStr());
582 setExpect(PPPData::data()->modemHangupResp()); 578 setExpect(_ifaceppp->data()->modemHangupResp());
583 579
@@ -594,3 +590,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
594 590
595 setExpect(PPPData::data()->modemRingResp()); 591 setExpect(_ifaceppp->data()->modemRingResp());
596 vmain = 150; 592 vmain = 150;
@@ -604,3 +600,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
604 600
605 QString idstring = PPPData::data()->storedUsername(); 601 QString idstring = _ifaceppp->data()->storedUsername();
606 602
@@ -640,3 +636,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
640 636
641 QString pwstring = PPPData::data()->password(); 637 QString pwstring = _ifaceppp->data()->password();
642 638
@@ -661,3 +657,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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());
@@ -787,4 +783,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -814,5 +810,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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) {
@@ -833,3 +829,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -837,4 +833,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -851,4 +847,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
851 if(result) { 847 if(result) {
852 if(!PPPData::data()->autoDNS()) 848 if(!_ifaceppp->data()->autoDNS())
853 adddns(); 849 adddns( _ifaceppp );
854 850
@@ -865,10 +861,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -892,3 +888,3 @@ void ConnectWidget::set_con_speed_string() {
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}
@@ -971,3 +967,3 @@ void ConnectWidget::pause() {
971void ConnectWidget::cancelbutton() { 967void ConnectWidget::cancelbutton() {
972 Modem::modem->stop(); 968 _ifaceppp->modem()->stop();
973 killTimer(main_timer_ID); 969 killTimer(main_timer_ID);
@@ -986,5 +982,5 @@ void ConnectWidget::cancelbutton() {
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
@@ -992,4 +988,4 @@ void ConnectWidget::cancelbutton() {
992 988
993 Modem::modem->killPPPDaemon(); 989 _ifaceppp->modem()->killPPPDaemon();
994 Modem::modem->hangup(); 990 _ifaceppp->modem()->hangup();
995 991
@@ -997,8 +993,8 @@ void ConnectWidget::cancelbutton() {
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
@@ -1028,3 +1024,3 @@ void ConnectWidget::script_timed_out() {
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();
@@ -1065,6 +1061,6 @@ void ConnectWidget::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
@@ -1090,3 +1086,3 @@ void ConnectWidget::if_waiting_slot() {
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.
@@ -1107,4 +1103,4 @@ void ConnectWidget::if_waiting_slot() {
1107 1103
1108 if(PPPData::data()->autoDNS()) 1104 if(_ifaceppp->data()->autoDNS())
1109 addpeerdns(); 1105 addpeerdns( _ifaceppp );
1110 1106
@@ -1114,5 +1110,5 @@ void ConnectWidget::if_waiting_slot() {
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..."));
@@ -1121,3 +1117,3 @@ void ConnectWidget::if_waiting_slot() {
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"));
@@ -1126,4 +1122,4 @@ void ConnectWidget::if_waiting_slot() {
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
@@ -1143,16 +1139,16 @@ void ConnectWidget::if_waiting_slot() {
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}
@@ -1170,5 +1166,5 @@ bool ConnectWidget::execppp() {
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
@@ -1176,7 +1172,7 @@ bool ConnectWidget::execppp() {
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 += ":";
@@ -1188,11 +1184,11 @@ bool ConnectWidget::execppp() {
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";
@@ -1202,9 +1198,9 @@ bool ConnectWidget::execppp() {
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();
@@ -1217,5 +1213,5 @@ bool ConnectWidget::execppp() {
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 }
@@ -1223,5 +1219,5 @@ bool ConnectWidget::execppp() {
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 }
@@ -1229,5 +1225,5 @@ bool ConnectWidget::execppp() {
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 }
@@ -1235,3 +1231,3 @@ bool ConnectWidget::execppp() {
1235 // check for debug 1231 // check for debug
1236 if(PPPData::data()->getPPPDebug()) 1232 if(_ifaceppp->data()->getPPPDebug())
1237 command += " debug"; 1233 command += " debug";
@@ -1249,3 +1245,3 @@ bool ConnectWidget::execppp() {
1249 1245
1250 return Modem::modem->execPPPDaemon(command); 1246 return _ifaceppp->modem()->execPPPDaemon(command);
1251} 1247}
@@ -1264,3 +1260,3 @@ void ConnectWidget::setMsg(const QString &msg) {
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}
@@ -1268,3 +1264,3 @@ void ConnectWidget::writeline(const QString &s) {
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;
@@ -1279,4 +1275,4 @@ void auto_hostname() {
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());
@@ -1288,3 +1284,3 @@ void auto_hostname() {
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;
@@ -1294,3 +1290,3 @@ void auto_hostname() {
1294 1290
1295 add_domain(new_hostname); 1291 add_domain(new_hostname, _ifaceppp);
1296 } 1292 }
@@ -1302,3 +1298,3 @@ void auto_hostname() {
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
@@ -1311,3 +1307,3 @@ void add_domain(const QString &domain) {
1311 1307
1312 if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { 1308 if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) {
1313 1309
@@ -1325,3 +1321,3 @@ void add_domain(const QString &domain) {
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() +
@@ -1334,3 +1330,3 @@ void add_domain(const QString &domain) {
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")) {
@@ -1352,3 +1348,3 @@ void add_domain(const QString &domain) {
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{
@@ -1356,4 +1352,4 @@ void adddns()
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();
@@ -1368,9 +1364,9 @@ void adddns()
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) {
@@ -1389,3 +1385,3 @@ void addpeerdns() {
1389 } 1385 }
1390 add_domain(PPPData::data()->domain()); 1386 add_domain(_ifaceppp->data()->domain(), _ifaceppp);
1391} 1387}
@@ -1393,3 +1389,3 @@ void addpeerdns() {
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
@@ -1399,3 +1395,3 @@ void removedns() {
1399 1395
1400 if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { 1396 if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) {
1401 1397
@@ -1412,3 +1408,3 @@ void removedns() {
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++) {
@@ -1431,3 +1427,3 @@ void removedns() {
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;
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
@@ -38,4 +38,3 @@
38#include "pwentry.h" 38#include "pwentry.h"
39//#include "docking.h" 39
40//#include "loginterm.h"
41 40
@@ -43,3 +42,4 @@
43 42
44class PPPStats; 43class InterfacePPP;
44class PPPData;
45 45
@@ -48,3 +48,3 @@ class ConnectWidget : public QWidget {
48public: 48public:
49 ConnectWidget(QWidget *parent, const char *name); 49 ConnectWidget(InterfacePPP*, QWidget *parent, const char *name);
50 ~ConnectWidget(); 50 ~ConnectWidget();
@@ -138,3 +138,3 @@ private:
138 138
139// PPPStats *stats; 139 InterfacePPP *_ifaceppp;
140}; 140};
@@ -143,8 +143,8 @@ private:
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
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
@@ -33,6 +33,5 @@
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),
@@ -43,5 +42,3 @@ ConWindow::ConWindow(QWidget *parent, const char *name, QDialog *mainwidget )
43 tl1(0), 42 tl1(0),
44// stats(st), 43 _pppdata(pd)
45 accountingEnabled(false),
46 volumeAccountingEnabled(false)
47{ 44{
@@ -117,118 +114,118 @@ QString ConWindow::prettyPrintVolume(unsigned int n) {
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
@@ -241,5 +238,5 @@ void ConWindow::startClock() {
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" ;
@@ -267,3 +264,3 @@ void ConWindow::timeclick() {
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);
@@ -277,3 +274,3 @@ void ConWindow::timeclick() {
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));
@@ -307,3 +304,3 @@ void ConWindow::timeclick() {
307 304
308// caption_string = PPPData::data()->accname(); 305// caption_string = _pppdata->accname();
309// caption_string += " "; 306// caption_string += " ";
@@ -314,3 +311,3 @@ void ConWindow::timeclick() {
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
@@ -330,4 +327,4 @@ void ConWindow::closeEvent( QCloseEvent *e ){
330 327
331 if(PPPData::data()->get_dock_into_panel()) 328// if(_pppdata->get_dock_into_panel())
332 dock(); 329// dock();
333} 330}
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
@@ -36,3 +36,3 @@
36 36
37//class PPPStats; 37class PPPData;
38 38
@@ -42,3 +42,3 @@ Q_OBJECT
42public: 42public:
43 ConWindow(QWidget *parent, const char *name, QDialog* ); 43 ConWindow(PPPData*, QWidget *parent, const char *name, QDialog* );
44 ~ConWindow(); 44 ~ConWindow();
@@ -51,3 +51,3 @@ private slots:
51 void timeclick(); 51 void timeclick();
52 void dock(); 52// void dock();
53 53
@@ -57,3 +57,3 @@ public:
57 void stopClock(); 57 void stopClock();
58 void accounting(bool); // show/ hide accounting info 58// void accounting(bool); // show/ hide accounting info
59 59
@@ -84,5 +84,3 @@ private:
84 QLabel *volinfo; 84 QLabel *volinfo;
85// PPPStats *stats; 85 PPPData *_pppdata;
86 bool accountingEnabled;
87 bool volumeAccountingEnabled;
88}; 86};
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
@@ -47,4 +47,5 @@
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{
@@ -156,6 +157,6 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name )
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 = "";
@@ -174,4 +175,4 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name )
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 {
@@ -189,6 +190,6 @@ bool DialWidget::save() {
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
@@ -201,5 +202,5 @@ bool DialWidget::save() {
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;
@@ -224,3 +225,3 @@ void DialWidget::selectionChanged(int) {
224void DialWidget::addNumber() { 225void DialWidget::addNumber() {
225 PhoneNumberDialog dlg(this); 226 PhoneNumberDialog dlg(this);
226 if(dlg.exec()) { 227 if(dlg.exec()) {
@@ -265,3 +266,3 @@ void DialWidget::downNumber() {
265void DialWidget::pppdargsbutton() { 266void DialWidget::pppdargsbutton() {
266 PPPdArguments pa(this); 267 PPPdArguments pa(_pppdata, this);
267 pa.exec(); 268 pa.exec();
@@ -274,4 +275,4 @@ void DialWidget::pppdargsbutton() {
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{
@@ -362,6 +363,6 @@ i18n("Here you can select commands to run at certain stages of the\n"
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 }
@@ -371,6 +372,6 @@ i18n("Here you can select commands to run at certain stages of the\n"
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;
@@ -385,4 +386,4 @@ bool ExecWidget::save() {
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{
@@ -451,3 +452,3 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name )
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)),
@@ -471,11 +472,11 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name )
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);
@@ -512,9 +513,9 @@ void 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}
@@ -539,4 +540,4 @@ void IPWidget::hitIPSelect( int i ) {
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{
@@ -574,3 +575,3 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
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);
@@ -647,3 +648,3 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
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);
@@ -663,7 +664,7 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
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);
@@ -697,3 +698,3 @@ void DNSWidget::DNS_Mode_Selected(int mode) {
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;
@@ -701,3 +702,3 @@ void DNSWidget::save() {
701 serverlist.append(dnsservers->text(i)); 702 serverlist.append(dnsservers->text(i));
702 PPPData::data()->setDns(serverlist); 703 _pppdata->setDns(serverlist);
703 704
@@ -706,7 +707,7 @@ void DNSWidget::save() {
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}
@@ -734,4 +735,4 @@ void DNSWidget::removedns() {
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{
@@ -787,3 +788,3 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na
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);
@@ -792,6 +793,6 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na
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 }
@@ -805,4 +806,4 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na
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}
@@ -825,4 +826,4 @@ void GatewayWidget::hitGatewaySelect( int i ) {
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{
@@ -869,4 +870,4 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name
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();
@@ -916,4 +917,4 @@ void ScriptWidget::save() {
916 } 917 }
917 PPPData::data()->setScriptType(typelist); 918 _pppdata->setScriptType(typelist);
918 PPPData::data()->setScript(arglist); 919 _pppdata->setScript(arglist);
919} 920}
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
@@ -49,2 +49,3 @@
49class IPLineEdit; 49class IPLineEdit;
50class PPPData;
50 51
@@ -53,3 +54,3 @@ class DialWidget : public QWidget {
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() {}
@@ -78,2 +79,3 @@ private:
78 QListBox *numbers; 79 QListBox *numbers;
80 PPPData *_pppdata;
79}; 81};
@@ -89,3 +91,3 @@ class ExecWidget : public QWidget {
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
@@ -106,2 +108,3 @@ private:
106 QLabel *discommand_label; 108 QLabel *discommand_label;
109 PPPData *_pppdata;
107}; 110};
@@ -112,3 +115,3 @@ class IPWidget : public QWidget {
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() {}
@@ -136,2 +139,3 @@ private:
136 QCheckBox *autoname; 139 QCheckBox *autoname;
140 PPPData *_pppdata;
137}; 141};
@@ -142,3 +146,3 @@ class DNSWidget : public QWidget {
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() {}
@@ -168,2 +172,3 @@ private:
168 QCheckBox *exdnsdisabled_toggle; 172 QCheckBox *exdnsdisabled_toggle;
173 PPPData *_pppdata;
169}; 174};
@@ -174,3 +179,3 @@ class GatewayWidget : public QWidget {
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() {}
@@ -192,2 +197,3 @@ private:
192 QCheckBox *defaultroute; 197 QCheckBox *defaultroute;
198 PPPData *_pppdata;
193}; 199};
@@ -198,3 +204,3 @@ class ScriptWidget : public QWidget {
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() {}
@@ -227,2 +233,3 @@ private:
227 QScrollBar *slb; 233 QScrollBar *slb;
234 PPPData *_pppdata;
228}; 235};
@@ -247,2 +254,3 @@ private:
247 QLineEdit *le; 254 QLineEdit *le;
255
248}; 256};
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
@@ -41,3 +41,3 @@
41#include "general.h" 41#include "general.h"
42//#include "version.h" 42#include "interfaceppp.h"
43//#include "miniterm.h" 43//#include "miniterm.h"
@@ -52,4 +52,4 @@
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{
@@ -174,3 +174,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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);
@@ -183,3 +183,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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)),
@@ -203,3 +203,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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:"));
@@ -207,2 +207,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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)),
@@ -220,3 +221,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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);
@@ -225,3 +226,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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);
@@ -230,3 +231,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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);
@@ -236,3 +237,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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);
@@ -244,3 +245,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
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}
@@ -249,3 +250,3 @@ void ModemWidget::speed_selection(int) {
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}
@@ -254,3 +255,3 @@ void ModemWidget::setenter(int ) {
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}
@@ -259,3 +260,3 @@ void ModemWidget::setmodemdc(int i) {
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}
@@ -264,3 +265,3 @@ void ModemWidget::setflowcontrol(int i) {
264void ModemWidget::modemlockfilechanged(bool set) { 265void ModemWidget::modemlockfilechanged(bool set) {
265 PPPData::data()->setModemLockFile(set); 266 _ifaceppp->data()->setModemLockFile(set);
266} 267}
@@ -269,3 +270,3 @@ void ModemWidget::modemlockfilechanged(bool set) {
269void ModemWidget::modemtimeoutchanged(int n) { 270void ModemWidget::modemtimeoutchanged(int n) {
270 PPPData::data()->setModemTimeout(n); 271 _ifaceppp->data()->setModemTimeout(n);
271} 272}
@@ -273,4 +274,5 @@ void ModemWidget::modemtimeoutchanged(int n) {
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{
@@ -280,3 +282,3 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
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)));
@@ -295,3 +297,3 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
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:"));
@@ -320,3 +322,4 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
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);
@@ -344,3 +347,3 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
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)),
@@ -401,3 +404,3 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
401void ModemWidget2::modemcmdsbutton() { 404void ModemWidget2::modemcmdsbutton() {
402 ModemCommands mc(this); 405 ModemCommands mc(_ifaceppp->data(), this);
403 mc.showMaximized(); 406 mc.showMaximized();
@@ -408,3 +411,3 @@ void ModemWidget2::modemcmdsbutton() {
408void ModemWidget2::query_modem() { 411void ModemWidget2::query_modem() {
409 ModemTransfer mt(this); 412 ModemTransfer mt(_ifaceppp->modem(), this);
410 mt.exec(); 413 mt.exec();
@@ -421,3 +424,3 @@ void ModemWidget2::query_modem() {
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}
@@ -426,3 +429,3 @@ void ModemWidget2::use_cdline_toggled(bool on) {
426void ModemWidget2::waitfordtchanged(bool b) { 429void ModemWidget2::waitfordtchanged(bool b) {
427 PPPData::data()->setWaitForDialTone((int)b); 430 _ifaceppp->data()->setWaitForDialTone((int)b);
428} 431}
@@ -430,3 +433,3 @@ void ModemWidget2::waitfordtchanged(bool b) {
430void ModemWidget2::busywaitchanged(int n) { 433void ModemWidget2::busywaitchanged(int n) {
431 PPPData::data()->setbusyWait(n); 434 _ifaceppp->data()->setbusyWait(n);
432} 435}
@@ -435,3 +438,3 @@ void ModemWidget2::busywaitchanged(int n) {
435void ModemWidget2::volumeChanged(int v) { 438void ModemWidget2::volumeChanged(int v) {
436 PPPData::data()->setVolume(v); 439 _ifaceppp->data()->setVolume(v);
437} 440}
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
@@ -36,4 +36,4 @@ class QCheckBox;
36class QComboBox; 36class QComboBox;
37 37class PPPData;
38 38class InterfacePPP;
39 39
@@ -42,3 +42,3 @@ class ModemWidget : public QWidget {
42public: 42public:
43 ModemWidget( QWidget *parent=0, const char *name=0 ); 43 ModemWidget( InterfacePPP*, QWidget *parent=0, const char *name=0 );
44 44
@@ -66,2 +66,3 @@ private:
66 QCheckBox *modemlockfile; 66 QCheckBox *modemlockfile;
67 InterfacePPP *_ifaceppp;
67}; 68};
@@ -72,3 +73,3 @@ class ModemWidget2 : public QWidget {
72public: 73public:
73 ModemWidget2( QWidget *parent=0, const char *name=0 ); 74 ModemWidget2( InterfacePPP*, QWidget *parent=0, const char *name=0 );
74 75
@@ -93,2 +94,3 @@ private:
93 QSlider *volume; 94 QSlider *volume;
95 InterfacePPP *_ifaceppp;
94}; 96};
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
@@ -39,2 +39,3 @@
39#include <qwhatsthis.h> 39#include <qwhatsthis.h>
40#include <qcheckbox.h>
40 41
@@ -72,2 +73,3 @@
72#include "general.h" 73#include "general.h"
74#include "interface.h"
73 75
@@ -77,6 +79,4 @@ KPPPWidget *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{
@@ -85,2 +85,11 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
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
@@ -92,105 +101,105 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
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
@@ -206,19 +215,19 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
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
@@ -226,3 +235,3 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
226 235
227 (void)new Modem; 236 (void)new Modem(_pppdata);
228 237
@@ -237,3 +246,3 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
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());
@@ -246,5 +255,5 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
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.
@@ -255,10 +264,10 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
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
@@ -276,3 +285,3 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
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){
@@ -348,3 +357,3 @@ void KPPPWidget::enterPressedInPW() {
348void KPPPWidget::saveMyself() { 357void KPPPWidget::saveMyself() {
349 PPPData::data()->save(); 358 _pppdata->save();
350} 359}
@@ -357,3 +366,3 @@ void KPPPWidget::shutDown() {
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}
@@ -366,3 +375,3 @@ void KPPPWidget::log_window_toggled(bool on) {
366 375
367// int count = PPPData::data()->count(); 376// int count = _pppdata->count();
368 377
@@ -377,4 +386,4 @@ void KPPPWidget::log_window_toggled(bool on) {
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// }
@@ -382,10 +391,10 @@ void KPPPWidget::log_window_toggled(bool on) {
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// }
@@ -394,6 +403,6 @@ void KPPPWidget::log_window_toggled(bool on) {
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// }
@@ -415,7 +424,9 @@ void 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();
@@ -430,3 +441,3 @@ void KPPPWidget::sigPPPDDied() {
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" );
@@ -442,3 +453,3 @@ void KPPPWidget::sigPPPDDied() {
442 453
443 PPPData::data()->setpppdRunning(false); 454 _pppdata->setpppdRunning(false);
444 455
@@ -446,3 +457,3 @@ void KPPPWidget::sigPPPDDied() {
446 QApplication::flushX(); 457 QApplication::flushX();
447 execute_command(PPPData::data()->command_on_disconnect()); 458 execute_command(_pppdata->command_on_disconnect());
448 459
@@ -450,3 +461,3 @@ void KPPPWidget::sigPPPDDied() {
450 461
451// con_win->stopClock(); 462 con_win->stopClock();
452// DockWidget::dock_widget->stop_stats(); 463// DockWidget::dock_widget->stop_stats();
@@ -454,20 +465,21 @@ void KPPPWidget::sigPPPDDied() {
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 "
@@ -492,13 +504,13 @@ void KPPPWidget::sigPPPDDied() {
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();
@@ -507,3 +519,3 @@ void KPPPWidget::sigPPPDDied() {
507 } 519 }
508 PPPData::data()->setpppdError(0); 520 _pppdata->setpppdError(0);
509 } 521 }
@@ -528,6 +540,6 @@ void KPPPWidget::sigPPPDDied() {
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}
@@ -541,6 +553,6 @@ void KPPPWidget::beginConnect() {
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// }
@@ -562,3 +574,3 @@ void KPPPWidget::beginConnect() {
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);
@@ -569,3 +581,3 @@ void KPPPWidget::beginConnect() {
569 581
570 QFileInfo info2(PPPData::data()->modemDevice()); 582 QFileInfo info2(_pppdata->modemDevice());
571 583
@@ -577,3 +589,3 @@ void KPPPWidget::beginConnect() {
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);
@@ -584,16 +596,13 @@ void KPPPWidget::beginConnect() {
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;
@@ -607,3 +616,3 @@ void KPPPWidget::beginConnect() {
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!");
@@ -615,3 +624,3 @@ void KPPPWidget::beginConnect() {
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);
@@ -626,7 +635,7 @@ void KPPPWidget::beginConnect() {
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
@@ -635,3 +644,3 @@ void KPPPWidget::disconnect() {
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;
@@ -644,3 +653,3 @@ void KPPPWidget::disconnect() {
644 653
645// con->hide(); 654 con->hide();
646 } 655 }
@@ -653,3 +662,3 @@ void KPPPWidget::disconnect() {
653 QApplication::flushX(); 662 QApplication::flushX();
654 execute_command(PPPData::data()->command_on_disconnect()); 663 execute_command(_pppdata->command_on_disconnect());
655 664
@@ -661,5 +670,5 @@ void KPPPWidget::disconnect() {
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
@@ -683,3 +692,3 @@ void KPPPWidget::disconnect() {
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,
@@ -690,3 +699,3 @@ void KPPPWidget::quitbutton() {
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();
@@ -695,6 +704,6 @@ void KPPPWidget::quitbutton() {
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();
@@ -712,9 +721,9 @@ void KPPPWidget::quitbutton() {
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)
@@ -728,5 +737,5 @@ void KPPPWidget::quitbutton() {
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
@@ -745,5 +754,5 @@ void KPPPWidget::quitbutton() {
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;
@@ -768,3 +777,3 @@ void 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}
@@ -774,6 +783,6 @@ void 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}
@@ -817,3 +826,3 @@ void KPPPWidget::showNews() {
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);
@@ -869,4 +878,4 @@ void KPPPWidget::showNews() {
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 }
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
@@ -36,3 +36,4 @@
36class QPushButton; 36class QPushButton;
37 37class Interface;
38class PPPData;
38 39
@@ -42,3 +43,3 @@ public:
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();
@@ -72,4 +73,4 @@ public:
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;
@@ -88,3 +89,3 @@ private:
88 QString ruleset_load_errmsg; 89 QString ruleset_load_errmsg;
89 90 PPPData *_pppdata;
90 QPushButton *setup_b; 91 QPushButton *setup_b;
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
@@ -64,3 +64,3 @@ static sigjmp_buf jmp_buffer;
64 64
65Modem *Modem::modem = 0; 65//Modem *Modem::modem = 0;
66 66
@@ -93,5 +93,5 @@ const char* pppdPath() {
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;
@@ -104,3 +104,2 @@ Modem::Modem()
104 device = "/dev/modem"; 104 device = "/dev/modem";
105 modem = this;
106} 105}
@@ -108,4 +107,4 @@ Modem::Modem()
108 107
109Modem::~Modem() { 108Modem::~Modem()
110 modem = 0; 109{
111} 110}
@@ -117,3 +116,3 @@ speed_t Modem::modemspeed() {
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
@@ -167,3 +166,3 @@ bool Modem::opentty() {
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) {
@@ -177,3 +176,3 @@ bool Modem::opentty() {
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) {
@@ -225,4 +224,4 @@ bool Modem::opentty() {
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;
@@ -355,3 +354,3 @@ bool Modem::writeLine(const char *buf) {
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")
@@ -395,5 +394,5 @@ bool Modem::hangup() {
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
@@ -433,3 +432,3 @@ bool Modem::hangup() {
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
@@ -456,7 +455,7 @@ void Modem::escape_to_command_mode() {
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
@@ -576,3 +575,3 @@ int Modem::lockdevice() {
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.");
@@ -585,3 +584,3 @@ int Modem::lockdevice() {
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
@@ -616,3 +615,3 @@ if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) {
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) {
@@ -990,3 +989,3 @@ bool Modem::execPPPDaemon(const QString & arguments)
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;
@@ -998,3 +997,3 @@ void Modem::killPPPDaemon()
998{ 997{
999 PPPData::data()->setpppdRunning(false); 998 _pppdata->setpppdRunning(false);
1000 killpppd(); 999 killpppd();
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
@@ -37,3 +37,3 @@
37 37
38//#include <config.h> 38class PPPData;
39 39
@@ -45,3 +45,3 @@ class Modem : public QObject {
45public: 45public:
46 Modem(); 46 Modem(PPPData*);
47 ~Modem(); 47 ~Modem();
@@ -78,3 +78,3 @@ public:
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;
@@ -114,2 +114,3 @@ private:
114 bool modem_is_locked; 114 bool modem_is_locked;
115 PPPData *_pppdata;
115}; 116};
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
@@ -42,4 +42,4 @@
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{
@@ -242,36 +242,36 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name)
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}
@@ -280,31 +280,31 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name)
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();
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
@@ -46,3 +46,3 @@ public:
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() {}
@@ -54,2 +54,3 @@ private slots:
54private: 54private:
55 PPPData *_pppdata;
55 56
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
@@ -39,4 +39,5 @@
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{
@@ -99,4 +100,4 @@ void ModemTransfer::ati_done() {
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();
@@ -128,3 +129,3 @@ void ModemTransfer::init() {
128 129
129 int lock = Modem::modem->lockdevice(); 130 int lock = _modem->lockdevice();
130 if (lock == 1) { 131 if (lock == 1) {
@@ -142,6 +143,6 @@ void ModemTransfer::init() {
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
@@ -154,5 +155,5 @@ void ModemTransfer::init() {
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;
@@ -162,5 +163,5 @@ void ModemTransfer::init() {
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}
@@ -177,3 +178,3 @@ void ModemTransfer::do_script() {
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;
@@ -192,3 +193,3 @@ void ModemTransfer::do_script() {
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;
@@ -225,3 +226,3 @@ void ModemTransfer::cancelbutton() {
225 scripttimer->stop(); 226 scripttimer->stop();
226 Modem::modem->stop(); 227 _modem->stop();
227 timeout_timer->stop(); 228 timeout_timer->stop();
@@ -231,6 +232,6 @@ void ModemTransfer::cancelbutton() {
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();
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
@@ -39,2 +39,4 @@
39 39
40class Modem;
41
40const int NUM_OF_ATI = 8; 42const int NUM_OF_ATI = 8;
@@ -45,3 +47,3 @@ class ModemTransfer : public QDialog {
45public: 47public:
46 ModemTransfer(QWidget *parent=0, const char *name=0); 48 ModemTransfer(Modem*, QWidget *parent=0, const char *name=0);
47 49
@@ -62,2 +64,3 @@ protected:
62private: 64private:
65 Modem *_modem;
63 int step; 66 int step;
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
@@ -6,6 +6,6 @@ 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/
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
@@ -7,3 +7,3 @@
7#include "general.h" 7#include "general.h"
8#include "interface.h" 8#include "interfaceppp.h"
9#include "modem.h" 9#include "modem.h"
@@ -13,3 +13,3 @@
13 13
14PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent, 14PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
15 const char *name, 15 const char *name,
@@ -26,12 +26,7 @@ PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent,
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
@@ -43,7 +38,7 @@ PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent,
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") );
@@ -63,7 +58,7 @@ void PPPConfigWidget::accept()
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();
@@ -74,3 +69,3 @@ void PPPConfigWidget::reject()
74{ 69{
75 PPPData::data()->cancel(); 70 interface->data()->cancel();
76 QDialog::reject(); 71 QDialog::reject();
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
@@ -6,3 +6,4 @@
6class QTabWidget; 6class QTabWidget;
7class Interface; 7//class Interface;
8class InterfacePPP;
8class AccountWidget; 9class AccountWidget;
@@ -16,3 +17,3 @@ public:
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 );
@@ -26,3 +27,3 @@ protected slots:
26 private: 27 private:
27 Interface *interface; 28 InterfacePPP *interface;
28 QTabWidget *tabWindow; 29 QTabWidget *tabWindow;
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
@@ -36,4 +36,4 @@
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{
@@ -123,6 +123,6 @@ void PPPdArguments::defaultsbutton() {
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();
@@ -130,3 +130,3 @@ void PPPdArguments::defaultsbutton() {
130 // restore old list 130 // restore old list
131 PPPData::data()->setpppdArgument(arglist); 131 _pppdata->setpppdArgument(arglist);
132} 132}
@@ -138,3 +138,3 @@ void PPPdArguments::closebutton() {
138 arglist.append(arguments->text(i)); 138 arglist.append(arguments->text(i));
139 PPPData::data()->setpppdArgument(arglist); 139 _pppdata->setpppdArgument(arglist);
140 140
@@ -148,3 +148,3 @@ void PPPdArguments::init() {
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();
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
@@ -35,2 +35,3 @@
35#include <qlabel.h> 35#include <qlabel.h>
36class PPPData;
36 37
@@ -39,3 +40,3 @@ Q_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() {}
@@ -64,2 +65,3 @@ private:
64 QPushButton *closebtn; 65 QPushButton *closebtn;
66 PPPData *_pppdata;
65}; 67};
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
@@ -40,17 +40,4 @@
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
@@ -64,13 +51,2 @@ PPPData::PPPData()
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;
@@ -92,5 +68,8 @@ bool PPPData::open() {
92 68
93 return true;
94} 69}
95 70
71Config PPPData::config()
72{
73 return Config("NetworkSetupPPP");
74}
96 75
@@ -99,15 +78,40 @@ bool PPPData::open() {
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}
@@ -119,18 +123,7 @@ void PPPData::save() {
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
@@ -140,7 +133,8 @@ QString PPPData::readConfig(const QString &group, const QString &key,
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}
@@ -149,8 +143,16 @@ QString PPPData::readConfig(const QString &group, const QString &key,
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
@@ -162,8 +164,19 @@ bool PPPData::readListConfig(const QString &group, const QString &key,
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}
@@ -173,6 +186,7 @@ void 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}
@@ -180,7 +194,9 @@ void PPPData::writeConfig(const QString &group, const QString &key,
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}
@@ -189,7 +205,10 @@ void PPPData::writeConfig(const QString &group, const QString &key, int value) {
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}
@@ -283,20 +302,20 @@ void PPPData::set_automatic_redial(bool set) {
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
@@ -792,3 +811,3 @@ int PPPData::newaccount() {
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;
@@ -992,10 +1011,10 @@ void PPPData::setAcctEnabled(bool set) {
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
@@ -1025,3 +1044,3 @@ bool 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}
@@ -1228,8 +1247,12 @@ QMap<QString,QString> PPPData::getConfiguredInterfaces()
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 }
@@ -1242,10 +1265,11 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
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
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
@@ -157,3 +157,2 @@ public:
157 ~PPPData() {}; 157 ~PPPData() {};
158 static PPPData* data();
159 158
@@ -162,3 +161,2 @@ public:
162 // general functions 161 // general functions
163 bool open();
164 void save(); 162 void save();
@@ -166,6 +164,7 @@ public:
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 &);
@@ -209,7 +208,7 @@ public:
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
@@ -313,7 +312,2 @@ public:
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
@@ -376,4 +370,4 @@ public:
376 370
377 int VolAcctEnabled(); 371// int VolAcctEnabled();
378 void setVolAcctEnabled(int set); 372// void setVolAcctEnabled(int set);
379 373
@@ -417,37 +411,8 @@ public:
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
@@ -462,2 +427,7 @@ private:
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};
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 +1,2 @@
1
1#include "pppconfig.h" 2#include "pppconfig.h"
@@ -3,5 +4,5 @@
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
@@ -12,5 +13,5 @@ PPPModule::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");
@@ -18,5 +19,5 @@ PPPModule::PPPModule() : Module()
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 }
@@ -34,4 +35,3 @@ PPPModule::~PPPModule(){
34 } 35 }
35 PPPData::data()->setConfiguredInterfaces( ifaces ); 36 PPPData::setConfiguredInterfaces( ifaces );
36 PPPData::data()->save();
37} 37}
@@ -69,4 +69,4 @@ QWidget *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 );
@@ -83,3 +83,4 @@ QWidget *PPPModule::information(Interface *i){
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;
@@ -108,5 +109,6 @@ Interface *PPPModule::addNewInterface(const QString &newInterface){
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();
@@ -114,2 +116,3 @@ Interface *PPPModule::addNewInterface(const QString &newInterface){
114 iface->setModuleOwner( this ); 116 iface->setModuleOwner( this );
117 iface = ifaceppp;
115 list.append( iface ); 118 list.append( iface );