summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp16
-rw-r--r--noncore/settings/networksettings/mainwindow/addconnectionimp.cpp8
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp13
-rw-r--r--noncore/settings/networksettings/ppp/devices.cpp6
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp23
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.h2
-rw-r--r--noncore/settings/networksettings/wlan/keyedit.cpp4
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp1
10 files changed, 40 insertions, 39 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index 8498759..62b1b7a 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -1,209 +1,209 @@
1#include "interfacesetupimp.h" 1#include "interfacesetupimp.h"
2#include "interface.h" 2#include "interface.h"
3 3
4#include <qcheckbox.h> 4#include <qcheckbox.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6#include <qspinbox.h> 6#include <qspinbox.h>
7#include <qgroupbox.h> 7#include <qgroupbox.h>
8#include <qlabel.h> 8#include <qlabel.h>
9 9
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11 11
12#include <opie2/oprocess.h> 12#include <opie2/oprocess.h>
13 13
14#ifdef QWS 14#ifdef QWS
15#include <opie2/owait.h> 15#include <opie2/owait.h>
16#include <opie2/odebug.h> 16#include <opie2/odebug.h>
17#include <qpe/global.h> 17#include <qpe/global.h>
18#include <qapplication.h> 18#include <qapplication.h>
19#endif 19#endif
20 20
21#define DNSSCRIPT "changedns" 21#define DNSSCRIPT "changedns"
22 22
23/** 23/**
24 * Constuctor. Set up the connection. A profile must be set. 24 * Constuctor. Set up the connection. A profile must be set.
25 */ 25 */
26using namespace Opie::Ui; 26using namespace Opie::Ui;
27using namespace Opie::Core; 27using namespace Opie::Core;
28InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){ 28InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interfaces(j), interface(i), delInterfaces(false){
29 if (j == 0) { 29 if (j == 0) {
30 delInterfaces = true; 30 delInterfaces = true;
31 interfaces = new Interfaces; 31 interfaces = new Interfaces;
32 } 32 }
33} 33}
34 34
35/** 35/**
36 * Destructor 36 * Destructor
37 */ 37 */
38InterfaceSetupImp::~InterfaceSetupImp(){ 38InterfaceSetupImp::~InterfaceSetupImp(){
39 if(delInterfaces) { 39 if(delInterfaces) {
40 delete interfaces; 40 delete interfaces;
41 } 41 }
42} 42}
43 43
44/** 44/**
45 * Save the current settings, then write out the interfaces file and close. 45 * Save the current settings, then write out the interfaces file and close.
46 */ 46 */
47bool InterfaceSetupImp::saveChanges(){ 47bool InterfaceSetupImp::saveChanges(){
48 bool error; 48 bool error;
49 QString iface = interfaces->getInterfaceName(error); 49 QString iface = interfaces->getInterfaceName(error);
50 odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl; 50 odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl;
51 if(!saveSettings()) 51 if(!saveSettings())
52 return false; 52 return false;
53 53
54 interfaces->write(); 54 interfaces->write();
55 55
56 if (interface->getStatus()) { 56 if (interface->getStatus()) {
57 QString ifup; 57 QString ifup;
58 ifup += "ifdown "; 58 ifup += "ifdown ";
59 ifup += iface; 59 ifup += iface;
60 ifup += "; ifup "; 60 ifup += "; ifup ";
61 ifup += iface; 61 ifup += iface;
62 ifup += ";"; 62 ifup += ";";
63 63
64 OProcess restart; 64 OProcess restart;
65 restart << "sh"; 65 restart << "sh";
66 restart << "-c"; 66 restart << "-c";
67 restart << ifup; 67 restart << ifup;
68 68
69 OWait *owait = new OWait(); 69 OWait *owait = new OWait();
70 Global::statusMessage( tr( "Restarting interface" ) ); 70 Global::statusMessage( tr( "Restarting interface" ) );
71 71
72 owait->show(); 72 owait->show();
73 qApp->processEvents(); 73 qApp->processEvents();
74 74
75 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { 75 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
76 owarn << "unstable to spawn ifdown/ifup" << oendl; 76 owarn << "unstable to spawn ifdown/ifup" << oendl;
77 } 77 }
78 78
79 owait->hide(); 79 owait->hide();
80 delete owait; 80 delete owait;
81 81
82 interface->refresh(); 82 interface->refresh();
83 } 83 }
84 return true; 84 return true;
85} 85}
86 86
87/** 87/**
88 * Save the settings for the current Interface. 88 * Save the settings for the current Interface.
89 * @return bool true if successful, false otherwise 89 * @return bool true if successful, false otherwise
90 */ 90 */
91bool InterfaceSetupImp::saveSettings(){ 91bool InterfaceSetupImp::saveSettings(){
92 // eh can't really do anything about it other then return. :-D 92 // eh can't really do anything about it other then return. :-D
93 if(!interfaces->isInterfaceSet()) 93 if(!interfaces->isInterfaceSet())
94 return true; 94 return true;
95 95
96 bool error = false; 96 bool error = false;
97 // Loopback case 97 // Loopback case
98 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 98 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
99 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 99 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
100 return true; 100 return true;
101 } 101 }
102 102
103 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ 103 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
104 QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); 104 QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok);
105 return false; 105 return false;
106 } 106 }
107 // DHCP 107 // DHCP
108 if(dhcpCheckBox->isChecked()) { 108 if(dhcpCheckBox->isChecked()) {
109 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); 109 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
110 interfaces->removeInterfaceOption("address"); 110 interfaces->removeInterfaceOption("address");
111 interfaces->removeInterfaceOption("netmask"); 111 interfaces->removeInterfaceOption("netmask");
112 interfaces->removeInterfaceOption("gateway"); 112 interfaces->removeInterfaceOption("gateway");
113 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a "); 113 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
114 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r "); 114 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r ");
115 } else{ 115 } else{
116 interfaces->setInterfaceMethod("static"); 116 interfaces->setInterfaceMethod("static");
117 interfaces->setInterfaceOption("address", ipAddressEdit->text()); 117 interfaces->setInterfaceOption("address", ipAddressEdit->text());
118 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); 118 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
119 interfaces->setInterfaceOption("gateway", gatewayEdit->text()); 119 interfaces->setInterfaceOption("gateway", gatewayEdit->text());
120 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ 120 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
121 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); 121 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
122 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); 122 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
123 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); 123 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
124 }else{ 124 }else{
125 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a "); 125 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
126 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r"); 126 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r");
127 } 127 }
128 } 128 }
129 129
130 // IP Information 130 // IP Information
131 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 131 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
132 return true; 132 return true;
133} 133}
134 134
135/** 135/**
136 * The Profile has changed. 136 * The Profile has changed.
137 * @param QString profile the new profile. 137 * @param QString profile the new profile.
138 */ 138 */
139void InterfaceSetupImp::setProfile(const QString &profile){ 139void InterfaceSetupImp::setProfile(const QString &profile){
140 /* 140 /*
141 bool error = false; 141 bool error = false;
142 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 142 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
143 staticGroupBox->hide(); 143 staticGroupBox->hide();
144 dhcpCheckBox->hide(); 144 dhcpCheckBox->hide();
145 leaseTime->hide(); 145 leaseTime->hide();
146 leaseHoursLabel->hide(); 146 leaseHoursLabel->hide();
147 } 147 }
148 */ 148 */
149 149
150 QString newInterfaceName = interface->getInterfaceName(); 150 QString newInterfaceName = interface->getInterfaceName();
151 if(profile.length() > 0) 151 if(profile.length() > 0)
152 newInterfaceName += "_" + profile; 152 newInterfaceName += "_" + profile;
153 // See if we have to make a interface. 153 // See if we have to make a interface.
154 if(!interfaces->setInterface(newInterfaceName)){ 154 if(!interfaces->setInterface(newInterfaceName)){
155 // Add making for this new interface if need too 155 // Add making for this new interface if need too
156 if(profile != ""){ 156 if(profile != ""){
157 interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); 157 interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName);
158 if(!interfaces->setMapping(interface->getInterfaceName())){ 158 if(!interfaces->setMapping(interface->getInterfaceName())){
159 interfaces->addMapping(interface->getInterfaceName()); 159 interfaces->addMapping(interface->getInterfaceName());
160 if(!interfaces->setMapping(interface->getInterfaceName())){ 160 if(!interfaces->setMapping(interface->getInterfaceName())){
161 odebug << "InterfaceSetupImp: Added Mapping, but still can't setInterface." << oendl; 161 odebug << "InterfaceSetupImp: Added Mapping, but still can't setInterface." << oendl;
162 return; 162 return;
163 } 163 }
164 } 164 }
165 interfaces->setMap("map", newInterfaceName); 165 interfaces->setMap("map", newInterfaceName);
166 interfaces->setScript("getprofile.sh"); 166 interfaces->setScript("getprofile.sh");
167 } 167 }
168 else{ 168 else{
169 interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); 169 interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
170 if(!interfaces->setInterface(newInterfaceName)){ 170 if(!interfaces->setInterface(newInterfaceName)){
171 odebug << "InterfaceSetupImp: Added interface, but still can't setInterface." << oendl; 171 odebug << "InterfaceSetupImp: Added interface, but still can't setInterface." << oendl;
172 return; 172 return;
173 } 173 }
174 } 174 }
175 } 175 }
176 176
177 // We must have a valid interface to get this far so read some settings. 177 // We must have a valid interface to get this far so read some settings.
178 178
179 // DHCP 179 // DHCP
180 bool error = false; 180 bool error = false;
181 if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) 181 if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP)
182 dhcpCheckBox->setChecked(true); 182 dhcpCheckBox->setChecked(true);
183 else 183 else
184 dhcpCheckBox->setChecked(false); 184 dhcpCheckBox->setChecked(false);
185 185
186 // IP Information 186 // IP Information
187 autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); 187 autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName()));
188 QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error); 188 QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error);
189 odebug << "dns >" << dns.latin1() << "<" << oendl; 189 odebug << "dns >" << dns.latin1() << "<" << oendl;
190 if(dns.contains(" ")){ 190 if(dns.contains(" ")){
191 firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); 191 firstDNSLineEdit->setText(dns.mid(0, dns.find(" ")));
192 secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); 192 secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length()));
193 }else firstDNSLineEdit->setText(dns); 193 }else firstDNSLineEdit->setText(dns);
194 194
195 ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); 195 ipAddressEdit->setText(interfaces->getInterfaceOption("address", error));
196 subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); 196 subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error));
197 if (subnetMaskEdit->text().isEmpty()) 197 if (subnetMaskEdit->text().isEmpty())
198 subnetMaskEdit->setText( "255.255.255.0" ); 198 subnetMaskEdit->setText( "255.255.255.0" );
199 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); 199 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));
200 200
201 201
202 202
203 owarn << "InterfaceSetupImp::setProfile(" << profile.latin1() << ")\n" << oendl; 203 owarn << "InterfaceSetupImp::setProfile(" << profile.latin1() << ")\n" << oendl;
204 owarn << "InterfaceSetupImp::setProfile: iface is " << interfaces->getInterfaceName(error).latin1() << "\n" << oendl; 204 owarn << "InterfaceSetupImp::setProfile: iface is " << interfaces->getInterfaceName(error).latin1() << "\n" << oendl;
205 205
206} 206}
207 207
208// interfacesetup.cpp 208// interfacesetup.cpp
209 209
diff --git a/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp b/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp
index f18d8d1..84f1cf6 100644
--- a/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp
+++ b/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp
@@ -1,41 +1,41 @@
1#include "addconnectionimp.h" 1#include "addconnectionimp.h"
2#include <qlistview.h> 2#include <qlistview.h>
3#if QT_VERSION < 300 3#if QT_VERSION < 300
4#include <qlist.h> 4#include <qlist.h>
5#else 5#else
6#include <qptrlist.h> 6#include <qptrlist.h>
7#endif 7#endif
8#include <qlabel.h> 8#include <qlabel.h>
9#include <qheader.h> 9#include <qheader.h>
10 10
11/** 11/**
12 * Constructor 12 * Constructor
13 */ 13 */
14AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){ 14AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){
15 connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed())); 15 connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed()));
16 registeredServicesList->header()->hide(); 16 registeredServicesList->header()->hide();
17}; 17};
18 18
19/** 19/**
20 * The current item changed, update the discription. 20 * The current item changed, update the discription.
21 */ 21 */
22void AddConnectionImp::changed(){ 22void AddConnectionImp::changed(){
23 QListViewItem *item = registeredServicesList->currentItem(); 23 QListViewItem *item = registeredServicesList->currentItem();
24 if(item) 24 if(item)
25 help->setText(list[item->text(0)]); 25 help->setText(list[item->text(0)]);
26} 26}
27 27
28/** 28/**
29 * Save a copy of newList for the discriptions and append them all to the view 29 * Save a copy of newList for the discriptions and append them all to the view
30 * @param newList the new list of possible interfaces 30 * @param newList the new list of possible interfaces
31 */ 31 */
32void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){ 32void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){
33 list = newList; 33 list = newList;
34 QMap<QString, QString>::Iterator it; 34 QMap<QString, QString>::Iterator it;
35 for( it = list.begin(); it != list.end(); ++it ) 35 for( it = list.begin(); it != list.end(); ++it )
36 QListViewItem *item = new QListViewItem(registeredServicesList, it.key()); 36 (void)new QListViewItem(registeredServicesList, it.key());
37 registeredServicesList->setCurrentItem(registeredServicesList->firstChild()); 37 registeredServicesList->setCurrentItem(registeredServicesList->firstChild());
38} 38}
39 39
40// addserviceimp.cpp 40// addserviceimp.cpp
41 41
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
@@ -168,97 +168,98 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
168 168
169ConnectWidget::~ConnectWidget() { 169ConnectWidget::~ConnectWidget() {
170} 170}
171 171
172 172
173void ConnectWidget::preinit() { 173void ConnectWidget::preinit() {
174 // this is all just to keep the GUI nice and snappy .... 174 // this is all just to keep the GUI nice and snappy ....
175 // you have to see to believe ... 175 // you have to see to believe ...
176 messg->setText(QObject::tr("Looking for modem...")); 176 messg->setText(QObject::tr("Looking for modem..."));
177 inittimer->start(100); 177 inittimer->start(100);
178} 178}
179 179
180 180
181void ConnectWidget::init() { 181void ConnectWidget::init() {
182 _ifaceppp->data()->setpppdError(0); 182 _ifaceppp->data()->setpppdError(0);
183 inittimer->stop(); 183 inittimer->stop();
184 vmain = 0; 184 vmain = 0;
185 substate = -1; 185 substate = -1;
186 expecting = false; 186 expecting = false;
187 pausing = false; 187 pausing = false;
188 scriptindex = 0; 188 scriptindex = 0;
189 myreadbuffer = ""; 189 myreadbuffer = "";
190 scanning = false; 190 scanning = false;
191 scanvar = ""; 191 scanvar = "";
192 firstrunID = true; 192 firstrunID = true;
193 firstrunPW = true; 193 firstrunPW = true;
194// stats->totalbytes = 0; 194// stats->totalbytes = 0;
195 dialnumber = 0; 195 dialnumber = 0;
196 196
197// p_kppp->con_speed = ""; 197// p_kppp->con_speed = "";
198 198
199// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || _ifaceppp->data()->quit_on_disconnect()); 199// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || _ifaceppp->data()->quit_on_disconnect());
200 200
201 comlist = &_ifaceppp->data()->scriptType(); 201 comlist = &_ifaceppp->data()->scriptType();
202 arglist = &_ifaceppp->data()->script(); 202 arglist = &_ifaceppp->data()->script();
203 203
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) {
229 messg->setText(QObject::tr("Modem device is locked.")); 230 messg->setText(QObject::tr("Modem device is locked."));
230 vmain = 20; // wait until cancel is pressed 231 vmain = 20; // wait until cancel is pressed
231 return; 232 return;
232 } 233 }
233 234
234 if (lock == -1) { 235 if (lock == -1) {
235 messg->setText(QObject::tr("Unable to create modem lock file.")); 236 messg->setText(QObject::tr("Unable to create modem lock file."));
236 vmain = 20; // wait until cancel is pressed 237 vmain = 20; // wait until cancel is pressed
237 return; 238 return;
238 } 239 }
239 240
240 if(_ifaceppp->modem()->opentty()) { 241 if(_ifaceppp->modem()->opentty()) {
241 messg->setText(_ifaceppp->modem()->modemMessage()); 242 messg->setText(_ifaceppp->modem()->modemMessage());
242 qApp->processEvents(); 243 qApp->processEvents();
243 if(_ifaceppp->modem()->hangup()) { 244 if(_ifaceppp->modem()->hangup()) {
244 245
245 qApp->processEvents(); 246 qApp->processEvents();
246 247
247 semaphore = false; 248 semaphore = false;
248 249
249 _ifaceppp->modem()->stop(); 250 _ifaceppp->modem()->stop();
250 _ifaceppp->modem()->notify(this, SLOT(readChar(unsigned char))); 251 _ifaceppp->modem()->notify(this, SLOT(readChar(unsigned char)));
251 252
252 // if we are stuck anywhere we will time out 253 // if we are stuck anywhere we will time out
253 timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000); 254 timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
254 255
255 // this timer will run the script etc. 256 // this timer will run the script etc.
256 main_timer_ID = startTimer(10); 257 main_timer_ID = startTimer(10);
257 258
258 return; 259 return;
259 } 260 }
260 } 261 }
261 262
262 // initialization failed 263 // initialization failed
263 messg->setText(_ifaceppp->modem()->modemMessage()); 264 messg->setText(_ifaceppp->modem()->modemMessage());
264 vmain = 20; // wait until cancel is pressed 265 vmain = 20; // wait until cancel is pressed
@@ -428,97 +429,97 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
428 substate = -1; 429 substate = -1;
429 return; 430 return;
430 } 431 }
431 432
432 if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) { 433 if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) {
433 timeout_timer->stop(); 434 timeout_timer->stop();
434 435
435 messg->setText(QObject::tr("No Dialtone")); 436 messg->setText(QObject::tr("No Dialtone"));
436 vmain = 20; 437 vmain = 20;
437 _ifaceppp->modem()->unlockdevice(); 438 _ifaceppp->modem()->unlockdevice();
438 return; 439 return;
439 } 440 }
440 441
441 if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) { 442 if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) {
442 timeout_timer->stop(); 443 timeout_timer->stop();
443 444
444 messg->setText(QObject::tr("No Carrier")); 445 messg->setText(QObject::tr("No Carrier"));
445 vmain = 20; 446 vmain = 20;
446 _ifaceppp->modem()->unlockdevice(); 447 _ifaceppp->modem()->unlockdevice();
447 return; 448 return;
448 } 449 }
449 } 450 }
450 451
451 // wait for newline after CONNECT response (so we get the speed) 452 // wait for newline after CONNECT response (so we get the speed)
452 if(vmain == 101) { 453 if(vmain == 101) {
453 if(!expecting) { 454 if(!expecting) {
454 _ifaceppp->modem()->setDataMode(true); // modem will no longer respond to AT commands 455 _ifaceppp->modem()->setDataMode(true); // modem will no longer respond to AT commands
455 456
456 emit startAccounting(); 457 emit startAccounting();
457// p_kppp->con_win->startClock(); 458// p_kppp->con_win->startClock();
458 459
459 vmain = 2; 460 vmain = 2;
460 scriptTimeout=_ifaceppp->data()->modemTimeout()*1000; 461 scriptTimeout=_ifaceppp->data()->modemTimeout()*1000;
461 return; 462 return;
462 } 463 }
463 } 464 }
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;
489 } 490 }
490 491
491 if (scriptCommand == "Save") { 492 if (scriptCommand == "Save") {
492 QString bm = QObject::tr("Saving %1").arg(scriptArgument); 493 QString bm = QObject::tr("Saving %1").arg(scriptArgument);
493 messg->setText(bm); 494 messg->setText(bm);
494 emit debugMessage(bm); 495 emit debugMessage(bm);
495 496
496 if (scriptArgument.lower() == "password") { 497 if (scriptArgument.lower() == "password") {
497 _ifaceppp->data()->setPassword(scanvar); 498 _ifaceppp->data()->setPassword(scanvar);
498 // p_kppp->setPW_Edit(scanvar); 499 // p_kppp->setPW_Edit(scanvar);
499 if(_ifaceppp->data()->storePassword()) 500 if(_ifaceppp->data()->storePassword())
500 _ifaceppp->data()->setStoredPassword(scanvar); 501 _ifaceppp->data()->setStoredPassword(scanvar);
501 firstrunPW = true; 502 firstrunPW = true;
502 } 503 }
503 504
504 scriptindex++; 505 scriptindex++;
505 return; 506 return;
506 } 507 }
507 508
508 509
509 if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") { 510 if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") {
510 QString bm = QObject::tr("Sending %1"); 511 QString bm = QObject::tr("Sending %1");
511 512
512 // replace %USERNAME% and %PASSWORD% 513 // replace %USERNAME% and %PASSWORD%
513 QString arg = scriptArgument; 514 QString arg = scriptArgument;
514 QRegExp re1("%USERNAME%"); 515 QRegExp re1("%USERNAME%");
515 QRegExp re2("%PASSWORD%"); 516 QRegExp re2("%PASSWORD%");
516 arg = arg.replace(re1, _ifaceppp->data()->storedUsername()); 517 arg = arg.replace(re1, _ifaceppp->data()->storedUsername());
517 arg = arg.replace(re2, _ifaceppp->data()->storedPassword()); 518 arg = arg.replace(re2, _ifaceppp->data()->storedPassword());
518 519
519 if (scriptCommand == "Send") 520 if (scriptCommand == "Send")
520 bm = bm.arg(scriptArgument); 521 bm = bm.arg(scriptArgument);
521 else { 522 else {
522 for(uint i = 0; i < scriptArgument.length(); i++) 523 for(uint i = 0; i < scriptArgument.length(); i++)
523 bm = bm.arg("*"); 524 bm = bm.arg("*");
524 } 525 }
@@ -794,107 +795,107 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
794 } 795 }
795 } 796 }
796 797
797 if(vmain == 30) { 798 if(vmain == 30) {
798// if (termwindow->isVisible()) 799// if (termwindow->isVisible())
799// return; 800// return;
800// if (termwindow->pressedContinue()) 801// if (termwindow->pressedContinue())
801// vmain = 10; 802// vmain = 10;
802// else 803// else
803 cancelbutton(); 804 cancelbutton();
804 } 805 }
805 806
806 if(vmain == 10) { 807 if(vmain == 10) {
807 if(!expecting) { 808 if(!expecting) {
808 809
809 int result; 810 int result;
810 811
811 timeout_timer->stop(); 812 timeout_timer->stop();
812 if_timeout_timer->stop(); // better be sure. 813 if_timeout_timer->stop(); // better be sure.
813 814
814 // stop reading of data 815 // stop reading of data
815 _ifaceppp->modem()->stop(); 816 _ifaceppp->modem()->stop();
816 817
817 if(_ifaceppp->data()->authMethod() == AUTH_TERMINAL) { 818 if(_ifaceppp->data()->authMethod() == AUTH_TERMINAL) {
818 // if (termwindow) { 819 // if (termwindow) {
819 // delete termwindow; 820 // delete termwindow;
820 // termwindow = 0L; 821 // termwindow = 0L;
821 // this->show(); 822 // this->show();
822 // } else { 823 // } else {
823 // termwindow = new LoginTerm(0L, 0L); 824 // termwindow = new LoginTerm(0L, 0L);
824 // hide(); 825 // hide();
825 // termwindow->show(); 826 // termwindow->show();
826 // vmain = 30; 827 // vmain = 30;
827 // return; 828 // return;
828 // } 829 // }
829 } 830 }
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
865 // handled by execppp(); 866 // handled by execppp();
866 if_timeout_timer->stop(); 867 if_timeout_timer->stop();
867 this->hide(); 868 this->hide();
868 messg->setText(""); 869 messg->setText("");
869 //p_kppp->quit_b->setFocus(); 870 //p_kppp->quit_b->setFocus();
870 //p_kppp->show(); 871 //p_kppp->show();
871 qApp->processEvents(); 872 qApp->processEvents();
872 _ifaceppp->modem()->hangup(); 873 _ifaceppp->modem()->hangup();
873 emit stopAccounting(); 874 emit stopAccounting();
874 //p_kppp->con_win->stopClock(); 875 //p_kppp->con_win->stopClock();
875 _ifaceppp->modem()->closetty(); 876 _ifaceppp->modem()->closetty();
876 _ifaceppp->modem()->unlockdevice(); 877 _ifaceppp->modem()->unlockdevice();
877 878
878 } 879 }
879 880
880 return; 881 return;
881 } 882 }
882 } 883 }
883 884
884 // this is a "wait until cancel" entry 885 // this is a "wait until cancel" entry
885 886
886 if(vmain == 20) { 887 if(vmain == 20) {
887 } 888 }
888} 889}
889 890
890 891
891void ConnectWidget::set_con_speed_string() { 892void ConnectWidget::set_con_speed_string() {
892 // Here we are trying to determine the speed at which we are connected. 893 // Here we are trying to determine the speed at which we are connected.
893 // Usually the modem responds after connect with something like 894 // Usually the modem responds after connect with something like
894 // CONNECT 115200, so all we need to do is find the number after CONNECT 895 // CONNECT 115200, so all we need to do is find the number after CONNECT
895 // or whatever the modemConnectResp() is. 896 // or whatever the modemConnectResp() is.
896// p_kppp->con_speed = _ifaceppp->modem()->parseModemSpeed(myreadbuffer); 897// p_kppp->con_speed = _ifaceppp->modem()->parseModemSpeed(myreadbuffer);
897} 898}
898 899
899 900
900 901
@@ -1020,97 +1021,97 @@ void ConnectWidget::cancelbutton() {
1020void ConnectWidget::script_timed_out() { 1021void ConnectWidget::script_timed_out() {
1021 if(vmain == 20) { // we are in the 'wait for the user to cancel' state 1022 if(vmain == 20) { // we are in the 'wait for the user to cancel' state
1022 timeout_timer->stop(); 1023 timeout_timer->stop();
1023 emit stopAccounting(); 1024 emit stopAccounting();
1024// p_kppp->con_win->stopClock(); 1025// p_kppp->con_win->stopClock();
1025 return; 1026 return;
1026 } 1027 }
1027 1028
1028 if (prompt->isVisible()) 1029 if (prompt->isVisible())
1029 prompt->hide(); 1030 prompt->hide();
1030 1031
1031 prompt->setConsumed(); 1032 prompt->setConsumed();
1032 messg->setText(QObject::tr("Script timed out!")); 1033 messg->setText(QObject::tr("Script timed out!"));
1033 _ifaceppp->modem()->hangup(); 1034 _ifaceppp->modem()->hangup();
1034 emit stopAccounting(); 1035 emit stopAccounting();
1035// p_kppp->con_win->stopClock(); 1036// p_kppp->con_win->stopClock();
1036 1037
1037 vmain = 0; // let's try again. 1038 vmain = 0; // let's try again.
1038 substate = -1; 1039 substate = -1;
1039} 1040}
1040 1041
1041 1042
1042void ConnectWidget::setScan(const QString &n) { 1043void ConnectWidget::setScan(const QString &n) {
1043 scanning = true; 1044 scanning = true;
1044 scanstr = n; 1045 scanstr = n;
1045 scanbuffer = ""; 1046 scanbuffer = "";
1046 1047
1047 QString ts = QObject::tr("Scanning: %1").arg(n); 1048 QString ts = QObject::tr("Scanning: %1").arg(n);
1048 emit debugMessage(ts); 1049 emit debugMessage(ts);
1049} 1050}
1050 1051
1051 1052
1052void ConnectWidget::setExpect(const QString &n) { 1053void ConnectWidget::setExpect(const QString &n) {
1053 expecting = true; 1054 expecting = true;
1054 expectstr = n; 1055 expectstr = n;
1055 1056
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
1065void ConnectWidget::if_waiting_timed_out() { 1066void 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
1081 // reconnect_on_disconnect which is set in ConnectWidget::init(); 1082 // reconnect_on_disconnect which is set in ConnectWidget::init();
1082} 1083}
1083 1084
1084void ConnectWidget::pppdDied() 1085void ConnectWidget::pppdDied()
1085{ 1086{
1086 if_timer->stop(); 1087 if_timer->stop();
1087 if_timeout_timer->stop(); 1088 if_timeout_timer->stop();
1088} 1089}
1089 1090
1090void ConnectWidget::if_waiting_slot() { 1091void ConnectWidget::if_waiting_slot() {
1091 messg->setText(QObject::tr("Logging on to network...")); 1092 messg->setText(QObject::tr("Logging on to network..."));
1092 1093
1093// if(!stats->ifIsUp()) { 1094// if(!stats->ifIsUp()) {
1094 1095
1095// if(_ifaceppp->data()->pppdError() != 0) { 1096// if(_ifaceppp->data()->pppdError() != 0) {
1096// // we are here if pppd died immediately after starting it. 1097// // we are here if pppd died immediately after starting it.
1097// pppdDied(); 1098// pppdDied();
1098// // error message handled in main.cpp: sigPPPDDied() 1099// // error message handled in main.cpp: sigPPPDDied()
1099// return; 1100// return;
1100// } 1101// }
1101 1102
1102// if_timer->start(100, TRUE); // single shot 1103// if_timer->start(100, TRUE); // single shot
1103// return; 1104// return;
1104// } 1105// }
1105 1106
1106 // O.K the ppp interface is up and running 1107 // O.K the ppp interface is up and running
1107 // give it a few time to come up completly (0.2 seconds) 1108 // give it a few time to come up completly (0.2 seconds)
1108 if_timeout_timer->stop(); 1109 if_timeout_timer->stop();
1109 if_timer->stop(); 1110 if_timer->stop();
1110 usleep(200000); 1111 usleep(200000);
1111 1112
1112 if(_ifaceppp->data()->autoDNS()) 1113 if(_ifaceppp->data()->autoDNS())
1113 addpeerdns( _ifaceppp ); 1114 addpeerdns( _ifaceppp );
1114 1115
1115 // Close the debugging window. If we are connected, we 1116 // Close the debugging window. If we are connected, we
1116 // are not really interested in debug output 1117 // are not really interested in debug output
@@ -1227,97 +1228,97 @@ bool ConnectWidget::execppp() {
1227 if(_ifaceppp->data()->autoDNS()) 1228 if(_ifaceppp->data()->autoDNS())
1228 command += " usepeerdns"; 1229 command += " usepeerdns";
1229 1230
1230 1231
1231 // PAP settings 1232 // PAP settings
1232 if(_ifaceppp->data()->authMethod() == AUTH_PAP) { 1233 if(_ifaceppp->data()->authMethod() == AUTH_PAP) {
1233 command += " -chap user "; 1234 command += " -chap user ";
1234 command = command + _ifaceppp->data()->storedUsername(); 1235 command = command + _ifaceppp->data()->storedUsername();
1235 } 1236 }
1236 1237
1237 // CHAP settings 1238 // CHAP settings
1238 if(_ifaceppp->data()->authMethod() == AUTH_CHAP) { 1239 if(_ifaceppp->data()->authMethod() == AUTH_CHAP) {
1239 command += " -pap user "; 1240 command += " -pap user ";
1240 command = command + _ifaceppp->data()->storedUsername(); 1241 command = command + _ifaceppp->data()->storedUsername();
1241 } 1242 }
1242 1243
1243 // PAP/CHAP settings 1244 // PAP/CHAP settings
1244 if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) { 1245 if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) {
1245 QString tmpName = _ifaceppp->data()->storedUsername(); 1246 QString tmpName = _ifaceppp->data()->storedUsername();
1246 if ( !tmpName.isEmpty() ) { 1247 if ( !tmpName.isEmpty() ) {
1247 command += " user "; 1248 command += " user ";
1248 command = command + tmpName; 1249 command = command + tmpName;
1249 } 1250 }
1250 } 1251 }
1251 1252
1252 // check for debug 1253 // check for debug
1253 if(_ifaceppp->data()->getPPPDebug()) 1254 if(_ifaceppp->data()->getPPPDebug())
1254 command += " debug"; 1255 command += " debug";
1255 1256
1256 QStringList &arglist = _ifaceppp->data()->pppdArgument(); 1257 QStringList &arglist = _ifaceppp->data()->pppdArgument();
1257 for ( QStringList::Iterator it = arglist.begin(); 1258 for ( QStringList::Iterator it = arglist.begin();
1258 it != arglist.end(); 1259 it != arglist.end();
1259 ++it ) 1260 ++it )
1260 { 1261 {
1261 command += " " + *it; 1262 command += " " + *it;
1262 } 1263 }
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
1283void ConnectWidget::closeEvent( QCloseEvent *e ) { 1284void ConnectWidget::closeEvent( QCloseEvent *e ) {
1284 e->ignore(); 1285 e->ignore();
1285 emit cancelbutton(); 1286 emit cancelbutton();
1286} 1287}
1287 1288
1288 1289
1289void ConnectWidget::setMsg(const QString &msg) { 1290void ConnectWidget::setMsg(const QString &msg) {
1290 messg->setText(msg); 1291 messg->setText(msg);
1291} 1292}
1292 1293
1293void ConnectWidget::writeline(const QString &s) { 1294void ConnectWidget::writeline(const QString &s) {
1294 _ifaceppp->modem()->writeLine(s.local8Bit()); 1295 _ifaceppp->modem()->writeLine(s.local8Bit());
1295} 1296}
1296 1297
1297// Set the hostname and domain from DNS Server 1298// Set the hostname and domain from DNS Server
1298void auto_hostname(InterfacePPP *_ifaceppp) { 1299void auto_hostname(InterfacePPP *_ifaceppp) {
1299 struct in_addr local_ip; 1300 struct in_addr local_ip;
1300 struct hostent *hostname_entry; 1301 struct hostent *hostname_entry;
1301 QString new_hostname; 1302 QString new_hostname;
1302 int dot; 1303 int dot;
1303 char tmp_str[100]; // buffer overflow safe 1304 char tmp_str[100]; // buffer overflow safe
1304 1305
1305 gethostname(tmp_str, sizeof(tmp_str)); 1306 gethostname(tmp_str, sizeof(tmp_str));
1306 tmp_str[sizeof(tmp_str)-1]=0; // panic 1307 tmp_str[sizeof(tmp_str)-1]=0; // panic
1307 old_hostname=tmp_str; // copy to QString 1308 old_hostname=tmp_str; // copy to QString
1308 1309
1309 // if (!p_kppp->stats->local_ip_address.isEmpty() && _ifaceppp->data()->autoname()) { 1310 // if (!p_kppp->stats->local_ip_address.isEmpty() && _ifaceppp->data()->autoname()) {
1310 if ( _ifaceppp->data()->autoname()) { 1311 if ( _ifaceppp->data()->autoname()) {
1311// local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii()); 1312// local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii());
1312 hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET); 1313 hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET);
1313 1314
1314 if (hostname_entry != 0L) { 1315 if (hostname_entry != 0L) {
1315 new_hostname=hostname_entry->h_name; 1316 new_hostname=hostname_entry->h_name;
1316 dot=new_hostname.find('.'); 1317 dot=new_hostname.find('.');
1317 new_hostname=new_hostname.remove(dot,new_hostname.length()-dot); 1318 new_hostname=new_hostname.remove(dot,new_hostname.length()-dot);
1318 _ifaceppp->modem()->setHostname(new_hostname); 1319 _ifaceppp->modem()->setHostname(new_hostname);
1319 modified_hostname = TRUE; 1320 modified_hostname = TRUE;
1320 1321
1321 new_hostname=hostname_entry->h_name; 1322 new_hostname=hostname_entry->h_name;
1322 new_hostname.remove(0,dot+1); 1323 new_hostname.remove(0,dot+1);
1323 1324
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
@@ -29,110 +29,110 @@
29#include "authwidget.h" 29#include "authwidget.h"
30#include "pppdata.h" 30#include "pppdata.h"
31#include "edit.h" 31#include "edit.h"
32#include "general.h" 32#include "general.h"
33 33
34/* OPIE */ 34/* OPIE */
35#include <opie2/odebug.h> 35#include <opie2/odebug.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37using namespace Opie::Core; 37using namespace Opie::Core;
38 38
39/* QT */ 39/* QT */
40#include <qdir.h> 40#include <qdir.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qtabwidget.h> 42#include <qtabwidget.h>
43#include <qtabdialog.h> 43#include <qtabdialog.h>
44#include <qwhatsthis.h> 44#include <qwhatsthis.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qapplication.h> 46#include <qapplication.h>
47#include <qbuttongroup.h> 47#include <qbuttongroup.h>
48#include <qmessagebox.h> 48#include <qmessagebox.h>
49#include <qvgroupbox.h> 49#include <qvgroupbox.h>
50 50
51/* STD */ 51/* STD */
52#include <stdlib.h> 52#include <stdlib.h>
53 53
54 54
55void parseargs(char* buf, char** args); 55void parseargs(char* buf, char** args);
56 56
57DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f ) 57DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f )
58 : ChooserWidget(ip->data(), parent, name, f) 58 : ChooserWidget(ip->data(), parent, name, f)
59{ 59{
60 _ifaceppp = ip; 60 _ifaceppp = ip;
61 QWhatsThis::add(edit_b, tr("Allows you to modify the selected device")); 61 QWhatsThis::add(edit_b, tr("Allows you to modify the selected device"));
62 QWhatsThis::add(new_b, tr("Create a new device") ); 62 QWhatsThis::add(new_b, tr("Create a new device") );
63 63
64 QWhatsThis::add(copy_b, 64 QWhatsThis::add(copy_b,
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
89void DevicesWidget::slotListBoxSelect(int idx) { 89void 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
96void DevicesWidget::edit() { 96void 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());
103 _pppdata->save(); 103 _pppdata->save();
104 } 104 }
105} 105}
106 106
107 107
108void DevicesWidget::create() { 108void DevicesWidget::create() {
109 109
110// if(listListbox->count() == MAX_ACCOUNTS) { 110// if(listListbox->count() == MAX_ACCOUNTS) {
111// QMessageBox::information(this, "sorry", 111// QMessageBox::information(this, "sorry",
112// tr("Maximum number of accounts reached.")); 112// tr("Maximum number of accounts reached."));
113// return; 113// return;
114// } 114// }
115 115
116 int result; 116 int result;
117 if (_pppdata->newdevice() == -1){ 117 if (_pppdata->newdevice() == -1){
118 return; 118 return;
119 } 119 }
120 result = doTab(); 120 result = doTab();
121 121
122 if(result == QDialog::Accepted) { 122 if(result == QDialog::Accepted) {
123 listListbox->insertItem(_pppdata->devname()); 123 listListbox->insertItem(_pppdata->devname());
124 listListbox->setSelected(listListbox->findItem(_pppdata->devname()),true ); 124 listListbox->setSelected(listListbox->findItem(_pppdata->devname()),true );
125 125
126 _pppdata->save(); 126 _pppdata->save();
127 } else 127 } else
128 _pppdata->deleteDevice(); 128 _pppdata->deleteDevice();
129} 129}
130 130
131 131
132void DevicesWidget::copy() { 132void DevicesWidget::copy() {
133// if(listListbox->count() == MAX_ACCOUNTS) { 133// if(listListbox->count() == MAX_ACCOUNTS) {
134// QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); 134// QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached."));
135// return; 135// return;
136// } 136// }
137 137
138 if(listListbox->currentItem()<0) { 138 if(listListbox->currentItem()<0) {
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
@@ -1157,55 +1157,55 @@ void ScriptWidget::removeButton()
1157} 1157}
1158 1158
1159 1159
1160 1160
1161///////////////////////////////////////////////////////////////////////////// 1161/////////////////////////////////////////////////////////////////////////////
1162// 1162//
1163// Used to specify a new phone number 1163// Used to specify a new phone number
1164// 1164//
1165///////////////////////////////////////////////////////////////////////////// 1165/////////////////////////////////////////////////////////////////////////////
1166PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) 1166PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
1167 : QDialog(parent,"PhoneNumberDialog",true) 1167 : QDialog(parent,"PhoneNumberDialog",true)
1168{ 1168{
1169 setCaption( tr("Add Phone Number") ); 1169 setCaption( tr("Add Phone Number") );
1170 1170
1171 1171
1172 QVBoxLayout *layout = new QVBoxLayout( this ); 1172 QVBoxLayout *layout = new QVBoxLayout( this );
1173 layout->setSpacing( 3 ); 1173 layout->setSpacing( 3 );
1174 layout->setMargin( 3 ); 1174 layout->setMargin( 3 );
1175 1175
1176 // QHBox *hbox = new QHBox(this); 1176 // QHBox *hbox = new QHBox(this);
1177 // setMainWidget(hbox); 1177 // setMainWidget(hbox);
1178 1178
1179 // hbox->setSpacing( 2 );//KDialog::spacingHint()); 1179 // hbox->setSpacing( 2 );//KDialog::spacingHint());
1180 1180
1181 QLabel *label = new QLabel(this, tr("Enter a phone number:")); 1181 QLabel *label = new QLabel(this, tr("Enter a phone number:"));
1182 layout->addWidget( label ); 1182 layout->addWidget( label );
1183 1183
1184 le = new QLineEdit(this, "lineEdit"); 1184 le = new QLineEdit(this, "lineEdit");
1185 layout->addWidget( le ); 1185 layout->addWidget( le );
1186 1186
1187 connect(le, SIGNAL(textChanged(const QString&)), 1187 connect(le, SIGNAL(textChanged(const QString&)),
1188 this, SLOT(textChanged(const QString&))); 1188 this, SLOT(textChanged(const QString&)));
1189 1189
1190 le->setFocus(); 1190 le->setFocus();
1191 textChanged(""); 1191 textChanged("");
1192 1192
1193 1193
1194} 1194}
1195 1195
1196 1196
1197QString PhoneNumberDialog::phoneNumber() 1197QString 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
1205void PhoneNumberDialog::textChanged(const QString &s) 1205void 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
@@ -1,45 +1,45 @@
1#include "interfaceinformationppp.h" 1#include "interfaceinformationppp.h"
2#include "connect.h" 2#include "connect.h"
3#include "conwindow.h" 3#include "conwindow.h"
4 4
5/* OPIE */ 5/* OPIE */
6#include <opie2/odebug.h> 6#include <opie2/odebug.h>
7using namespace Opie::Core; 7using namespace Opie::Core;
8 8
9/* QT */ 9/* QT */
10#include <qpushbutton.h> 10#include <qpushbutton.h>
11#include <qlabel.h> 11#include <qlabel.h>
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 */
24InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) 24InterfaceInformationPPP::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 );
40 connect(i, SIGNAL(begin_connect()),con, SLOT(preinit())); 40 connect(i, SIGNAL(begin_connect()),con, SLOT(preinit()));
41 connect(i, SIGNAL(hangup_now() ), con, SLOT(cancelbutton() ) ); 41 connect(i, SIGNAL(hangup_now() ), con, SLOT(cancelbutton() ) );
42} 42}
43 43
44 44
45 45
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
@@ -18,269 +18,270 @@ using namespace Opie::Core;
18/* STD */ 18/* STD */
19#include <errno.h> 19#include <errno.h>
20#include <signal.h> 20#include <signal.h>
21 21
22// don't polute global namespace 22// don't polute global namespace
23namespace 23namespace
24{ 24{
25 /* 25 /*
26 * If network settings is qutting and we've ppp 26 * If network settings is qutting and we've ppp
27 * devices open we need to save the pid_t the PPData 27 * devices open we need to save the pid_t the PPData
28 * and the interface number 28 * and the interface number
29 */ 29 */
30 struct Connection 30 struct Connection
31 { 31 {
32 pid_t pid; 32 pid_t pid;
33 QString device; 33 QString device;
34 QString name; 34 QString name;
35 }; 35 };
36 class InterfaceKeeper 36 class InterfaceKeeper
37 { 37 {
38 public: 38 public:
39 InterfaceKeeper(); 39 InterfaceKeeper();
40 ~InterfaceKeeper(); 40 ~InterfaceKeeper();
41 41
42 void addInterface( pid_t, const QString& pppDev, const QString& name ); 42 void addInterface( pid_t, const QString& pppDev, const QString& name );
43 QMap<QString, Connection> interfaces()const; // will check if still available 43 QMap<QString, Connection> interfaces()const; // will check if still available
44 private: 44 private:
45 bool isAvailable( pid_t )const; 45 bool isAvailable( pid_t )const;
46 QMap<QString, Connection> m_interfaces; 46 QMap<QString, Connection> m_interfaces;
47 }; 47 };
48} 48}
49 49
50 50
51/** 51/**
52 * Constructor, find all of the possible interfaces 52 * Constructor, find all of the possible interfaces
53 * We also need to restore the state.. it could be that 53 * We also need to restore the state.. it could be that
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 */
57PPPModule::PPPModule() : Module() 57PPPModule::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 */
92PPPModule::~PPPModule() 92PPPModule::~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 */
116void PPPModule::setProfile(const QString &newProfile) 116void PPPModule::setProfile(const QString &newProfile)
117{ 117{
118 profile = newProfile; 118 profile = newProfile;
119} 119}
120 120
121/** 121/**
122 * get the icon name for this device. 122 * get the icon name for this device.
123 * @param Interface* can be used in determining the icon. 123 * @param Interface* can be used in determining the icon.
124 * @return QString the icon name (minus .png, .gif etc) 124 * @return QString the icon name (minus .png, .gif etc)
125 */ 125 */
126QString PPPModule::getPixmapName(Interface* ) 126QString PPPModule::getPixmapName(Interface* )
127{ 127{
128 return "ppp"; 128 return "ppp";
129} 129}
130 130
131/** 131/**
132 * Check to see if the interface i is owned by this module. 132 * Check to see if the interface i is owned by this module.
133 * @param Interface* interface to check against 133 * @param Interface* interface to check against
134 * @return bool true if i is owned by this module, false otherwise. 134 * @return bool true if i is owned by this module, false otherwise.
135 */ 135 */
136bool PPPModule::isOwner(Interface *i) 136bool 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 */
145QWidget *PPPModule::configure(Interface *i) 145QWidget *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 */
158QWidget *PPPModule::information(Interface *i) 158QWidget *PPPModule::information(Interface *i)
159{ 159{
160 // We don't have any advanced pppd information widget yet :-D 160 // We don't have any advanced pppd information widget yet :-D
161 // TODO ^ 161 // TODO ^
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 */
171QList<Interface> PPPModule::getInterfaces() 171QList<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 */
184Interface *PPPModule::addNewInterface(const QString &newInterface) 184Interface *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;
198 } 199 }
199 else 200 else
200 { 201 {
201 delete ifaceppp; 202 delete ifaceppp;
202 iface = NULL; 203 iface = NULL;
203 } 204 }
204 return iface; 205 return iface;
205} 206}
206 207
207/** 208/**
208 * Attempts to remove the interface, doesn't delete i 209 * Attempts to remove the interface, doesn't delete i
209 * @return bool true if successful, false otherwise. 210 * @return bool true if successful, false otherwise.
210 */ 211 */
211bool PPPModule::remove(Interface *i) 212bool PPPModule::remove(Interface *i)
212{ 213{
213 return list.remove(i); 214 return list.remove(i);
214} 215}
215 216
216void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) 217void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)
217{ 218{
218 newIfaces.insert(::QObject::tr("PPP") , 219 newIfaces.insert(::QObject::tr("PPP") ,
219 ::QObject::tr("generic ppp device")); 220 ::QObject::tr("generic ppp device"));
220} 221}
221 222
222 223
223 224
224namespace 225namespace
225{ 226{
226 InterfaceKeeper::InterfaceKeeper( ) 227 InterfaceKeeper::InterfaceKeeper( )
227 {} 228 {}
228 InterfaceKeeper::~InterfaceKeeper() 229 InterfaceKeeper::~InterfaceKeeper()
229 { 230 {
230 Config cfg("ppp_plugin_keeper"); 231 Config cfg("ppp_plugin_keeper");
231 QStringList lst = cfg.groupList(); 232 QStringList lst = cfg.groupList();
232 for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) 233 for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it )
233 { 234 {
234 Connection con; 235 Connection con;
235 cfg.setGroup( (*it) ); 236 cfg.setGroup( (*it) );
236 cfg.clearGroup(); 237 cfg.clearGroup();
237 } 238 }
238 239
239 for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) 240 for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it )
240 { 241 {
241 Connection con = it.data(); 242 Connection con = it.data();
242 cfg.setGroup( con.name ); 243 cfg.setGroup( con.name );
243 cfg.writeEntry( "pid", con.pid ); 244 cfg.writeEntry( "pid", con.pid );
244 cfg.writeEntry( "device", con.device ); 245 cfg.writeEntry( "device", con.device );
245 } 246 }
246 } 247 }
247 void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) 248 void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name )
248 { 249 {
249 Connection con; 250 Connection con;
250 con.pid = pid; 251 con.pid = pid;
251 con.device = dev; 252 con.device = dev;
252 con.name = name; 253 con.name = name;
253 m_interfaces.insert( name, con ); 254 m_interfaces.insert( name, con );
254 } 255 }
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
@@ -1,43 +1,43 @@
1#ifndef PPP_MODULE_H 1#ifndef PPP_MODULE_H
2#define PPP_MODULE_H 2#define PPP_MODULE_H
3 3
4#include "module.h" 4#include "module.h"
5 5
6class PPPModule : Module { 6class PPPModule : Module {
7 7
8signals: 8signals:
9 void updateInterface(Interface *i); 9 void updateInterface(Interface *i);
10 10
11public: 11public:
12 PPPModule(); 12 PPPModule();
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
27private: 27private:
28 QList<Interface> list; 28 QList<Interface> list;
29 QString profile; 29 QString profile;
30 30
31}; 31};
32 32
33extern "C" 33extern "C"
34{ 34{
35 void* create_plugin() { 35 void* create_plugin() {
36 return new PPPModule(); 36 return new PPPModule();
37 } 37 }
38}; 38};
39 39
40#endif 40#endif
41 41
42// pppmodule.h 42// pppmodule.h
43 43
diff --git a/noncore/settings/networksettings/wlan/keyedit.cpp b/noncore/settings/networksettings/wlan/keyedit.cpp
index 13a1c3b..62f8960 100644
--- a/noncore/settings/networksettings/wlan/keyedit.cpp
+++ b/noncore/settings/networksettings/wlan/keyedit.cpp
@@ -1,22 +1,22 @@
1#include "keyedit.h" 1#include "keyedit.h"
2#include <qlineedit.h> 2#include <qlineedit.h>
3 3
4KeyEdit::KeyEdit(QWidget* parent, const char* name) : 4KeyEdit::KeyEdit(QWidget* parent, const char* name) :
5 QLineEdit(parent, name) 5 QLineEdit(parent, name)
6{ 6{
7 setEchoMode(Password); 7 setEchoMode(Password);
8} 8}
9 9
10KeyEdit::~KeyEdit() 10KeyEdit::~KeyEdit()
11{ 11{
12} 12}
13 13
14void KeyEdit::focusInEvent(QFocusEvent *event) 14void KeyEdit::focusInEvent(QFocusEvent *)
15{ 15{
16 setEchoMode(Normal); 16 setEchoMode(Normal);
17} 17}
18 18
19void KeyEdit::focusOutEvent(QFocusEvent *event) 19void KeyEdit::focusOutEvent(QFocusEvent *)
20{ 20{
21 setEchoMode(Password); 21 setEchoMode(Password);
22} 22}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index d36a702..5cb78cf 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -71,97 +71,96 @@ WLANImp::~WLANImp() {
71 71
72/** 72/**
73 * Change the profile for both wireless settings and network settings. 73 * Change the profile for both wireless settings and network settings.
74 */ 74 */
75void WLANImp::setProfile(const QString &profile){ 75void WLANImp::setProfile(const QString &profile){
76 interfaceSetup->setProfile(profile); 76 interfaceSetup->setProfile(profile);
77 parseOpts(); 77 parseOpts();
78} 78}
79 79
80void WLANImp::parseOpts() { 80void WLANImp::parseOpts() {
81 bool error; 81 bool error;
82 QString opt; 82 QString opt;
83 83
84 if (! interfaces->isInterfaceSet()) 84 if (! interfaces->isInterfaceSet())
85 return; 85 return;
86 86
87 87
88 opt = interfaces->getInterfaceOption("wireless_essid", error); 88 opt = interfaces->getInterfaceOption("wireless_essid", error);
89 if(opt == "any" || opt == "off" || opt.isNull()){ 89 if(opt == "any" || opt == "off" || opt.isNull()){
90 essid->setEditText("any"); 90 essid->setEditText("any");
91 } else { 91 } else {
92 essid->setEditText(opt); 92 essid->setEditText(opt);
93 } 93 }
94 94
95 opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); 95 opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace();
96 96
97 for ( int i = 0; i < mode->count(); i++) 97 for ( int i = 0; i < mode->count(); i++)
98 if ( mode->text( i ) == opt ) mode->setCurrentItem( i ); 98 if ( mode->text( i ) == opt ) mode->setCurrentItem( i );
99 99
100 opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); 100 opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace();
101 if (! opt.isNull()) { 101 if (! opt.isNull()) {
102 specifyAp->setChecked(true); 102 specifyAp->setChecked(true);
103 macEdit->setText(opt); 103 macEdit->setText(opt);
104 } 104 }
105 105
106 opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); 106 opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace();
107 if (! opt.isNull()) { 107 if (! opt.isNull()) {
108 specifyChan->setChecked(true); 108 specifyChan->setChecked(true);
109 networkChannel->setValue(opt.toInt()); 109 networkChannel->setValue(opt.toInt());
110 } 110 }
111 111
112 opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace(); 112 opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace();
113 if (opt.isNull()) 113 if (opt.isNull())
114 opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace(); 114 opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace();
115 parseKeyStr(opt); 115 parseKeyStr(opt);
116} 116}
117 117
118void WLANImp::parseKeyStr(QString keystr) { 118void WLANImp::parseKeyStr(QString keystr) {
119 int loc = 0;
120 int index = 1; 119 int index = 1;
121 QString key; 120 QString key;
122 QStringList keys = QStringList::split(QRegExp("\\s+"), keystr); 121 QStringList keys = QStringList::split(QRegExp("\\s+"), keystr);
123 int enc = -1; // encryption state 122 int enc = -1; // encryption state
124 123
125 for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) { 124 for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) {
126 if ((*it).left(3) == "off") { 125 if ((*it).left(3) == "off") {
127 // encryption disabled 126 // encryption disabled
128 enc = 0; 127 enc = 0;
129 } else if ((*it).left(2) == "on") { 128 } else if ((*it).left(2) == "on") {
130 // encryption enabled 129 // encryption enabled
131 enc = 1; 130 enc = 1;
132 } else if ((*it).left(4) == "open") { 131 } else if ((*it).left(4) == "open") {
133 // open mode, accept non encrypted packets 132 // open mode, accept non encrypted packets
134 acceptNonEnc->setChecked(true); 133 acceptNonEnc->setChecked(true);
135 } else if ((*it).left(10) == "restricted") { 134 } else if ((*it).left(10) == "restricted") {
136 // restricted mode, only accept encrypted packets 135 // restricted mode, only accept encrypted packets
137 rejectNonEnc->setChecked(true); 136 rejectNonEnc->setChecked(true);
138 } else if ((*it).left(3) == "key") { 137 } else if ((*it).left(3) == "key") {
139 // new set of options 138 // new set of options
140 } else if ((*it).left(1) == "[") { 139 } else if ((*it).left(1) == "[") {
141 index = (*it).mid(1, 1).toInt(); 140 index = (*it).mid(1, 1).toInt();
142 // switch current key to index 141 // switch current key to index
143 switch (index) { 142 switch (index) {
144 case 1: 143 case 1:
145 keyRadio0->setChecked(true); 144 keyRadio0->setChecked(true);
146 break; 145 break;
147 case 2: 146 case 2:
148 keyRadio1->setChecked(true); 147 keyRadio1->setChecked(true);
149 break; 148 break;
150 case 3: 149 case 3:
151 keyRadio2->setChecked(true); 150 keyRadio2->setChecked(true);
152 break; 151 break;
153 case 4: 152 case 4:
154 keyRadio3->setChecked(true); 153 keyRadio3->setChecked(true);
155 break; 154 break;
156 } 155 }
157 } else { 156 } else {
158 // key 157 // key
159 key = (*it); 158 key = (*it);
160 } 159 }
161 if (! key.isNull()) { 160 if (! key.isNull()) {
162 if (enc == -1) 161 if (enc == -1)
163 enc = 1; 162 enc = 1;
164 QStringList::Iterator next = ++it; 163 QStringList::Iterator next = ++it;
165 if (it == keys.end()) { 164 if (it == keys.end()) {
166 break; 165 break;
167 } 166 }