author | zecke <zecke> | 2004-09-10 11:16:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-10 11:16:54 (UTC) |
commit | 59dbb076579e0387f960525b415511946eb83b17 (patch) (unidiff) | |
tree | dc8caeebf7e5a1968a399838b53cb09a1537d9ec /noncore/settings/networksettings/ppp | |
parent | b8baf551919868737c6f56a05e6efa1bad4d97ac (diff) | |
download | opie-59dbb076579e0387f960525b415511946eb83b17.zip opie-59dbb076579e0387f960525b415511946eb83b17.tar.gz opie-59dbb076579e0387f960525b415511946eb83b17.tar.bz2 |
Fix the issues the compilers bothers
remove unused parameters, give return values on return
Diffstat (limited to 'noncore/settings/networksettings/ppp') (more/less context) (ignore whitespace changes)
6 files changed, 26 insertions, 24 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index 24d33f4..128877a 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -204,25 +204,26 @@ void ConnectWidget::init() { | |||
204 | QString tit = QObject::tr("Connecting to: %1").arg(_ifaceppp->data()->accname()); | 204 | QString tit = QObject::tr("Connecting to: %1").arg(_ifaceppp->data()->accname()); |
205 | setCaption(tit); | 205 | setCaption(tit); |
206 | 206 | ||
207 | qApp->processEvents(); | 207 | qApp->processEvents(); |
208 | 208 | ||
209 | // run the "before-connect" command | 209 | // run the "before-connect" command |
210 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { | 210 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { |
211 | messg->setText(QObject::tr("Running pre-startup command...")); | 211 | messg->setText(QObject::tr("Running pre-startup command...")); |
212 | emit debugMessage(QObject::tr("Running pre-startup command...")); | 212 | emit debugMessage(QObject::tr("Running pre-startup command...")); |
213 | 213 | ||
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | QApplication::flushX(); | 215 | QApplication::flushX(); |
216 | pid_t id = execute_command(_ifaceppp->data()->command_before_connect()); | 216 | (void)execute_command(_ifaceppp->data()->command_before_connect()); |
217 | |||
217 | // int i, status; | 218 | // int i, status; |
218 | 219 | ||
219 | // do { | 220 | // do { |
220 | // qApp->processEvents(); | 221 | // qApp->processEvents(); |
221 | // i = waitpid(id, &status, WNOHANG); | 222 | // i = waitpid(id, &status, WNOHANG); |
222 | // usleep(100000); | 223 | // usleep(100000); |
223 | // } while (i == 0 && errno == 0); | 224 | // } while (i == 0 && errno == 0); |
224 | } | 225 | } |
225 | 226 | ||
226 | int lock = _ifaceppp->modem()->lockdevice(); | 227 | int lock = _ifaceppp->modem()->lockdevice(); |
227 | 228 | ||
228 | if (lock == 1) { | 229 | if (lock == 1) { |
@@ -464,25 +465,25 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
464 | 465 | ||
465 | // execute the script | 466 | // execute the script |
466 | if(vmain == 2) { | 467 | if(vmain == 2) { |
467 | if(!expecting && !pausing && !scanning) { | 468 | if(!expecting && !pausing && !scanning) { |
468 | 469 | ||
469 | timeout_timer->stop(); | 470 | timeout_timer->stop(); |
470 | timeout_timer->start(scriptTimeout); | 471 | timeout_timer->start(scriptTimeout); |
471 | 472 | ||
472 | if((unsigned) scriptindex < comlist->count()) { | 473 | if((unsigned) scriptindex < comlist->count()) { |
473 | scriptCommand = *(comlist->at(scriptindex)); | 474 | scriptCommand = *(comlist->at(scriptindex)); |
474 | scriptArgument = *(arglist->at(scriptindex)); | 475 | scriptArgument = *(arglist->at(scriptindex)); |
475 | } else { | 476 | } else { |
476 | odebug << "End of script" << oendl; | 477 | odebug << "End of script" << oendl; |
477 | vmain = 10; | 478 | vmain = 10; |
478 | return; | 479 | return; |
479 | } | 480 | } |
480 | 481 | ||
481 | if (scriptCommand == "Scan") { | 482 | if (scriptCommand == "Scan") { |
482 | QString bm = QObject::tr("Scanning %1").arg(scriptArgument); | 483 | QString bm = QObject::tr("Scanning %1").arg(scriptArgument); |
483 | messg->setText(bm); | 484 | messg->setText(bm); |
484 | emit debugMessage(bm); | 485 | emit debugMessage(bm); |
485 | 486 | ||
486 | setScan(scriptArgument); | 487 | setScan(scriptArgument); |
487 | scriptindex++; | 488 | scriptindex++; |
488 | return; | 489 | return; |
@@ -830,35 +831,35 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
830 | 831 | ||
831 | // Close the tty. This prevents the QTimer::singleShot() in | 832 | // Close the tty. This prevents the QTimer::singleShot() in |
832 | // Modem::readtty() from re-enabling the socket notifier. | 833 | // Modem::readtty() from re-enabling the socket notifier. |
833 | // The port is still held open by the helper process. | 834 | // The port is still held open by the helper process. |
834 | 835 | ||
835 | /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), | 836 | /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), |
836 | and closing the thing prevents pppd from using it later. */ | 837 | and closing the thing prevents pppd from using it later. */ |
837 | //_ifaceppp->modem()->closetty(); | 838 | //_ifaceppp->modem()->closetty(); |
838 | 839 | ||
839 | killTimer( main_timer_ID ); | 840 | killTimer( main_timer_ID ); |
840 | 841 | ||
841 | if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); | 842 | if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); |
842 | odebug << "started if timeout timer with " << _ifaceppp->data()->pppdTimeout()*1000 << "" << oendl; | 843 | odebug << "started if timeout timer with " << _ifaceppp->data()->pppdTimeout()*1000 << "" << oendl; |
843 | 844 | ||
844 | // find out PPP interface and notify the stats module | 845 | // find out PPP interface and notify the stats module |
845 | // stats->setUnit(pppInterfaceNumber()); | 846 | // stats->setUnit(pppInterfaceNumber()); |
846 | 847 | ||
847 | qApp->flushX(); | 848 | qApp->flushX(); |
848 | semaphore = true; | 849 | semaphore = true; |
849 | result = execppp(); | 850 | result = execppp(); |
850 | 851 | ||
851 | emit debugMessage(QObject::tr("Starting pppd...")); | 852 | emit debugMessage(QObject::tr("Starting pppd...")); |
852 | odebug << "execppp() returned with return-code " << result << "" << oendl; | 853 | odebug << "execppp() returned with return-code " << result << "" << oendl; |
853 | 854 | ||
854 | if(result) { | 855 | if(result) { |
855 | if(!_ifaceppp->data()->autoDNS()) | 856 | if(!_ifaceppp->data()->autoDNS()) |
856 | adddns( _ifaceppp ); | 857 | adddns( _ifaceppp ); |
857 | 858 | ||
858 | // O.K we are done here, let's change over to the if_waiting loop | 859 | // O.K we are done here, let's change over to the if_waiting loop |
859 | // where we wait for the ppp if (interface) to come up. | 860 | // where we wait for the ppp if (interface) to come up. |
860 | 861 | ||
861 | emit if_waiting_signal(); | 862 | emit if_waiting_signal(); |
862 | } else { | 863 | } else { |
863 | 864 | ||
864 | // starting pppd wasn't successful. Error messages were | 865 | // starting pppd wasn't successful. Error messages were |
@@ -1056,25 +1057,25 @@ void ConnectWidget::setExpect(const QString &n) { | |||
1056 | QString ts = QObject::tr("Expecting: %1").arg(n); | 1057 | QString ts = QObject::tr("Expecting: %1").arg(n); |
1057 | ts.replace(QRegExp("\n"), "<LF>"); | 1058 | ts.replace(QRegExp("\n"), "<LF>"); |
1058 | emit debugMessage(ts); | 1059 | emit debugMessage(ts); |
1059 | 1060 | ||
1060 | // check if the expected string is in the read buffer already. | 1061 | // check if the expected string is in the read buffer already. |
1061 | checkBuffers(); | 1062 | checkBuffers(); |
1062 | } | 1063 | } |
1063 | 1064 | ||
1064 | 1065 | ||
1065 | void ConnectWidget::if_waiting_timed_out() { | 1066 | void ConnectWidget::if_waiting_timed_out() { |
1066 | if_timer->stop(); | 1067 | if_timer->stop(); |
1067 | if_timeout_timer->stop(); | 1068 | if_timeout_timer->stop(); |
1068 | odebug << "if_waiting_timed_out()" << oendl; | 1069 | odebug << "if_waiting_timed_out()" << oendl; |
1069 | 1070 | ||
1070 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); | 1071 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); |
1071 | 1072 | ||
1072 | // let's kill the stuck pppd | 1073 | // let's kill the stuck pppd |
1073 | _ifaceppp->modem()->killPPPDaemon(); | 1074 | _ifaceppp->modem()->killPPPDaemon(); |
1074 | 1075 | ||
1075 | emit stopAccounting(); | 1076 | emit stopAccounting(); |
1076 | // p_kppp->con_win->stopClock(); | 1077 | // p_kppp->con_win->stopClock(); |
1077 | 1078 | ||
1078 | 1079 | ||
1079 | // killing ppp will generate a SIGCHLD which will be caught in pppdie() | 1080 | // killing ppp will generate a SIGCHLD which will be caught in pppdie() |
1080 | // in main.cpp what happens next will depend on the boolean | 1081 | // in main.cpp what happens next will depend on the boolean |
@@ -1263,25 +1264,25 @@ bool ConnectWidget::execppp() { | |||
1263 | 1264 | ||
1264 | command += " call opie-kppp logfd 11"; | 1265 | command += " call opie-kppp logfd 11"; |
1265 | 1266 | ||
1266 | if (command.length() > MAX_CMDLEN) { | 1267 | if (command.length() > MAX_CMDLEN) { |
1267 | QMessageBox::critical(this, "error", QObject::tr( | 1268 | QMessageBox::critical(this, "error", QObject::tr( |
1268 | "pppd command + command-line arguments exceed " | 1269 | "pppd command + command-line arguments exceed " |
1269 | "2024 characters in length." | 1270 | "2024 characters in length." |
1270 | )); | 1271 | )); |
1271 | 1272 | ||
1272 | return false; // nonsensically long command which would bust my buffer buf. | 1273 | return false; // nonsensically long command which would bust my buffer buf. |
1273 | } | 1274 | } |
1274 | 1275 | ||
1275 | owarn << "Command IS: " << command.latin1() << "" << oendl; | 1276 | owarn << "Command IS: " << command.latin1() << "" << oendl; |
1276 | 1277 | ||
1277 | qApp->flushX(); | 1278 | qApp->flushX(); |
1278 | 1279 | ||
1279 | return _ifaceppp->modem()->execPPPDaemon(command); | 1280 | return _ifaceppp->modem()->execPPPDaemon(command); |
1280 | } | 1281 | } |
1281 | 1282 | ||
1282 | 1283 | ||
1283 | void ConnectWidget::closeEvent( QCloseEvent *e ) { | 1284 | void ConnectWidget::closeEvent( QCloseEvent *e ) { |
1284 | e->ignore(); | 1285 | e->ignore(); |
1285 | emit cancelbutton(); | 1286 | emit cancelbutton(); |
1286 | } | 1287 | } |
1287 | 1288 | ||
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp index 42de44c..e2c67d8 100644 --- a/noncore/settings/networksettings/ppp/devices.cpp +++ b/noncore/settings/networksettings/ppp/devices.cpp | |||
@@ -65,38 +65,38 @@ DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *nam | |||
65 | tr("Makes a copy of the selected device. All\n" | 65 | tr("Makes a copy of the selected device. All\n" |
66 | "settings of the selected device are copied\n" | 66 | "settings of the selected device are copied\n" |
67 | "to a new device, that you can modify to fit your\n" | 67 | "to a new device, that you can modify to fit your\n" |
68 | "needs")); | 68 | "needs")); |
69 | QWhatsThis::add(delete_b, | 69 | QWhatsThis::add(delete_b, |
70 | tr("<p>Deletes the selected device\n\n" | 70 | tr("<p>Deletes the selected device\n\n" |
71 | "<font color=\"red\"><b>Use with care!</b></font>")); | 71 | "<font color=\"red\"><b>Use with care!</b></font>")); |
72 | 72 | ||
73 | copy_b->setEnabled( false ); //FIXME | 73 | copy_b->setEnabled( false ); //FIXME |
74 | // delete_b->setEnabled( false ); //FIXME | 74 | // delete_b->setEnabled( false ); //FIXME |
75 | 75 | ||
76 | QStringList tmp = _pppdata->getDevicesNamesList(); | 76 | QStringList tmp = _pppdata->getDevicesNamesList(); |
77 | odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl; | 77 | odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl; |
78 | listListbox->insertStringList(tmp); | 78 | listListbox->insertStringList(tmp); |
79 | 79 | ||
80 | for (uint i = 0; i < listListbox->count(); i++){ | 80 | for (uint i = 0; i < listListbox->count(); i++){ |
81 | odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl; | 81 | odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl; |
82 | if ( listListbox->text(i) == _pppdata->devname() ) | 82 | if ( listListbox->text(i) == _pppdata->devname() ) |
83 | listListbox->setCurrentItem( i ); | 83 | listListbox->setCurrentItem( i ); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | void DevicesWidget::slotListBoxSelect(int idx) { | 89 | void DevicesWidget::slotListBoxSelect(int idx) { |
90 | bool ok = _pppdata->setDevice( listListbox->text(idx) ); | 90 | _pppdata->setDevice( listListbox->text(idx) ); |
91 | delete_b->setEnabled((bool)(idx != -1)); | 91 | delete_b->setEnabled((bool)(idx != -1)); |
92 | edit_b->setEnabled((bool)(idx != -1)); | 92 | edit_b->setEnabled((bool)(idx != -1)); |
93 | //FIXME copy_b->setEnabled((bool)(idx != -1)); | 93 | //FIXME copy_b->setEnabled((bool)(idx != -1)); |
94 | } | 94 | } |
95 | 95 | ||
96 | void DevicesWidget::edit() { | 96 | void DevicesWidget::edit() { |
97 | _pppdata->setDevice(listListbox->text(listListbox->currentItem())); | 97 | _pppdata->setDevice(listListbox->text(listListbox->currentItem())); |
98 | 98 | ||
99 | int result = doTab(); | 99 | int result = doTab(); |
100 | 100 | ||
101 | if(result == QDialog::Accepted) { | 101 | if(result == QDialog::Accepted) { |
102 | listListbox->changeItem(_pppdata->devname(),listListbox->currentItem()); | 102 | listListbox->changeItem(_pppdata->devname(),listListbox->currentItem()); |
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index 3b2393c..6c9735c 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp | |||
@@ -1193,19 +1193,19 @@ PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) | |||
1193 | 1193 | ||
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | 1196 | ||
1197 | QString PhoneNumberDialog::phoneNumber() | 1197 | QString PhoneNumberDialog::phoneNumber() |
1198 | { | 1198 | { |
1199 | QString s = le->text(); | 1199 | QString s = le->text(); |
1200 | 1200 | ||
1201 | return s; | 1201 | return s; |
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | 1204 | ||
1205 | void PhoneNumberDialog::textChanged(const QString &s) | 1205 | void PhoneNumberDialog::textChanged(const QString &) |
1206 | { | 1206 | { |
1207 | // enableButtonOK(s.length() > 0); | 1207 | // enableButtonOK(s.length() > 0); |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | 1210 | ||
1211 | //#include "edit.moc" | 1211 | //#include "edit.moc" |
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp index 4755aed..56e1c1f 100644 --- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp | |||
@@ -12,28 +12,28 @@ using namespace Opie::Core; | |||
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qabstractlayout.h> | 13 | #include <qabstractlayout.h> |
14 | 14 | ||
15 | #ifdef QWS | 15 | #ifdef QWS |
16 | #else | 16 | #else |
17 | #define showMaximized show | 17 | #define showMaximized show |
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Constructor for the InterfaceInformationImp class. This class pretty much | 21 | * Constructor for the InterfaceInformationImp class. This class pretty much |
22 | * just display's information about the interface that is passed to it. | 22 | * just display's information about the interface that is passed to it. |
23 | */ | 23 | */ |
24 | InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) | 24 | InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags ) |
25 | :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp) | 25 | :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp) |
26 | { | 26 | { |
27 | odebug << "InterfaceInformationPPP::InterfaceInformationPPP " << name << "" << oendl; | 27 | odebug << "InterfaceInformationPPP::InterfaceInformationPPP " << name << "" << oendl; |
28 | con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); | 28 | con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); |
29 | con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, | 29 | con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, |
30 | QSizePolicy::Fixed) ); | 30 | QSizePolicy::Fixed) ); |
31 | 31 | ||
32 | macAddressLabel->hide(); | 32 | macAddressLabel->hide(); |
33 | subnetMaskLabel->hide(); | 33 | subnetMaskLabel->hide(); |
34 | broadcastLabel->hide(); | 34 | broadcastLabel->hide(); |
35 | TextLabel23->hide(); | 35 | TextLabel23->hide(); |
36 | TextLabel21->hide(); | 36 | TextLabel21->hide(); |
37 | TextLabel24->hide(); | 37 | TextLabel24->hide(); |
38 | 38 | ||
39 | InterfaceInformationLayout->addWidget( con, 1, 0 ); | 39 | InterfaceInformationLayout->addWidget( con, 1, 0 ); |
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index fb279ee..dec0177 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -54,62 +54,62 @@ namespace | |||
54 | * an interface was up while closing the application | 54 | * an interface was up while closing the application |
55 | * we need to be able to shut it down... | 55 | * we need to be able to shut it down... |
56 | */ | 56 | */ |
57 | PPPModule::PPPModule() : Module() | 57 | PPPModule::PPPModule() : Module() |
58 | { | 58 | { |
59 | InterfaceKeeper inFace; | 59 | InterfaceKeeper inFace; |
60 | QMap<QString,Connection> running = inFace.interfaces(); | 60 | QMap<QString,Connection> running = inFace.interfaces(); |
61 | QStringList handledInterfaceNames; | 61 | QStringList handledInterfaceNames; |
62 | 62 | ||
63 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); | 63 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); |
64 | QMap<QString,QString>::Iterator it; | 64 | QMap<QString,QString>::Iterator it; |
65 | InterfacePPP *iface; | 65 | InterfacePPP *iface; |
66 | odebug << "getting interfaces" << oendl; | 66 | odebug << "getting interfaces" << oendl; |
67 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) | 67 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) |
68 | { | 68 | { |
69 | odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl; | 69 | odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl; |
70 | iface = new InterfacePPP( 0, it.key() ); | 70 | iface = new InterfacePPP( 0, it.key() ); |
71 | iface->setHardwareName( it.data() ); | 71 | iface->setHardwareName( it.data() ); |
72 | list.append( (Interface*)iface ); | 72 | list.append( (Interface*)iface ); |
73 | 73 | ||
74 | // check if (*it) is one of the running ifaces | 74 | // check if (*it) is one of the running ifaces |
75 | if ( running.contains( it.data() ) ) | 75 | if ( running.contains( it.data() ) ) |
76 | { | 76 | { |
77 | odebug << "iface is running " << it.key().latin1() << "" << oendl; | 77 | odebug << "iface is running " << it.key().latin1() << "" << oendl; |
78 | handledInterfaceNames << running[it.data()].device; | 78 | handledInterfaceNames << running[it.data()].device; |
79 | iface->setStatus( true ); | 79 | iface->setStatus( true ); |
80 | iface->setPPPDpid( running[it.data()].pid ); | 80 | iface->setPPPDpid( running[it.data()].pid ); |
81 | iface->modem()->setPPPDevice( running[it.data()].device ); | 81 | iface->modem()->setPPPDevice( running[it.data()].device ); |
82 | iface->refresh(); | 82 | iface->refresh(); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | setHandledInterfaceNames( handledInterfaceNames ); | 86 | setHandledInterfaceNames( handledInterfaceNames ); |
87 | } | 87 | } |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Delete any interfaces that we own. | 90 | * Delete any interfaces that we own. |
91 | */ | 91 | */ |
92 | PPPModule::~PPPModule() | 92 | PPPModule::~PPPModule() |
93 | { | 93 | { |
94 | odebug << "PPPModule::~PPPModule() " << oendl; | 94 | odebug << "PPPModule::~PPPModule() " << oendl; |
95 | QMap<QString,QString> ifaces; | 95 | QMap<QString,QString> ifaces; |
96 | InterfaceKeeper keeper; | 96 | InterfaceKeeper keeper; |
97 | Interface *i; | 97 | Interface *i; |
98 | for ( i=list.first(); i != 0; i=list.next() ) | 98 | for ( i=list.first(); i != 0; i=list.next() ) |
99 | { | 99 | { |
100 | /* if online save the state */ | 100 | /* if online save the state */ |
101 | if ( i->getStatus() ) | 101 | if ( i->getStatus() ) |
102 | { | 102 | { |
103 | odebug << "Iface " << i->getHardwareName().latin1() << " is still up" << oendl; | 103 | odebug << "Iface " << i->getHardwareName().latin1() << " is still up" << oendl; |
104 | InterfacePPP* ppp = static_cast<InterfacePPP*>(i); | 104 | InterfacePPP* ppp = static_cast<InterfacePPP*>(i); |
105 | keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); | 105 | keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); |
106 | } | 106 | } |
107 | ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); | 107 | ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); |
108 | delete i; | 108 | delete i; |
109 | } | 109 | } |
110 | PPPData::setConfiguredInterfaces( ifaces ); | 110 | PPPData::setConfiguredInterfaces( ifaces ); |
111 | } | 111 | } |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Change the current profile | 114 | * Change the current profile |
115 | */ | 115 | */ |
@@ -135,25 +135,25 @@ QString PPPModule::getPixmapName(Interface* ) | |||
135 | */ | 135 | */ |
136 | bool PPPModule::isOwner(Interface *i) | 136 | bool PPPModule::isOwner(Interface *i) |
137 | { | 137 | { |
138 | return list.find( i ) != -1; | 138 | return list.find( i ) != -1; |
139 | } | 139 | } |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * Create, and return the WLANConfigure Module | 142 | * Create, and return the WLANConfigure Module |
143 | * @return QWidget* pointer to this modules configure. | 143 | * @return QWidget* pointer to this modules configure. |
144 | */ | 144 | */ |
145 | QWidget *PPPModule::configure(Interface *i) | 145 | QWidget *PPPModule::configure(Interface *i) |
146 | { | 146 | { |
147 | odebug << "return ModemWidget" << oendl; | 147 | odebug << "return ModemWidget" << oendl; |
148 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, | 148 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, |
149 | 0, "PPPConfig", false, | 149 | 0, "PPPConfig", false, |
150 | ::Qt::WDestructiveClose | ::Qt::WStyle_ContextHelp); | 150 | ::Qt::WDestructiveClose | ::Qt::WStyle_ContextHelp); |
151 | return pppconfig; | 151 | return pppconfig; |
152 | } | 152 | } |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Create, and return the Information Module | 155 | * Create, and return the Information Module |
156 | * @return QWidget* pointer to this modules info. | 156 | * @return QWidget* pointer to this modules info. |
157 | */ | 157 | */ |
158 | QWidget *PPPModule::information(Interface *i) | 158 | QWidget *PPPModule::information(Interface *i) |
159 | { | 159 | { |
@@ -162,36 +162,37 @@ QWidget *PPPModule::information(Interface *i) | |||
162 | 162 | ||
163 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); | 163 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); |
164 | } | 164 | } |
165 | 165 | ||
166 | /** | 166 | /** |
167 | * Get all active (up or down) interfaces | 167 | * Get all active (up or down) interfaces |
168 | * @return QList<Interface> A list of interfaces that exsist that havn't | 168 | * @return QList<Interface> A list of interfaces that exsist that havn't |
169 | * been called by isOwner() | 169 | * been called by isOwner() |
170 | */ | 170 | */ |
171 | QList<Interface> PPPModule::getInterfaces() | 171 | QList<Interface> PPPModule::getInterfaces() |
172 | { | 172 | { |
173 | // List all of the files in the peer directory | 173 | // List all of the files in the peer directory |
174 | odebug << "PPPModule::getInterfaces" << oendl; | 174 | odebug << "PPPModule::getInterfaces" << oendl; |
175 | return list; | 175 | return list; |
176 | } | 176 | } |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Attempt to add a new interface as defined by name | 179 | * Attempt to add a new interface as defined by name |
180 | * @param name the name of the type of interface that should be created given | 180 | * @param newInterface the name of the type of interface that should be created given |
181 | * by possibleNewInterfaces(); | 181 | * by possibleNewInterfaces(); |
182 | * @return Interface* NULL if it was unable to be created. | 182 | * @return Interface* NULL if it was unable to be created. |
183 | */ | 183 | */ |
184 | Interface *PPPModule::addNewInterface(const QString &newInterface) | 184 | Interface *PPPModule::addNewInterface(const QString &newInterface) |
185 | { | 185 | { |
186 | Q_CONST_UNUSED( newInterface ) | ||
186 | 187 | ||
187 | InterfacePPP *ifaceppp; | 188 | InterfacePPP *ifaceppp; |
188 | Interface *iface; | 189 | Interface *iface; |
189 | ifaceppp = new InterfacePPP(); | 190 | ifaceppp = new InterfacePPP(); |
190 | PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); | 191 | PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); |
191 | 192 | ||
192 | if( QPEApplication::execDialog( &imp ) == QDialog::Accepted ) | 193 | if( QPEApplication::execDialog( &imp ) == QDialog::Accepted ) |
193 | { | 194 | { |
194 | iface = (InterfacePPP*) ifaceppp; | 195 | iface = (InterfacePPP*) ifaceppp; |
195 | iface->setModuleOwner( this ); | 196 | iface->setModuleOwner( this ); |
196 | list.append( iface ); | 197 | list.append( iface ); |
197 | return iface; | 198 | return iface; |
@@ -255,32 +256,32 @@ namespace | |||
255 | QMap<QString, Connection> InterfaceKeeper::interfaces()const | 256 | QMap<QString, Connection> InterfaceKeeper::interfaces()const |
256 | { | 257 | { |
257 | Config cfg("ppp_plugin_keeper"); | 258 | Config cfg("ppp_plugin_keeper"); |
258 | QMap<QString, Connection> ifaces; | 259 | QMap<QString, Connection> ifaces; |
259 | QStringList lst = cfg.groupList(); | 260 | QStringList lst = cfg.groupList(); |
260 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) | 261 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) |
261 | { | 262 | { |
262 | Connection con; | 263 | Connection con; |
263 | cfg.setGroup( (*it) ); | 264 | cfg.setGroup( (*it) ); |
264 | con.name = (*it); | 265 | con.name = (*it); |
265 | con.pid = cfg.readNumEntry("pid"); | 266 | con.pid = cfg.readNumEntry("pid"); |
266 | con.device = cfg.readEntry("device"); | 267 | con.device = cfg.readEntry("device"); |
267 | odebug << " " << con.name.latin1() << " " << con.device.latin1() << " " << con.pid << "" << oendl; | 268 | odebug << " " << con.name.latin1() << " " << con.device.latin1() << " " << con.pid << "" << oendl; |
268 | 269 | ||
269 | if ( con.pid != -1 && isAvailable( con.pid ) ) | 270 | if ( con.pid != -1 && isAvailable( con.pid ) ) |
270 | ifaces.insert( con.name, con ); | 271 | ifaces.insert( con.name, con ); |
271 | } | 272 | } |
272 | return ifaces; | 273 | return ifaces; |
273 | } | 274 | } |
274 | bool InterfaceKeeper::isAvailable( pid_t p)const | 275 | bool InterfaceKeeper::isAvailable( pid_t p)const |
275 | { | 276 | { |
276 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) | 277 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) |
277 | { | 278 | { |
278 | odebug << "isAvailable " << p << "" << oendl; | 279 | odebug << "isAvailable " << p << "" << oendl; |
279 | return true; | 280 | return true; |
280 | } | 281 | } |
281 | 282 | ||
282 | odebug << "notAvailable " << p << "" << oendl; | 283 | odebug << "notAvailable " << p << "" << oendl; |
283 | return false; | 284 | return false; |
284 | } | 285 | } |
285 | 286 | ||
286 | } | 287 | } |
diff --git a/noncore/settings/networksettings/ppp/pppmodule.h b/noncore/settings/networksettings/ppp/pppmodule.h index de649e4..1ecbf7a 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.h +++ b/noncore/settings/networksettings/ppp/pppmodule.h | |||
@@ -13,25 +13,25 @@ public: | |||
13 | ~PPPModule(); | 13 | ~PPPModule(); |
14 | 14 | ||
15 | virtual const QString type() {return "ppp";}; | 15 | virtual const QString type() {return "ppp";}; |
16 | virtual void setProfile(const QString &newProfile); | 16 | virtual void setProfile(const QString &newProfile); |
17 | virtual bool isOwner(Interface *); | 17 | virtual bool isOwner(Interface *); |
18 | virtual QWidget *configure(Interface *i); | 18 | virtual QWidget *configure(Interface *i); |
19 | virtual QWidget *information(Interface *i); | 19 | virtual QWidget *information(Interface *i); |
20 | virtual QList<Interface> getInterfaces(); | 20 | virtual QList<Interface> getInterfaces(); |
21 | virtual void possibleNewInterfaces(QMap<QString, QString> &); | 21 | virtual void possibleNewInterfaces(QMap<QString, QString> &); |
22 | virtual Interface *addNewInterface(const QString &name); | 22 | virtual Interface *addNewInterface(const QString &name); |
23 | virtual bool remove(Interface* i); | 23 | virtual bool remove(Interface* i); |
24 | virtual QString getPixmapName(Interface* i); | 24 | virtual QString getPixmapName(Interface* i); |
25 | virtual void receive(const QCString &msg, const QByteArray &arg) {}; | 25 | virtual void receive(const QCString &, const QByteArray &) {}; |
26 | 26 | ||
27 | private: | 27 | private: |
28 | QList<Interface> list; | 28 | QList<Interface> list; |
29 | QString profile; | 29 | QString profile; |
30 | 30 | ||
31 | }; | 31 | }; |
32 | 32 | ||
33 | extern "C" | 33 | extern "C" |
34 | { | 34 | { |
35 | void* create_plugin() { | 35 | void* create_plugin() { |
36 | return new PPPModule(); | 36 | return new PPPModule(); |
37 | } | 37 | } |