-rw-r--r-- | noncore/settings/networksettings/ppp/connect.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/general.cpp | 34 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/general.h | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 12 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.h | 19 |
6 files changed, 45 insertions, 44 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index 128877a..8981e01 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -1206,26 +1206,26 @@ bool ConnectWidget::execppp() { | |||
1206 | else { | 1206 | else { |
1207 | command += " "; | 1207 | command += " "; |
1208 | command += ":"; | 1208 | command += ":"; |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | if(_ifaceppp->data()->gateway() != "0.0.0.0") | 1211 | if(_ifaceppp->data()->gateway() != "0.0.0.0") |
1212 | command += _ifaceppp->data()->gateway(); | 1212 | command += _ifaceppp->data()->gateway(); |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | if(_ifaceppp->data()->subnetmask() != "0.0.0.0") | 1215 | if(_ifaceppp->data()->subnetmask() != "0.0.0.0") |
1216 | command += " netmask " + _ifaceppp->data()->subnetmask(); | 1216 | command += " netmask " + _ifaceppp->data()->subnetmask(); |
1217 | 1217 | ||
1218 | if(_ifaceppp->data()->flowcontrol() != "None") { | 1218 | if(_ifaceppp->data()->flowcontrol() != PPPData::FlowNone) { |
1219 | if(_ifaceppp->data()->flowcontrol() == "CRTSCTS") | 1219 | if(_ifaceppp->data()->flowcontrol() == PPPData::FlowHardware) |
1220 | command += " crtscts"; | 1220 | command += " crtscts"; |
1221 | else | 1221 | else |
1222 | command += " xonxoff"; | 1222 | command += " xonxoff"; |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | if(_ifaceppp->data()->defaultroute()) | 1225 | if(_ifaceppp->data()->defaultroute()) |
1226 | command += " defaultroute"; | 1226 | command += " defaultroute"; |
1227 | 1227 | ||
1228 | if(_ifaceppp->data()->autoDNS()) | 1228 | if(_ifaceppp->data()->autoDNS()) |
1229 | command += " usepeerdns"; | 1229 | command += " usepeerdns"; |
1230 | 1230 | ||
1231 | 1231 | ||
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index 5e2a04f..9457173 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp | |||
@@ -183,35 +183,28 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
183 | tl->addWidget(baud_c, 4, 1); | 183 | tl->addWidget(baud_c, 4, 1); |
184 | 184 | ||
185 | tmp = tr("Specifies the speed your modem and the serial\n" | 185 | tmp = tr("Specifies the speed your modem and the serial\n" |
186 | "port talk to each other. You should begin with\n" | 186 | "port talk to each other. You should begin with\n" |
187 | "the default of 38400 bits/sec. If everything\n" | 187 | "the default of 38400 bits/sec. If everything\n" |
188 | "works you can try to increase this value, but to\n" | 188 | "works you can try to increase this value, but to\n" |
189 | "no more than 115200 bits/sec (unless you know\n" | 189 | "no more than 115200 bits/sec (unless you know\n" |
190 | "that your serial port supports higher speeds)."); | 190 | "that your serial port supports higher speeds)."); |
191 | 191 | ||
192 | QWhatsThis::add(baud_label,tmp); | 192 | QWhatsThis::add(baud_label,tmp); |
193 | QWhatsThis::add(baud_c,tmp); | 193 | QWhatsThis::add(baud_c,tmp); |
194 | 194 | ||
195 | for(int i=0; i <= enter->count()-1; i++) | ||
196 | { | ||
197 | if(_pppdata->enter() == enter->text(i)) | ||
198 | enter->setCurrentItem(i); | ||
199 | } | ||
200 | |||
201 | tl->addRowSpacing(5, 10); | 195 | tl->addRowSpacing(5, 10); |
202 | 196 | ||
203 | //Modem Lock File | 197 | //Modem Lock File |
204 | modemlockfile = new QCheckBox(tr("&Use lock file"), this); | 198 | modemlockfile = new QCheckBox(tr("&Use lock file"), this); |
205 | |||
206 | modemlockfile->setChecked(_pppdata->modemLockFile()); | 199 | modemlockfile->setChecked(_pppdata->modemLockFile()); |
207 | // connect(modemlockfile, SIGNAL(toggled(bool)), | 200 | // connect(modemlockfile, SIGNAL(toggled(bool)), |
208 | // SLOT(modemlockfilechanged(bool))); | 201 | // SLOT(modemlockfilechanged(bool))); |
209 | tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1); | 202 | tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1); |
210 | // l12->addStretch(1); | 203 | // l12->addStretch(1); |
211 | QWhatsThis::add(modemlockfile, | 204 | QWhatsThis::add(modemlockfile, |
212 | tr("<p>To prevent other programs from accessing the\n" | 205 | tr("<p>To prevent other programs from accessing the\n" |
213 | "modem while a connection is established, a\n" | 206 | "modem while a connection is established, a\n" |
214 | "file can be created to indicate that the modem\n" | 207 | "file can be created to indicate that the modem\n" |
215 | "is in use. On Linux an example file would be\n" | 208 | "is in use. On Linux an example file would be\n" |
216 | "<tt>/var/lock/LCK..ttyS1</tt>\n" | 209 | "<tt>/var/lock/LCK..ttyS1</tt>\n" |
217 | "Here you can select whether this locking will\n" | 210 | "Here you can select whether this locking will\n" |
@@ -231,42 +224,33 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
231 | // connect(modemtimeout, SIGNAL(valueChanged(int)), | 224 | // connect(modemtimeout, SIGNAL(valueChanged(int)), |
232 | // SLOT(modemtimeoutchanged(int))); | 225 | // SLOT(modemtimeoutchanged(int))); |
233 | timeoutLayout->addWidget(timeoutlabel); | 226 | timeoutLayout->addWidget(timeoutlabel); |
234 | timeoutLayout->addWidget(modemtimeout); | 227 | timeoutLayout->addWidget(modemtimeout); |
235 | tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1); | 228 | tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1); |
236 | 229 | ||
237 | QWhatsThis::add(modemtimeout, | 230 | QWhatsThis::add(modemtimeout, |
238 | tr("This specifies how long <i>kppp</i> waits for a\n" | 231 | tr("This specifies how long <i>kppp</i> waits for a\n" |
239 | "<i>CONNECT</i> response from your modem. The\n" | 232 | "<i>CONNECT</i> response from your modem. The\n" |
240 | "recommended value is 30 seconds.")); | 233 | "recommended value is 30 seconds.")); |
241 | 234 | ||
242 | //set stuff from gpppdata | 235 | //set stuff from gpppdata |
243 | for(int i=0; i <= enter->count()-1; i++) | 236 | enter->setCurrentItem( static_cast<int>(_pppdata->enter()) ); |
244 | { | 237 | flowcontrol->setCurrentItem( static_cast<int>( _pppdata->flowcontrol() ) ); |
245 | if(_pppdata->enter() == enter->text(i)) | ||
246 | enter->setCurrentItem(i); | ||
247 | } | ||
248 | 238 | ||
249 | for(int i=0; i <= modemdevice->count()-1; i++) | 239 | for(int i=0; i <= modemdevice->count()-1; i++) |
250 | { | 240 | { |
251 | if(_pppdata->modemDevice() == modemdevice->text(i)) | 241 | if(_pppdata->modemDevice() == modemdevice->text(i)) |
252 | modemdevice->setCurrentItem(i); | 242 | modemdevice->setCurrentItem(i); |
253 | } | 243 | } |
254 | 244 | ||
255 | for(int i=0; i <= flowcontrol->count()-1; i++) | ||
256 | { | ||
257 | if(_pppdata->flowcontrol() == flowcontrol->text(i)) | ||
258 | flowcontrol->setCurrentItem(i); | ||
259 | } | ||
260 | |||
261 | //set the modem speed | 245 | //set the modem speed |
262 | for(int i=0; i < baud_c->count(); i++) | 246 | for(int i=0; i < baud_c->count(); i++) |
263 | if(baud_c->text(i) == _pppdata->speed()) | 247 | if(baud_c->text(i) == _pppdata->speed()) |
264 | baud_c->setCurrentItem(i); | 248 | baud_c->setCurrentItem(i); |
265 | 249 | ||
266 | tl->setRowStretch(1, 1); | 250 | tl->setRowStretch(1, 1); |
267 | } | 251 | } |
268 | 252 | ||
269 | ModemWidget::~ModemWidget() | 253 | ModemWidget::~ModemWidget() |
270 | { | 254 | { |
271 | QStringList devs; | 255 | QStringList devs; |
272 | 256 | ||
@@ -329,55 +313,57 @@ ModemWidget::~ModemWidget() | |||
329 | 313 | ||
330 | 314 | ||
331 | 315 | ||
332 | bool ModemWidget::save() | 316 | bool ModemWidget::save() |
333 | { | 317 | { |
334 | //first check to make sure that the device name is unique! | 318 | //first check to make sure that the device name is unique! |
335 | if(modemname->text().isEmpty() || | 319 | if(modemname->text().isEmpty() || |
336 | !_pppdata->isUniqueDevname(modemname->text())) | 320 | !_pppdata->isUniqueDevname(modemname->text())) |
337 | return false; | 321 | return false; |
338 | 322 | ||
339 | _pppdata->setDevname( modemname->text() ); | 323 | _pppdata->setDevname( modemname->text() ); |
340 | _pppdata->setModemDevice( modemdevice->currentText() ); | 324 | _pppdata->setModemDevice( modemdevice->currentText() ); |
341 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 325 | _pppdata->setFlowcontrol(static_cast<PPPData::FlowControl>(flowcontrol->currentItem())); |
342 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 326 | _pppdata->setEnter( static_cast<PPPData::LineTermination>(enter->currentItem())); |
343 | _pppdata->setSpeed(baud_c->currentText()); | 327 | _pppdata->setSpeed(baud_c->currentText()); |
344 | _pppdata->setModemLockFile( modemlockfile->isChecked()); | 328 | _pppdata->setModemLockFile( modemlockfile->isChecked()); |
345 | _pppdata->setModemTimeout( modemtimeout->value() ); | 329 | _pppdata->setModemTimeout( modemtimeout->value() ); |
346 | return true; | 330 | return true; |
347 | 331 | ||
348 | } | 332 | } |
349 | 333 | ||
350 | void ModemWidget::slotBeforeModemQuery() | 334 | void ModemWidget::slotBeforeModemQuery() |
351 | { | 335 | { |
352 | m_oldModemDev = _pppdata->modemDevice(); | 336 | m_oldModemDev = _pppdata->modemDevice(); |
353 | m_oldFlowControl = _pppdata->flowcontrol(); | 337 | m_oldFlowControl = static_cast<int>( _pppdata->flowcontrol() ); |
354 | m_oldSpeed = _pppdata->speed(); | 338 | m_oldSpeed = _pppdata->speed(); |
355 | m_oldModemLock = _pppdata->modemLockFile(); | 339 | m_oldModemLock = _pppdata->modemLockFile(); |
356 | m_oldModemTimeout = _pppdata->modemTimeout(); | 340 | m_oldModemTimeout = _pppdata->modemTimeout(); |
341 | m_oldLineEnd = static_cast<int>( _pppdata->enter() ); | ||
357 | 342 | ||
358 | 343 | ||
359 | _pppdata->setModemDevice( modemdevice->currentText() ); | 344 | _pppdata->setModemDevice( modemdevice->currentText() ); |
360 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 345 | _pppdata->setFlowcontrol(static_cast<PPPData::FlowControl>(flowcontrol->currentItem())); |
361 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 346 | _pppdata->setEnter(static_cast<PPPData::LineTermination>(enter->currentItem())); |
362 | _pppdata->setSpeed(baud_c->currentText()); | 347 | _pppdata->setSpeed(baud_c->currentText()); |
363 | _pppdata->setModemLockFile( modemlockfile->isChecked()); | 348 | _pppdata->setModemLockFile( modemlockfile->isChecked()); |
364 | _pppdata->setModemTimeout( modemtimeout->value() ); | 349 | _pppdata->setModemTimeout( modemtimeout->value() ); |
365 | } | 350 | } |
366 | 351 | ||
367 | 352 | ||
368 | void ModemWidget::slotAfterModemQuery() | 353 | void ModemWidget::slotAfterModemQuery() |
369 | { | 354 | { |
370 | _pppdata->setModemDevice( m_oldModemDev ); | 355 | _pppdata->setModemDevice( m_oldModemDev ); |
371 | _pppdata->setFlowcontrol( m_oldFlowControl ); | 356 | _pppdata->setFlowcontrol( static_cast<PPPData::FlowControl>(m_oldFlowControl) ); |
357 | _pppdata->setEnter( static_cast<PPPData::LineTermination>(m_oldLineEnd) ); | ||
372 | _pppdata->setSpeed( m_oldSpeed ); | 358 | _pppdata->setSpeed( m_oldSpeed ); |
373 | _pppdata->setModemLockFile( m_oldModemLock ); | 359 | _pppdata->setModemLockFile( m_oldModemLock ); |
374 | _pppdata->setModemTimeout( m_oldModemTimeout ); | 360 | _pppdata->setModemTimeout( m_oldModemTimeout ); |
375 | } | 361 | } |
376 | 362 | ||
377 | 363 | ||
378 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, | 364 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, |
379 | const char *name) | 365 | const char *name) |
380 | : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) | 366 | : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) |
381 | { | 367 | { |
382 | QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 368 | QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
383 | 369 | ||
diff --git a/noncore/settings/networksettings/ppp/general.h b/noncore/settings/networksettings/ppp/general.h index a4dece4..0bb3136 100644 --- a/noncore/settings/networksettings/ppp/general.h +++ b/noncore/settings/networksettings/ppp/general.h | |||
@@ -72,27 +72,27 @@ private: | |||
72 | QLineEdit *modemname; | 72 | QLineEdit *modemname; |
73 | QComboBox *modemdevice; | 73 | QComboBox *modemdevice; |
74 | QComboBox *flowcontrol; | 74 | QComboBox *flowcontrol; |
75 | 75 | ||
76 | QComboBox *baud_c; | 76 | QComboBox *baud_c; |
77 | QLabel *baud_label; | 77 | QLabel *baud_label; |
78 | 78 | ||
79 | QSpinBox *modemtimeout; | 79 | QSpinBox *modemtimeout; |
80 | QCheckBox *modemlockfile; | 80 | QCheckBox *modemlockfile; |
81 | PPPData *_pppdata; | 81 | PPPData *_pppdata; |
82 | 82 | ||
83 | private: | 83 | private: |
84 | QString m_oldModemDev, m_oldFlowControl, m_oldSpeed; | 84 | QString m_oldModemDev, m_oldSpeed; |
85 | bool m_oldModemLock; | 85 | bool m_oldModemLock; |
86 | int m_oldModemTimeout; | 86 | int m_oldModemTimeout, m_oldFlowControl, m_oldLineEnd; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | 89 | ||
90 | class ModemWidget2 : public QWidget { | 90 | class ModemWidget2 : public QWidget { |
91 | Q_OBJECT | 91 | Q_OBJECT |
92 | public: | 92 | public: |
93 | ModemWidget2( PPPData*, InterfacePPP*, QWidget *parent=0, const char *name=0 ); | 93 | ModemWidget2( PPPData*, InterfacePPP*, QWidget *parent=0, const char *name=0 ); |
94 | bool save(); | 94 | bool save(); |
95 | 95 | ||
96 | signals: | 96 | signals: |
97 | void sig_beforeQueryModem(); | 97 | void sig_beforeQueryModem(); |
98 | void sig_afterQueryModem(); | 98 | void sig_afterQueryModem(); |
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index 79f015b..7b2e2a3 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp | |||
@@ -216,26 +216,26 @@ bool Modem::opentty() { | |||
216 | tty.c_cc[VTIME] = 0; | 216 | tty.c_cc[VTIME] = 0; |
217 | tty.c_oflag = 0; | 217 | tty.c_oflag = 0; |
218 | tty.c_lflag = 0; | 218 | tty.c_lflag = 0; |
219 | 219 | ||
220 | tty.c_cflag &= ~(CSIZE | CSTOPB | PARENB); | 220 | tty.c_cflag &= ~(CSIZE | CSTOPB | PARENB); |
221 | tty.c_cflag |= CS8 | CREAD; | 221 | tty.c_cflag |= CS8 | CREAD; |
222 | tty.c_cflag |= CLOCAL; // ignore modem status lines | 222 | tty.c_cflag |= CLOCAL; // ignore modem status lines |
223 | tty.c_iflag = IGNBRK | IGNPAR /* | ISTRIP */ ; | 223 | tty.c_iflag = IGNBRK | IGNPAR /* | ISTRIP */ ; |
224 | tty.c_lflag &= ~ICANON; // non-canonical mode | 224 | tty.c_lflag &= ~ICANON; // non-canonical mode |
225 | tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE); | 225 | tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE); |
226 | 226 | ||
227 | 227 | ||
228 | if(_pppdata->flowcontrol() != "None") { | 228 | if(_pppdata->flowcontrol() != PPPData::FlowNone) { |
229 | if(_pppdata->flowcontrol() == "CRTSCTS") { | 229 | if(_pppdata->flowcontrol() == PPPData::FlowHardware) { |
230 | tty.c_cflag |= CRTSCTS; | 230 | tty.c_cflag |= CRTSCTS; |
231 | } | 231 | } |
232 | else { | 232 | else { |
233 | tty.c_iflag |= IXON | IXOFF; | 233 | tty.c_iflag |= IXON | IXOFF; |
234 | tty.c_cc[VSTOP] = 0x13; /* DC3 = XOFF = ^S */ | 234 | tty.c_cc[VSTOP] = 0x13; /* DC3 = XOFF = ^S */ |
235 | tty.c_cc[VSTART] = 0x11; /* DC1 = XON = ^Q */ | 235 | tty.c_cc[VSTART] = 0x11; /* DC1 = XON = ^Q */ |
236 | } | 236 | } |
237 | } | 237 | } |
238 | else { | 238 | else { |
239 | tty.c_cflag &= ~CRTSCTS; | 239 | tty.c_cflag &= ~CRTSCTS; |
240 | tty.c_iflag &= ~(IXON | IXOFF); | 240 | tty.c_iflag &= ~(IXON | IXOFF); |
241 | } | 241 | } |
@@ -346,33 +346,37 @@ bool Modem::writeChar(unsigned char c) { | |||
346 | } | 346 | } |
347 | } while(s == 0); | 347 | } while(s == 0); |
348 | 348 | ||
349 | return true; | 349 | return true; |
350 | } | 350 | } |
351 | 351 | ||
352 | 352 | ||
353 | bool Modem::writeLine(const char *buf) { | 353 | bool Modem::writeLine(const char *buf) { |
354 | int len = strlen(buf); | 354 | int len = strlen(buf); |
355 | char *b = new char[len+2]; | 355 | char *b = new char[len+2]; |
356 | memcpy(b, buf, len); | 356 | memcpy(b, buf, len); |
357 | // different modems seem to need different line terminations | 357 | // different modems seem to need different line terminations |
358 | QString term = _pppdata->enter(); | 358 | switch( _pppdata->enter() ) { |
359 | if(term == "LF") | 359 | case PPPData::EndLF: |
360 | b[len++]='\n'; | 360 | b[len++]='\n'; |
361 | else if(term == "CR") | 361 | break; |
362 | case PPPData::EndCR: | ||
362 | b[len++]='\r'; | 363 | b[len++]='\r'; |
363 | else if(term == "CR/LF") { | 364 | break; |
365 | case PPPData::EndCRLF: | ||
364 | b[len++]='\r'; | 366 | b[len++]='\r'; |
365 | b[len++]='\n'; | 367 | b[len++]='\n'; |
368 | break; | ||
366 | } | 369 | } |
370 | |||
367 | int l = len; | 371 | int l = len; |
368 | while(l) { | 372 | while(l) { |
369 | int wr = write(modemfd, &b[len-l], l); | 373 | int wr = write(modemfd, &b[len-l], l); |
370 | if(wr < 0) { | 374 | if(wr < 0) { |
371 | // TODO do something meaningful with the error code (or ignore it | 375 | // TODO do something meaningful with the error code (or ignore it |
372 | oerr << "write() in Modem::writeLine failed" << oendl; | 376 | oerr << "write() in Modem::writeLine failed" << oendl; |
373 | delete[] b; | 377 | delete[] b; |
374 | return false; | 378 | return false; |
375 | } | 379 | } |
376 | l -= wr; | 380 | l -= wr; |
377 | } | 381 | } |
378 | delete[] b; | 382 | delete[] b; |
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index eb03ef4..1491ea2 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp | |||
@@ -378,30 +378,30 @@ const QString PPPData::modemDevice() { | |||
378 | // _modemName = n; | 378 | // _modemName = n; |
379 | // writeConfig(modemGroup(), MODEMNAME_KEY, n); | 379 | // writeConfig(modemGroup(), MODEMNAME_KEY, n); |
380 | // return true; //FIXME | 380 | // return true; //FIXME |
381 | // } | 381 | // } |
382 | 382 | ||
383 | bool PPPData::setModemDevice(const QString &n) { | 383 | bool PPPData::setModemDevice(const QString &n) { |
384 | odebug << "Setting modem dev to >" << n.latin1() << "<" << oendl; | 384 | odebug << "Setting modem dev to >" << n.latin1() << "<" << oendl; |
385 | writeConfig(modemGroup(), MODEMDEV_KEY, n); | 385 | writeConfig(modemGroup(), MODEMDEV_KEY, n); |
386 | return true; //FIXME | 386 | return true; //FIXME |
387 | } | 387 | } |
388 | 388 | ||
389 | 389 | ||
390 | const QString PPPData::flowcontrol() { | 390 | enum PPPData::FlowControl PPPData::flowcontrol() { |
391 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); | 391 | return static_cast<FlowControl>(readNumConfig(modemGroup(), FLOWCONTROL_KEY, FlowHardware)); |
392 | } | 392 | } |
393 | 393 | ||
394 | 394 | ||
395 | void PPPData::setFlowcontrol(const QString &n) { | 395 | void PPPData::setFlowcontrol(enum FlowControl n) { |
396 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); | 396 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); |
397 | } | 397 | } |
398 | 398 | ||
399 | 399 | ||
400 | const QString PPPData::speed() { | 400 | const QString PPPData::speed() { |
401 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); | 401 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); |
402 | // undo the damage of a bug in former versions. It left an empty Speed= | 402 | // undo the damage of a bug in former versions. It left an empty Speed= |
403 | // entry in kppprc. kppp did set the serial port to 57600 as default but | 403 | // entry in kppprc. kppp did set the serial port to 57600 as default but |
404 | // pppd wouldn't receive the speed via the command line. | 404 | // pppd wouldn't receive the speed via the command line. |
405 | if(s.toUInt() == 0) | 405 | if(s.toUInt() == 0) |
406 | s = "57600"; | 406 | s = "57600"; |
407 | return s; | 407 | return s; |
@@ -711,30 +711,30 @@ void PPPData::setModemRingResp(const QString &n) { | |||
711 | 711 | ||
712 | 712 | ||
713 | const QString PPPData::modemAnswerResp() { | 713 | const QString PPPData::modemAnswerResp() { |
714 | return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); | 714 | return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); |
715 | } | 715 | } |
716 | 716 | ||
717 | 717 | ||
718 | void PPPData::setModemAnswerResp(const QString &n) { | 718 | void PPPData::setModemAnswerResp(const QString &n) { |
719 | writeConfig(modemGroup(), ANSWERRESP_KEY, n); | 719 | writeConfig(modemGroup(), ANSWERRESP_KEY, n); |
720 | } | 720 | } |
721 | 721 | ||
722 | 722 | ||
723 | const QString PPPData::enter() { | 723 | enum PPPData::LineTermination PPPData::enter(){ |
724 | return readConfig(modemGroup(), ENTER_KEY, "CR"); | 724 | return static_cast<PPPData::LineTermination>(readNumConfig(modemGroup(), ENTER_KEY, EndCR)); |
725 | } | 725 | } |
726 | 726 | ||
727 | 727 | ||
728 | void PPPData::setEnter(const QString &n) { | 728 | void PPPData::setEnter(enum PPPData::LineTermination n) { |
729 | writeConfig(modemGroup(), ENTER_KEY, n); | 729 | writeConfig(modemGroup(), ENTER_KEY, n); |
730 | } | 730 | } |
731 | 731 | ||
732 | 732 | ||
733 | // | 733 | // |
734 | // functions to set/return account information | 734 | // functions to set/return account information |
735 | // | 735 | // |
736 | 736 | ||
737 | //returns number of accounts | 737 | //returns number of accounts |
738 | int PPPData::count() const { | 738 | int PPPData::count() const { |
739 | return highcount + 1; | 739 | return highcount + 1; |
740 | } | 740 | } |
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h index d1cbeb5..d731b62 100644 --- a/noncore/settings/networksettings/ppp/pppdata.h +++ b/noncore/settings/networksettings/ppp/pppdata.h | |||
@@ -156,24 +156,35 @@ class Config; | |||
156 | #define ACOUNTS_ACC "Accounts_Account" | 156 | #define ACOUNTS_ACC "Accounts_Account" |
157 | 157 | ||
158 | #define DEVICESNAMES_LIST "DevicesNames_List" | 158 | #define DEVICESNAMES_LIST "DevicesNames_List" |
159 | #define DEVICES_LIST "Devices_List" | 159 | #define DEVICES_LIST "Devices_List" |
160 | #define DEVICES_LIST_SEP ',' | 160 | #define DEVICES_LIST_SEP ',' |
161 | 161 | ||
162 | class PPPData { | 162 | class PPPData { |
163 | public: | 163 | public: |
164 | PPPData(); | 164 | PPPData(); |
165 | ~PPPData() {}; | 165 | ~PPPData() {}; |
166 | 166 | ||
167 | enum { NumInitStrings = 2 }; | 167 | enum { NumInitStrings = 2 }; |
168 | enum LineTermination { | ||
169 | EndCR, | ||
170 | EndLF, | ||
171 | EndCRLF | ||
172 | }; | ||
173 | |||
174 | enum FlowControl { | ||
175 | FlowHardware, | ||
176 | FlowSoftware, | ||
177 | FlowNone | ||
178 | }; | ||
168 | 179 | ||
169 | // general functions | 180 | // general functions |
170 | void save(); | 181 | void save(); |
171 | void cancel(); | 182 | void cancel(); |
172 | 183 | ||
173 | QStringList getAccountList(); | 184 | QStringList getAccountList(); |
174 | 185 | ||
175 | static QMap<QString,QString> getConfiguredInterfaces(); | 186 | static QMap<QString,QString> getConfiguredInterfaces(); |
176 | static void setConfiguredInterfaces( QMap<QString,QString> ); | 187 | static void setConfiguredInterfaces( QMap<QString,QString> ); |
177 | 188 | ||
178 | // function to read/write date to configuration file | 189 | // function to read/write date to configuration file |
179 | static Config config(); | 190 | static Config config(); |
@@ -213,26 +224,26 @@ public: | |||
213 | void set_show_log_window(bool set); | 224 | void set_show_log_window(bool set); |
214 | bool get_show_log_window(); | 225 | bool get_show_log_window(); |
215 | 226 | ||
216 | void set_automatic_redial(bool set); | 227 | void set_automatic_redial(bool set); |
217 | bool automatic_redial(); | 228 | bool automatic_redial(); |
218 | 229 | ||
219 | // void set_iconify_on_connect(bool set); | 230 | // void set_iconify_on_connect(bool set); |
220 | // bool get_iconify_on_connect(); | 231 | // bool get_iconify_on_connect(); |
221 | 232 | ||
222 | // void set_dock_into_panel(bool set); | 233 | // void set_dock_into_panel(bool set); |
223 | // bool get_dock_into_panel(); | 234 | // bool get_dock_into_panel(); |
224 | 235 | ||
225 | const QString enter(); | 236 | enum LineTermination enter(); |
226 | void setEnter(const QString &); | 237 | void setEnter(enum LineTermination); |
227 | 238 | ||
228 | QString pppdVersion(); | 239 | QString pppdVersion(); |
229 | bool pppdVersionMin(int ver, int mod, int patch); | 240 | bool pppdVersionMin(int ver, int mod, int patch); |
230 | 241 | ||
231 | int pppdTimeout(); | 242 | int pppdTimeout(); |
232 | void setpppdTimeout(int); | 243 | void setpppdTimeout(int); |
233 | 244 | ||
234 | int busyWait(); | 245 | int busyWait(); |
235 | void setbusyWait(int); | 246 | void setbusyWait(int); |
236 | 247 | ||
237 | bool modemLockFile(); | 248 | bool modemLockFile(); |
238 | void setModemLockFile(bool set); | 249 | void setModemLockFile(bool set); |
@@ -244,26 +255,26 @@ public: | |||
244 | const QString modemEscapeStr(); | 255 | const QString modemEscapeStr(); |
245 | 256 | ||
246 | void setModemEscapeResp(const QString &); | 257 | void setModemEscapeResp(const QString &); |
247 | const QString modemEscapeResp(); | 258 | const QString modemEscapeResp(); |
248 | 259 | ||
249 | // const QString modemName(); | 260 | // const QString modemName(); |
250 | // bool setModemName(const QString &); | 261 | // bool setModemName(const QString &); |
251 | // bool changeModemName(const QString &); | 262 | // bool changeModemName(const QString &); |
252 | 263 | ||
253 | const QString modemDevice(); | 264 | const QString modemDevice(); |
254 | bool setModemDevice(const QString &); | 265 | bool setModemDevice(const QString &); |
255 | 266 | ||
256 | const QString flowcontrol(); | 267 | enum FlowControl flowcontrol(); |
257 | void setFlowcontrol(const QString &); | 268 | void setFlowcontrol(enum FlowControl); |
258 | 269 | ||
259 | int modemTimeout(); | 270 | int modemTimeout(); |
260 | void setModemTimeout(int); | 271 | void setModemTimeout(int); |
261 | 272 | ||
262 | int modemToneDuration(); | 273 | int modemToneDuration(); |
263 | void setModemToneDuration(int); | 274 | void setModemToneDuration(int); |
264 | 275 | ||
265 | QString volumeInitString(); | 276 | QString volumeInitString(); |
266 | int volume(); | 277 | int volume(); |
267 | void setVolume(int); | 278 | void setVolume(int); |
268 | 279 | ||
269 | int waitForDialTone(); | 280 | int waitForDialTone(); |