Diffstat (limited to 'noncore/settings/networksettings') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/devices.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/edit.cpp | 233 |
2 files changed, 170 insertions, 88 deletions
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp index e94904b..9da090d 100644 --- a/noncore/settings/networksettings/ppp/devices.cpp +++ b/noncore/settings/networksettings/ppp/devices.cpp @@ -26,4 +26,14 @@ +#include "interfaceppp.h" +#include "devices.h" +#include "authwidget.h" +#include "pppdata.h" +#include "edit.h" +#include "general.h" + +/* OPIE */ +#include <qpe/qpeapplication.h> + +/* QT */ #include <qdir.h> -#include <stdlib.h> #include <qlayout.h> @@ -33,3 +43,2 @@ #include <qmessagebox.h> - #include <qapplication.h> @@ -39,8 +48,5 @@ -#include "interfaceppp.h" -#include "devices.h" -#include "authwidget.h" -#include "pppdata.h" -#include "edit.h" -#include "general.h" +/* STD */ +#include <stdlib.h> + @@ -193,4 +199,3 @@ int DevicesWidget::doTab(){ while (!ok){ - dlg->showMaximized(); - result = dlg->exec(); + result = QPEApplication::execDialog( dlg ); ok = true; diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index ceac90c..7d21605 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp @@ -25,4 +25,12 @@ -#include <string.h> -#include <termios.h> +#include "edit.h" +#include "pppdata.h" +#include "iplined.h" +#include "auth.h" + +/* OPIE */ +#include <qpe/resource.h> +#include <qpe/qpeapplication.h> + +/* QT */ #include <qlayout.h> @@ -36,8 +44,7 @@ #include <qdialog.h> -#include <qpe/resource.h> -#include "edit.h" -#include "pppdata.h" -#include "iplined.h" -#include "auth.h" +/* STD */ + +#include <string.h> +#include <termios.h> @@ -114,3 +121,4 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount // Set defaults if editing an existing connection - if(!isnewaccount) { + if(!isnewaccount) + { connectname_l->setText(_pppdata->accname()); @@ -121,4 +129,6 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount uint idx = 0; - while(idx != n.length()) { - if(n[idx] == ':') { + while(idx != n.length()) + { + if(n[idx] == ':') + { if(tmp.length() > 0) @@ -126,3 +136,4 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount tmp = ""; - } else + } + else tmp += n[idx]; @@ -139,8 +150,12 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount -bool DialWidget::save() { +bool DialWidget::save() +{ //first check to make sure that the account name is unique! if(connectname_l->text().isEmpty() || - !_pppdata->isUniqueAccname(connectname_l->text())) { + !_pppdata->isUniqueAccname(connectname_l->text())) + { return false; - } else { + } + else + { _pppdata->setAccname(connectname_l->text()); @@ -148,3 +163,4 @@ bool DialWidget::save() { QString number = ""; - for(uint i = 0; i < numbers->count(); i++) { + for(uint i = 0; i < numbers->count(); i++) + { if(i != 0) @@ -160,3 +176,4 @@ bool DialWidget::save() { -void DialWidget::numbersChanged() { +void DialWidget::numbersChanged() +{ int sel = numbers->currentItem(); @@ -169,3 +186,4 @@ void DialWidget::numbersChanged() { -void DialWidget::selectionChanged(int) { +void DialWidget::selectionChanged(int) +{ numbersChanged(); @@ -174,5 +192,7 @@ void DialWidget::selectionChanged(int) { -void DialWidget::addNumber() { +void DialWidget::addNumber() +{ PhoneNumberDialog dlg(this); - if(dlg.exec()) { + if(dlg.exec()) + { numbers->insertItem(dlg.phoneNumber()); @@ -183,4 +203,6 @@ void DialWidget::addNumber() { -void DialWidget::delNumber() { - if(numbers->currentItem() != -1) { +void DialWidget::delNumber() +{ + if(numbers->currentItem() != -1) + { numbers->removeItem(numbers->currentItem()); @@ -191,5 +213,7 @@ void DialWidget::delNumber() { -void DialWidget::upNumber() { +void DialWidget::upNumber() +{ int idx = numbers->currentItem(); - if(idx != -1) { + if(idx != -1) + { QString item = numbers->text(idx); @@ -203,5 +227,7 @@ void DialWidget::upNumber() { -void DialWidget::downNumber() { +void DialWidget::downNumber() +{ int idx = numbers->currentItem(); - if(idx != -1) { + if(idx != -1) + { QString item = numbers->text(idx); @@ -215,6 +241,6 @@ void DialWidget::downNumber() { -void DialWidget::pppdargsbutton() { +void DialWidget::pppdargsbutton() +{ PPPdArguments pa(_pppdata, this); - pa.showMaximized(); - pa.exec(); + QPEApplication::execDialog( &pa ); } @@ -307,3 +333,4 @@ ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch // Set defaults if editing an existing connection - if(!isnewaccount) { + if(!isnewaccount) + { before_connect->setText(_pppdata->command_before_connect()); @@ -316,3 +343,4 @@ ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch -bool ExecWidget::save() { +bool ExecWidget::save() +{ _pppdata->setCommand_before_connect(before_connect->text()); @@ -416,5 +444,7 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char //load info from gpppdata - if(!isnewaccount) { + if(!isnewaccount) + { if(_pppdata->ipaddr() == "0.0.0.0" && - _pppdata->subnetmask() == "0.0.0.0") { + _pppdata->subnetmask() == "0.0.0.0") + { dynamicadd_rb->setChecked(true); @@ -423,3 +453,4 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char } - else { + else + { ipaddress_l->setText(_pppdata->ipaddr()); @@ -430,3 +461,4 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char } - else { + else + { dynamicadd_rb->setChecked(true); @@ -437,3 +469,4 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char -void IPWidget::autoname_t(bool on) { +void IPWidget::autoname_t(bool on) +{ static bool was_warned = false; @@ -441,3 +474,4 @@ void IPWidget::autoname_t(bool on) { // big-fat warning when selecting the auto configure hostname option - if(on && !was_warned) { + if(on && !was_warned) + { QMessageBox::information(this, @@ -456,7 +490,11 @@ void IPWidget::autoname_t(bool on) { -void IPWidget::save() { - if(dynamicadd_rb->isChecked()) { +void IPWidget::save() +{ + if(dynamicadd_rb->isChecked()) + { _pppdata->setIpaddr("0.0.0.0"); _pppdata->setSubnetmask("0.0.0.0"); - } else { + } + else + { _pppdata->setIpaddr(ipaddress_l->text()); @@ -468,4 +506,6 @@ void IPWidget::save() { -void IPWidget::hitIPSelect( int i ) { - if(i == 0) { +void IPWidget::hitIPSelect( int i ) +{ + if(i == 0) + { ipaddress_label->setEnabled(false); @@ -475,3 +515,4 @@ void IPWidget::hitIPSelect( int i ) { } - else { + else + { ipaddress_label->setEnabled(true); @@ -599,3 +640,4 @@ DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const cha // restore data if editing - if(!isnewaccount) { + if(!isnewaccount) + { dnsservers->insertStringList(_pppdata->dns()); @@ -611,3 +653,4 @@ DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const cha -void DNSWidget::DNS_Edit_Changed(const QString &text) { +void DNSWidget::DNS_Edit_Changed(const QString &text) +{ QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); @@ -616,3 +659,4 @@ void DNSWidget::DNS_Edit_Changed(const QString &text) { -void DNSWidget::DNS_Entry_Selected(int) { +void DNSWidget::DNS_Entry_Selected(int) +{ remove->setEnabled(true); @@ -620,3 +664,4 @@ void DNSWidget::DNS_Entry_Selected(int) { -void DNSWidget::DNS_Mode_Selected(int mode) { +void DNSWidget::DNS_Mode_Selected(int mode) +{ bool on = (mode == 1); @@ -633,3 +678,4 @@ void DNSWidget::DNS_Mode_Selected(int mode) { -void DNSWidget::save() { +void DNSWidget::save() +{ _pppdata->setAutoDNS(bg->id(bg->selected()) == 0); @@ -651,4 +697,6 @@ void DNSWidget::save() { -void DNSWidget::adddns() { - if(dnsservers->count() < MAX_DNS_ENTRIES) { +void DNSWidget::adddns() +{ + if(dnsservers->count() < MAX_DNS_ENTRIES) + { dnsservers->insertItem(dnsipaddr->text()); @@ -659,3 +707,4 @@ void DNSWidget::adddns() { -void DNSWidget::removedns() { +void DNSWidget::removedns() +{ int i; @@ -723,4 +772,6 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c //load info from gpppdata - if(!isnewaccount) { - if(_pppdata->gateway() == "0.0.0.0") { + if(!isnewaccount) + { + if(_pppdata->gateway() == "0.0.0.0") + { defaultgateway->setChecked(true); @@ -728,3 +779,4 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c } - else { + else + { gatewayaddr->setText(_pppdata->gateway()); @@ -734,3 +786,4 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c } - else { + else + { defaultgateway->setChecked(true); @@ -741,3 +794,4 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c -void GatewayWidget::save() { +void GatewayWidget::save() +{ _pppdata->setGateway(gatewayaddr->text()); @@ -747,4 +801,6 @@ void GatewayWidget::save() { -void GatewayWidget::hitGatewaySelect( int i ) { - if(i == 0) { +void GatewayWidget::hitGatewaySelect( int i ) +{ + if(i == 0) + { gatewayaddr->setText("0.0.0.0"); @@ -753,3 +809,4 @@ void GatewayWidget::hitGatewaySelect( int i ) { } - else { + else + { gatewayaddr->setEnabled(true); @@ -805,3 +862,4 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con //load data from gpppdata - if(!isnewaccount) { + if(!isnewaccount) + { QStringList &comlist = _pppdata->scriptType(); @@ -826,3 +884,4 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con -bool ScriptWidget::check() { +bool ScriptWidget::check() +{ uint lstart = 0; @@ -831,8 +890,12 @@ bool ScriptWidget::check() { - if(sl->count() > 0) { - for( uint i=0; i <= sl->count()-1; i++) { - if(stl->text(i) == "LoopStart") { + if(sl->count() > 0) + { + for( uint i=0; i <= sl->count()-1; i++) + { + if(stl->text(i) == "LoopStart") + { lstart++; } - if (stl->text(i) == "LoopEnd") { + if (stl->text(i) == "LoopEnd") + { lend++; @@ -847,5 +910,7 @@ bool ScriptWidget::check() { -void ScriptWidget::save() { +void ScriptWidget::save() +{ QStringList typelist, arglist; - for(uint i=0; i < sl->count(); i++) { + for(uint i=0; i < sl->count(); i++) + { typelist.append(stl->text(i)); @@ -859,3 +924,4 @@ void ScriptWidget::save() { -void ScriptWidget::adjustScrollBar() { +void ScriptWidget::adjustScrollBar() +{ if((int)sl->count() <= sl->numItemsVisible()) @@ -867,3 +933,4 @@ void ScriptWidget::adjustScrollBar() { -void ScriptWidget::scrolling(int i) { +void ScriptWidget::scrolling(int i) +{ sl->setTopItem(i); @@ -873,3 +940,4 @@ void ScriptWidget::scrolling(int i) { -void ScriptWidget::slhighlighted(int i) { +void ScriptWidget::slhighlighted(int i) +{ insert->setEnabled(true); @@ -880,3 +948,4 @@ void ScriptWidget::slhighlighted(int i) { -void ScriptWidget::stlhighlighted(int i) { +void ScriptWidget::stlhighlighted(int i) +{ insert->setEnabled(true); @@ -887,3 +956,4 @@ void ScriptWidget::stlhighlighted(int i) { -void ScriptWidget::addButton() { +void ScriptWidget::addButton() +{ //don't allow more than the maximum script entries @@ -892,3 +962,4 @@ void ScriptWidget::addButton() { - switch(se->type()) { + switch(se->type()) + { case ScriptEdit::Expect: @@ -982,3 +1053,4 @@ void ScriptWidget::addButton() { -void ScriptWidget::insertButton() { +void ScriptWidget::insertButton() +{ //exit if there is no highlighted item, or we've reached the @@ -988,3 +1060,4 @@ void ScriptWidget::insertButton() { - switch(se->type()) { + switch(se->type()) + { case ScriptEdit::Expect: @@ -1072,4 +1145,6 @@ void ScriptWidget::insertButton() { -void ScriptWidget::removeButton() { - if(sl->currentItem() >= 0) { +void ScriptWidget::removeButton() +{ + if(sl->currentItem() >= 0) + { int stlc = stl->currentItem(); @@ -1121,3 +1196,4 @@ PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) -QString PhoneNumberDialog::phoneNumber() { +QString PhoneNumberDialog::phoneNumber() +{ QString s = le->text(); @@ -1128,3 +1204,4 @@ QString PhoneNumberDialog::phoneNumber() { -void PhoneNumberDialog::textChanged(const QString &s) { +void PhoneNumberDialog::textChanged(const QString &s) +{ // enableButtonOK(s.length() > 0); |