summaryrefslogtreecommitdiff
authortille <tille>2003-06-21 15:34:55 (UTC)
committer tille <tille>2003-06-21 15:34:55 (UTC)
commit5f5accf337a109371296c6a78175734454165406 (patch) (unidiff)
tree7c4334febdedcd8c0b42a2296af6875f6f990762
parentfde32755685bec14851f943be337e94675caf0c4 (diff)
downloadopie-5f5accf337a109371296c6a78175734454165406.zip
opie-5f5accf337a109371296c6a78175734454165406.tar.gz
opie-5f5accf337a109371296c6a78175734454165406.tar.bz2
channel count for wellenreiter
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp114
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp36
3 files changed, 92 insertions, 60 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index a62a90c..71d0cf5 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -11,15 +11,15 @@
11 11
12/** 12/**
13 * Constructor. Reads in the interfaces file and then split the file up by 13 * Constructor. Reads in the interfaces file and then split the file up by
14 * the \n for interfaces variable. 14 * the \n for interfaces variable.
15 * @param useInterfacesFile if an interface file other then the default is 15 * @param useInterfacesFile if an interface file other then the default is
16 * desired to be used it should be passed in. 16 * desired to be used it should be passed in.
17 */ 17 */
18Interfaces::Interfaces(QString useInterfacesFile){ 18Interfaces::Interfaces(QString useInterfacesFile){
19 acceptedFamily.append(INTERFACES_FAMILY_INET); 19 acceptedFamily.append(INTERFACES_FAMILY_INET);
20 acceptedFamily.append(INTERFACES_FAMILY_IPX); 20 acceptedFamily.append(INTERFACES_FAMILY_IPX);
21 acceptedFamily.append(INTERFACES_FAMILY_INET6); 21 acceptedFamily.append(INTERFACES_FAMILY_INET6);
22 22
23 interfacesFile = useInterfacesFile; 23 interfacesFile = useInterfacesFile;
24 QFile file(interfacesFile); 24 QFile file(interfacesFile);
25 if (!file.open(IO_ReadOnly)){ 25 if (!file.open(IO_ReadOnly)){
@@ -36,7 +36,7 @@ Interfaces::Interfaces(QString useInterfacesFile){
36 } 36 }
37 file.close(); 37 file.close();
38 interfaces = QStringList::split("\n", line, true); 38 interfaces = QStringList::split("\n", line, true);
39 39
40 currentIface = interfaces.end(); 40 currentIface = interfaces.end();
41 currentMapping = interfaces.end(); 41 currentMapping = interfaces.end();
42} 42}
@@ -44,10 +44,10 @@ Interfaces::Interfaces(QString useInterfacesFile){
44 44
45/** 45/**
46 * Get a list of all interfaces in the interface file. Usefull for 46 * Get a list of all interfaces in the interface file. Usefull for
47 * hardware that is not currently connected such as an 802.11b card 47 * hardware that is not currently connected such as an 802.11b card
48 * not plugged in, but configured for when it is plugged in. 48 * not plugged in, but configured for when it is plugged in.
49 * @return Return string list of interfaces. 49 * @return Return string list of interfaces.
50 **/ 50 **/
51QStringList Interfaces::getInterfaceList(){ 51QStringList Interfaces::getInterfaceList(){
52 QStringList list; 52 QStringList list;
53 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 53 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
@@ -67,10 +67,10 @@ QStringList Interfaces::getInterfaceList(){
67 67
68/** 68/**
69 * Find out if interface is in an "auto" group or not. 69 * Find out if interface is in an "auto" group or not.
70 * Report any duplicates such as eth0 being in two differnt auto's 70 * Report any duplicates such as eth0 being in two differnt auto's
71 * @param interface interface to check to see if it is on or not. 71 * @param interface interface to check to see if it is on or not.
72 * @return true is interface is in auto 72 * @return true is interface is in auto
73 */ 73 */
74bool Interfaces::isAuto(const QString &interface) const { 74bool Interfaces::isAuto(const QString &interface) const {
75 QStringList autoLines = interfaces.grep(QRegExp(AUTO)); 75 QStringList autoLines = interfaces.grep(QRegExp(AUTO));
76 QStringList awi = autoLines.grep(QRegExp(interface)); 76 QStringList awi = autoLines.grep(QRegExp(interface));
@@ -84,12 +84,12 @@ bool Interfaces::isAuto(const QString &interface) const {
84 * @param interface the interface to set 84 * @param interface the interface to set
85 * @param setAuto the value to set interface to. 85 * @param setAuto the value to set interface to.
86 * @return false if already set to setAuto. 86 * @return false if already set to setAuto.
87 * */ 87 * */
88bool Interfaces::setAuto(const QString &interface, bool setAuto){ 88bool Interfaces::setAuto(const QString &interface, bool setAuto){
89 // Don't need to set it if it is already set. 89 // Don't need to set it if it is already set.
90 if(isAuto(interface) == setAuto) 90 if(isAuto(interface) == setAuto)
91 return false; 91 return false;
92 92
93 bool changed = false; 93 bool changed = false;
94 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 94 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
95 if((*it).contains(AUTO)){ 95 if((*it).contains(AUTO)){
@@ -125,8 +125,8 @@ bool Interfaces::setAuto(const QString &interface, bool setAuto){
125 * can call getFamily(), getMethod, and get/setOption(). 125 * can call getFamily(), getMethod, and get/setOption().
126 * @param interface the name of the interface to set. All whitespace is 126 * @param interface the name of the interface to set. All whitespace is
127 * removed from the interface name. 127 * removed from the interface name.
128 * @return bool true if it is successfull. 128 * @return bool true if it is successfull.
129 */ 129 */
130bool Interfaces::setInterface(QString interface){ 130bool Interfaces::setInterface(QString interface){
131 interface = interface.simplifyWhiteSpace(); 131 interface = interface.simplifyWhiteSpace();
132 interface = interface.replace(QRegExp(" "), ""); 132 interface = interface.replace(QRegExp(" "), "");
@@ -136,7 +136,7 @@ bool Interfaces::setInterface(QString interface){
136/** 136/**
137 * A quick helper funtion to see if the current interface is set. 137 * A quick helper funtion to see if the current interface is set.
138 * @return bool true if set, false otherwise. 138 * @return bool true if set, false otherwise.
139 */ 139 */
140bool Interfaces::isInterfaceSet() const { 140bool Interfaces::isInterfaceSet() const {
141 return (interfaces.end() != currentIface); 141 return (interfaces.end() != currentIface);
142} 142}
@@ -149,7 +149,7 @@ bool Interfaces::isInterfaceSet() const {
149 * Must of one of the families defined in interfaces.h 149 * Must of one of the families defined in interfaces.h
150 * @param method for the family. see interfaces man page for family methods. 150 * @param method for the family. see interfaces man page for family methods.
151 * @return true if successfull. 151 * @return true if successfull.
152 */ 152 */
153bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ 153bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
154 if(0 == acceptedFamily.contains(family)) 154 if(0 == acceptedFamily.contains(family))
155 return false; 155 return false;
@@ -164,7 +164,7 @@ bool Interfaces::addInterface(const QString &interface, const QString &family, c
164 * Copies interface with name interface to name newInterface 164 * Copies interface with name interface to name newInterface
165 * @param newInterface name of the new interface. 165 * @param newInterface name of the new interface.
166 * @return bool true if successfull 166 * @return bool true if successfull
167 */ 167 */
168bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ 168bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
169 if(!setInterface(interface)) 169 if(!setInterface(interface))
170 return false; 170 return false;
@@ -172,30 +172,30 @@ bool Interfaces::copyInterface(const QString &interface, const QString &newInter
172 // Store the old interface and bump past the stanza line. 172 // Store the old interface and bump past the stanza line.
173 QStringList::Iterator it = currentIface; 173 QStringList::Iterator it = currentIface;
174 it++; 174 it++;
175 175
176 // Add the new interface 176 // Add the new interface
177 bool error; 177 bool error;
178 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); 178 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error));
179 if(!setInterface(newInterface)) 179 if(!setInterface(newInterface))
180 return false; 180 return false;
181 181
182 QStringList::Iterator newIface = currentIface; 182 QStringList::Iterator newIface = currentIface;
183 newIface++; 183 newIface++;
184 184
185 // Copy all of the lines 185 // Copy all of the lines
186 for ( ; it != interfaces.end(); ++it ){ 186 for ( ; it != interfaces.end(); ++it ){
187 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO))) 187 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)))
188 break; 188 break;
189 newIface = interfaces.insert(newIface, *it); 189 newIface = interfaces.insert(newIface, *it);
190 } 190 }
191 191
192 return true; 192 return true;
193} 193}
194 194
195/** 195/**
196 * Remove the currently selected interface and all of its options. 196 * Remove the currently selected interface and all of its options.
197 * @return bool if successfull or not. 197 * @return bool if successfull or not.
198 */ 198 */
199bool Interfaces::removeInterface(){ 199bool Interfaces::removeInterface(){
200 return removeStanza(currentIface); 200 return removeStanza(currentIface);
201} 201}
@@ -204,7 +204,7 @@ bool Interfaces::removeInterface(){
204 * Gets the hardware name of the interface that is currently selected. 204 * Gets the hardware name of the interface that is currently selected.
205 * @return QString name of the hardware interface (eth0, usb2, wlan1...). 205 * @return QString name of the hardware interface (eth0, usb2, wlan1...).
206 * @param error set to true if any error occurs, false otherwise. 206 * @param error set to true if any error occurs, false otherwise.
207 */ 207 */
208QString Interfaces::getInterfaceName(bool &error){ 208QString Interfaces::getInterfaceName(bool &error){
209 if(currentIface == interfaces.end()){ 209 if(currentIface == interfaces.end()){
210 error = true; 210 error = true;
@@ -226,7 +226,7 @@ QString Interfaces::getInterfaceName(bool &error){
226 * Gets the family name of the interface that is currently selected. 226 * Gets the family name of the interface that is currently selected.
227 * @return QString name of the family (inet, inet6, ipx). 227 * @return QString name of the family (inet, inet6, ipx).
228 * @param error set to true if any error occurs, false otherwise. 228 * @param error set to true if any error occurs, false otherwise.
229 */ 229 */
230QString Interfaces::getInterfaceFamily(bool &error){ 230QString Interfaces::getInterfaceFamily(bool &error){
231 QString name = getInterfaceName(error); 231 QString name = getInterfaceName(error);
232 if(error) 232 if(error)
@@ -249,7 +249,7 @@ QString Interfaces::getInterfaceFamily(bool &error){
249 * @return QString name of the method such as staic or dhcp. 249 * @return QString name of the method such as staic or dhcp.
250 * See the man page of interfaces for possible methods depending on the family. 250 * See the man page of interfaces for possible methods depending on the family.
251 * @param error set to true if any error occurs, false otherwise. 251 * @param error set to true if any error occurs, false otherwise.
252 */ 252 */
253QString Interfaces::getInterfaceMethod(bool &error){ 253QString Interfaces::getInterfaceMethod(bool &error){
254 QString name = getInterfaceName(error); 254 QString name = getInterfaceName(error);
255 if(error) 255 if(error)
@@ -267,10 +267,10 @@ QString Interfaces::getInterfaceMethod(bool &error){
267} 267}
268 268
269/** 269/**
270 * Sets the interface name to newName. 270 * Sets the interface name to newName.
271 * @param newName the new name of the interface. All whitespace is removed. 271 * @param newName the new name of the interface. All whitespace is removed.
272 * @return bool true if successfull. 272 * @return bool true if successfull.
273 */ 273 */
274bool Interfaces::setInterfaceName(const QString &newName){ 274bool Interfaces::setInterfaceName(const QString &newName){
275 if(currentIface == interfaces.end()) 275 if(currentIface == interfaces.end())
276 return false; 276 return false;
@@ -278,15 +278,15 @@ bool Interfaces::setInterfaceName(const QString &newName){
278 name = name.replace(QRegExp(" "), ""); 278 name = name.replace(QRegExp(" "), "");
279 bool returnValue = false; 279 bool returnValue = false;
280 (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); 280 (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
281 return !returnValue; 281 return !returnValue;
282} 282}
283 283
284/** 284/**
285 * Sets the interface family to newName. 285 * Sets the interface family to newName.
286 * @param newName the new name of the interface. Must be one of the families 286 * @param newName the new name of the interface. Must be one of the families
287 * defined in the interfaces.h file. 287 * defined in the interfaces.h file.
288 * @return bool true if successfull. 288 * @return bool true if successfull.
289 */ 289 */
290bool Interfaces::setInterfaceFamily(const QString &newName){ 290bool Interfaces::setInterfaceFamily(const QString &newName){
291 if(currentIface == interfaces.end()) 291 if(currentIface == interfaces.end())
292 return false; 292 return false;
@@ -294,20 +294,20 @@ bool Interfaces::setInterfaceFamily(const QString &newName){
294 return false; 294 return false;
295 bool returnValue = false; 295 bool returnValue = false;
296 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(newName).arg(getInterfaceMethod(returnValue)); 296 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(newName).arg(getInterfaceMethod(returnValue));
297 return !returnValue; 297 return !returnValue;
298} 298}
299 299
300/** 300/**
301 * Sets the interface method to newName 301 * Sets the interface method to newName
302 * @param newName the new name of the interface 302 * @param newName the new name of the interface
303 * @return bool true if successfull. 303 * @return bool true if successfull.
304 */ 304 */
305bool Interfaces::setInterfaceMethod(const QString &newName){ 305bool Interfaces::setInterfaceMethod(const QString &newName){
306 if(currentIface == interfaces.end()) 306 if(currentIface == interfaces.end())
307 return false; 307 return false;
308 bool returnValue = false; 308 bool returnValue = false;
309 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName); 309 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName);
310 return !returnValue; 310 return !returnValue;
311} 311}
312 312
313/** 313/**
@@ -319,7 +319,7 @@ bool Interfaces::setInterfaceMethod(const QString &newName){
319 * @param option the options to get the value. 319 * @param option the options to get the value.
320 * @param error set to true if any error occurs, false otherwise. 320 * @param error set to true if any error occurs, false otherwise.
321 * @return QString the options value. QString::null if error == true 321 * @return QString the options value. QString::null if error == true
322 */ 322 */
323QString Interfaces::getInterfaceOption(const QString &option, bool &error){ 323QString Interfaces::getInterfaceOption(const QString &option, bool &error){
324 return getOption(currentIface, option, error); 324 return getOption(currentIface, option, error);
325} 325}
@@ -331,36 +331,36 @@ QString Interfaces::getInterfaceOption(const QString &option, bool &error){
331 * @param value the value that option should be set to. 331 * @param value the value that option should be set to.
332 * @param error set to true if any error occurs, false otherwise. 332 * @param error set to true if any error occurs, false otherwise.
333 * @return QString the options value. QString::null if error == true 333 * @return QString the options value. QString::null if error == true
334 */ 334 */
335bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ 335bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
336 return setOption(currentIface, option, value); 336 return setOption(currentIface, option, value);
337} 337}
338 338
339/** 339/**
340 * Removes a value for an option in the currently selected interface. 340 * Removes a value for an option in the currently selected interface.
341 * @param option the options to set the value. 341 * @param option the options to set the value.
342 * @param error set to true if any error occurs, false otherwise. 342 * @param error set to true if any error occurs, false otherwise.
343 * @return QString the options value. QString::null if error == true 343 * @return QString the options value. QString::null if error == true
344 */ 344 */
345bool Interfaces::removeInterfaceOption(const QString &option){ 345bool Interfaces::removeInterfaceOption(const QString &option){
346 return removeOption(currentIface, option); 346 return removeOption(currentIface, option);
347} 347}
348 348
349/** 349/**
350 * Removes a value for an option in the currently selected interface. 350 * Removes a value for an option in the currently selected interface.
351 * @param option the options to set the value. 351 * @param option the options to set the value.
352 * @param value the value that option should be set to. 352 * @param value the value that option should be set to.
353 * @param error set to true if any error occurs, false otherwise. 353 * @param error set to true if any error occurs, false otherwise.
354 * @return QString the options value. QString::null if error == true 354 * @return QString the options value. QString::null if error == true
355 */ 355 */
356bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){ 356bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){
357 return removeOption(currentIface, option, value); 357 return removeOption(currentIface, option, value);
358} 358}
359 359
360/** 360/**
361 * Removes all of the options from the currently selected interface. 361 * Removes all of the options from the currently selected interface.
362 * @return bool error if if successfull 362 * @return bool error if if successfull
363 */ 363 */
364bool Interfaces::removeAllInterfaceOptions(){ 364bool Interfaces::removeAllInterfaceOptions(){
365 return removeAllOptions(currentIface); 365 return removeAllOptions(currentIface);
366} 366}
@@ -370,8 +370,8 @@ bool Interfaces::removeAllInterfaceOptions(){
370 * can call addMapping(), set/getMap(), and get/setScript(). 370 * can call addMapping(), set/getMap(), and get/setScript().
371 * @param interface the name of the interface to set. All whitespace is 371 * @param interface the name of the interface to set. All whitespace is
372 * removed from the interface name. 372 * removed from the interface name.
373 * @return bool true if it is successfull. 373 * @return bool true if it is successfull.
374 */ 374 */
375bool Interfaces::setMapping(const QString &interface){ 375bool Interfaces::setMapping(const QString &interface){
376 QString interfaceName = interface.simplifyWhiteSpace(); 376 QString interfaceName = interface.simplifyWhiteSpace();
377 interfaceName = interfaceName.replace(QRegExp(" "), ""); 377 interfaceName = interfaceName.replace(QRegExp(" "), "");
@@ -381,7 +381,7 @@ bool Interfaces::setMapping(const QString &interface){
381/** 381/**
382 * Adds a new Mapping to the interfaces file with interfaces. 382 * Adds a new Mapping to the interfaces file with interfaces.
383 * @param interface the name(s) of the interfaces to set to this mapping 383 * @param interface the name(s) of the interfaces to set to this mapping
384 */ 384 */
385void Interfaces::addMapping(const QString &option){ 385void Interfaces::addMapping(const QString &option){
386 interfaces.append(""); 386 interfaces.append("");
387 interfaces.append(QString(MAPPING " %1").arg(option)); 387 interfaces.append(QString(MAPPING " %1").arg(option));
@@ -393,14 +393,14 @@ void Interfaces::addMapping(const QString &option){
393 */ 393 */
394bool Interfaces::removeMapping(){ 394bool Interfaces::removeMapping(){
395 return removeStanza(currentMapping); 395 return removeStanza(currentMapping);
396} 396}
397 397
398/** 398/**
399 * Set a map option within a mapping. 399 * Set a map option within a mapping.
400 * @param map map to use 400 * @param map map to use
401 * @param value value to go with map 401 * @param value value to go with map
402 * @return bool true if it is successfull. 402 * @return bool true if it is successfull.
403 */ 403 */
404bool Interfaces::setMap(const QString &map, const QString &value){ 404bool Interfaces::setMap(const QString &map, const QString &value){
405 return setOption(currentMapping, map, value); 405 return setOption(currentMapping, map, value);
406} 406}
@@ -410,7 +410,7 @@ bool Interfaces::setMap(const QString &map, const QString &value){
410 * @param map map to use 410 * @param map map to use
411 * @param value value to go with map 411 * @param value value to go with map
412 * @return bool true if it is successfull. 412 * @return bool true if it is successfull.
413 */ 413 */
414bool Interfaces::removeMap(const QString &map, const QString &value){ 414bool Interfaces::removeMap(const QString &map, const QString &value){
415 return removeOption(currentMapping, map, value); 415 return removeOption(currentMapping, map, value);
416} 416}
@@ -420,7 +420,7 @@ bool Interfaces::removeMap(const QString &map, const QString &value){
420 * @param map map to get value of 420 * @param map map to get value of
421 * @param bool true if it is successfull. 421 * @param bool true if it is successfull.
422 * @return value that goes to the map 422 * @return value that goes to the map
423 */ 423 */
424QString Interfaces::getMap(const QString &map, bool &error){ 424QString Interfaces::getMap(const QString &map, bool &error){
425 return getOption(currentMapping, map, error); 425 return getOption(currentMapping, map, error);
426} 426}
@@ -429,7 +429,7 @@ QString Interfaces::getMap(const QString &map, bool &error){
429 * Sets a script value of the current mapping to argument. 429 * Sets a script value of the current mapping to argument.
430 * @param argument the script name. 430 * @param argument the script name.
431 * @return true if successfull. 431 * @return true if successfull.
432 */ 432 */
433bool Interfaces::setScript(const QString &argument){ 433bool Interfaces::setScript(const QString &argument){
434 return setOption(currentMapping, "script", argument); 434 return setOption(currentMapping, "script", argument);
435} 435}
@@ -437,7 +437,7 @@ bool Interfaces::setScript(const QString &argument){
437/** 437/**
438 * @param error true if could not retrieve the current script argument. 438 * @param error true if could not retrieve the current script argument.
439 * @return QString the argument of the script for the current mapping. 439 * @return QString the argument of the script for the current mapping.
440 */ 440 */
441QString Interfaces::getScript(bool &error){ 441QString Interfaces::getScript(bool &error){
442 return getOption(currentMapping, "script", error); 442 return getOption(currentMapping, "script", error);
443} 443}
@@ -445,13 +445,13 @@ QString Interfaces::getScript(bool &error){
445 445
446 446
447/** 447/**
448 * Helper function used to parse through the QStringList and put pointers in 448 * Helper function used to parse through the QStringList and put pointers in
449 * the correct place. 449 * the correct place.
450 * @param stanza The stanza (auto, iface, mapping) to look for. 450 * @param stanza The stanza (auto, iface, mapping) to look for.
451 * @param option string that must be in the stanza's main line. 451 * @param option string that must be in the stanza's main line.
452 * @param interator interator to place at location of stanza if successfull. 452 * @param interator interator to place at location of stanza if successfull.
453 * @return bool true if the stanza is found. 453 * @return bool true if the stanza is found.
454 */ 454 */
455bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){ 455bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){
456 bool found = false; 456 bool found = false;
457 iterator = interfaces.end(); 457 iterator = interfaces.end();
@@ -492,7 +492,7 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
492bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ 492bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
493 if(start == interfaces.end()) 493 if(start == interfaces.end())
494 return false; 494 return false;
495 495
496 bool found = false; 496 bool found = false;
497 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 497 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
498 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 498 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
@@ -523,7 +523,7 @@ bool Interfaces::setOption(const QStringList::Iterator &start, const QString &op
523 * Removes a stanza and all of its options 523 * Removes a stanza and all of its options
524 * @param stanza the stanza to remove 524 * @param stanza the stanza to remove
525 * @return bool true if successfull. 525 * @return bool true if successfull.
526 */ 526 */
527bool Interfaces::removeStanza(QStringList::Iterator &stanza){ 527bool Interfaces::removeStanza(QStringList::Iterator &stanza){
528 if(stanza == interfaces.end()) 528 if(stanza == interfaces.end())
529 return false; 529 return false;
@@ -540,7 +540,7 @@ bool Interfaces::removeStanza(QStringList::Iterator &stanza){
540bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option){ 540bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option){
541 if(start == interfaces.end()) 541 if(start == interfaces.end())
542 return false; 542 return false;
543 543
544 bool found = false; 544 bool found = false;
545 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 545 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
546 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 546 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
@@ -567,7 +567,7 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
567bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){ 567bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){
568 if(start == interfaces.end()) 568 if(start == interfaces.end())
569 return false; 569 return false;
570 570
571 bool found = false; 571 bool found = false;
572 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 572 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
573 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 573 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
@@ -593,7 +593,7 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
593bool Interfaces::removeAllOptions(const QStringList::Iterator &start){ 593bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
594 if(start == interfaces.end()) 594 if(start == interfaces.end())
595 return false; 595 return false;
596 596
597 QStringList::Iterator it = start; 597 QStringList::Iterator it = start;
598 it = ++it; 598 it = ++it;
599 for (; it != interfaces.end(); ++it ) { 599 for (; it != interfaces.end(); ++it ) {
@@ -620,7 +620,7 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
620 error = false; 620 error = false;
621 return QString(); 621 return QString();
622 } 622 }
623 623
624 QString value; 624 QString value;
625 bool found = false; 625 bool found = false;
626 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 626 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
@@ -647,7 +647,7 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
647 * Write out the interfaces file to the file passed into the constructor. 647 * Write out the interfaces file to the file passed into the constructor.
648 * Removes any excess blank lines over 1 line long. 648 * Removes any excess blank lines over 1 line long.
649 * @return bool true if successfull, false if not. 649 * @return bool true if successfull, false if not.
650 */ 650 */
651bool Interfaces::write(){ 651bool Interfaces::write(){
652 QFile::remove(interfacesFile); 652 QFile::remove(interfacesFile);
653 QFile file(interfacesFile); 653 QFile file(interfacesFile);
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index f19cbdd..b40d101 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -187,6 +187,8 @@ void InterfaceSetupImp::setProfile(const QString &profile){
187 187
188 ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); 188 ipAddressEdit->setText(interfaces->getInterfaceOption("address", error));
189 subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); 189 subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error));
190 if (subnetMaskEdit->text().isEmpty())
191 subnetMaskEdit->setText( "255.255.255.0" );
190 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); 192 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));
191 193
192 194
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index 7bded85..a4488f9 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -132,9 +132,26 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
132 QDataStream stream(arg,IO_ReadOnly); 132 QDataStream stream(arg,IO_ReadOnly);
133 QString interface; 133 QString interface;
134 QString action; 134 QString action;
135 int countMsgs = 0;
136 stream >> interface;
137 qDebug("got count? >%s<",interface.latin1());
138 if (interface == "count"){
139 qDebug("got count");
140 stream >> action;
141 qDebug("Got count num >%s<", action.latin1());
142 countMsgs = action.toInt();
143 }
144
135 QDialog *toShow; 145 QDialog *toShow;
136 while (! stream.atEnd() ){ 146 //while (! stream.atEnd() ){
147 for (int i = 0; i < countMsgs; i++){
148 qDebug("start stream %d/%d",i,countMsgs);
149 if (stream.atEnd()){
150 qDebug("end of stream");
151 return;
152 }
137 stream >> interface; 153 stream >> interface;
154 qDebug("got iface");
138 stream >> action; 155 stream >> action;
139 qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1()); 156 qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1());
140 // find interfaces 157 // find interfaces
@@ -175,7 +192,11 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
175 } 192 }
176 wlanconfigWiget->showMaximized(); 193 wlanconfigWiget->showMaximized();
177 stream >> value; 194 stream >> value;
178 qDebug("WLANModule is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); 195 qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() );
196 if (value.isEmpty()){
197 qDebug("value is empty!!!\nreturning");
198 return;
199 }
179 if ( action.contains("ESSID") ){ 200 if ( action.contains("ESSID") ){
180 QComboBox *combo = wlanconfigWiget->essid; 201 QComboBox *combo = wlanconfigWiget->essid;
181 bool found = false; 202 bool found = false;
@@ -194,8 +215,10 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
194 215
195 }else if (action.contains("Channel")){ 216 }else if (action.contains("Channel")){
196 bool ok; 217 bool ok;
218 qDebug("converting channel");
197 int chan = value.toInt( &ok ); 219 int chan = value.toInt( &ok );
198 if (ok){ 220 if (ok){
221 qDebug("ok setting channel");
199 wlanconfigWiget->specifyChan->setChecked( true ); 222 wlanconfigWiget->specifyChan->setChecked( true );
200 wlanconfigWiget->networkChannel->setValue( chan ); 223 wlanconfigWiget->networkChannel->setValue( chan );
201 } 224 }
@@ -205,8 +228,11 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
205 }else 228 }else
206 qDebug("wlan plugin has no clue"); 229 qDebug("wlan plugin has no clue");
207 } 230 }
231 qDebug("next stream");
208 }// while stream 232 }// while stream
233 qDebug("end of stream");
209 if (toShow) toShow->exec(); 234 if (toShow) toShow->exec();
235 qDebug("returning");
210} 236}
211 237
212QWidget *WLANModule::getInfo( Interface *i) 238QWidget *WLANModule::getInfo( Interface *i)
@@ -215,7 +241,11 @@ QWidget *WLANModule::getInfo( Interface *i)
215 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); 241 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
216 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); 242 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
217 info->tabWidget->insertTab(information, "TCP/IP", 0); 243 info->tabWidget->insertTab(information, "TCP/IP", 0);
218 244 info->tabWidget->setCurrentPage( 0 );
245 info->tabWidget->showPage( information );
246 if (info->tabWidget->currentPage() == information ) qDebug("infotab OK");
247 else qDebug("infotab NOT OK");
248 qDebug("current idx %d", info->tabWidget->currentPageIndex());
219 qDebug("WLANModule::getInfo return"); 249 qDebug("WLANModule::getInfo return");
220 return info; 250 return info;
221} 251}