author | zecke <zecke> | 2004-10-14 00:39:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-14 00:39:47 (UTC) |
commit | b17b6c77af35b610d236321279d3f18eb3060c90 (patch) (side-by-side diff) | |
tree | 4ff66b2060c91373f86f3fd14890dcb8e98babb6 | |
parent | 9cc9ed1e746477c59b1fd3d572cdce052f0ccf85 (diff) | |
download | opie-b17b6c77af35b610d236321279d3f18eb3060c90.zip opie-b17b6c77af35b610d236321279d3f18eb3060c90.tar.gz opie-b17b6c77af35b610d236321279d3f18eb3060c90.tar.bz2 |
-Make ModemQuery to use the 'current' configuration
-Todo make FlowControl, LineTermination lwork across locales
for safe and restore
-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(){ } else { QString tit = tr("Edit Device: "); tit += _pppdata->devname(); dlg->setCaption(tit); 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; return result; } 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() if (! s.isEmpty() ) devs << s; } 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,','); } // void ModemWidget::speed_selection(int) { // _pppdata->setSpeed(baud_c->text(baud_c->currentItem())); // } @@ -328,36 +327,63 @@ ModemWidget::~ModemWidget() // _pppdata->setModemTimeout(n); // } 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); waitfordt->setChecked(_pppdata->waitForDialTone()); // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); l1->addWidget(waitfordt); QWhatsThis::add(waitfordt, @@ -479,26 +505,30 @@ ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, 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(); // } // #if 0 // void ModemWidget2::use_cdline_toggled(bool on) { // _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; class PPPData; class InterfacePPP; 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); */ private: QComboBox *enter; /* QLabel *label1; */ @@ -62,33 +70,42 @@ private: /* QLabel *labeltmp; */ /* QLabel *labelenter; */ QLineEdit *modemname; QComboBox *modemdevice; 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); private: QLabel *labeltmp; QPushButton *modemcmds; |