-rw-r--r-- | noncore/net/networksetup/TODO | 6 | ||||
-rw-r--r-- | noncore/net/networksetup/interface.cpp | 4 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 10 | ||||
-rw-r--r-- | noncore/settings/networksettings/TODO | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/interface.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wextensions.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 10 |
12 files changed, 26 insertions, 26 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO index 7a71142..d61c510 100644 --- a/noncore/net/networksetup/TODO +++ b/noncore/net/networksetup/TODO @@ -1,11 +1,9 @@ WLAN needs to be re-written to not use Config --remove WLAN Config item --sub class out the wlan info --check if an interface supports wireless extensions before config. +WHERE Is DHCP info stored??? PPP module needs to be written Write a class that parses /proc and not ifconfig -Possible other modules: ipsec, bluetooth +Possible other modules: ipsec, bluetooth, ipchains diff --git a/noncore/net/networksetup/interface.cpp b/noncore/net/networksetup/interface.cpp index a84b91f..929b3a1 100644 --- a/noncore/net/networksetup/interface.cpp +++ b/noncore/net/networksetup/interface.cpp @@ -1,21 +1,21 @@ #include "interface.h" #include <qdatetime.h> #include <qfile.h> #include <qdir.h> #include <qfileinfo.h> #include <qtextstream.h> #define IFCONFIG "/sbin/ifconfig" -#define HDCP_INFO_DIR "/etc/dhcpc" +#define DHCP_INFO_DIR "/etc/dhcpc" #include <stdio.h> #include <stdlib.h> 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(); } /** * Set status * @param newStatus - the new status * emit updateInterface @@ -162,25 +162,25 @@ bool Interface::refresh(){ } } file.close(); QFile::remove(fileName); // DHCP TESTING // reset DHCP info dhcpServerIp = ""; leaseObtained = ""; leaseExpires = ""; dhcp = false; - QString dhcpDirectory(HDCP_INFO_DIR); + QString dhcpDirectory(DHCP_INFO_DIR); QDir d(dhcpDirectory); if(!d.exists(dhcpDirectory)) dhcpDirectory = "/var/run"; // See if we have 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; } diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 9d81ab1..c86acdc 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp @@ -69,42 +69,44 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par currentProfileLabel->setText(line);
break;
}
}
file.close();
}
}
/**
* Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
+ qDebug("start Saving mainwindow");
// Save profiles.
Config cfg("NetworkSetup");
cfg.setGroup("General");
cfg.writeEntry("Profiles", profiles.join(" "));
// Delete all interfaces that don't have owners.
QMap<Interface*, QListViewItem*>::Iterator iIt;
for( iIt = items.begin(); iIt != items.end(); ++iIt ){
if(iIt.key()->getModuleOwner() == NULL)
delete iIt.key();
}
// Delete Modules and Libraries
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
delete it.key();
delete it.data();
}
+ qDebug("done Saving mainwindow");
}
/**
* Load all modules that are found in the path
* @param path a directory that is scaned for any plugins that can be loaded
* and attempts to load them
*/
void MainWindowImp::loadModules(QString path){
//qDebug(path.latin1());
QDir d(path);
if(!d.exists())
return;
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp index ef4ba8f..e545bd1 100644 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/noncore/net/networksetup/wlan/wextensions.cpp @@ -148,25 +148,25 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){ QTextStream wstream( &wfile ); wstream.readLine(); // skip the first two lines wstream.readLine(); // because they only contain headers while(!wstream.atEnd()){ wstream >> name >> status >> quality >> c >> signal >> c >> noise; if(name == QString("%1:").arg(interface)){ if ( quality > 92 ) qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); - qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); + //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; quality = ( quality*100 ) / 92; return true; } } qDebug("WExtensions::statsCard no longer present."); quality = -1; signal = IW_LOWER; noise = IW_LOWER; return false; diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index ea19207..94c7518 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp @@ -7,25 +7,25 @@ /* system() */ #include <stdlib.h> #include <qfile.h> #include <qdir.h> #include <qtextstream.h> #include <qmessagebox.h> #include <qlineedit.h> #include <qspinbox.h> #include <qradiobutton.h> #include <qcheckbox.h> #include <qregexp.h> -WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name){ +WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name, Qt::WDestructiveClose){ config = new Config("wireless"); readConfig(); } WLANImp::~WLANImp( ){ delete config; } void WLANImp::readConfig() { qWarning( "WLANImp::readConfig() called." ); config->setGroup( "Properties" ); diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index 73e753c..7507c54 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp @@ -1,25 +1,24 @@ #include "wlanmodule.h" #include "wlanimp.h" #include "info.h" #include "wextensions.h" #include <qlabel.h> #include <qprogressbar.h> /** * Constructor, find all of the possible interfaces */ WLANModule::WLANModule() : Module() { - // get output from iwconfig } /** */ WLANModule::~WLANModule(){ Interface *i; for ( i=list.first(); i != 0; i=list.next() ) delete i; } /** * Change the current profile @@ -38,69 +37,70 @@ QString WLANModule::getPixmapName(Interface* ){ } /** * Check to see if the interface i is owned by this module. * @param Interface* interface to check against * @return bool true if i is owned by this module, false otherwise. */ bool WLANModule::isOwner(Interface *i){ WExtensions we(i->getInterfaceName()); if(!we.doesHaveWirelessExtensions()) return false; - //if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ i->setHardwareName("802.11b"); list.append(i); return true; - //} - //return false; } /** * Create, set tabWiget and return the WLANConfigure Module * @param tabWidget a pointer to the tab widget that this configure has. * @return QWidget* pointer to the tab widget in this modules configure. */ QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); (*tabWidget) = wlanconfig->tabWidget; return wlanconfig; } /** * Create, set tabWiget and return the Information Module * @param tabWidget a pointer to the tab widget that this information has. * @return QWidget* pointer to the tab widget in this modules info. */ QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ WExtensions we(i->getInterfaceName()); if(!we.doesHaveWirelessExtensions()) return NULL; - WlanInfo *info = new WlanInfo(0, "wireless info"); + WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); (*tabWidget) = info->tabWidget; info->essidLabel->setText(we.essid()); info->apLabel->setText(we.ap()); info->stationLabel->setText(we.station()); info->modeLabel->setText(we.mode()); info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); int signal = 0; int noise = 0; int quality = 0; we.stats(signal, noise, quality); info->signalProgressBar->setProgress(signal); info->noiseProgressBar->setProgress(noise); info->qualityProgressBar->setProgress(quality); info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); + //WlanInfo info (0, "wireless info", true); + //info.show(); + //return NULL; + return info; } /** * Get all active (up or down) interfaces * @return QList<Interface> A list of interfaces that exsist that havn't * been called by isOwner() */ QList<Interface> WLANModule::getInterfaces(){ return list; } diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO index 7a71142..d61c510 100644 --- a/noncore/settings/networksettings/TODO +++ b/noncore/settings/networksettings/TODO @@ -1,11 +1,9 @@ WLAN needs to be re-written to not use Config --remove WLAN Config item --sub class out the wlan info --check if an interface supports wireless extensions before config. +WHERE Is DHCP info stored??? PPP module needs to be written Write a class that parses /proc and not ifconfig -Possible other modules: ipsec, bluetooth +Possible other modules: ipsec, bluetooth, ipchains diff --git a/noncore/settings/networksettings/interface.cpp b/noncore/settings/networksettings/interface.cpp index a84b91f..929b3a1 100644 --- a/noncore/settings/networksettings/interface.cpp +++ b/noncore/settings/networksettings/interface.cpp @@ -1,21 +1,21 @@ #include "interface.h" #include <qdatetime.h> #include <qfile.h> #include <qdir.h> #include <qfileinfo.h> #include <qtextstream.h> #define IFCONFIG "/sbin/ifconfig" -#define HDCP_INFO_DIR "/etc/dhcpc" +#define DHCP_INFO_DIR "/etc/dhcpc" #include <stdio.h> #include <stdlib.h> 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(); } /** * Set status * @param newStatus - the new status * emit updateInterface @@ -162,25 +162,25 @@ bool Interface::refresh(){ } } file.close(); QFile::remove(fileName); // DHCP TESTING // reset DHCP info dhcpServerIp = ""; leaseObtained = ""; leaseExpires = ""; dhcp = false; - QString dhcpDirectory(HDCP_INFO_DIR); + QString dhcpDirectory(DHCP_INFO_DIR); QDir d(dhcpDirectory); if(!d.exists(dhcpDirectory)) dhcpDirectory = "/var/run"; // See if we have 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; } diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 9d81ab1..c86acdc 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -69,42 +69,44 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par currentProfileLabel->setText(line);
break;
}
}
file.close();
}
}
/**
* Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
+ qDebug("start Saving mainwindow");
// Save profiles.
Config cfg("NetworkSetup");
cfg.setGroup("General");
cfg.writeEntry("Profiles", profiles.join(" "));
// Delete all interfaces that don't have owners.
QMap<Interface*, QListViewItem*>::Iterator iIt;
for( iIt = items.begin(); iIt != items.end(); ++iIt ){
if(iIt.key()->getModuleOwner() == NULL)
delete iIt.key();
}
// Delete Modules and Libraries
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it ){
delete it.key();
delete it.data();
}
+ qDebug("done Saving mainwindow");
}
/**
* Load all modules that are found in the path
* @param path a directory that is scaned for any plugins that can be loaded
* and attempts to load them
*/
void MainWindowImp::loadModules(QString path){
//qDebug(path.latin1());
QDir d(path);
if(!d.exists())
return;
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index ef4ba8f..e545bd1 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp @@ -148,25 +148,25 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){ QTextStream wstream( &wfile ); wstream.readLine(); // skip the first two lines wstream.readLine(); // because they only contain headers while(!wstream.atEnd()){ wstream >> name >> status >> quality >> c >> signal >> c >> noise; if(name == QString("%1:").arg(interface)){ if ( quality > 92 ) qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); - qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); + //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; quality = ( quality*100 ) / 92; return true; } } qDebug("WExtensions::statsCard no longer present."); quality = -1; signal = IW_LOWER; noise = IW_LOWER; return false; diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index ea19207..94c7518 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp @@ -7,25 +7,25 @@ /* system() */ #include <stdlib.h> #include <qfile.h> #include <qdir.h> #include <qtextstream.h> #include <qmessagebox.h> #include <qlineedit.h> #include <qspinbox.h> #include <qradiobutton.h> #include <qcheckbox.h> #include <qregexp.h> -WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name){ +WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name, Qt::WDestructiveClose){ config = new Config("wireless"); readConfig(); } WLANImp::~WLANImp( ){ delete config; } void WLANImp::readConfig() { qWarning( "WLANImp::readConfig() called." ); config->setGroup( "Properties" ); diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 73e753c..7507c54 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp @@ -1,25 +1,24 @@ #include "wlanmodule.h" #include "wlanimp.h" #include "info.h" #include "wextensions.h" #include <qlabel.h> #include <qprogressbar.h> /** * Constructor, find all of the possible interfaces */ WLANModule::WLANModule() : Module() { - // get output from iwconfig } /** */ WLANModule::~WLANModule(){ Interface *i; for ( i=list.first(); i != 0; i=list.next() ) delete i; } /** * Change the current profile @@ -38,69 +37,70 @@ QString WLANModule::getPixmapName(Interface* ){ } /** * Check to see if the interface i is owned by this module. * @param Interface* interface to check against * @return bool true if i is owned by this module, false otherwise. */ bool WLANModule::isOwner(Interface *i){ WExtensions we(i->getInterfaceName()); if(!we.doesHaveWirelessExtensions()) return false; - //if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ i->setHardwareName("802.11b"); list.append(i); return true; - //} - //return false; } /** * Create, set tabWiget and return the WLANConfigure Module * @param tabWidget a pointer to the tab widget that this configure has. * @return QWidget* pointer to the tab widget in this modules configure. */ QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); (*tabWidget) = wlanconfig->tabWidget; return wlanconfig; } /** * Create, set tabWiget and return the Information Module * @param tabWidget a pointer to the tab widget that this information has. * @return QWidget* pointer to the tab widget in this modules info. */ QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ WExtensions we(i->getInterfaceName()); if(!we.doesHaveWirelessExtensions()) return NULL; - WlanInfo *info = new WlanInfo(0, "wireless info"); + WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); (*tabWidget) = info->tabWidget; info->essidLabel->setText(we.essid()); info->apLabel->setText(we.ap()); info->stationLabel->setText(we.station()); info->modeLabel->setText(we.mode()); info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); int signal = 0; int noise = 0; int quality = 0; we.stats(signal, noise, quality); info->signalProgressBar->setProgress(signal); info->noiseProgressBar->setProgress(noise); info->qualityProgressBar->setProgress(quality); info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); + //WlanInfo info (0, "wireless info", true); + //info.show(); + //return NULL; + return info; } /** * Get all active (up or down) interfaces * @return QList<Interface> A list of interfaces that exsist that havn't * been called by isOwner() */ QList<Interface> WLANModule::getInterfaces(){ return list; } |