Diffstat (limited to 'noncore/settings/networksettings/ppp/modemcmds.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/modemcmds.cpp | 111 |
1 files changed, 54 insertions, 57 deletions
diff --git a/noncore/settings/networksettings/ppp/modemcmds.cpp b/noncore/settings/networksettings/ppp/modemcmds.cpp index 766ba0f..65032e8 100644 --- a/noncore/settings/networksettings/ppp/modemcmds.cpp +++ b/noncore/settings/networksettings/ppp/modemcmds.cpp @@ -23,51 +23,48 @@ * License along with dummyWidget program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <qlayout.h> #include <qslider.h> #include <qbuttongroup.h> #include <stdlib.h> //#include <kapplication.h> // for getMiniIcon() //#include <klocale.h> #define i18n QObject::tr #include "modemcmds.h" #include "pppdata.h" //#include <kwin.h> #define ADJUSTEDIT(e) //e->setText("XXXXXXXXqy"); e->setMinimumSize(e->sizeHint()); /*e->setFixedHeight(e->sizeHint().height());*/ e->setText(""); e->setMaxLength(MODEMSTR_SIZE); // a little trick to make the label look like a disabled lineedit #define FORMATSLIDERLABEL(l) //l->setFixedWidth(l->sizeHint().width()); l->setFixedHeight(QLineEdit(dummyWidget).sizeHint().height()); l->setAlignment(AlignCenter); l->setFrameStyle(QFrame::WinPanel|QFrame::Sunken); l->setLineWidth(2); ModemCommands::ModemCommands(QWidget *parent, const char *name) : QDialog(parent, name, true ) //, i18n("Edit Modem Commands") , Ok|Cancel) { setCaption(i18n("Edit Modem Commands")); -// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); - QWidget *dummyWidget = new QWidget(this); -// setMainWidget(dummyWidget); const int GRIDROWS = 22; int row = 0; // toplevel layout QVBoxLayout *tl = new QVBoxLayout(this, 10, 4); // add grid + frame QGridLayout *l1 = new QGridLayout(GRIDROWS, 4); tl->addLayout(l1); box = new QGroupBox(this, "box"); l1->addMultiCellWidget(box, row++, GRIDROWS, 0, 3); // put slider and label into a separate H-Box QHBoxLayout *l2 = new QHBoxLayout; l1->addLayout(l2, row, 2); lpreinitslider = new QLabel("MMMM", this); FORMATSLIDERLABEL(lpreinitslider); QSlider *preinitslider = new QSlider(0, 300, 1, 0, QSlider::Horizontal, this); // preinitslider->setFixedHeight(preinitslider->sizeHint().height()); connect(preinitslider, SIGNAL(valueChanged(int)), lpreinitslider, SLOT(setNum(int))); @@ -222,100 +219,100 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name) l1->addWidget(l, row, 1); QHBoxLayout *l6 = new QHBoxLayout; l1->addLayout(l6, row++, 2); volume_off = new QLineEdit(this); // volume_off->setFixedHeight(volume_off->sizeHint().height()); // volume_off->setMinimumWidth((int)(volume_off->sizeHint().width() / 2)); volume_medium = new QLineEdit(this); // volume_medium->setFixedHeight(volume_medium->sizeHint().height()); // volume_medium->setMinimumWidth((int)(volume_medium->sizeHint().width() / 2)); volume_high = new QLineEdit(this); // volume_high->setFixedHeight(volume_high->sizeHint().height()); // volume_high->setMinimumWidth((int)(volume_high->sizeHint().width() / 2)); l6->addWidget(volume_off); l6->addWidget(volume_medium); l6->addWidget(volume_high); initstr[0]->setFocus(); l1->addColSpacing(0, 10); l1->addColSpacing(3, 10); l1->addRowSpacing(0, 5); l1->addRowSpacing(GRIDROWS, 5); //set stuff from gpppdata - preinitslider->setValue(gpppdata.modemPreInitDelay()); - lpreinitslider->setNum(gpppdata.modemPreInitDelay()); + preinitslider->setValue(PPPData::data()->modemPreInitDelay()); + lpreinitslider->setNum(PPPData::data()->modemPreInitDelay()); for(int i = 0; i < PPPData::NumInitStrings; i++) - initstr[i]->setText(gpppdata.modemInitStr(i)); - initslider->setValue(gpppdata.modemInitDelay()); - linitslider->setNum(gpppdata.modemInitDelay()); - initresp->setText(gpppdata.modemInitResp()); + initstr[i]->setText(PPPData::data()->modemInitStr(i)); + initslider->setValue(PPPData::data()->modemInitDelay()); + linitslider->setNum(PPPData::data()->modemInitDelay()); + initresp->setText(PPPData::data()->modemInitResp()); - durationslider->setValue(gpppdata.modemToneDuration()); - ldurationslider->setNum(gpppdata.modemToneDuration()); + durationslider->setValue(PPPData::data()->modemToneDuration()); + ldurationslider->setNum(PPPData::data()->modemToneDuration()); - nodetectdialtone->setText(gpppdata.modemNoDialToneDetectionStr()); - dialstr->setText(gpppdata.modemDialStr()); - connectresp->setText(gpppdata.modemConnectResp()); - busyresp->setText(gpppdata.modemBusyResp()); - nocarrierresp->setText(gpppdata.modemNoCarrierResp()); - nodialtoneresp->setText(gpppdata.modemNoDialtoneResp()); + nodetectdialtone->setText(PPPData::data()->modemNoDialToneDetectionStr()); + dialstr->setText(PPPData::data()->modemDialStr()); + connectresp->setText(PPPData::data()->modemConnectResp()); + busyresp->setText(PPPData::data()->modemBusyResp()); + nocarrierresp->setText(PPPData::data()->modemNoCarrierResp()); + nodialtoneresp->setText(PPPData::data()->modemNoDialtoneResp()); - escapestr->setText(gpppdata.modemEscapeStr()); - escaperesp->setText(gpppdata.modemEscapeResp()); + escapestr->setText(PPPData::data()->modemEscapeStr()); + escaperesp->setText(PPPData::data()->modemEscapeResp()); - hangupstr->setText(gpppdata.modemHangupStr()); - hangupresp->setText(gpppdata.modemHangupResp()); + hangupstr->setText(PPPData::data()->modemHangupStr()); + hangupresp->setText(PPPData::data()->modemHangupResp()); - answerstr->setText(gpppdata.modemAnswerStr()); - ringresp->setText(gpppdata.modemRingResp()); - answerresp->setText(gpppdata.modemAnswerResp()); + answerstr->setText(PPPData::data()->modemAnswerStr()); + ringresp->setText(PPPData::data()->modemRingResp()); + answerresp->setText(PPPData::data()->modemAnswerResp()); - slider->setValue(gpppdata.modemEscapeGuardTime()); - lslider->setNum(gpppdata.modemEscapeGuardTime()); + slider->setValue(PPPData::data()->modemEscapeGuardTime()); + lslider->setNum(PPPData::data()->modemEscapeGuardTime()); - volume_off->setText(gpppdata.volumeOff()); - volume_medium->setText(gpppdata.volumeMedium()); - volume_high->setText(gpppdata.volumeHigh()); + volume_off->setText(PPPData::data()->volumeOff()); + volume_medium->setText(PPPData::data()->volumeMedium()); + volume_high->setText(PPPData::data()->volumeHigh()); } void ModemCommands::slotOk() { - gpppdata.setModemPreInitDelay(lpreinitslider->text().toInt()); + PPPData::data()->setModemPreInitDelay(lpreinitslider->text().toInt()); for(int i = 0; i < PPPData::NumInitStrings; i++) - gpppdata.setModemInitStr(i, initstr[i]->text()); - gpppdata.setModemInitResp(initresp->text()); - gpppdata.setModemInitDelay(linitslider->text().toInt()); - - gpppdata.setModemToneDuration(ldurationslider->text().toInt()); - gpppdata.setModemNoDialToneDetectionStr(nodetectdialtone->text()); - gpppdata.setModemDialStr(dialstr->text()); - gpppdata.setModemConnectResp(connectresp->text()); - gpppdata.setModemBusyResp(busyresp->text()); - gpppdata.setModemNoCarrierResp(nocarrierresp->text()); - gpppdata.setModemNoDialtoneResp(nodialtoneresp->text()); - - gpppdata.setModemEscapeStr(escapestr->text()); - gpppdata.setModemEscapeResp(escaperesp->text()); - gpppdata.setModemEscapeGuardTime(lslider->text().toInt()); - gpppdata.setModemHangupStr(hangupstr->text()); - gpppdata.setModemHangupResp(hangupresp->text()); - - gpppdata.setModemAnswerStr(answerstr->text()); - gpppdata.setModemRingResp(ringresp->text()); - gpppdata.setModemAnswerResp(answerresp->text()); - - gpppdata.setVolumeHigh(volume_high->text()); - gpppdata.setVolumeMedium(volume_medium->text()); - gpppdata.setVolumeOff(volume_off->text()); - - gpppdata.save(); + PPPData::data()->setModemInitStr(i, initstr[i]->text()); + PPPData::data()->setModemInitResp(initresp->text()); + PPPData::data()->setModemInitDelay(linitslider->text().toInt()); + + PPPData::data()->setModemToneDuration(ldurationslider->text().toInt()); + PPPData::data()->setModemNoDialToneDetectionStr(nodetectdialtone->text()); + PPPData::data()->setModemDialStr(dialstr->text()); + PPPData::data()->setModemConnectResp(connectresp->text()); + PPPData::data()->setModemBusyResp(busyresp->text()); + PPPData::data()->setModemNoCarrierResp(nocarrierresp->text()); + PPPData::data()->setModemNoDialtoneResp(nodialtoneresp->text()); + + PPPData::data()->setModemEscapeStr(escapestr->text()); + PPPData::data()->setModemEscapeResp(escaperesp->text()); + PPPData::data()->setModemEscapeGuardTime(lslider->text().toInt()); + PPPData::data()->setModemHangupStr(hangupstr->text()); + PPPData::data()->setModemHangupResp(hangupresp->text()); + + PPPData::data()->setModemAnswerStr(answerstr->text()); + PPPData::data()->setModemRingResp(ringresp->text()); + PPPData::data()->setModemAnswerResp(answerresp->text()); + + PPPData::data()->setVolumeHigh(volume_high->text()); + PPPData::data()->setVolumeMedium(volume_medium->text()); + PPPData::data()->setVolumeOff(volume_off->text()); + + PPPData::data()->save(); accept(); } void ModemCommands::slotCancel() { reject(); } //#include "modemcmds.moc" |