From e483d88ee4158ba13d8c28b020d0e93b62e86d85 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 03 Jan 2003 21:24:40 +0000 Subject: - these have been renamed to networksettings --- (limited to 'noncore/net/networksetup/wlan') diff --git a/noncore/net/networksetup/wlan/config.in b/noncore/net/networksetup/wlan/config.in deleted file mode 100644 index 36ced3a..0000000 --- a/noncore/net/networksetup/wlan/config.in +++ b/dev/null @@ -1,4 +0,0 @@ - config WLAN - boolean "Wireless LAN Module" - default "y" if NETWORKSETUP - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES diff --git a/noncore/net/networksetup/wlan/info.ui b/noncore/net/networksetup/wlan/info.ui deleted file mode 100644 index 7a5bf0b..0000000 --- a/noncore/net/networksetup/wlan/info.ui +++ b/dev/null @@ -1,321 +0,0 @@ - -WlanInfo - - QWidget - - name - WlanInfo - - - geometry - - 0 - 0 - 238 - 316 - - - - caption - Interface Information - - - - margin - 0 - - - spacing - 0 - - - QTabWidget - - name - tabWidget - - - QWidget - - name - Widget2 - - - title - 802.11b - - - - margin - 11 - - - spacing - 6 - - - QLabel - - name - TextLabel4 - - - text - Channel - - - - QLabel - - name - TextLabel3 - - - text - Mode - - - - QLabel - - name - TextLabel2 - - - text - ESSID - - - - QLabel - - name - TextLabel1 - - - text - Station - - - - QLabel - - name - TextLabel9 - - - text - AP - - - - QLabel - - name - apLabel - - - frameShape - Panel - - - frameShadow - Sunken - - - - QLabel - - name - modeLabel - - - frameShape - Panel - - - frameShadow - Sunken - - - - QLabel - - name - essidLabel - - - frameShape - Panel - - - frameShadow - Sunken - - - - QLabel - - name - stationLabel - - - frameShape - Panel - - - frameShadow - Sunken - - - - QLabel - - name - channelLabel - - - frameShape - Panel - - - frameShadow - Sunken - - - - - name - Spacer7 - - - orientation - Vertical - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QProgressBar - - name - signalProgressBar - - - - QProgressBar - - name - noiseProgressBar - - - - QProgressBar - - name - qualityProgressBar - - - - QLabel - - name - rateLabel - - - sizePolicy - - 7 - 1 - - - - frameShape - Panel - - - frameShadow - Sunken - - - - QLabel - - name - TextLabel4_2 - - - text - Rate - - - - QLabel - - name - TextLabel3_2 - - - text - Quality - - - - QLabel - - name - TextLabel2_2 - - - text - Noise - - - - QLabel - - name - TextLabel1_2 - - - text - Signal - - - - - - - - - - QWidget -
qwidget.h
- - 100 - 100 - - 0 - - 7 - 7 - - image0 -
-
- - - image0 - 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 - - -
diff --git a/noncore/net/networksetup/wlan/infoimp.cpp b/noncore/net/networksetup/wlan/infoimp.cpp deleted file mode 100644 index bd56678..0000000 --- a/noncore/net/networksetup/wlan/infoimp.cpp +++ b/dev/null @@ -1,56 +0,0 @@ -#include "infoimp.h" -#include "wextensions.h" - -#include -#include -#include - -/** - * Constructor. If wireless extensions are enabled on device name then - * start a timer that every second will update the information. - */ -WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ - WExtensions *wExtensions = new WExtensions(name); - if(!wExtensions->doesHaveWirelessExtensions()){ - delete wExtensions; - qDebug("WlanInfoImp::No wireless extension"); - return; - } - delete wExtensions; - timer = new QTimer( this ); - connect( timer, SIGNAL(timeout()), this, SLOT(update())); - timer->start( 1000, false ); -} - -/** - * Updates the information about the wireless device. - */ -void WlanInfoImp::update(){ - WExtensions *wExtensions = new WExtensions(this->name()); - if(!wExtensions->doesHaveWirelessExtensions()){ - qDebug("No extension"); - delete wExtensions; - timer->stop(); - return; - } - essidLabel->setText(wExtensions->essid()); - apLabel->setText(wExtensions->ap()); - stationLabel->setText(wExtensions->station()); - modeLabel->setText(wExtensions->mode()); - channelLabel->setText(QString("%1").arg(wExtensions->channel())); - int signal = 0; - int noise = 0; - int quality = 0; - wExtensions->stats(signal, noise, quality); - if(signalProgressBar->progress() != signal) - signalProgressBar->setProgress(signal); - if(noiseProgressBar->progress() != noise) - noiseProgressBar->setProgress(noise); - if(qualityProgressBar->progress() != quality) - qualityProgressBar->setProgress(quality); - rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); - delete wExtensions; -} - -// infoimp.cpp - diff --git a/noncore/net/networksetup/wlan/infoimp.h b/noncore/net/networksetup/wlan/infoimp.h deleted file mode 100644 index 8f7f0d6..0000000 --- a/noncore/net/networksetup/wlan/infoimp.h +++ b/dev/null @@ -1,27 +0,0 @@ -#ifndef INFOIMP_H -#define INFOIMP_H - -#include "info.h" - -class QTimer; -//class WExtensions; - -class WlanInfoImp : public WlanInfo { - Q_OBJECT - -public: - WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - -private slots: - void update(); - -private: - //WExtensions *wExtensions; - QTimer *timer; - -}; - -#endif - -// infoimp.h - diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp deleted file mode 100644 index 827d075..0000000 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/dev/null @@ -1,200 +0,0 @@ -#include "wextensions.h" - -#include -#include - -#include -#include -#include - -#include - -#define PROCNETWIRELESS "/proc/net/wireless" -#define IW_LOWER 0 -#define IW_UPPER 256 - -/** - * Constructor. Sets hasWirelessExtensions - */ -WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { - fd = socket( AF_INET, SOCK_DGRAM, 0 ); - if(fd == -1) - return; - - const char* buffer[200]; - 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) - - const char* iname = interface.latin1(); - strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); - if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) - hasWirelessExtensions = true; -} - -/** - * @return QString the station name of the access point. - */ -QString WExtensions::station(){ - if(!hasWirelessExtensions) - return QString(); - const char* buffer[200]; - iwr.u.data.pointer = (caddr_t) buffer; - iwr.u.data.length = IW_ESSID_MAX_SIZE; - iwr.u.data.flags = 0; - if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ - iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; - return QString(iwr.u.data.pointer); - } - return QString(); -} - -/** - * @return QString the essid of the host 802.11 access point. - */ -QString WExtensions::essid(){ - if(!hasWirelessExtensions) - return QString(); - if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ - iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0'; - return QString(iwr.u.essid.pointer); - } - return QString(); -} - -/** - * @return QString the mode of interface - */ -QString WExtensions::mode(){ - if(!hasWirelessExtensions) - return QString(); - if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) - return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); - return QString(); -} - -/** - * Get the frequency that the interface is running at. - * @return int the frequency that the interfacae is running at. - */ -double WExtensions::frequency(){ - if(!hasWirelessExtensions) - return 0; - if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) - return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); - return 0; -} - -/** - * Get the channel that the interface is running at. - * @return int the channel that the interfacae is running at. - */ -int WExtensions::channel(){ - if(!hasWirelessExtensions) - return 0; - if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) - return 0; - - // http://www.elanix.com/pdf/an137e.pdf - - double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); - double left = 2.401; - double right = 2.416; - for(int channel = 1; channel<= 15; channel++){ - if( num >= left && num <= right ) - return channel; - left += 0.005; - right += 0.005; - } - qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); - return -1; -} - -/*** - * Get the current rate that the card is transmiting at. - * @return double the rate, 0 if error. - */ -double WExtensions::rate(){ - if(!hasWirelessExtensions) - return 0; - if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ - return ((double)iwr.u.bitrate.value)/1000000; - } - return 0; -} - - -/** - * @return QString the AccessPoint that the interface is connected to. - */ -QString WExtensions::ap(){ - if(!hasWirelessExtensions) - return QString(); - if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){ - QString ap; - ap = ap.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 ); - return ap; - } - else return QString(); -} - -/** - * Get the stats for interfaces - * @param signal the signal strength of interface - * @param noise the noise level of the interface - * @param quality the quality level of the interface - * @return bool true if successfull - */ -bool WExtensions::stats(int &signal, int &noise, int &quality){ - // gather link quality from /proc/net/wireless - if(!QFile::exists(PROCNETWIRELESS)) - return false; - - char c; - QString status; - QString name; - - QFile wfile( PROCNETWIRELESS ); - if(!wfile.open( IO_ReadOnly )) - return false; - - 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()); - 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; -} - -// wextensions.cpp diff --git a/noncore/net/networksetup/wlan/wextensions.h b/noncore/net/networksetup/wlan/wextensions.h deleted file mode 100644 index a89e33a..0000000 --- a/noncore/net/networksetup/wlan/wextensions.h +++ b/dev/null @@ -1,34 +0,0 @@ -#ifndef WEXTENSIONS_H -#define WEXTENSIONS_H - -#include - -#include -#include - -class WExtensions { - -public: - WExtensions(QString interfaceName); - QString getInterfaceName(){return interface;}; - bool doesHaveWirelessExtensions(){return hasWirelessExtensions;}; - QString station(); - QString essid(); - QString mode(); - double frequency(); - int channel(); - double rate(); - QString ap(); - bool stats( int &signal, int &noise, int &quality); - -private: - bool hasWirelessExtensions; - QString interface; - - // Used in we calls - struct iwreq iwr; - int fd; - -}; - -#endif diff --git a/noncore/net/networksetup/wlan/wlan.pro b/noncore/net/networksetup/wlan/wlan.pro deleted file mode 100644 index 23fc39a..0000000 --- a/noncore/net/networksetup/wlan/wlan.pro +++ b/dev/null @@ -1,12 +0,0 @@ -TEMPLATE = lib -CONFIG += qt warn_on release -#CONFIG += qt warn_on debug -DESTDIR = $(OPIEDIR)/plugins/networksetup -HEADERS = wlanimp.h infoimp.h wlanmodule.h wextensions.h -SOURCES = wlanimp.cpp infoimp.cpp wlanmodule.cpp wextensions.cpp -INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/ -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -L../interfaces/ -linterfaces -INTERFACES = wlan.ui info.ui -TARGET = wlanplugin -VERSION = 1.0.0 diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui deleted file mode 100644 index 744c559..0000000 --- a/noncore/net/networksetup/wlan/wlan.ui +++ b/dev/null @@ -1,491 +0,0 @@ - -WLAN - - QDialog - - name - WLAN - - - geometry - - 0 - 0 - 239 - 277 - - - - caption - Wireless LAN Setting - - - sizeGripEnabled - true - - - layoutMargin - - - - margin - 0 - - - spacing - 6 - - - QTabWidget - - name - tabWidget - - - enabled - true - - - QWidget - - name - ConfigPage - - - title - General - - - - margin - 11 - - - spacing - 6 - - - QCheckBox - - name - essAny - - - text - &Specify Access Point - - - - QGroupBox - - name - GroupBox1 - - - enabled - false - - - title - Specific &Access Point Settings - - - - margin - 11 - - - spacing - 6 - - - QLabel - - name - TextLabel1 - - - text - ESS-ID - - - - QLabel - - name - TextLabel2 - - - text - Network Type - - - - QLineEdit - - name - essSpecificLineEdit - - - - QComboBox - - - text - Infrastructure - - - - - text - Ad-Hoc - - - - name - networkType - - - - QLabel - - name - channelLabel - - - text - Channel - - - - QSpinBox - - name - networkChannel - - - enabled - false - - - maxValue - 15 - - - minValue - 1 - - - value - 6 - - - - - name - Spacer4 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - - - - name - Spacer31 - - - orientation - Vertical - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - - - QWidget - - name - WepPage - - - title - Encryption - - - - margin - 11 - - - spacing - 6 - - - QCheckBox - - name - wepEnabled - - - text - &Enable WEP - - - - QButtonGroup - - name - ButtonGroup43 - - - enabled - false - - - title - &Authentication Type - - - - margin - 11 - - - spacing - 6 - - - QRadioButton - - name - authOpen - - - text - &Open System - - - checked - true - - - - QRadioButton - - name - authShared - - - text - &Shared Key - - - - - - QButtonGroup - - name - KeyButtonGroup - - - enabled - false - - - title - &Key Setting - - - - margin - 11 - - - spacing - 6 - - - QLineEdit - - name - keyLineEdit0 - - - echoMode - Password - - - - QLineEdit - - name - keyLineEdit1 - - - echoMode - Password - - - - QLineEdit - - name - keyLineEdit2 - - - echoMode - Password - - - - QLineEdit - - name - keyLineEdit3 - - - echoMode - Password - - - - QRadioButton - - name - keyRadio0 - - - text - Key 1 - - - checked - true - - - - QRadioButton - - name - keyRadio1 - - - text - Key 2 - - - - QRadioButton - - name - keyRadio2 - - - text - Key 3 - - - - QRadioButton - - name - keyRadio3 - - - text - Key 4 - - - - - - - name - Spacer30 - - - orientation - Vertical - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - - - - - - - wepEnabled - toggled(bool) - ButtonGroup43 - setEnabled(bool) - - - wepEnabled - toggled(bool) - KeyButtonGroup - setEnabled(bool) - - - essAny - toggled(bool) - GroupBox1 - setEnabled(bool) - - - - tabWidget - essAny - essSpecificLineEdit - networkType - networkChannel - wepEnabled - authOpen - authShared - keyRadio0 - keyLineEdit0 - keyRadio1 - keyLineEdit1 - keyRadio2 - keyLineEdit2 - keyRadio3 - keyLineEdit3 - - diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp deleted file mode 100644 index 1782c22..0000000 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/dev/null @@ -1,247 +0,0 @@ -#include "wlanimp.h" -#include "interfacesetupimp.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* system() */ -#include - -#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" - -/** - * Constructor, read in the wireless.opts file for parsing later. - */ -WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") { - interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i); - tabWidget->insertTab(interfaceSetup, "TCP/IP"); - - // Read in the config file. - QString wlanFile = WIRELESS_OPTS; - QFile file(wlanFile); - if (file.open(IO_ReadOnly)){ - QTextStream stream( &file ); - QString line = ""; - while ( !stream.eof() ) { - line += stream.readLine(); - line += "\n"; - } - file.close(); - settingsFileText = QStringList::split("\n", line, true); - parseSettingFile(); - } - else - qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); - connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); -} - -void WLANImp::typeChanged(int mod){ - networkChannel->setEnabled(mod); - channelLabel->setEnabled(mod); -} - -/** - * Change the profile for both wireless settings and network settings. - */ -void WLANImp::setProfile(const QString &profile){ - interfaceSetup->setProfile(profile); - parseSettingFile(); -} - -/** - * Parses the settings file that was read in and gets any setting from it. - */ -void WLANImp::parseSettingFile(){ - bool foundCase = false; - bool found = false; - for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { - QString line = (*it).simplifyWhiteSpace(); - if(line.contains("case")) - foundCase = true; - // See if we found our scheme to write or the sceme couldn't be found - if((foundCase && line.contains("esac")) || - (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) - found = true; - - if(line.contains(";;")) - found = false; - if(found){ - // write out scheme - if(line.contains("ESSID=")){ - QString id = line.mid(line.find("ESSID=")+6, line.length()); - if(id == "any"){ - essAny->setChecked(false); - }else{ - essAny->setChecked(true); - essSpecificLineEdit->setText(id); - } - } - if(line.contains("MODE=")){ - QString mode = line.mid(line.find("MODE=")+5, line.length()); - if(mode == "Managed"){ - networkType->setCurrentItem(0); - channelLabel->setEnabled(false); - networkChannel->setEnabled(false); - } - else{ - networkType->setCurrentItem(1); - networkChannel->setEnabled(true); - channelLabel->setEnabled(true); - } - } - if(line.contains("#KEY0=")) - keyLineEdit0->setText(line.mid(6, line.length())); - if(line.contains("#KEY1=")) - keyLineEdit1->setText(line.mid(6, line.length())); - if(line.contains("#KEY2=")) - keyLineEdit2->setText(line.mid(6, line.length())); - if(line.contains("#KEY3=")) - keyLineEdit3->setText(line.mid(6, line.length())); - - if(line.contains("KEY=")){ - wepEnabled->setChecked(true); - QString key; - if(line.right(5) == (" open")){ - key = line.mid(4, line.length()-5); - authOpen->setChecked(true); - authShared->setChecked(false); - } - else{ - authOpen->setChecked(false); - authShared->setChecked(true); - key = line.mid(4, line.length()); - } - if(key == keyLineEdit0->text()) keyRadio0->setChecked(true); - if(key == keyLineEdit1->text()) keyRadio1->setChecked(true); - if(key == keyLineEdit2->text()) keyRadio2->setChecked(true); - if(key == keyLineEdit3->text()) keyRadio3->setChecked(true); - } - if(line.contains("CHANNEL=")){ - networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); - } - } - } -} - -/** - * Saves settings to the wireless.opts file using the current profile - */ -void WLANImp::changeAndSaveSettingFile(){ - QString wlanFile = WIRELESS_OPTS; - QFile::remove(wlanFile); - QFile file(wlanFile); - - if (!file.open(IO_ReadWrite)){ - qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); - return; - } - - QTextStream stream( &file ); - bool foundCase = false; - bool found = false; - bool output = true; - for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { - QString line = (*it).simplifyWhiteSpace(); - if(line.contains("case")) - foundCase = true; - // See if we found our scheme to write or the sceme couldn't be found - if((foundCase && line.contains("esac") && !found) || - (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ - // write out scheme - found = true; - output = false; - - if(!line.contains("esac")) - stream << line << "\n"; - if(!essAny->isChecked() == true){ - stream << "\tESSID=any\n"; - stream << "\tMODE=Managed\n"; - } - else{ - stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; - stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; - stream << "\tCHANNEL=" << networkChannel->value() << "\n"; - } - - stream << "\t#KEY0=" << keyLineEdit0->text() << "\n"; - stream << "\t#KEY1=" << keyLineEdit1->text() << "\n"; - stream << "\t#KEY2=" << keyLineEdit2->text() << "\n"; - stream << "\t#KEY3=" << keyLineEdit3->text() << "\n"; - - if(wepEnabled->isChecked()){ - stream << "\tKEY=\""; - if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); - if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); - if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); - if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); - if(authOpen->isChecked()) - stream << " open"; - else - stream << " restricted"; - stream << "\"\n"; - } - stream << "\tRATE=auto\n"; - if(line.contains("esac")) - stream << line << "\n"; - } - if(line.contains(";;")) - output = true; - if(output && (*it).length() ) - stream << (*it) << '\n'; - } - file.close(); -} - -/** - * Check to see if the current config is valid - * Save wireless.opts, save interfaces - */ -void WLANImp::accept(){ - if(wepEnabled->isChecked()){ - if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){ - QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); - return; - } - } - - if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ - QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); - return; - } - - // Ok settings are good here, save - changeAndSaveSettingFile(); - - // Try to save the interfaces settings. - if(!interfaceSetup->saveChanges()) - return; - - // Restart the device now that the settings have changed - QString initpath; - if( QDir("/etc/rc.d/init.d").exists() ) - initpath = "/etc/rc.d/init.d"; - else if( QDir("/etc/init.d").exists() ) - initpath = "/etc/init.d"; - - // It would be kinda cool if we didn't have to do this and could just to ifup/down - - if( initpath ) - system(QString("%1/pcmcia stop").arg(initpath)); - if( initpath ) - system(QString("%1/pcmcia start").arg(initpath)); - - // Close out the dialog - QDialog::accept(); -} - -// wlanimp.cpp - diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h deleted file mode 100644 index 310836c..0000000 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/dev/null @@ -1,34 +0,0 @@ -#ifndef WLANIMP_H -#define WLANIMP_H - -#include "wlan.h" -#include - -class InterfaceSetupImp; -class Interface; -class Config; - -class WLANImp : public WLAN { - Q_OBJECT - -public: - WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); - void setProfile(const QString &profile); - -protected: - void accept(); - -private slots: - void typeChanged(int); - -private: - void parseSettingFile(); - void changeAndSaveSettingFile(); - - InterfaceSetupImp *interfaceSetup; - QStringList settingsFileText; - QString currentProfile; -}; - -#endif - diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp deleted file mode 100644 index 3979e60..0000000 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/dev/null @@ -1,113 +0,0 @@ -#include "wlanmodule.h" -#include "wlanimp.h" -#include "infoimp.h" -#include "wextensions.h" -#include "interfaceinformationimp.h" - -#include -#include -#include - -/** - * Constructor, find all of the possible interfaces - */ -WLANModule::WLANModule() : Module() { -} - -/** - * Delete any interfaces that we own. - */ -WLANModule::~WLANModule(){ - Interface *i; - for ( i=list.first(); i != 0; i=list.next() ) - delete i; -} - -/** - * Change the current profile - */ -void WLANModule::setProfile(const 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){ - WExtensions we(i->getInterfaceName()); - if(!we.doesHaveWirelessExtensions()) - return false; - - i->setHardwareName("802.11b"); - list.append(i); - return true; -} - -/** - * Create, and return the WLANConfigure Module - * @return QWidget* pointer to this modules configure. - */ -QWidget *WLANModule::configure(Interface *i){ - WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); - wlanconfig->setProfile(profile); - return wlanconfig; -} - -/** - * Create, and return the Information Module - * @return QWidget* pointer to this modules info. - */ -QWidget *WLANModule::information(Interface *i){ - WExtensions we(i->getInterfaceName()); - if(!we.doesHaveWirelessExtensions()) - return NULL; - - WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); - InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); - info->tabWidget->insertTab(information, "TCP/IP"); - return info; -} - -/** - * Get all active (up or down) interfaces - * @return QList A list of interfaces that exsist that havn't - * been called by isOwner() - */ -QList WLANModule::getInterfaces(){ - return list; -} - -/** - * Attempt to add a new interface as defined by name - * @param name the name of the type of interface that should be created given - * by possibleNewInterfaces(); - * @return Interface* NULL if it was unable to be created. - */ -Interface *WLANModule::addNewInterface(const QString &){ - // We can't add a 802.11 interface, either the hardware will be there - // or it wont. - return NULL; -} - -/** - * Attempts to remove the interface, doesn't delete i - * @return bool true if successfull, false otherwise. - */ -bool WLANModule::remove(Interface*){ - // Can't remove a hardware device, you can stop it though. - return false; -} - -// wlanmodule.cpp - diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h deleted file mode 100644 index 3a54de6..0000000 --- a/noncore/net/networksetup/wlan/wlanmodule.h +++ b/dev/null @@ -1,41 +0,0 @@ -#ifndef WLAN_MODULE_H -#define WLAN_MODULE_H - -#include "module.h" - -class WLANModule : Module{ - -signals: - void updateInterface(Interface *i); - -public: - WLANModule(); - ~WLANModule(); - - void setProfile(const QString &newProfile); - bool isOwner(Interface *); - QWidget *configure(Interface *i); - QWidget *information(Interface *i); - QList getInterfaces(); - void possibleNewInterfaces(QMap &){}; - Interface *addNewInterface(const QString &name); - bool remove(Interface* i); - QString getPixmapName(Interface* i); - -private: - QList list; - QString profile; - -}; - -extern "C" -{ - void* create_plugin() { - return new WLANModule(); - } -}; - -#endif - -// wlanmodule.h - -- cgit v0.9.0.2