-rw-r--r-- | noncore/net/networksetup/TODO | 1 | ||||
-rw-r--r-- | noncore/net/networksetup/interfaces.cpp | 26 | ||||
-rw-r--r-- | noncore/net/networksetup/interfaces.h | 1 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 22 | ||||
-rw-r--r-- | noncore/net/networksetup/networksetup.pro | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/TODO | 1 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfaces.cpp | 26 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfaces.h | 1 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/networksettings/networksetup.pro | 6 |
10 files changed, 104 insertions, 8 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO index 70d6717..7386646 100644 --- a/noncore/net/networksetup/TODO +++ b/noncore/net/networksetup/TODO @@ -5,3 +5,4 @@ [x] Wlanmodule isnt writing out wireless.opts [ ] Need a means of bringing an interface up and down (calling out ifup/ifdown) from the gui. + -Ben- Click information, then click up or down... :-D diff --git a/noncore/net/networksetup/interfaces.cpp b/noncore/net/networksetup/interfaces.cpp index b8a3e7f..1287d90 100644 --- a/noncore/net/networksetup/interfaces.cpp +++ b/noncore/net/networksetup/interfaces.cpp @@ -40,10 +40,34 @@ Interfaces::Interfaces(QString useInterfacesFile){ currentMapping = interfaces.end(); } + +/** + * Get a list of all interfaces in the interface file. Usefull for + * hardware that is not currently connected such as an 802.11b card + * not plugged in, but configured for when it is plugged in. + * @return Return string list of interfaces. + **/ +QStringList Interfaces::getInterfaceList(){ + QStringList list; + for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { + QString line = (*it).simplifyWhiteSpace(); + if(line.contains(IFACE)){ + line = line.mid(QString(IFACE).length() +1, line.length()); + line = line.simplifyWhiteSpace(); + int findSpace = line.find(" "); + if( findSpace >= 0){ + line = line.mid(0, findSpace); + list.append(line); + } + } + } + return list; +} + /** * Find out if interface is in an "auto" group or not. * Report any duplicates such as eth0 being in two differnt auto's - * @param + * @param interface interface to check to see if it is on or not. * @return true is interface is in auto */ bool Interfaces::isAuto(QString interface){ diff --git a/noncore/net/networksetup/interfaces.h b/noncore/net/networksetup/interfaces.h index 2cc9689..8b4788c 100644 --- a/noncore/net/networksetup/interfaces.h +++ b/noncore/net/networksetup/interfaces.h @@ -23,6 +23,7 @@ class Interfaces { public: Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); + QStringList getInterfaceList(); bool isAuto(QString interface); bool setAuto(QString interface, bool setAuto); diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 36f12e0..24af1ec 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp @@ -2,6 +2,8 @@ #include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
+#include "interfaces.h"
+
#include "module.h"
#include "kprocess.h"
@@ -332,6 +334,23 @@ void MainWindowImp::jobDone(KProcess *process){ }
file.close();
QFile::remove(fileName);
+ if(threads.count() == 0){
+ Interfaces i;
+ QStringList list = i.getInterfaceList();
+ QMap<QString, Interface*>::Iterator it;
+ for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
+ for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
+ if(it.key() == (*ni)){
+ Interface *i = new Interface(*ni, false);
+ i->setAttached(false);
+ i->setHardwareName(QString("Disconnected (%1)").arg(*ni));
+ i->setInterfaceName(*ni);
+ interfaceNames.insert(i->getInterfaceName(), i);
+ updateInterface(i);
+ }
+ }
+ }
+ }
}
/**
@@ -366,6 +385,9 @@ void MainWindowImp::updateInterface(Interface *i){ typeName = "irda";
if(i->getInterfaceName().contains("wlan"))
typeName = "wlan";
+
+ if(!i->isAttached())
+ typeName = "connect_no";
// Actually try to use the Module
if(i->getModuleOwner() != NULL)
typeName = i->getModuleOwner()->getPixmapName(i);
diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro index f09db93..441bbaa 100644 --- a/noncore/net/networksetup/networksetup.pro +++ b/noncore/net/networksetup/networksetup.pro @@ -1,11 +1,11 @@ -DESTDIR = $(OPIEDIR)/bin +#DESTDIR = $(OPIEDIR)/bin TEMPLATE = app #CONFIG = qt warn_on debug CONFIG = qt warn_on release HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include +#INCLUDEPATH += $(OPIEDIR)/include +#DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe INTERFACES = mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui TARGET = networksetup diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO index 70d6717..7386646 100644 --- a/noncore/settings/networksettings/TODO +++ b/noncore/settings/networksettings/TODO @@ -5,3 +5,4 @@ [x] Wlanmodule isnt writing out wireless.opts [ ] Need a means of bringing an interface up and down (calling out ifup/ifdown) from the gui. + -Ben- Click information, then click up or down... :-D diff --git a/noncore/settings/networksettings/interfaces.cpp b/noncore/settings/networksettings/interfaces.cpp index b8a3e7f..1287d90 100644 --- a/noncore/settings/networksettings/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces.cpp @@ -40,10 +40,34 @@ Interfaces::Interfaces(QString useInterfacesFile){ currentMapping = interfaces.end(); } + +/** + * Get a list of all interfaces in the interface file. Usefull for + * hardware that is not currently connected such as an 802.11b card + * not plugged in, but configured for when it is plugged in. + * @return Return string list of interfaces. + **/ +QStringList Interfaces::getInterfaceList(){ + QStringList list; + for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { + QString line = (*it).simplifyWhiteSpace(); + if(line.contains(IFACE)){ + line = line.mid(QString(IFACE).length() +1, line.length()); + line = line.simplifyWhiteSpace(); + int findSpace = line.find(" "); + if( findSpace >= 0){ + line = line.mid(0, findSpace); + list.append(line); + } + } + } + return list; +} + /** * Find out if interface is in an "auto" group or not. * Report any duplicates such as eth0 being in two differnt auto's - * @param + * @param interface interface to check to see if it is on or not. * @return true is interface is in auto */ bool Interfaces::isAuto(QString interface){ diff --git a/noncore/settings/networksettings/interfaces.h b/noncore/settings/networksettings/interfaces.h index 2cc9689..8b4788c 100644 --- a/noncore/settings/networksettings/interfaces.h +++ b/noncore/settings/networksettings/interfaces.h @@ -23,6 +23,7 @@ class Interfaces { public: Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); + QStringList getInterfaceList(); bool isAuto(QString interface); bool setAuto(QString interface, bool setAuto); diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 36f12e0..24af1ec 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -2,6 +2,8 @@ #include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
+#include "interfaces.h"
+
#include "module.h"
#include "kprocess.h"
@@ -332,6 +334,23 @@ void MainWindowImp::jobDone(KProcess *process){ }
file.close();
QFile::remove(fileName);
+ if(threads.count() == 0){
+ Interfaces i;
+ QStringList list = i.getInterfaceList();
+ QMap<QString, Interface*>::Iterator it;
+ for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
+ for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
+ if(it.key() == (*ni)){
+ Interface *i = new Interface(*ni, false);
+ i->setAttached(false);
+ i->setHardwareName(QString("Disconnected (%1)").arg(*ni));
+ i->setInterfaceName(*ni);
+ interfaceNames.insert(i->getInterfaceName(), i);
+ updateInterface(i);
+ }
+ }
+ }
+ }
}
/**
@@ -366,6 +385,9 @@ void MainWindowImp::updateInterface(Interface *i){ typeName = "irda";
if(i->getInterfaceName().contains("wlan"))
typeName = "wlan";
+
+ if(!i->isAttached())
+ typeName = "connect_no";
// Actually try to use the Module
if(i->getModuleOwner() != NULL)
typeName = i->getModuleOwner()->getPixmapName(i);
diff --git a/noncore/settings/networksettings/networksetup.pro b/noncore/settings/networksettings/networksetup.pro index f09db93..441bbaa 100644 --- a/noncore/settings/networksettings/networksetup.pro +++ b/noncore/settings/networksettings/networksetup.pro @@ -1,11 +1,11 @@ -DESTDIR = $(OPIEDIR)/bin +#DESTDIR = $(OPIEDIR)/bin TEMPLATE = app #CONFIG = qt warn_on debug CONFIG = qt warn_on release HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include +#INCLUDEPATH += $(OPIEDIR)/include +#DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe INTERFACES = mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui TARGET = networksetup |