-rw-r--r-- | noncore/settings/networksettings/ppp/devices.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/general.cpp | 34 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/general.h | 17 |
3 files changed, 55 insertions, 3 deletions
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp index e2c67d8..c658227 100644 --- a/noncore/settings/networksettings/ppp/devices.cpp +++ b/noncore/settings/networksettings/ppp/devices.cpp | |||
@@ -186,34 +186,39 @@ int DevicesWidget::doTab(){ | |||
186 | } else { | 186 | } else { |
187 | QString tit = tr("Edit Device: "); | 187 | QString tit = tr("Edit Device: "); |
188 | tit += _pppdata->devname(); | 188 | tit += _pppdata->devname(); |
189 | dlg->setCaption(tit); | 189 | dlg->setCaption(tit); |
190 | isnew = false; | 190 | isnew = false; |
191 | } | 191 | } |
192 | 192 | ||
193 | modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" ); | 193 | modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" ); |
194 | tabWindow->addTab( modem1, tr("&Device") ); | 194 | tabWindow->addTab( modem1, tr("&Device") ); |
195 | modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" ); | 195 | modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" ); |
196 | tabWindow->addTab( modem2, tr("&Modem") ); | 196 | tabWindow->addTab( modem2, tr("&Modem") ); |
197 | 197 | ||
198 | connect(modem2, SIGNAL(sig_beforeQueryModem()), | ||
199 | modem1, SLOT(slotBeforeModemQuery())); | ||
200 | connect(modem2, SIGNAL(sig_afterQueryModem()), | ||
201 | modem1, SLOT(slotAfterModemQuery())); | ||
202 | |||
198 | int result = 0; | 203 | int result = 0; |
199 | bool ok = false; | 204 | bool ok = false; |
200 | 205 | ||
201 | while (!ok){ | 206 | while (!ok){ |
202 | result = QPEApplication::execDialog( dlg ); | 207 | result = QPEApplication::execDialog( dlg ); |
203 | ok = true; | 208 | ok = true; |
204 | 209 | ||
205 | if(result == QDialog::Accepted) { | 210 | if(result == QDialog::Accepted) { |
206 | if (!modem1->save()){ | 211 | if (!modem1->save()){ |
207 | QMessageBox::critical(this, "error", tr( "You must enter a unique device name")); | 212 | QMessageBox::critical(this, tr("Error"), tr( "You must enter a unique device name")); |
208 | ok = false; | 213 | ok = false; |
209 | }else{ | 214 | }else{ |
210 | modem2->save(); | 215 | modem2->save(); |
211 | } | 216 | } |
212 | } | 217 | } |
213 | } | 218 | } |
214 | 219 | ||
215 | delete dlg; | 220 | delete dlg; |
216 | 221 | ||
217 | return result; | 222 | return result; |
218 | } | 223 | } |
219 | 224 | ||
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index 40ba19b..5e2a04f 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp | |||
@@ -277,25 +277,24 @@ ModemWidget::~ModemWidget() | |||
277 | if (! s.isEmpty() ) devs << s; | 277 | if (! s.isEmpty() ) devs << s; |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
281 | QString edited = modemdevice->currentText(); | 281 | QString edited = modemdevice->currentText(); |
282 | if ( !( edited ).isEmpty() ) | 282 | if ( !( edited ).isEmpty() ) |
283 | { | 283 | { |
284 | edited.simplifyWhiteSpace(); | 284 | edited.simplifyWhiteSpace(); |
285 | if ( devs.contains( edited ) == 0 ) | 285 | if ( devs.contains( edited ) == 0 ) |
286 | { | 286 | { |
287 | devs << edited; | 287 | devs << edited; |
288 | } | 288 | } |
289 | _pppdata->setModemDevice( edited ); | ||
290 | } | 289 | } |
291 | 290 | ||
292 | 291 | ||
293 | Config cfg("NetworkSetupPPP"); | 292 | Config cfg("NetworkSetupPPP"); |
294 | cfg.setGroup("Devices_General"); | 293 | cfg.setGroup("Devices_General"); |
295 | cfg.writeEntry("devices",devs,','); | 294 | cfg.writeEntry("devices",devs,','); |
296 | 295 | ||
297 | } | 296 | } |
298 | 297 | ||
299 | // void ModemWidget::speed_selection(int) { | 298 | // void ModemWidget::speed_selection(int) { |
300 | // _pppdata->setSpeed(baud_c->text(baud_c->currentItem())); | 299 | // _pppdata->setSpeed(baud_c->text(baud_c->currentItem())); |
301 | // } | 300 | // } |
@@ -328,36 +327,63 @@ ModemWidget::~ModemWidget() | |||
328 | // _pppdata->setModemTimeout(n); | 327 | // _pppdata->setModemTimeout(n); |
329 | // } | 328 | // } |
330 | 329 | ||
331 | 330 | ||
332 | 331 | ||
333 | bool ModemWidget::save() | 332 | bool ModemWidget::save() |
334 | { | 333 | { |
335 | //first check to make sure that the device name is unique! | 334 | //first check to make sure that the device name is unique! |
336 | if(modemname->text().isEmpty() || | 335 | if(modemname->text().isEmpty() || |
337 | !_pppdata->isUniqueDevname(modemname->text())) | 336 | !_pppdata->isUniqueDevname(modemname->text())) |
338 | return false; | 337 | return false; |
339 | 338 | ||
340 | odebug << "ModemWidget::save saving modem1 data" << oendl; | ||
341 | _pppdata->setDevname( modemname->text() ); | 339 | _pppdata->setDevname( modemname->text() ); |
342 | _pppdata->setModemDevice( modemdevice->currentText() ); | 340 | _pppdata->setModemDevice( modemdevice->currentText() ); |
343 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 341 | _pppdata->setFlowcontrol(flowcontrol->currentText()); |
344 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 342 | _pppdata->setFlowcontrol(flowcontrol->currentText()); |
345 | _pppdata->setSpeed(baud_c->currentText()); | 343 | _pppdata->setSpeed(baud_c->currentText()); |
346 | _pppdata->setModemLockFile( modemlockfile->isChecked()); | 344 | _pppdata->setModemLockFile( modemlockfile->isChecked()); |
347 | _pppdata->setModemTimeout( modemtimeout->value() ); | 345 | _pppdata->setModemTimeout( modemtimeout->value() ); |
348 | return true; | 346 | return true; |
349 | 347 | ||
350 | } | 348 | } |
351 | 349 | ||
350 | void ModemWidget::slotBeforeModemQuery() | ||
351 | { | ||
352 | m_oldModemDev = _pppdata->modemDevice(); | ||
353 | m_oldFlowControl = _pppdata->flowcontrol(); | ||
354 | m_oldSpeed = _pppdata->speed(); | ||
355 | m_oldModemLock = _pppdata->modemLockFile(); | ||
356 | m_oldModemTimeout = _pppdata->modemTimeout(); | ||
357 | |||
358 | |||
359 | _pppdata->setModemDevice( modemdevice->currentText() ); | ||
360 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | ||
361 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | ||
362 | _pppdata->setSpeed(baud_c->currentText()); | ||
363 | _pppdata->setModemLockFile( modemlockfile->isChecked()); | ||
364 | _pppdata->setModemTimeout( modemtimeout->value() ); | ||
365 | } | ||
366 | |||
367 | |||
368 | void ModemWidget::slotAfterModemQuery() | ||
369 | { | ||
370 | _pppdata->setModemDevice( m_oldModemDev ); | ||
371 | _pppdata->setFlowcontrol( m_oldFlowControl ); | ||
372 | _pppdata->setSpeed( m_oldSpeed ); | ||
373 | _pppdata->setModemLockFile( m_oldModemLock ); | ||
374 | _pppdata->setModemTimeout( m_oldModemTimeout ); | ||
375 | } | ||
376 | |||
377 | |||
352 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, | 378 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, |
353 | const char *name) | 379 | const char *name) |
354 | : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) | 380 | : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) |
355 | { | 381 | { |
356 | QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 382 | QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
357 | 383 | ||
358 | 384 | ||
359 | waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this); | 385 | waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this); |
360 | waitfordt->setChecked(_pppdata->waitForDialTone()); | 386 | waitfordt->setChecked(_pppdata->waitForDialTone()); |
361 | // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); | 387 | // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); |
362 | l1->addWidget(waitfordt); | 388 | l1->addWidget(waitfordt); |
363 | QWhatsThis::add(waitfordt, | 389 | QWhatsThis::add(waitfordt, |
@@ -479,26 +505,30 @@ ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, | |||
479 | 505 | ||
480 | 506 | ||
481 | void ModemWidget2::modemcmdsbutton() | 507 | void ModemWidget2::modemcmdsbutton() |
482 | { | 508 | { |
483 | ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); | 509 | ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); |
484 | 510 | ||
485 | QPEApplication::execDialog( &mc ); | 511 | QPEApplication::execDialog( &mc ); |
486 | } | 512 | } |
487 | 513 | ||
488 | 514 | ||
489 | void ModemWidget2::query_modem() | 515 | void ModemWidget2::query_modem() |
490 | { | 516 | { |
517 | emit sig_beforeQueryModem(); | ||
518 | |||
491 | ModemTransfer mt(_ifaceppp->modem(), this); | 519 | ModemTransfer mt(_ifaceppp->modem(), this); |
492 | mt.exec(); | 520 | mt.exec(); |
521 | |||
522 | emit sig_afterQueryModem(); | ||
493 | } | 523 | } |
494 | 524 | ||
495 | 525 | ||
496 | // void ModemWidget2::terminal() { | 526 | // void ModemWidget2::terminal() { |
497 | // MiniTerm terminal(NULL,NULL); | 527 | // MiniTerm terminal(NULL,NULL); |
498 | // terminal.exec(); | 528 | // terminal.exec(); |
499 | // } | 529 | // } |
500 | 530 | ||
501 | 531 | ||
502 | // #if 0 | 532 | // #if 0 |
503 | // void ModemWidget2::use_cdline_toggled(bool on) { | 533 | // void ModemWidget2::use_cdline_toggled(bool on) { |
504 | // _pppdata->setUseCDLine(on); | 534 | // _pppdata->setUseCDLine(on); |
diff --git a/noncore/settings/networksettings/ppp/general.h b/noncore/settings/networksettings/ppp/general.h index f43f241..a4dece4 100644 --- a/noncore/settings/networksettings/ppp/general.h +++ b/noncore/settings/networksettings/ppp/general.h | |||
@@ -37,24 +37,32 @@ class QComboBox; | |||
37 | class PPPData; | 37 | class PPPData; |
38 | class InterfacePPP; | 38 | class InterfacePPP; |
39 | class QLineEdit; | 39 | class QLineEdit; |
40 | 40 | ||
41 | class ModemWidget : public QWidget { | 41 | class ModemWidget : public QWidget { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | ModemWidget(PPPData*, QWidget *parent=0, const char *name=0 ); | 44 | ModemWidget(PPPData*, QWidget *parent=0, const char *name=0 ); |
45 | ~ModemWidget(); | 45 | ~ModemWidget(); |
46 | 46 | ||
47 | bool save(); | 47 | bool save(); |
48 | 48 | ||
49 | private slots: | ||
50 | /* | ||
51 | * temporarily commit configuration so queryModem | ||
52 | * will use 'current' settings | ||
53 | */ | ||
54 | void slotBeforeModemQuery(); | ||
55 | void slotAfterModemQuery(); | ||
56 | |||
49 | /* private slots: */ | 57 | /* private slots: */ |
50 | /* void setmodemdc(int); */ | 58 | /* void setmodemdc(int); */ |
51 | /* void setmodemdc(const QString &); */ | 59 | /* void setmodemdc(const QString &); */ |
52 | /* void setflowcontrol(int); */ | 60 | /* void setflowcontrol(int); */ |
53 | /* void modemtimeoutchanged(int); */ | 61 | /* void modemtimeoutchanged(int); */ |
54 | /* void modemlockfilechanged(bool); */ | 62 | /* void modemlockfilechanged(bool); */ |
55 | /* void setenter(int); */ | 63 | /* void setenter(int); */ |
56 | /* void speed_selection(int); */ | 64 | /* void speed_selection(int); */ |
57 | 65 | ||
58 | private: | 66 | private: |
59 | QComboBox *enter; | 67 | QComboBox *enter; |
60 | /* QLabel *label1; */ | 68 | /* QLabel *label1; */ |
@@ -62,33 +70,42 @@ private: | |||
62 | /* QLabel *labeltmp; */ | 70 | /* QLabel *labeltmp; */ |
63 | /* QLabel *labelenter; */ | 71 | /* QLabel *labelenter; */ |
64 | QLineEdit *modemname; | 72 | QLineEdit *modemname; |
65 | QComboBox *modemdevice; | 73 | QComboBox *modemdevice; |
66 | QComboBox *flowcontrol; | 74 | QComboBox *flowcontrol; |
67 | 75 | ||
68 | QComboBox *baud_c; | 76 | QComboBox *baud_c; |
69 | QLabel *baud_label; | 77 | QLabel *baud_label; |
70 | 78 | ||
71 | QSpinBox *modemtimeout; | 79 | QSpinBox *modemtimeout; |
72 | QCheckBox *modemlockfile; | 80 | QCheckBox *modemlockfile; |
73 | PPPData *_pppdata; | 81 | PPPData *_pppdata; |
82 | |||
83 | private: | ||
84 | QString m_oldModemDev, m_oldFlowControl, m_oldSpeed; | ||
85 | bool m_oldModemLock; | ||
86 | int m_oldModemTimeout; | ||
74 | }; | 87 | }; |
75 | 88 | ||
76 | 89 | ||
77 | class ModemWidget2 : public QWidget { | 90 | class ModemWidget2 : public QWidget { |
78 | Q_OBJECT | 91 | Q_OBJECT |
79 | public: | 92 | public: |
80 | ModemWidget2( PPPData*, InterfacePPP*, QWidget *parent=0, const char *name=0 ); | 93 | ModemWidget2( PPPData*, InterfacePPP*, QWidget *parent=0, const char *name=0 ); |
81 | bool save(); | 94 | bool save(); |
82 | 95 | ||
96 | signals: | ||
97 | void sig_beforeQueryModem(); | ||
98 | void sig_afterQueryModem(); | ||
99 | |||
83 | private slots: | 100 | private slots: |
84 | /* void waitfordtchanged(bool); */ | 101 | /* void waitfordtchanged(bool); */ |
85 | /* void busywaitchanged(int); */ | 102 | /* void busywaitchanged(int); */ |
86 | // void use_cdline_toggled(bool); | 103 | // void use_cdline_toggled(bool); |
87 | void modemcmdsbutton(); | 104 | void modemcmdsbutton(); |
88 | // void terminal(); | 105 | // void terminal(); |
89 | void query_modem(); | 106 | void query_modem(); |
90 | // void volumeChanged(int); | 107 | // void volumeChanged(int); |
91 | 108 | ||
92 | private: | 109 | private: |
93 | QLabel *labeltmp; | 110 | QLabel *labeltmp; |
94 | QPushButton *modemcmds; | 111 | QPushButton *modemcmds; |