author | simon <simon> | 2003-01-03 21:24:40 (UTC) |
---|---|---|
committer | simon <simon> | 2003-01-03 21:24:40 (UTC) |
commit | e483d88ee4158ba13d8c28b020d0e93b62e86d85 (patch) (side-by-side diff) | |
tree | 2c4ac27cf05428ad58257869c90a9ce51c4e43d3 /noncore/net/networksetup/wlan | |
parent | 91395e6cd4d104b05f962ae8833767bbbd094163 (diff) | |
download | opie-e483d88ee4158ba13d8c28b020d0e93b62e86d85.zip opie-e483d88ee4158ba13d8c28b020d0e93b62e86d85.tar.gz opie-e483d88ee4158ba13d8c28b020d0e93b62e86d85.tar.bz2 |
- these have been renamed to networksettings
-rw-r--r-- | noncore/net/networksetup/wlan/config.in | 4 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/info.ui | 321 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/infoimp.cpp | 56 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/infoimp.h | 27 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 200 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.h | 34 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlan.pro | 12 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlan.ui | 491 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 247 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.h | 34 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 113 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.h | 41 |
12 files changed, 0 insertions, 1580 deletions
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 @@ -<!DOCTYPE UI><UI> -<class>WlanInfo</class> -<widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>WlanInfo</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>238</width> - <height>316</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Interface Information</string> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>0</number> - </property> - <widget> - <class>QTabWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tabWidget</cstring> - </property> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Widget2</cstring> - </property> - <attribute> - <name>title</name> - <string>802.11b</string> - </attribute> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel4</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Channel</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Mode</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>ESSID</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Station</string> - </property> - </widget> - <widget row="4" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel9</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>AP</string> - </property> - </widget> - <widget row="4" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>apLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="2" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>modeLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="1" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>essidLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="0" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>stationLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="3" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>channelLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <spacer row="9" column="1" > - <property> - <name>name</name> - <cstring>Spacer7</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="5" column="1" > - <class>QProgressBar</class> - <property stdset="1"> - <name>name</name> - <cstring>signalProgressBar</cstring> - </property> - </widget> - <widget row="6" column="1" > - <class>QProgressBar</class> - <property stdset="1"> - <name>name</name> - <cstring>noiseProgressBar</cstring> - </property> - </widget> - <widget row="7" column="1" > - <class>QProgressBar</class> - <property stdset="1"> - <name>name</name> - <cstring>qualityProgressBar</cstring> - </property> - </widget> - <widget row="8" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>rateLabel</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>1</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="8" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel4_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Rate</string> - </property> - </widget> - <widget row="7" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Quality</string> - </property> - </widget> - <widget row="6" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Noise</string> - </property> - </widget> - <widget row="5" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Signal</string> - </property> - </widget> - </grid> - </widget> - </widget> - </vbox> -</widget> -<customwidgets> - <customwidget> - <class>QWidget</class> - <header location="local">qwidget.h</header> - <sizehint> - <width>100</width> - <height>100</height> - </sizehint> - <container>0</container> - <sizepolicy> - <hordata>7</hordata> - <verdata>7</verdata> - </sizepolicy> - <pixmap>image0</pixmap> - </customwidget> -</customwidgets> -<images> - <image> - <name>image0</name> - <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> - </image> -</images> -</UI> 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 <qtimer.h> -#include <qprogressbar.h> -#include <qlabel.h> - -/** - * 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 <qfile.h> -#include <qtextstream.h> - -#include <arpa/inet.h> -#include <sys/socket.h> -#include <sys/ioctl.h> - -#include <math.h> - -#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 <qstring.h> - -#include <netinet/ip.h> -#include <linux/wireless.h> - -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 @@ -<!DOCTYPE UI><UI> -<class>WLAN</class> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>WLAN</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>239</width> - <height>277</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Wireless LAN Setting</string> - </property> - <property stdset="1"> - <name>sizeGripEnabled</name> - <bool>true</bool> - </property> - <property> - <name>layoutMargin</name> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QTabWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tabWidget</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>ConfigPage</cstring> - </property> - <attribute> - <name>title</name> - <string>General</string> - </attribute> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>essAny</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Specify Access Point</string> - </property> - </widget> - <widget> - <class>QGroupBox</class> - <property stdset="1"> - <name>name</name> - <cstring>GroupBox1</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>title</name> - <string>Specific &Access Point Settings</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>ESS-ID</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Network Type</string> - </property> - </widget> - <widget row="0" column="1" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>essSpecificLineEdit</cstring> - </property> - </widget> - <widget row="1" column="1" rowspan="1" colspan="2" > - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>Infrastructure</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>Ad-Hoc</string> - </property> - </item> - <property stdset="1"> - <name>name</name> - <cstring>networkType</cstring> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>channelLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Channel</string> - </property> - </widget> - <widget row="2" column="1" > - <class>QSpinBox</class> - <property stdset="1"> - <name>name</name> - <cstring>networkChannel</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>maxValue</name> - <number>15</number> - </property> - <property stdset="1"> - <name>minValue</name> - <number>1</number> - </property> - <property stdset="1"> - <name>value</name> - <number>6</number> - </property> - </widget> - <spacer row="2" column="2" > - <property> - <name>name</name> - <cstring>Spacer4</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer31</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </vbox> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>WepPage</cstring> - </property> - <attribute> - <name>title</name> - <string>Encryption</string> - </attribute> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>wepEnabled</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Enable WEP</string> - </property> - </widget> - <widget> - <class>QButtonGroup</class> - <property stdset="1"> - <name>name</name> - <cstring>ButtonGroup43</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>title</name> - <string>&Authentication Type</string> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>authOpen</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Open System</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <widget> - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>authShared</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Shared Key</string> - </property> - </widget> - </hbox> - </widget> - <widget> - <class>QButtonGroup</class> - <property stdset="1"> - <name>name</name> - <cstring>KeyButtonGroup</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>title</name> - <string>&Key Setting</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>keyLineEdit0</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="1" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>keyLineEdit1</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="2" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>keyLineEdit2</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="3" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>keyLineEdit3</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="0" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>keyRadio0</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Key 1</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <widget row="1" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>keyRadio1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Key 2</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>keyRadio2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Key 3</string> - </property> - </widget> - <widget row="3" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>keyRadio3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Key 4</string> - </property> - </widget> - </grid> - </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer30</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </vbox> - </widget> - </widget> - </vbox> -</widget> -<connections> - <connection> - <sender>wepEnabled</sender> - <signal>toggled(bool)</signal> - <receiver>ButtonGroup43</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>wepEnabled</sender> - <signal>toggled(bool)</signal> - <receiver>KeyButtonGroup</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>essAny</sender> - <signal>toggled(bool)</signal> - <receiver>GroupBox1</receiver> - <slot>setEnabled(bool)</slot> - </connection> -</connections> -<tabstops> - <tabstop>tabWidget</tabstop> - <tabstop>essAny</tabstop> - <tabstop>essSpecificLineEdit</tabstop> - <tabstop>networkType</tabstop> - <tabstop>networkChannel</tabstop> - <tabstop>wepEnabled</tabstop> - <tabstop>authOpen</tabstop> - <tabstop>authShared</tabstop> - <tabstop>keyRadio0</tabstop> - <tabstop>keyLineEdit0</tabstop> - <tabstop>keyRadio1</tabstop> - <tabstop>keyLineEdit1</tabstop> - <tabstop>keyRadio2</tabstop> - <tabstop>keyLineEdit2</tabstop> - <tabstop>keyRadio3</tabstop> - <tabstop>keyLineEdit3</tabstop> -</tabstops> -</UI> 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 <qfile.h> -#include <qdir.h> -#include <qtextstream.h> -#include <qmessagebox.h> -#include <qlineedit.h> -#include <qlabel.h> -#include <qspinbox.h> -#include <qradiobutton.h> -#include <qcheckbox.h> -#include <qtabwidget.h> -#include <qcombobox.h> - -/* system() */ -#include <stdlib.h> - -#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 <qstringlist.h> - -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 <qlabel.h> -#include <qprogressbar.h> -#include <qtabwidget.h> - -/** - * 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<Interface> A list of interfaces that exsist that havn't - * been called by isOwner() - */ -QList<Interface> 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<Interface> getInterfaces(); - void possibleNewInterfaces(QMap<QString, QString> &){}; - Interface *addNewInterface(const QString &name); - bool remove(Interface* i); - QString getPixmapName(Interface* i); - -private: - QList<Interface> list; - QString profile; - -}; - -extern "C" -{ - void* create_plugin() { - return new WLANModule(); - } -}; - -#endif - -// wlanmodule.h - |