-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 @@ -195,6 +195,11 @@ int DevicesWidget::doTab(){ modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" ); tabWindow->addTab( modem2, tr("&Modem") ); + connect(modem2, SIGNAL(sig_beforeQueryModem()), + modem1, SLOT(slotBeforeModemQuery())); + connect(modem2, SIGNAL(sig_afterQueryModem()), + modem1, SLOT(slotAfterModemQuery())); + int result = 0; bool ok = false; @@ -204,7 +209,7 @@ int DevicesWidget::doTab(){ if(result == QDialog::Accepted) { if (!modem1->save()){ - QMessageBox::critical(this, "error", tr( "You must enter a unique device name")); + QMessageBox::critical(this, tr("Error"), tr( "You must enter a unique device name")); ok = false; }else{ modem2->save(); 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 @@ -286,7 +286,6 @@ ModemWidget::~ModemWidget() { devs << edited; } - _pppdata->setModemDevice( edited ); } @@ -337,7 +336,6 @@ bool ModemWidget::save() !_pppdata->isUniqueDevname(modemname->text())) return false; - odebug << "ModemWidget::save saving modem1 data" << oendl; _pppdata->setDevname( modemname->text() ); _pppdata->setModemDevice( modemdevice->currentText() ); _pppdata->setFlowcontrol(flowcontrol->currentText()); @@ -349,6 +347,34 @@ bool ModemWidget::save() } +void ModemWidget::slotBeforeModemQuery() +{ + m_oldModemDev = _pppdata->modemDevice(); + m_oldFlowControl = _pppdata->flowcontrol(); + m_oldSpeed = _pppdata->speed(); + m_oldModemLock = _pppdata->modemLockFile(); + m_oldModemTimeout = _pppdata->modemTimeout(); + + + _pppdata->setModemDevice( modemdevice->currentText() ); + _pppdata->setFlowcontrol(flowcontrol->currentText()); + _pppdata->setFlowcontrol(flowcontrol->currentText()); + _pppdata->setSpeed(baud_c->currentText()); + _pppdata->setModemLockFile( modemlockfile->isChecked()); + _pppdata->setModemTimeout( modemtimeout->value() ); +} + + +void ModemWidget::slotAfterModemQuery() +{ + _pppdata->setModemDevice( m_oldModemDev ); + _pppdata->setFlowcontrol( m_oldFlowControl ); + _pppdata->setSpeed( m_oldSpeed ); + _pppdata->setModemLockFile( m_oldModemLock ); + _pppdata->setModemTimeout( m_oldModemTimeout ); +} + + ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, const char *name) : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) @@ -488,8 +514,12 @@ void ModemWidget2::modemcmdsbutton() void ModemWidget2::query_modem() { + emit sig_beforeQueryModem(); + ModemTransfer mt(_ifaceppp->modem(), this); mt.exec(); + + emit sig_afterQueryModem(); } 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 @@ -46,6 +46,14 @@ public: bool save(); +private slots: + /* + * temporarily commit configuration so queryModem + * will use 'current' settings + */ + void slotBeforeModemQuery(); + void slotAfterModemQuery(); + /* private slots: */ /* void setmodemdc(int); */ /* void setmodemdc(const QString &); */ @@ -71,6 +79,11 @@ private: QSpinBox *modemtimeout; QCheckBox *modemlockfile; PPPData *_pppdata; + +private: + QString m_oldModemDev, m_oldFlowControl, m_oldSpeed; + bool m_oldModemLock; + int m_oldModemTimeout; }; @@ -80,6 +93,10 @@ public: ModemWidget2( PPPData*, InterfacePPP*, QWidget *parent=0, const char *name=0 ); bool save(); +signals: + void sig_beforeQueryModem(); + void sig_afterQueryModem(); + private slots: /* void waitfordtchanged(bool); */ /* void busywaitchanged(int); */ |