-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 7 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 5 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 5 |
4 files changed, 18 insertions, 6 deletions
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 843f630..9d81ab1 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp @@ -1,181 +1,188 @@ #include "mainwindowimp.h"
#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
#include "interfaces.h"
#include "module.h"
#include "kprocess.h"
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qlistbox.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qlist.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#define TEMP_ALL "/tmp/ifconfig-a"
#define TEMP_UP "/tmp/ifconfig"
#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
// Load connections.
loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
getInterfaceList();
connectionList->header()->hide();
Config cfg("NetworkSetup");
profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
QFile file(scheme);
if ( file.open(IO_ReadOnly) ) { // file opened successfully
QTextStream stream( &file ); // use a text stream
while ( !stream.eof() ) { // until end of file...
QString line = stream.readLine(); // line of text excluding '\n'
if(line.contains("SCHEME")){
line = line.mid(7, line.length());
currentProfileLabel->setText(line);
break;
}
}
file.close();
}
}
/**
* Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
// 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();
}
}
/**
* 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;
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if(fi->fileName().contains(".so")){
loadPlugin(path + "/" + fi->fileName());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
//qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL){
qDebug("MainWindowImp: Couldn't create object, but did load library!");
delete lib;
return NULL;
}
// Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* The Add button was clicked. Bring up the add dialog and if OK is hit
* load the plugin and append it to the list
*/
void MainWindowImp::addClicked(){
QMap<Module*, QLibrary*>::Iterator it;
QMap<QString, QString> list;
QMap<QString, Module*> newInterfaceOwners;
list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()){
(it.key())->possibleNewInterfaces(list);
}
}
// See if the list has anything that we can add.
if(list.count() == 0){
QMessageBox::information(this, "Sorry", "Nothing to add.", "Ok");
return;
}
AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
addNewConnection.addConnections(list);
addNewConnection.showMaximized();
if(QDialog::Accepted == addNewConnection.exec()){
QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
if(!item)
return;
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()){
Interface *i = (it.key())->addNewInterface(item->text(0));
if(i){
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
}
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index cbb520d..24cb1cd 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp @@ -1,172 +1,171 @@ #include "wlanmodule.h" -#include <qpe/config.h> #include "wlanimp.h" #include "info.h" - #include <arpa/inet.h> #include <sys/socket.h> #include <linux/if_ether.h> #include <netinet/ip.h> #include <sys/ioctl.h> #include <linux/wireless.h> #include <unistd.h> #include <math.h> #include <errno.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <qlabel.h> /** * Constructor, find all of the possible interfaces */ WLANModule::WLANModule() : Module() { // get output from iwconfig } /** * Change the current profile */ void WLANModule::setProfile(QString newProfile){ profile = newProfile; } /** * get the icon name for this device. * @param Interface* can be used in determining the icon. * @return QString the icon name (minus .png, .gif etc) */ QString WLANModule::getPixmapName(Interface* ){ return "wlan"; } /** * 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){ if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ i->setHardwareName("802.11b"); 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 *i, QTabWidget **tabWidget){ - WLANImp *wlanconfig = new WLANImp( ); + 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){ + return NULL; WlanInfo *info = new WlanInfo(0, "wireless info"); (*tabWidget) = info->tabWidget; struct ifreq ifr; struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; int fd = socket( AF_INET, SOCK_DGRAM, 0 ); const char* buffer[200]; struct iwreq iwr; memset( &iwr, 0, sizeof( iwr ) ); iwr.u.essid.pointer = (caddr_t) buffer; iwr.u.essid.length = IW_ESSID_MAX_SIZE; iwr.u.essid.flags = 0; // check if it is an IEEE 802.11 standard conform // wireless device by sending SIOCGIWESSID // which also gives back the Extended Service Set ID // (see IEEE 802.11 for more information) QString n = (i->getInterfaceName()); const char* iname = n.latin1(); strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); int result = ioctl( fd, SIOCGIWESSID, &iwr ); if ( result == 0 ){ //hasWirelessExtensions = true; iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0'; info->essidLabel->setText(QString(iwr.u.essid.pointer)); } else return info; //info->essidLabel->setText("*** Unknown ***"); // Address of associated access-point result = ioctl( fd, SIOCGIWAP, &iwr ); if ( result == 0 ){ QString foo = foo.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", iwr.u.ap_addr.sa_data[0]&0xff, iwr.u.ap_addr.sa_data[1]&0xff, iwr.u.ap_addr.sa_data[2]&0xff, iwr.u.ap_addr.sa_data[3]&0xff, iwr.u.ap_addr.sa_data[4]&0xff, iwr.u.ap_addr.sa_data[5]&0xff ); info->apLabel->setText(foo); } else info->apLabel->setText("*** Unknown ***"); iwr.u.data.pointer = (caddr_t) buffer; iwr.u.data.length = IW_ESSID_MAX_SIZE; iwr.u.data.flags = 0; result = ioctl( fd, SIOCGIWNICKN, &iwr ); if ( result == 0 ){ iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; info->stationLabel->setText(iwr.u.data.pointer); } else info->stationLabel->setText("*** Unknown ***"); result = ioctl( fd, SIOCGIWMODE, &iwr ); if ( result == 0 ) info->modeLabel->setText( QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed")); else info->modeLabel->setText("*** Unknown ***"); result = ioctl( fd, SIOCGIWFREQ, &iwr ); if ( result == 0 ) info->freqLabel->setText(QString("%1").arg((double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000))); else info->freqLabel->setText("*** Unknown ***"); /* // gather link quality from /proc/net/wireless char c; QString status; QString name; QFile wfile( PROCNETWIRELESS ); bool hasFile = wfile.open( IO_ReadOnly ); QTextStream wstream( &wfile ); if ( hasFile ) { wstream.readLine(); // skip the first two lines wstream.readLine(); // because they only contain headers } if ( ( !hasFile ) || ( wstream.atEnd() ) ) { #ifdef MDEBUG qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." ); #endif quality = -1; signal = IW_LOWER; noise = IW_LOWER; return false; } wstream >> name >> status >> quality >> c >> signal >> c >> noise; if ( quality > 92 ) diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 843f630..9d81ab1 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -1,181 +1,188 @@ #include "mainwindowimp.h"
#include "addconnectionimp.h"
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
#include "interfaces.h"
#include "module.h"
#include "kprocess.h"
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qlistbox.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qlist.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#define TEMP_ALL "/tmp/ifconfig-a"
#define TEMP_UP "/tmp/ifconfig"
#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
// Load connections.
loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
getInterfaceList();
connectionList->header()->hide();
Config cfg("NetworkSetup");
profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
QFile file(scheme);
if ( file.open(IO_ReadOnly) ) { // file opened successfully
QTextStream stream( &file ); // use a text stream
while ( !stream.eof() ) { // until end of file...
QString line = stream.readLine(); // line of text excluding '\n'
if(line.contains("SCHEME")){
line = line.mid(7, line.length());
currentProfileLabel->setText(line);
break;
}
}
file.close();
}
}
/**
* Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp(){
// 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();
}
}
/**
* 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;
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if(fi->fileName().contains(".so")){
loadPlugin(path + "/" + fi->fileName());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
//qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL){
qDebug("MainWindowImp: Couldn't create object, but did load library!");
delete lib;
return NULL;
}
// Store for deletion later
libraries.insert(object, lib);
return object;
}
/**
* The Add button was clicked. Bring up the add dialog and if OK is hit
* load the plugin and append it to the list
*/
void MainWindowImp::addClicked(){
QMap<Module*, QLibrary*>::Iterator it;
QMap<QString, QString> list;
QMap<QString, Module*> newInterfaceOwners;
list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()){
(it.key())->possibleNewInterfaces(list);
}
}
// See if the list has anything that we can add.
if(list.count() == 0){
QMessageBox::information(this, "Sorry", "Nothing to add.", "Ok");
return;
}
AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
addNewConnection.addConnections(list);
addNewConnection.showMaximized();
if(QDialog::Accepted == addNewConnection.exec()){
QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
if(!item)
return;
for( it = libraries.begin(); it != libraries.end(); ++it ){
if(it.key()){
Interface *i = (it.key())->addNewInterface(item->text(0));
if(i){
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
}
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index cbb520d..24cb1cd 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp @@ -1,172 +1,171 @@ #include "wlanmodule.h" -#include <qpe/config.h> #include "wlanimp.h" #include "info.h" - #include <arpa/inet.h> #include <sys/socket.h> #include <linux/if_ether.h> #include <netinet/ip.h> #include <sys/ioctl.h> #include <linux/wireless.h> #include <unistd.h> #include <math.h> #include <errno.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <qlabel.h> /** * Constructor, find all of the possible interfaces */ WLANModule::WLANModule() : Module() { // get output from iwconfig } /** * Change the current profile */ void WLANModule::setProfile(QString newProfile){ profile = newProfile; } /** * get the icon name for this device. * @param Interface* can be used in determining the icon. * @return QString the icon name (minus .png, .gif etc) */ QString WLANModule::getPixmapName(Interface* ){ return "wlan"; } /** * 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){ if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ i->setHardwareName("802.11b"); 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 *i, QTabWidget **tabWidget){ - WLANImp *wlanconfig = new WLANImp( ); + 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){ + return NULL; WlanInfo *info = new WlanInfo(0, "wireless info"); (*tabWidget) = info->tabWidget; struct ifreq ifr; struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; int fd = socket( AF_INET, SOCK_DGRAM, 0 ); const char* buffer[200]; struct iwreq iwr; memset( &iwr, 0, sizeof( iwr ) ); iwr.u.essid.pointer = (caddr_t) buffer; iwr.u.essid.length = IW_ESSID_MAX_SIZE; iwr.u.essid.flags = 0; // check if it is an IEEE 802.11 standard conform // wireless device by sending SIOCGIWESSID // which also gives back the Extended Service Set ID // (see IEEE 802.11 for more information) QString n = (i->getInterfaceName()); const char* iname = n.latin1(); strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); int result = ioctl( fd, SIOCGIWESSID, &iwr ); if ( result == 0 ){ //hasWirelessExtensions = true; iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0'; info->essidLabel->setText(QString(iwr.u.essid.pointer)); } else return info; //info->essidLabel->setText("*** Unknown ***"); // Address of associated access-point result = ioctl( fd, SIOCGIWAP, &iwr ); if ( result == 0 ){ QString foo = foo.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", iwr.u.ap_addr.sa_data[0]&0xff, iwr.u.ap_addr.sa_data[1]&0xff, iwr.u.ap_addr.sa_data[2]&0xff, iwr.u.ap_addr.sa_data[3]&0xff, iwr.u.ap_addr.sa_data[4]&0xff, iwr.u.ap_addr.sa_data[5]&0xff ); info->apLabel->setText(foo); } else info->apLabel->setText("*** Unknown ***"); iwr.u.data.pointer = (caddr_t) buffer; iwr.u.data.length = IW_ESSID_MAX_SIZE; iwr.u.data.flags = 0; result = ioctl( fd, SIOCGIWNICKN, &iwr ); if ( result == 0 ){ iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; info->stationLabel->setText(iwr.u.data.pointer); } else info->stationLabel->setText("*** Unknown ***"); result = ioctl( fd, SIOCGIWMODE, &iwr ); if ( result == 0 ) info->modeLabel->setText( QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed")); else info->modeLabel->setText("*** Unknown ***"); result = ioctl( fd, SIOCGIWFREQ, &iwr ); if ( result == 0 ) info->freqLabel->setText(QString("%1").arg((double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000))); else info->freqLabel->setText("*** Unknown ***"); /* // gather link quality from /proc/net/wireless char c; QString status; QString name; QFile wfile( PROCNETWIRELESS ); bool hasFile = wfile.open( IO_ReadOnly ); QTextStream wstream( &wfile ); if ( hasFile ) { wstream.readLine(); // skip the first two lines wstream.readLine(); // because they only contain headers } if ( ( !hasFile ) || ( wstream.atEnd() ) ) { #ifdef MDEBUG qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." ); #endif quality = -1; signal = IW_LOWER; noise = IW_LOWER; return false; } wstream >> name >> status >> quality >> c >> signal >> c >> noise; if ( quality > 92 ) |