summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/devices.cpp7
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp34
-rw-r--r--noncore/settings/networksettings/ppp/general.h17
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
@@ -194,8 +194,13 @@ int DevicesWidget::doTab(){
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){
@@ -203,9 +208,9 @@ int DevicesWidget::doTab(){
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();
}
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
@@ -285,9 +285,8 @@ ModemWidget::~ModemWidget()
if ( devs.contains( edited ) == 0 )
{
devs << edited;
}
- _pppdata->setModemDevice( edited );
}
Config cfg("NetworkSetupPPP");
@@ -336,9 +335,8 @@ bool ModemWidget::save()
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());
@@ -348,8 +346,36 @@ bool ModemWidget::save()
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)
{
@@ -487,10 +513,14 @@ void ModemWidget2::modemcmdsbutton()
void ModemWidget2::query_modem()
{
+ emit sig_beforeQueryModem();
+
ModemTransfer mt(_ifaceppp->modem(), this);
mt.exec();
+
+ emit sig_afterQueryModem();
}
// void ModemWidget2::terminal() {
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
@@ -45,8 +45,16 @@ public:
~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); */
@@ -70,8 +78,13 @@ private:
QSpinBox *modemtimeout;
QCheckBox *modemlockfile;
PPPData *_pppdata;
+
+private:
+ QString m_oldModemDev, m_oldFlowControl, m_oldSpeed;
+ bool m_oldModemLock;
+ int m_oldModemTimeout;
};
class ModemWidget2 : public QWidget {
@@ -79,8 +92,12 @@ class ModemWidget2 : public QWidget {
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);