summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/general.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/ppp/general.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp293
1 files changed, 185 insertions, 108 deletions
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index f735e49..5540946 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -37,5 +37,6 @@
#include <qwhatsthis.h>
-
+#include <qpe/config.h>
// #include <qgroupbox.h>
+
#include "general.h"
@@ -45,6 +46,5 @@
#include "modemcmds.h"
-#include "devices.h"
+//#include "devices.h"
#include "pppdata.h"
//#include <klocale.h>
-#define i18n QObject::tr
@@ -52,4 +52,5 @@
-ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name )
- : QWidget(parent, name), _ifaceppp(ifppp)
+
+ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
+ : QWidget(parent, name), _pppdata(pd)
{
@@ -60,15 +61,33 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
QLabel *label1;
- label1 = new QLabel(i18n("Modem de&vice:"), this);
+
+ label1 = new QLabel(tr("Modem &name:"), this);
tl->addWidget(label1, 0, 0);
+ modemname = new QLineEdit(this, "modemName");
+ modemname->setText( _pppdata->devname() );
+ label1->setBuddy(modemname);
+ tl->addWidget(modemname, 0, 1);
+
+ label1 = new QLabel(tr("Modem de&vice:"), this);
+ tl->addWidget(label1, 1, 0);
+
modemdevice = new QComboBox(false, this);
+ modemdevice->setEditable( true );
+ modemdevice->setDuplicatesEnabled ( false );
+ modemdevice->setInsertionPolicy( QComboBox::AtTop );
label1->setBuddy(modemdevice);
- for(k = 0; devices[k]; k++)
- modemdevice->insertItem(devices[k]);
+ Config cfg("NetworkSetupPPP");
+ cfg.setGroup("Devices_General");
+ QStringList devs = cfg.readListEntry("devices",',');
+ if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0";
+ modemdevice->insertStringList( devs );
+ tl->addWidget(modemdevice, 1, 1);
+
+// connect(modemdevice, SIGNAL(activated(int)),
+// SLOT(setmodemdc(int)));
+// connect(modemdevice, SIGNAL(textChanged( const QString & ) ),
+// SLOT( setmodemdc( const QString &) ) );
- tl->addWidget(modemdevice, 0, 1);
- connect(modemdevice, SIGNAL(activated(int)),
- SLOT(setmodemdc(int)));
- QString tmp = i18n("This specifies the serial port your modem is attached \n"
+ QString tmp = tr("This specifies the serial port your modem is attached \n"
"to. On Linux/x86, typically this is either /dev/ttyS0 \n"
@@ -84,4 +103,4 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
- label1 = new QLabel(i18n("&Flow control:"), this);
- tl->addWidget(label1, 1, 0);
+ label1 = new QLabel(tr("&Flow control:"), this);
+ tl->addWidget(label1, 2, 0);
@@ -89,10 +108,10 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
label1->setBuddy(flowcontrol);
- flowcontrol->insertItem(i18n("Hardware [CRTSCTS]"));
- flowcontrol->insertItem(i18n("Software [XON/XOFF]"));
- flowcontrol->insertItem(i18n("None"));
- tl->addWidget(flowcontrol, 1, 1);
- connect(flowcontrol, SIGNAL(activated(int)),
- SLOT(setflowcontrol(int)));
-
- tmp = i18n("<p>Specifies how the serial port and modem\n"
+ flowcontrol->insertItem(tr("Hardware [CRTSCTS]"));
+ flowcontrol->insertItem(tr("Software [XON/XOFF]"));
+ flowcontrol->insertItem(tr("None"));
+ tl->addWidget(flowcontrol, 2, 1);
+// connect(flowcontrol, SIGNAL(activated(int)),
+// SLOT(setflowcontrol(int)));
+
+ tmp = tr("<p>Specifies how the serial port and modem\n"
"communicate. You should not change this unless\n"
@@ -105,4 +124,4 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
- QLabel *labelenter = new QLabel(i18n("&Line termination:"), this);
- tl->addWidget(labelenter, 2, 0);
+ QLabel *labelenter = new QLabel(tr("&Line termination:"), this);
+ tl->addWidget(labelenter, 3, 0);
@@ -113,5 +132,5 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
enter->insertItem("CR/LF");
- tl->addWidget(enter, 2, 1);
- connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
- tmp = i18n("<p>Specifies how AT commands are sent to your\n"
+ tl->addWidget(enter, 3, 1);
+// connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
+ tmp = tr("<p>Specifies how AT commands are sent to your\n"
"modem. Most modems will work fine with the\n"
@@ -126,4 +145,4 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
- QLabel *baud_label = new QLabel(i18n("Co&nnection speed:"), this);
- tl->addWidget(baud_label, 3, 0);
+ QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this);
+ tl->addWidget(baud_label, 4, 0);
baud_c = new QComboBox(this);
@@ -159,7 +178,7 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
baud_c->setCurrentItem(3);
- connect(baud_c, SIGNAL(activated(int)),
- this, SLOT(speed_selection(int)));
- tl->addWidget(baud_c, 3, 1);
+// connect(baud_c, SIGNAL(activated(int)),
+// this, SLOT(speed_selection(int)));
+ tl->addWidget(baud_c, 4, 1);
- tmp = i18n("Specifies the speed your modem and the serial\n"
+ tmp = tr("Specifies the speed your modem and the serial\n"
"port talk to each other. You should begin with\n"
@@ -174,3 +193,3 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
for(int i=0; i <= enter->count()-1; i++) {
- if(_ifaceppp->data()->enter() == enter->text(i))
+ if(_pppdata->enter() == enter->text(i))
enter->setCurrentItem(i);
@@ -178,14 +197,14 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
- tl->addRowSpacing(4, 10);
+ tl->addRowSpacing(5, 10);
//Modem Lock File
- modemlockfile = new QCheckBox(i18n("&Use lock file"), this);
+ modemlockfile = new QCheckBox(tr("&Use lock file"), this);
- modemlockfile->setChecked(_ifaceppp->data()->modemLockFile());
- connect(modemlockfile, SIGNAL(toggled(bool)),
- SLOT(modemlockfilechanged(bool)));
- tl->addMultiCellWidget(modemlockfile, 5, 5, 0, 1);
+ modemlockfile->setChecked(_pppdata->modemLockFile());
+// connect(modemlockfile, SIGNAL(toggled(bool)),
+// SLOT(modemlockfilechanged(bool)));
+ tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1);
// l12->addStretch(1);
QWhatsThis::add(modemlockfile,
- i18n("<p>To prevent other programs from accessing the\n"
+ tr("<p>To prevent other programs from accessing the\n"
"modem while a connection is established, a\n"
@@ -204,14 +223,14 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
// modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this);
-// modemtimeout->setLabel(i18n("Modem &timeout:"));
+// modemtimeout->setLabel(tr("Modem &timeout:"));
// modemtimeout->setRange(1, 120, 1);
- modemtimeout->setSuffix(i18n(" sec"));
- modemtimeout->setValue( _ifaceppp->data()->modemTimeout() );
- connect(modemtimeout, SIGNAL(valueChanged(int)),
- SLOT(modemtimeoutchanged(int)));
+ modemtimeout->setSuffix(tr(" sec"));
+ modemtimeout->setValue( _pppdata->modemTimeout() );
+// connect(modemtimeout, SIGNAL(valueChanged(int)),
+// SLOT(modemtimeoutchanged(int)));
timeoutLayout->addWidget(timeoutlabel);
timeoutLayout->addWidget(modemtimeout);
- tl->addMultiCellLayout(timeoutLayout, 6, 6, 0, 1);
+ tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1);
QWhatsThis::add(modemtimeout,
- i18n("This specifies how long <i>kppp</i> waits for a\n"
+ tr("This specifies how long <i>kppp</i> waits for a\n"
"<i>CONNECT</i> response from your modem. The\n"
@@ -221,3 +240,3 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
for(int i=0; i <= enter->count()-1; i++) {
- if(_ifaceppp->data()->enter() == enter->text(i))
+ if(_pppdata->enter() == enter->text(i))
enter->setCurrentItem(i);
@@ -226,3 +245,3 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
for(int i=0; i <= modemdevice->count()-1; i++) {
- if(_ifaceppp->data()->modemDevice() == modemdevice->text(i))
+ if(_pppdata->modemDevice() == modemdevice->text(i))
modemdevice->setCurrentItem(i);
@@ -231,3 +250,3 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
for(int i=0; i <= flowcontrol->count()-1; i++) {
- if(_ifaceppp->data()->flowcontrol() == flowcontrol->text(i))
+ if(_pppdata->flowcontrol() == flowcontrol->text(i))
flowcontrol->setCurrentItem(i);
@@ -237,42 +256,92 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
for(int i=0; i < baud_c->count(); i++)
- if(baud_c->text(i) == _ifaceppp->data()->speed())
+ if(baud_c->text(i) == _pppdata->speed())
baud_c->setCurrentItem(i);
- tl->setRowStretch(7, 1);
+ tl->setRowStretch(1, 1);
}
+ModemWidget::~ModemWidget()
+{
+ QStringList devs;
-void ModemWidget::speed_selection(int) {
- _ifaceppp->data()->setSpeed(baud_c->text(baud_c->currentItem()));
-}
+ for (int i=0;i<modemdevice->count();i++)
+ {
+ QString s = modemdevice->text(i);
+ s.simplifyWhiteSpace();
+ if (! s.isEmpty() ) devs << s;
+ }
-void ModemWidget::setenter(int ) {
- _ifaceppp->data()->setEnter(enter->text(enter->currentItem()));
-}
+ 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::setmodemdc(int i) {
- _ifaceppp->data()->setModemDevice(modemdevice->text(i));
}
+// void ModemWidget::speed_selection(int) {
+// _pppdata->setSpeed(baud_c->text(baud_c->currentItem()));
+// }
-void ModemWidget::setflowcontrol(int i) {
- _ifaceppp->data()->setFlowcontrol(flowcontrol->text(i));
-}
+// void ModemWidget::setenter(int ) {
+// _pppdata->setEnter(enter->text(enter->currentItem()));
+// }
-void ModemWidget::modemlockfilechanged(bool set) {
- _ifaceppp->data()->setModemLockFile(set);
-}
+// void ModemWidget::setmodemdc(int i) {
+// _pppdata->setModemDevice(modemdevice->text(i));
+// }
-void ModemWidget::modemtimeoutchanged(int n) {
- _ifaceppp->data()->setModemTimeout(n);
-}
+// void ModemWidget::setmodemdc( const QString &string ) {
+// _pppdata->setModemDevice( string );
+// }
+
+// void ModemWidget::setflowcontrol(int i) {
+// _pppdata->setFlowcontrol(flowcontrol->text(i));
+// }
-ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
+// void ModemWidget::modemlockfilechanged(bool set) {
+// _pppdata->setModemLockFile(set);
+// }
+
+
+// void ModemWidget::modemtimeoutchanged(int n) {
+// _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;
+
+ qDebug("ModemWidget::save saving modem1 data");
+ _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;
+
+}
+
+ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent,
const char *name)
- : QWidget(parent, name), _ifaceppp(ifp)
+ : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip)
{
@@ -281,8 +350,8 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
- waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this);
- waitfordt->setChecked(_ifaceppp->data()->waitForDialTone());
- connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
+ 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,
- i18n("<p>Normally the modem waits for a dial tone\n"
+ tr("<p>Normally the modem waits for a dial tone\n"
"from your phone line, indicating that it can\n"
@@ -298,6 +367,6 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
// busywait = new KIntNumInput(_pppdata->busyWait(), this);
-// busywait->setLabel(i18n("B&usy wait:"));
+// busywait->setLabel(tr("B&usy wait:"));
// busywait->setRange(0, 300, 5, true);
- busywait->setSuffix(i18n(" sec"));
- connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
+ busywait->setSuffix(tr(" sec"));
+// connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
waitLayout->addWidget(waitLabel);
@@ -307,3 +376,3 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
QWhatsThis::add(busywait,
- i18n("Specifies the number of seconds to wait before\n"
+ tr("Specifies the number of seconds to wait before\n"
"redial if all dialed numbers are busy. This is\n"
@@ -320,5 +389,5 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
- QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this);
+ QLabel *volumeLabel = new QLabel(tr("Modem &volume:"), this);
hbl->addWidget(volumeLabel);
- volume = new QSlider(0, 2, 1, _ifaceppp->data()->volume(),
+ volume = new QSlider(0, 2, 1, _pppdata->volume(),
QSlider::Horizontal, this);
@@ -330,5 +399,5 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
- connect(volume, SIGNAL(valueChanged(int)),
- this, SLOT(volumeChanged(int)));
- QString tmp = i18n("Most modems have a speaker which makes\n"
+// connect(volume, SIGNAL(valueChanged(int)),
+// this, SLOT(volumeChanged(int)));
+ QString tmp = tr("Most modems have a speaker which makes\n"
"a lot of noise when dialing. Here you can\n"
@@ -346,4 +415,4 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
#if 0
- chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this);
- chkbox1->setChecked(_ifaceppp->data()->UseCDLine());
+ chkbox1 = new QCheckBox(tr("Modem asserts CD line"), this);
+ chkbox1->setChecked(_pppdata->UseCDLine());
connect(chkbox1,SIGNAL(toggled(bool)),
@@ -354,3 +423,3 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
QWhatsThis::add(chkbox1,
- i18n("This controls how <i>kppp</i> detects that the modem\n"
+ tr("This controls how <i>kppp</i> detects that the modem\n"
"is not responding. Unless you are having\n"
@@ -361,10 +430,10 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
- modemcmds = new QPushButton(i18n("Mod&em Commands..."), this);
+ modemcmds = new QPushButton(tr("Mod&em Commands..."), this);
QWhatsThis::add(modemcmds,
- i18n("Allows you to change the AT command for\n"
+ tr("Allows you to change the AT command for\n"
"your modem."));
- modeminfo_button = new QPushButton(i18n("&Query Modem..."), this);
+ modeminfo_button = new QPushButton(tr("&Query Modem..."), this);
QWhatsThis::add(modeminfo_button,
- i18n("Most modems support the ATI command set to\n"
+ tr("Most modems support the ATI command set to\n"
"find out vendor and revision of your modem.\n"
@@ -375,5 +444,5 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
-// terminal_button = new QPushButton(i18n("&Terminal..."), this);
+// terminal_button = new QPushButton(tr("&Terminal..."), this);
// QWhatsThis::add(terminal_button,
-// i18n("Opens the built-in terminal program. You\n"
+// tr("Opens the built-in terminal program. You\n"
// "can use this if you want to play around\n"
@@ -404,3 +473,3 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
void ModemWidget2::modemcmdsbutton() {
- ModemCommands mc(_ifaceppp->data(), this);
+ ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp);
mc.showMaximized();
@@ -422,19 +491,27 @@ void ModemWidget2::query_modem() {
-#if 0
-void ModemWidget2::use_cdline_toggled(bool on) {
- _ifaceppp->data()->setUseCDLine(on);
-}
-#endif
+// #if 0
+// void ModemWidget2::use_cdline_toggled(bool on) {
+// _pppdata->setUseCDLine(on);
+// }
+// #endif
-void ModemWidget2::waitfordtchanged(bool b) {
- _ifaceppp->data()->setWaitForDialTone((int)b);
-}
+// void ModemWidget2::waitfordtchanged(bool b) {
+// _pppdata->setWaitForDialTone((int)b);
+// }
-void ModemWidget2::busywaitchanged(int n) {
- _ifaceppp->data()->setbusyWait(n);
-}
+// void ModemWidget2::busywaitchanged(int n) {
+// _pppdata->setbusyWait(n);
+// }
-void ModemWidget2::volumeChanged(int v) {
- _ifaceppp->data()->setVolume(v);
+// void ModemWidget2::volumeChanged(int v) {
+// _pppdata->setVolume(v);
+// }
+
+bool ModemWidget2::save()
+{
+ _pppdata->setWaitForDialTone(waitfordt->isChecked());
+ _pppdata->setbusyWait(busywait->value());
+ _pppdata->setVolume(volume->value());
+ return true;
}