summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2002-10-17 16:44:30 (UTC)
committer benmeyer <benmeyer>2002-10-17 16:44:30 (UTC)
commit8511273d7122d50ffea27f78ba13ab72af60326d (patch) (unidiff)
treeab7fae876ce1af5665a882b1a53b5f3e240cf4ab
parent18cc7321db186865629a5c4702074211e42b92fd (diff)
downloadopie-8511273d7122d50ffea27f78ba13ab72af60326d.zip
opie-8511273d7122d50ffea27f78ba13ab72af60326d.tar.gz
opie-8511273d7122d50ffea27f78ba13ab72af60326d.tar.bz2
fix interface name bug
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/interface.cpp16
-rw-r--r--noncore/net/networksetup/interface.h4
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp7
-rw-r--r--noncore/settings/networksettings/interface.cpp16
-rw-r--r--noncore/settings/networksettings/interface.h4
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp7
6 files changed, 26 insertions, 28 deletions
diff --git a/noncore/net/networksetup/interface.cpp b/noncore/net/networksetup/interface.cpp
index 1e01da4..a84b91f 100644
--- a/noncore/net/networksetup/interface.cpp
+++ b/noncore/net/networksetup/interface.cpp
@@ -11,7 +11,7 @@
11#include <stdio.h> 11#include <stdio.h>
12#include <stdlib.h> 12#include <stdlib.h>
13 13
14Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){ 14Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardwareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
15 refresh(); 15 refresh();
16} 16}
17 17
@@ -43,7 +43,7 @@ void Interface::setAttached(bool isAttached){
43 * emit updateInterface 43 * emit updateInterface
44 */ 44 */
45void Interface::setHardwareName(QString name){ 45void Interface::setHardwareName(QString name){
46 hardareName = name; 46 hardwareName = name;
47 emit(updateInterface(this)); 47 emit(updateInterface(this));
48}; 48};
49 49
@@ -66,7 +66,7 @@ void Interface::start(){
66 if(true == status) 66 if(true == status)
67 return; 67 return;
68 68
69 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1()); 69 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
70 // See if it was successfull... 70 // See if it was successfull...
71 if(ret != 0) 71 if(ret != 0)
72 return; 72 return;
@@ -83,7 +83,7 @@ void Interface::stop(){
83 if(false == status) 83 if(false == status)
84 return; 84 return;
85 85
86 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1()); 86 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
87 if(ret != 0) 87 if(ret != 0)
88 return; 88 return;
89 89
@@ -119,8 +119,8 @@ bool Interface::refresh(){
119 return true; 119 return true;
120 } 120 }
121 121
122 QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName); 122 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
123 int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1()); 123 int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
124 if(ret != 0){ 124 if(ret != 0){
125 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); 125 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
126 return false; 126 return false;
@@ -177,7 +177,7 @@ bool Interface::refresh(){
177 dhcpDirectory = "/var/run"; 177 dhcpDirectory = "/var/run";
178 178
179 // See if we have 179 // See if we have
180 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(interfaceName)); 180 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
181 // If there is no DHCP information then exit now with no errors. 181 // If there is no DHCP information then exit now with no errors.
182 if(!QFile::exists(dhcpFile)){ 182 if(!QFile::exists(dhcpFile)){
183 emit(updateInterface(this)); 183 emit(updateInterface(this));
@@ -209,7 +209,7 @@ bool Interface::refresh(){
209 //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); 209 //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1());
210 210
211 // Get the pid of the deamond 211 // Get the pid of the deamond
212 dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(interfaceName)); 212 dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name()));
213 file.setName(dhcpFile); 213 file.setName(dhcpFile);
214 if (!file.open(IO_ReadOnly)){ 214 if (!file.open(IO_ReadOnly)){
215 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); 215 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
diff --git a/noncore/net/networksetup/interface.h b/noncore/net/networksetup/interface.h
index 980171a..7943fd6 100644
--- a/noncore/net/networksetup/interface.h
+++ b/noncore/net/networksetup/interface.h
@@ -24,7 +24,7 @@ public:
24 virtual bool isAttached(){ return attached; }; 24 virtual bool isAttached(){ return attached; };
25 virtual void setAttached(bool isAttached=false); 25 virtual void setAttached(bool isAttached=false);
26 26
27 virtual QString getHardwareName(){ return hardareName; }; 27 virtual QString getHardwareName(){ return hardwareName; };
28 virtual void setHardwareName(QString name="Unknown"); 28 virtual void setHardwareName(QString name="Unknown");
29 29
30 virtual Module* getModuleOwner(){ return moduleOwner; }; 30 virtual Module* getModuleOwner(){ return moduleOwner; };
@@ -51,7 +51,7 @@ private:
51 bool status; 51 bool status;
52 bool attached; 52 bool attached;
53 QString interfaceName; 53 QString interfaceName;
54 QString hardareName; 54 QString hardwareName;
55 Module *moduleOwner; 55 Module *moduleOwner;
56 56
57 // Network information 57 // Network information
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp
index 117bac1..a446d29 100644
--- a/noncore/net/networksetup/mainwindowimp.cpp
+++ b/noncore/net/networksetup/mainwindowimp.cpp
@@ -308,7 +308,7 @@ void MainWindowImp::jobDone(KProcess *process){
308 //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); 308 //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
309 // See if we already have it 309 // See if we already have it
310 if(interfaceNames.find(interfaceName) == interfaceNames.end()){ 310 if(interfaceNames.find(interfaceName) == interfaceNames.end()){
311 if(fileName == TEMP_ALL) 311 if(fileName == TEMP_ALL)
312 i = new Interface(this, interfaceName, false); 312 i = new Interface(this, interfaceName, false);
313 else 313 else
314 i = new Interface(this, interfaceName, true); 314 i = new Interface(this, interfaceName, true);
@@ -328,9 +328,8 @@ void MainWindowImp::jobDone(KProcess *process){
328 } 328 }
329 // It was an interface we already had. 329 // It was an interface we already had.
330 else{ 330 else{
331 i = interfaceNames[interfaceName];
332 if(fileName != TEMP_ALL) 331 if(fileName != TEMP_ALL)
333 i->setStatus(true); 332 (interfaceNames[interfaceName])->setStatus(true);
334 } 333 }
335 } 334 }
336 } 335 }
@@ -398,7 +397,7 @@ void MainWindowImp::updateInterface(Interface *i){
398 typeName = "wlan"; 397 typeName = "wlan";
399 if(i->getInterfaceName().contains("usb")) 398 if(i->getInterfaceName().contains("usb"))
400 typeName = "usb"; 399 typeName = "usb";
401 400
402 if(!i->isAttached()) 401 if(!i->isAttached())
403 typeName = "connect_no"; 402 typeName = "connect_no";
404 // Actually try to use the Module 403 // Actually try to use the Module
diff --git a/noncore/settings/networksettings/interface.cpp b/noncore/settings/networksettings/interface.cpp
index 1e01da4..a84b91f 100644
--- a/noncore/settings/networksettings/interface.cpp
+++ b/noncore/settings/networksettings/interface.cpp
@@ -11,7 +11,7 @@
11#include <stdio.h> 11#include <stdio.h>
12#include <stdlib.h> 12#include <stdlib.h>
13 13
14Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){ 14Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardwareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
15 refresh(); 15 refresh();
16} 16}
17 17
@@ -43,7 +43,7 @@ void Interface::setAttached(bool isAttached){
43 * emit updateInterface 43 * emit updateInterface
44 */ 44 */
45void Interface::setHardwareName(QString name){ 45void Interface::setHardwareName(QString name){
46 hardareName = name; 46 hardwareName = name;
47 emit(updateInterface(this)); 47 emit(updateInterface(this));
48}; 48};
49 49
@@ -66,7 +66,7 @@ void Interface::start(){
66 if(true == status) 66 if(true == status)
67 return; 67 return;
68 68
69 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1()); 69 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
70 // See if it was successfull... 70 // See if it was successfull...
71 if(ret != 0) 71 if(ret != 0)
72 return; 72 return;
@@ -83,7 +83,7 @@ void Interface::stop(){
83 if(false == status) 83 if(false == status)
84 return; 84 return;
85 85
86 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1()); 86 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
87 if(ret != 0) 87 if(ret != 0)
88 return; 88 return;
89 89
@@ -119,8 +119,8 @@ bool Interface::refresh(){
119 return true; 119 return true;
120 } 120 }
121 121
122 QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName); 122 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
123 int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1()); 123 int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
124 if(ret != 0){ 124 if(ret != 0){
125 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); 125 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
126 return false; 126 return false;
@@ -177,7 +177,7 @@ bool Interface::refresh(){
177 dhcpDirectory = "/var/run"; 177 dhcpDirectory = "/var/run";
178 178
179 // See if we have 179 // See if we have
180 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(interfaceName)); 180 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
181 // If there is no DHCP information then exit now with no errors. 181 // If there is no DHCP information then exit now with no errors.
182 if(!QFile::exists(dhcpFile)){ 182 if(!QFile::exists(dhcpFile)){
183 emit(updateInterface(this)); 183 emit(updateInterface(this));
@@ -209,7 +209,7 @@ bool Interface::refresh(){
209 //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); 209 //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1());
210 210
211 // Get the pid of the deamond 211 // Get the pid of the deamond
212 dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(interfaceName)); 212 dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name()));
213 file.setName(dhcpFile); 213 file.setName(dhcpFile);
214 if (!file.open(IO_ReadOnly)){ 214 if (!file.open(IO_ReadOnly)){
215 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); 215 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
diff --git a/noncore/settings/networksettings/interface.h b/noncore/settings/networksettings/interface.h
index 980171a..7943fd6 100644
--- a/noncore/settings/networksettings/interface.h
+++ b/noncore/settings/networksettings/interface.h
@@ -24,7 +24,7 @@ public:
24 virtual bool isAttached(){ return attached; }; 24 virtual bool isAttached(){ return attached; };
25 virtual void setAttached(bool isAttached=false); 25 virtual void setAttached(bool isAttached=false);
26 26
27 virtual QString getHardwareName(){ return hardareName; }; 27 virtual QString getHardwareName(){ return hardwareName; };
28 virtual void setHardwareName(QString name="Unknown"); 28 virtual void setHardwareName(QString name="Unknown");
29 29
30 virtual Module* getModuleOwner(){ return moduleOwner; }; 30 virtual Module* getModuleOwner(){ return moduleOwner; };
@@ -51,7 +51,7 @@ private:
51 bool status; 51 bool status;
52 bool attached; 52 bool attached;
53 QString interfaceName; 53 QString interfaceName;
54 QString hardareName; 54 QString hardwareName;
55 Module *moduleOwner; 55 Module *moduleOwner;
56 56
57 // Network information 57 // Network information
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 117bac1..a446d29 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -308,7 +308,7 @@ void MainWindowImp::jobDone(KProcess *process){
308 //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); 308 //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
309 // See if we already have it 309 // See if we already have it
310 if(interfaceNames.find(interfaceName) == interfaceNames.end()){ 310 if(interfaceNames.find(interfaceName) == interfaceNames.end()){
311 if(fileName == TEMP_ALL) 311 if(fileName == TEMP_ALL)
312 i = new Interface(this, interfaceName, false); 312 i = new Interface(this, interfaceName, false);
313 else 313 else
314 i = new Interface(this, interfaceName, true); 314 i = new Interface(this, interfaceName, true);
@@ -328,9 +328,8 @@ void MainWindowImp::jobDone(KProcess *process){
328 } 328 }
329 // It was an interface we already had. 329 // It was an interface we already had.
330 else{ 330 else{
331 i = interfaceNames[interfaceName];
332 if(fileName != TEMP_ALL) 331 if(fileName != TEMP_ALL)
333 i->setStatus(true); 332 (interfaceNames[interfaceName])->setStatus(true);
334 } 333 }
335 } 334 }
336 } 335 }
@@ -398,7 +397,7 @@ void MainWindowImp::updateInterface(Interface *i){
398 typeName = "wlan"; 397 typeName = "wlan";
399 if(i->getInterfaceName().contains("usb")) 398 if(i->getInterfaceName().contains("usb"))
400 typeName = "usb"; 399 typeName = "usb";
401 400
402 if(!i->isAttached()) 401 if(!i->isAttached())
403 typeName = "connect_no"; 402 typeName = "connect_no";
404 // Actually try to use the Module 403 // Actually try to use the Module