-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 @@ -190,26 +190,31 @@ int DevicesWidget::doTab(){ isnew = false; } modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" ); tabWindow->addTab( modem1, tr("&Device") ); 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; while (!ok){ result = QPEApplication::execDialog( dlg ); ok = true; 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(); } } } delete dlg; 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 @@ -281,17 +281,16 @@ ModemWidget::~ModemWidget() QString edited = modemdevice->currentText(); if ( !( edited ).isEmpty() ) { edited.simplifyWhiteSpace(); if ( devs.contains( edited ) == 0 ) { devs << edited; } - _pppdata->setModemDevice( edited ); } Config cfg("NetworkSetupPPP"); cfg.setGroup("Devices_General"); cfg.writeEntry("devices",devs,','); } @@ -332,28 +331,55 @@ ModemWidget::~ModemWidget() bool ModemWidget::save() { //first check to make sure that the device name is unique! if(modemname->text().isEmpty() || !_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()); _pppdata->setFlowcontrol(flowcontrol->currentText()); _pppdata->setSpeed(baud_c->currentText()); _pppdata->setModemLockFile( modemlockfile->isChecked()); _pppdata->setModemTimeout( modemtimeout->value() ); return true; } +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) { QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this); @@ -483,18 +509,22 @@ void ModemWidget2::modemcmdsbutton() ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); QPEApplication::execDialog( &mc ); } void ModemWidget2::query_modem() { + emit sig_beforeQueryModem(); + ModemTransfer mt(_ifaceppp->modem(), this); mt.exec(); + + emit sig_afterQueryModem(); } // void ModemWidget2::terminal() { // MiniTerm terminal(NULL,NULL); // terminal.exec(); // } 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 @@ -41,16 +41,24 @@ class QLineEdit; class ModemWidget : public QWidget { Q_OBJECT public: ModemWidget(PPPData*, QWidget *parent=0, const char *name=0 ); ~ModemWidget(); 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 &); */ /* void setflowcontrol(int); */ /* void modemtimeoutchanged(int); */ /* void modemlockfilechanged(bool); */ /* void setenter(int); */ /* void speed_selection(int); */ @@ -66,25 +74,34 @@ private: QComboBox *flowcontrol; QComboBox *baud_c; QLabel *baud_label; QSpinBox *modemtimeout; QCheckBox *modemlockfile; PPPData *_pppdata; + +private: + QString m_oldModemDev, m_oldFlowControl, m_oldSpeed; + bool m_oldModemLock; + int m_oldModemTimeout; }; class ModemWidget2 : public QWidget { Q_OBJECT 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); */ // void use_cdline_toggled(bool); void modemcmdsbutton(); // void terminal(); void query_modem(); // void volumeChanged(int); |