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 @@ | |||
23 | * License along with dummyWidget program; if not, write to the Free | 23 | * License along with dummyWidget program; if not, write to the Free |
24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qslider.h> | 28 | #include <qslider.h> |
29 | #include <qbuttongroup.h> | 29 | #include <qbuttongroup.h> |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | //#include <kapplication.h> // for getMiniIcon() | 31 | //#include <kapplication.h> // for getMiniIcon() |
32 | //#include <klocale.h> | 32 | //#include <klocale.h> |
33 | #define i18n QObject::tr | 33 | #define i18n QObject::tr |
34 | #include "modemcmds.h" | 34 | #include "modemcmds.h" |
35 | #include "pppdata.h" | 35 | #include "pppdata.h" |
36 | //#include <kwin.h> | 36 | //#include <kwin.h> |
37 | 37 | ||
38 | #define ADJUSTEDIT(e) //e->setText("XXXXXXXXqy"); e->setMinimumSize(e->sizeHint()); /*e->setFixedHeight(e->sizeHint().height());*/ e->setText(""); e->setMaxLength(MODEMSTR_SIZE); | 38 | #define ADJUSTEDIT(e) //e->setText("XXXXXXXXqy"); e->setMinimumSize(e->sizeHint()); /*e->setFixedHeight(e->sizeHint().height());*/ e->setText(""); e->setMaxLength(MODEMSTR_SIZE); |
39 | 39 | ||
40 | // a little trick to make the label look like a disabled lineedit | 40 | // a little trick to make the label look like a disabled lineedit |
41 | #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); | 41 | #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); |
42 | 42 | ||
43 | ModemCommands::ModemCommands(QWidget *parent, const char *name) | 43 | ModemCommands::ModemCommands(QWidget *parent, const char *name) |
44 | : QDialog(parent, name, true ) //, i18n("Edit Modem Commands") , Ok|Cancel) | 44 | : QDialog(parent, name, true ) //, i18n("Edit Modem Commands") , Ok|Cancel) |
45 | { | 45 | { |
46 | setCaption(i18n("Edit Modem Commands")); | 46 | setCaption(i18n("Edit Modem Commands")); |
47 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | ||
48 | QWidget *dummyWidget = new QWidget(this); | ||
49 | // setMainWidget(dummyWidget); | ||
50 | 47 | ||
51 | const int GRIDROWS = 22; | 48 | const int GRIDROWS = 22; |
52 | int row = 0; | 49 | int row = 0; |
53 | 50 | ||
54 | // toplevel layout | 51 | // toplevel layout |
55 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 4); | 52 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 4); |
56 | 53 | ||
57 | // add grid + frame | 54 | // add grid + frame |
58 | QGridLayout *l1 = new QGridLayout(GRIDROWS, 4); | 55 | QGridLayout *l1 = new QGridLayout(GRIDROWS, 4); |
59 | tl->addLayout(l1); | 56 | tl->addLayout(l1); |
60 | box = new QGroupBox(this, "box"); | 57 | box = new QGroupBox(this, "box"); |
61 | l1->addMultiCellWidget(box, row++, GRIDROWS, 0, 3); | 58 | l1->addMultiCellWidget(box, row++, GRIDROWS, 0, 3); |
62 | 59 | ||
63 | // put slider and label into a separate H-Box | 60 | // put slider and label into a separate H-Box |
64 | QHBoxLayout *l2 = new QHBoxLayout; | 61 | QHBoxLayout *l2 = new QHBoxLayout; |
65 | l1->addLayout(l2, row, 2); | 62 | l1->addLayout(l2, row, 2); |
66 | lpreinitslider = new QLabel("MMMM", this); | 63 | lpreinitslider = new QLabel("MMMM", this); |
67 | FORMATSLIDERLABEL(lpreinitslider); | 64 | FORMATSLIDERLABEL(lpreinitslider); |
68 | 65 | ||
69 | QSlider *preinitslider = new QSlider(0, 300, 1, 0, | 66 | QSlider *preinitslider = new QSlider(0, 300, 1, 0, |
70 | QSlider::Horizontal, this); | 67 | QSlider::Horizontal, this); |
71 | // preinitslider->setFixedHeight(preinitslider->sizeHint().height()); | 68 | // preinitslider->setFixedHeight(preinitslider->sizeHint().height()); |
72 | connect(preinitslider, SIGNAL(valueChanged(int)), | 69 | connect(preinitslider, SIGNAL(valueChanged(int)), |
73 | lpreinitslider, SLOT(setNum(int))); | 70 | lpreinitslider, SLOT(setNum(int))); |
@@ -222,100 +219,100 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name) | |||
222 | l1->addWidget(l, row, 1); | 219 | l1->addWidget(l, row, 1); |
223 | QHBoxLayout *l6 = new QHBoxLayout; | 220 | QHBoxLayout *l6 = new QHBoxLayout; |
224 | l1->addLayout(l6, row++, 2); | 221 | l1->addLayout(l6, row++, 2); |
225 | volume_off = new QLineEdit(this); | 222 | volume_off = new QLineEdit(this); |
226 | // volume_off->setFixedHeight(volume_off->sizeHint().height()); | 223 | // volume_off->setFixedHeight(volume_off->sizeHint().height()); |
227 | // volume_off->setMinimumWidth((int)(volume_off->sizeHint().width() / 2)); | 224 | // volume_off->setMinimumWidth((int)(volume_off->sizeHint().width() / 2)); |
228 | volume_medium = new QLineEdit(this); | 225 | volume_medium = new QLineEdit(this); |
229 | // volume_medium->setFixedHeight(volume_medium->sizeHint().height()); | 226 | // volume_medium->setFixedHeight(volume_medium->sizeHint().height()); |
230 | // volume_medium->setMinimumWidth((int)(volume_medium->sizeHint().width() / 2)); | 227 | // volume_medium->setMinimumWidth((int)(volume_medium->sizeHint().width() / 2)); |
231 | volume_high = new QLineEdit(this); | 228 | volume_high = new QLineEdit(this); |
232 | // volume_high->setFixedHeight(volume_high->sizeHint().height()); | 229 | // volume_high->setFixedHeight(volume_high->sizeHint().height()); |
233 | // volume_high->setMinimumWidth((int)(volume_high->sizeHint().width() / 2)); | 230 | // volume_high->setMinimumWidth((int)(volume_high->sizeHint().width() / 2)); |
234 | l6->addWidget(volume_off); | 231 | l6->addWidget(volume_off); |
235 | l6->addWidget(volume_medium); | 232 | l6->addWidget(volume_medium); |
236 | l6->addWidget(volume_high); | 233 | l6->addWidget(volume_high); |
237 | 234 | ||
238 | initstr[0]->setFocus(); | 235 | initstr[0]->setFocus(); |
239 | 236 | ||
240 | l1->addColSpacing(0, 10); | 237 | l1->addColSpacing(0, 10); |
241 | l1->addColSpacing(3, 10); | 238 | l1->addColSpacing(3, 10); |
242 | l1->addRowSpacing(0, 5); | 239 | l1->addRowSpacing(0, 5); |
243 | l1->addRowSpacing(GRIDROWS, 5); | 240 | l1->addRowSpacing(GRIDROWS, 5); |
244 | 241 | ||
245 | //set stuff from gpppdata | 242 | //set stuff from gpppdata |
246 | preinitslider->setValue(gpppdata.modemPreInitDelay()); | 243 | preinitslider->setValue(PPPData::data()->modemPreInitDelay()); |
247 | lpreinitslider->setNum(gpppdata.modemPreInitDelay()); | 244 | lpreinitslider->setNum(PPPData::data()->modemPreInitDelay()); |
248 | for(int i = 0; i < PPPData::NumInitStrings; i++) | 245 | for(int i = 0; i < PPPData::NumInitStrings; i++) |
249 | initstr[i]->setText(gpppdata.modemInitStr(i)); | 246 | initstr[i]->setText(PPPData::data()->modemInitStr(i)); |
250 | initslider->setValue(gpppdata.modemInitDelay()); | 247 | initslider->setValue(PPPData::data()->modemInitDelay()); |
251 | linitslider->setNum(gpppdata.modemInitDelay()); | 248 | linitslider->setNum(PPPData::data()->modemInitDelay()); |
252 | initresp->setText(gpppdata.modemInitResp()); | 249 | initresp->setText(PPPData::data()->modemInitResp()); |
253 | 250 | ||
254 | durationslider->setValue(gpppdata.modemToneDuration()); | 251 | durationslider->setValue(PPPData::data()->modemToneDuration()); |
255 | ldurationslider->setNum(gpppdata.modemToneDuration()); | 252 | ldurationslider->setNum(PPPData::data()->modemToneDuration()); |
256 | 253 | ||
257 | nodetectdialtone->setText(gpppdata.modemNoDialToneDetectionStr()); | 254 | nodetectdialtone->setText(PPPData::data()->modemNoDialToneDetectionStr()); |
258 | dialstr->setText(gpppdata.modemDialStr()); | 255 | dialstr->setText(PPPData::data()->modemDialStr()); |
259 | connectresp->setText(gpppdata.modemConnectResp()); | 256 | connectresp->setText(PPPData::data()->modemConnectResp()); |
260 | busyresp->setText(gpppdata.modemBusyResp()); | 257 | busyresp->setText(PPPData::data()->modemBusyResp()); |
261 | nocarrierresp->setText(gpppdata.modemNoCarrierResp()); | 258 | nocarrierresp->setText(PPPData::data()->modemNoCarrierResp()); |
262 | nodialtoneresp->setText(gpppdata.modemNoDialtoneResp()); | 259 | nodialtoneresp->setText(PPPData::data()->modemNoDialtoneResp()); |
263 | 260 | ||
264 | escapestr->setText(gpppdata.modemEscapeStr()); | 261 | escapestr->setText(PPPData::data()->modemEscapeStr()); |
265 | escaperesp->setText(gpppdata.modemEscapeResp()); | 262 | escaperesp->setText(PPPData::data()->modemEscapeResp()); |
266 | 263 | ||
267 | hangupstr->setText(gpppdata.modemHangupStr()); | 264 | hangupstr->setText(PPPData::data()->modemHangupStr()); |
268 | hangupresp->setText(gpppdata.modemHangupResp()); | 265 | hangupresp->setText(PPPData::data()->modemHangupResp()); |
269 | 266 | ||
270 | answerstr->setText(gpppdata.modemAnswerStr()); | 267 | answerstr->setText(PPPData::data()->modemAnswerStr()); |
271 | ringresp->setText(gpppdata.modemRingResp()); | 268 | ringresp->setText(PPPData::data()->modemRingResp()); |
272 | answerresp->setText(gpppdata.modemAnswerResp()); | 269 | answerresp->setText(PPPData::data()->modemAnswerResp()); |
273 | 270 | ||
274 | slider->setValue(gpppdata.modemEscapeGuardTime()); | 271 | slider->setValue(PPPData::data()->modemEscapeGuardTime()); |
275 | lslider->setNum(gpppdata.modemEscapeGuardTime()); | 272 | lslider->setNum(PPPData::data()->modemEscapeGuardTime()); |
276 | 273 | ||
277 | volume_off->setText(gpppdata.volumeOff()); | 274 | volume_off->setText(PPPData::data()->volumeOff()); |
278 | volume_medium->setText(gpppdata.volumeMedium()); | 275 | volume_medium->setText(PPPData::data()->volumeMedium()); |
279 | volume_high->setText(gpppdata.volumeHigh()); | 276 | volume_high->setText(PPPData::data()->volumeHigh()); |
280 | } | 277 | } |
281 | 278 | ||
282 | 279 | ||
283 | void ModemCommands::slotOk() { | 280 | void ModemCommands::slotOk() { |
284 | gpppdata.setModemPreInitDelay(lpreinitslider->text().toInt()); | 281 | PPPData::data()->setModemPreInitDelay(lpreinitslider->text().toInt()); |
285 | for(int i = 0; i < PPPData::NumInitStrings; i++) | 282 | for(int i = 0; i < PPPData::NumInitStrings; i++) |
286 | gpppdata.setModemInitStr(i, initstr[i]->text()); | 283 | PPPData::data()->setModemInitStr(i, initstr[i]->text()); |
287 | gpppdata.setModemInitResp(initresp->text()); | 284 | PPPData::data()->setModemInitResp(initresp->text()); |
288 | gpppdata.setModemInitDelay(linitslider->text().toInt()); | 285 | PPPData::data()->setModemInitDelay(linitslider->text().toInt()); |
289 | 286 | ||
290 | gpppdata.setModemToneDuration(ldurationslider->text().toInt()); | 287 | PPPData::data()->setModemToneDuration(ldurationslider->text().toInt()); |
291 | gpppdata.setModemNoDialToneDetectionStr(nodetectdialtone->text()); | 288 | PPPData::data()->setModemNoDialToneDetectionStr(nodetectdialtone->text()); |
292 | gpppdata.setModemDialStr(dialstr->text()); | 289 | PPPData::data()->setModemDialStr(dialstr->text()); |
293 | gpppdata.setModemConnectResp(connectresp->text()); | 290 | PPPData::data()->setModemConnectResp(connectresp->text()); |
294 | gpppdata.setModemBusyResp(busyresp->text()); | 291 | PPPData::data()->setModemBusyResp(busyresp->text()); |
295 | gpppdata.setModemNoCarrierResp(nocarrierresp->text()); | 292 | PPPData::data()->setModemNoCarrierResp(nocarrierresp->text()); |
296 | gpppdata.setModemNoDialtoneResp(nodialtoneresp->text()); | 293 | PPPData::data()->setModemNoDialtoneResp(nodialtoneresp->text()); |
297 | 294 | ||
298 | gpppdata.setModemEscapeStr(escapestr->text()); | 295 | PPPData::data()->setModemEscapeStr(escapestr->text()); |
299 | gpppdata.setModemEscapeResp(escaperesp->text()); | 296 | PPPData::data()->setModemEscapeResp(escaperesp->text()); |
300 | gpppdata.setModemEscapeGuardTime(lslider->text().toInt()); | 297 | PPPData::data()->setModemEscapeGuardTime(lslider->text().toInt()); |
301 | gpppdata.setModemHangupStr(hangupstr->text()); | 298 | PPPData::data()->setModemHangupStr(hangupstr->text()); |
302 | gpppdata.setModemHangupResp(hangupresp->text()); | 299 | PPPData::data()->setModemHangupResp(hangupresp->text()); |
303 | 300 | ||
304 | gpppdata.setModemAnswerStr(answerstr->text()); | 301 | PPPData::data()->setModemAnswerStr(answerstr->text()); |
305 | gpppdata.setModemRingResp(ringresp->text()); | 302 | PPPData::data()->setModemRingResp(ringresp->text()); |
306 | gpppdata.setModemAnswerResp(answerresp->text()); | 303 | PPPData::data()->setModemAnswerResp(answerresp->text()); |
307 | 304 | ||
308 | gpppdata.setVolumeHigh(volume_high->text()); | 305 | PPPData::data()->setVolumeHigh(volume_high->text()); |
309 | gpppdata.setVolumeMedium(volume_medium->text()); | 306 | PPPData::data()->setVolumeMedium(volume_medium->text()); |
310 | gpppdata.setVolumeOff(volume_off->text()); | 307 | PPPData::data()->setVolumeOff(volume_off->text()); |
311 | 308 | ||
312 | gpppdata.save(); | 309 | PPPData::data()->save(); |
313 | accept(); | 310 | accept(); |
314 | } | 311 | } |
315 | 312 | ||
316 | 313 | ||
317 | void ModemCommands::slotCancel() { | 314 | void ModemCommands::slotCancel() { |
318 | reject(); | 315 | reject(); |
319 | } | 316 | } |
320 | 317 | ||
321 | //#include "modemcmds.moc" | 318 | //#include "modemcmds.moc" |