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