-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 | 3 | ||||
-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 | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/networksettings/networksetup.pro | 6 |
10 files changed, 106 insertions, 10 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 @@ -4,4 +4,5 @@ networksetup, doesnt bring you back to the main screen. [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 @@ -39,12 +39,36 @@ Interfaces::Interfaces(QString useInterfacesFile){ currentIface = interfaces.end(); 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){ QStringList autoLines = interfaces.grep(QRegExp(AUTO)); 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 @@ -22,9 +22,10 @@ class Interfaces { public: Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); - + QStringList getInterfaceList(); + bool isAuto(QString interface); bool setAuto(QString interface, bool setAuto); bool removeInterface(); 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 @@ -1,8 +1,10 @@ #include "mainwindowimp.h"
#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
+#include "interfaces.h"
+
#include "module.h"
#include "kprocess.h"
@@ -331,8 +333,25 @@ 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);
+ }
+ }
+ }
+ }
}
/**
* Update this interface. If no QListViewItem exists create one.
@@ -365,8 +384,11 @@ void MainWindowImp::updateInterface(Interface *i){ if(i->getInterfaceName().contains("irda"))
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 @@ -4,4 +4,5 @@ networksetup, doesnt bring you back to the main screen. [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 @@ -39,12 +39,36 @@ Interfaces::Interfaces(QString useInterfacesFile){ currentIface = interfaces.end(); 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){ QStringList autoLines = interfaces.grep(QRegExp(AUTO)); 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 @@ -22,9 +22,10 @@ class Interfaces { public: Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); - + QStringList getInterfaceList(); + bool isAuto(QString interface); bool setAuto(QString interface, bool setAuto); bool removeInterface(); 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 @@ -1,8 +1,10 @@ #include "mainwindowimp.h"
#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
+#include "interfaces.h"
+
#include "module.h"
#include "kprocess.h"
@@ -331,8 +333,25 @@ 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);
+ }
+ }
+ }
+ }
}
/**
* Update this interface. If no QListViewItem exists create one.
@@ -365,8 +384,11 @@ void MainWindowImp::updateInterface(Interface *i){ if(i->getInterfaceName().contains("irda"))
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 |