Diffstat (limited to 'noncore/settings/networksettings/ppp/general.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/general.cpp | 59 |
1 files changed, 31 insertions, 28 deletions
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 | |||
@@ -34,29 +34,29 @@ | |||
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qslider.h> | 35 | #include <qslider.h> |
36 | #include <qspinbox.h> | 36 | #include <qspinbox.h> |
37 | #include <qwhatsthis.h> | 37 | #include <qwhatsthis.h> |
38 | 38 | ||
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" |
46 | #include "devices.h" | 46 | #include "devices.h" |
47 | #include "pppdata.h" | 47 | #include "pppdata.h" |
48 | //#include <klocale.h> | 48 | //#include <klocale.h> |
49 | #define i18n QObject::tr | 49 | #define i18n QObject::tr |
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 | ||
58 | QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); | 58 | QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); |
59 | 59 | ||
60 | QLabel *label1; | 60 | QLabel *label1; |
61 | label1 = new QLabel(i18n("Modem de&vice:"), this); | 61 | label1 = new QLabel(i18n("Modem de&vice:"), this); |
62 | tl->addWidget(label1, 0, 0); | 62 | tl->addWidget(label1, 0, 0); |
@@ -167,26 +167,26 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) | |||
167 | "works you can try to increase this value, but to\n" | 167 | "works you can try to increase this value, but to\n" |
168 | "no more than 115200 bits/sec (unless you know\n" | 168 | "no more than 115200 bits/sec (unless you know\n" |
169 | "that your serial port supports higher speeds)."); | 169 | "that your serial port supports higher speeds)."); |
170 | 170 | ||
171 | QWhatsThis::add(baud_label,tmp); | 171 | QWhatsThis::add(baud_label,tmp); |
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 | ||
179 | tl->addRowSpacing(4, 10); | 179 | tl->addRowSpacing(4, 10); |
180 | 180 | ||
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); |
188 | // l12->addStretch(1); | 188 | // l12->addStretch(1); |
189 | QWhatsThis::add(modemlockfile, | 189 | QWhatsThis::add(modemlockfile, |
190 | i18n("<p>To prevent other programs from accessing the\n" | 190 | i18n("<p>To prevent other programs from accessing the\n" |
191 | "modem while a connection is established, a\n" | 191 | "modem while a connection is established, a\n" |
192 | "file can be created to indicate that the modem\n" | 192 | "file can be created to indicate that the modem\n" |
@@ -196,109 +196,111 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) | |||
196 | "be done.\n" | 196 | "be done.\n" |
197 | "\n" | 197 | "\n" |
198 | "<b>Default</b>: On")); | 198 | "<b>Default</b>: On")); |
199 | 199 | ||
200 | // Modem Timeout Line Edit Box | 200 | // Modem Timeout Line Edit Box |
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); |
211 | timeoutLayout->addWidget(modemtimeout); | 212 | timeoutLayout->addWidget(modemtimeout); |
212 | tl->addMultiCellLayout(timeoutLayout, 6, 6, 0, 1); | 213 | tl->addMultiCellLayout(timeoutLayout, 6, 6, 0, 1); |
213 | 214 | ||
214 | QWhatsThis::add(modemtimeout, | 215 | QWhatsThis::add(modemtimeout, |
215 | i18n("This specifies how long <i>kppp</i> waits for a\n" | 216 | i18n("This specifies how long <i>kppp</i> waits for a\n" |
216 | "<i>CONNECT</i> response from your modem. The\n" | 217 | "<i>CONNECT</i> response from your modem. The\n" |
217 | "recommended value is 30 seconds.")); | 218 | "recommended value is 30 seconds.")); |
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); |
241 | } | 242 | } |
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, |
285 | i18n("<p>Normally the modem waits for a dial tone\n" | 287 | i18n("<p>Normally the modem waits for a dial tone\n" |
286 | "from your phone line, indicating that it can\n" | 288 | "from your phone line, indicating that it can\n" |
287 | "start to dial a number. If your modem does not\n" | 289 | "start to dial a number. If your modem does not\n" |
288 | "recognize this sound, or your local phone system\n" | 290 | "recognize this sound, or your local phone system\n" |
289 | "does not emit such a tone, uncheck this option\n" | 291 | "does not emit such a tone, uncheck this option\n" |
290 | "\n" | 292 | "\n" |
291 | "<b>Default:</b>: On")); | 293 | "<b>Default:</b>: On")); |
292 | 294 | ||
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")); |
300 | connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); | 302 | connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); |
301 | waitLayout->addWidget(waitLabel); | 303 | waitLayout->addWidget(waitLabel); |
302 | waitLayout->addWidget(busywait); | 304 | waitLayout->addWidget(busywait); |
303 | l1->addLayout( waitLayout ); | 305 | l1->addLayout( waitLayout ); |
304 | 306 | ||
@@ -313,17 +315,18 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name) | |||
313 | 315 | ||
314 | l1->addSpacing(10); | 316 | l1->addSpacing(10); |
315 | 317 | ||
316 | QHBoxLayout *hbl = new QHBoxLayout; | 318 | QHBoxLayout *hbl = new QHBoxLayout; |
317 | hbl->setSpacing(2);//KDialog::spacingHint()); | 319 | hbl->setSpacing(2);//KDialog::spacingHint()); |
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); |
325 | 328 | ||
326 | l1->addLayout(hbl); | 329 | l1->addLayout(hbl); |
327 | 330 | ||
328 | connect(volume, SIGNAL(valueChanged(int)), | 331 | connect(volume, SIGNAL(valueChanged(int)), |
329 | this, SLOT(volumeChanged(int))); | 332 | this, SLOT(volumeChanged(int))); |
@@ -337,17 +340,17 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name) | |||
337 | 340 | ||
338 | QWhatsThis::add(volumeLabel,tmp); | 341 | QWhatsThis::add(volumeLabel,tmp); |
339 | QWhatsThis::add(volume, tmp); | 342 | QWhatsThis::add(volume, tmp); |
340 | 343 | ||
341 | l1->addSpacing(20); | 344 | l1->addSpacing(20); |
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); |
349 | l12->addStretch(1); | 352 | l12->addStretch(1); |
350 | l1->addStretch(1); | 353 | l1->addStretch(1); |
351 | QWhatsThis::add(chkbox1, | 354 | QWhatsThis::add(chkbox1, |
352 | i18n("This controls how <i>kppp</i> detects that the modem\n" | 355 | i18n("This controls how <i>kppp</i> detects that the modem\n" |
353 | "is not responding. Unless you are having\n" | 356 | "is not responding. Unless you are having\n" |
@@ -394,45 +397,45 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name) | |||
394 | connect(modeminfo_button, SIGNAL(clicked()), | 397 | connect(modeminfo_button, SIGNAL(clicked()), |
395 | SLOT(query_modem())); | 398 | SLOT(query_modem())); |
396 | // connect(terminal_button, SIGNAL(clicked()), | 399 | // connect(terminal_button, SIGNAL(clicked()), |
397 | // SLOT(terminal())); | 400 | // SLOT(terminal())); |
398 | } | 401 | } |
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 | ||
413 | 416 | ||
414 | // void ModemWidget2::terminal() { | 417 | // void ModemWidget2::terminal() { |
415 | // MiniTerm terminal(NULL,NULL); | 418 | // MiniTerm terminal(NULL,NULL); |
416 | // terminal.exec(); | 419 | // terminal.exec(); |
417 | // } | 420 | // } |
418 | 421 | ||
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 | ||