-rw-r--r-- | noncore/net/networksetup/interface.cpp | 16 | ||||
-rw-r--r-- | noncore/net/networksetup/interface.h | 4 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/interface.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/networksettings/interface.h | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 7 |
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 @@ -10,9 +10,9 @@ #include <stdio.h> #include <stdlib.h> -Interface::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){ +Interface::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){ refresh(); } /** @@ -42,9 +42,9 @@ void Interface::setAttached(bool isAttached){ * @param name - the new name * emit updateInterface */ void Interface::setHardwareName(QString name){ - hardareName = name; + hardwareName = name; emit(updateInterface(this)); }; /** @@ -65,9 +65,9 @@ void Interface::start(){ // check to see if we are already running. if(true == status) return; - int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1()); + int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); // See if it was successfull... if(ret != 0) return; @@ -82,9 +82,9 @@ void Interface::stop(){ // check to see if we are already stopped. if(false == status) return; - int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1()); + int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); if(ret != 0) return; status = true; @@ -118,10 +118,10 @@ bool Interface::refresh(){ emit(updateInterface(this)); return true; } - QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName); - int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1()); + QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); + int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); if(ret != 0){ qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); return false; } @@ -176,9 +176,9 @@ bool Interface::refresh(){ if(!d.exists(dhcpDirectory)) dhcpDirectory = "/var/run"; // See if we have - QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(interfaceName)); + QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name())); // If there is no DHCP information then exit now with no errors. if(!QFile::exists(dhcpFile)){ emit(updateInterface(this)); return true; @@ -208,9 +208,9 @@ bool Interface::refresh(){ //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); // Get the pid of the deamond - dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(interfaceName)); + dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name())); file.setName(dhcpFile); if (!file.open(IO_ReadOnly)){ qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); return false; 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 @@ -23,9 +23,9 @@ public: virtual bool isAttached(){ return attached; }; virtual void setAttached(bool isAttached=false); - virtual QString getHardwareName(){ return hardareName; }; + virtual QString getHardwareName(){ return hardwareName; }; virtual void setHardwareName(QString name="Unknown"); virtual Module* getModuleOwner(){ return moduleOwner; }; virtual void setModuleOwner(Module *owner=NULL); @@ -50,9 +50,9 @@ private: // Interface information bool status; bool attached; QString interfaceName; - QString hardareName; + QString hardwareName; Module *moduleOwner; // Network information QString macAddress; 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 @@ -307,9 +307,9 @@ void MainWindowImp::jobDone(KProcess *process){ // We have found an interface
//qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
// See if we already have it
if(interfaceNames.find(interfaceName) == interfaceNames.end()){
- if(fileName == TEMP_ALL)
+ if(fileName == TEMP_ALL)
i = new Interface(this, interfaceName, false);
else
i = new Interface(this, interfaceName, true);
i->setAttached(true);
@@ -327,11 +327,10 @@ void MainWindowImp::jobDone(KProcess *process){ connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
}
// It was an interface we already had.
else{
- i = interfaceNames[interfaceName];
if(fileName != TEMP_ALL)
- i->setStatus(true);
+ (interfaceNames[interfaceName])->setStatus(true);
}
}
}
file.close();
@@ -397,9 +396,9 @@ void MainWindowImp::updateInterface(Interface *i){ if(i->getInterfaceName().contains("wlan"))
typeName = "wlan";
if(i->getInterfaceName().contains("usb"))
typeName = "usb";
-
+
if(!i->isAttached())
typeName = "connect_no";
// Actually try to use the Module
if(i->getModuleOwner() != NULL)
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 @@ -10,9 +10,9 @@ #include <stdio.h> #include <stdlib.h> -Interface::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){ +Interface::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){ refresh(); } /** @@ -42,9 +42,9 @@ void Interface::setAttached(bool isAttached){ * @param name - the new name * emit updateInterface */ void Interface::setHardwareName(QString name){ - hardareName = name; + hardwareName = name; emit(updateInterface(this)); }; /** @@ -65,9 +65,9 @@ void Interface::start(){ // check to see if we are already running. if(true == status) return; - int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1()); + int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); // See if it was successfull... if(ret != 0) return; @@ -82,9 +82,9 @@ void Interface::stop(){ // check to see if we are already stopped. if(false == status) return; - int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1()); + int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); if(ret != 0) return; status = true; @@ -118,10 +118,10 @@ bool Interface::refresh(){ emit(updateInterface(this)); return true; } - QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName); - int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1()); + QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); + int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); if(ret != 0){ qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); return false; } @@ -176,9 +176,9 @@ bool Interface::refresh(){ if(!d.exists(dhcpDirectory)) dhcpDirectory = "/var/run"; // See if we have - QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(interfaceName)); + QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name())); // If there is no DHCP information then exit now with no errors. if(!QFile::exists(dhcpFile)){ emit(updateInterface(this)); return true; @@ -208,9 +208,9 @@ bool Interface::refresh(){ //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); // Get the pid of the deamond - dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(interfaceName)); + dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name())); file.setName(dhcpFile); if (!file.open(IO_ReadOnly)){ qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); return false; 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 @@ -23,9 +23,9 @@ public: virtual bool isAttached(){ return attached; }; virtual void setAttached(bool isAttached=false); - virtual QString getHardwareName(){ return hardareName; }; + virtual QString getHardwareName(){ return hardwareName; }; virtual void setHardwareName(QString name="Unknown"); virtual Module* getModuleOwner(){ return moduleOwner; }; virtual void setModuleOwner(Module *owner=NULL); @@ -50,9 +50,9 @@ private: // Interface information bool status; bool attached; QString interfaceName; - QString hardareName; + QString hardwareName; Module *moduleOwner; // Network information QString macAddress; 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 @@ -307,9 +307,9 @@ void MainWindowImp::jobDone(KProcess *process){ // We have found an interface
//qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1());
// See if we already have it
if(interfaceNames.find(interfaceName) == interfaceNames.end()){
- if(fileName == TEMP_ALL)
+ if(fileName == TEMP_ALL)
i = new Interface(this, interfaceName, false);
else
i = new Interface(this, interfaceName, true);
i->setAttached(true);
@@ -327,11 +327,10 @@ void MainWindowImp::jobDone(KProcess *process){ connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
}
// It was an interface we already had.
else{
- i = interfaceNames[interfaceName];
if(fileName != TEMP_ALL)
- i->setStatus(true);
+ (interfaceNames[interfaceName])->setStatus(true);
}
}
}
file.close();
@@ -397,9 +396,9 @@ void MainWindowImp::updateInterface(Interface *i){ if(i->getInterfaceName().contains("wlan"))
typeName = "wlan";
if(i->getInterfaceName().contains("usb"))
typeName = "usb";
-
+
if(!i->isAttached())
typeName = "connect_no";
// Actually try to use the Module
if(i->getModuleOwner() != NULL)
|