author | benmeyer <benmeyer> | 2002-10-25 19:34:32 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-25 19:34:32 (UTC) |
commit | f16dd7fc272f3f8354dc696fcc881dfe74755a21 (patch) (side-by-side diff) | |
tree | edaab125b322744d8684e6aee4d2c5955b68689b /noncore/net/networksetup/wlan | |
parent | 77347ba522a5913ff17561e6fd2c15981d42e86b (diff) | |
download | opie-f16dd7fc272f3f8354dc696fcc881dfe74755a21.zip opie-f16dd7fc272f3f8354dc696fcc881dfe74755a21.tar.gz opie-f16dd7fc272f3f8354dc696fcc881dfe74755a21.tar.bz2 |
Moved Interfaces into a library
Diffstat (limited to 'noncore/net/networksetup/wlan') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 6 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlan.pro | 4 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 14 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.h | 8 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 22 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.h | 4 |
6 files changed, 36 insertions, 22 deletions
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp index e545bd1..eb6fc42 100644 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/noncore/net/networksetup/wlan/wextensions.cpp @@ -7,45 +7,45 @@ #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){ +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; - else - hasWirelessExtensions = false; } /** * @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; diff --git a/noncore/net/networksetup/wlan/wlan.pro b/noncore/net/networksetup/wlan/wlan.pro index f28feb2..23fc39a 100644 --- a/noncore/net/networksetup/wlan/wlan.pro +++ b/noncore/net/networksetup/wlan/wlan.pro @@ -1,12 +1,12 @@ 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 ../ +INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/ DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -L../interfaces/ -linterfaces INTERFACES = wlan.ui info.ui TARGET = wlanplugin VERSION = 1.0.0 diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 45952b9..7c902e0 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp @@ -6,28 +6,36 @@ #include <qpe/global.h> /* system() */ #include <stdlib.h> #include <qfile.h> #include <qdir.h> #include <qtextstream.h> #include <qmessagebox.h> #include <qlineedit.h> #include <qspinbox.h> #include <qradiobutton.h> #include <qcheckbox.h> #include <qregexp.h> +#include <qpe/config.h> +#include <qtabwidget.h> +#include "interfacesetupimp.h" -WLANImp::WLANImp( QWidget* parent, const char* name, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ +WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ config = new Config("wireless"); + interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i);//, Qt::WDestructiveClose); + //configure->setProfile(currentProfile); + tabWidget->insertTab(interfaceSetup, "TCP/IP"); + readConfig(); + } WLANImp::~WLANImp( ){ delete config; } void WLANImp::readConfig() { qWarning( "WLANImp::readConfig() called." ); config->setGroup( "Properties" ); QString ssid = config->readEntry( "SSID", "any" ); if( ssid == "any" || ssid == "ANY" ){ @@ -100,26 +108,28 @@ bool WLANImp::writeConfig() config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); return true; return writeWirelessOpts( ); } /** */ void WLANImp::accept() { - if ( writeConfig() ) + if ( writeConfig() ){ + interfaceSetup->saveChanges(); QDialog::accept(); + } } bool WLANImp::writeWirelessOpts( QString scheme ) { qWarning( "WLANImp::writeWirelessOpts entered." ); QString prev = "/etc/pcmcia/wireless.opts"; QFile prevFile(prev); if ( !prevFile.open( IO_ReadOnly ) ) return false; QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; QFile tmpFile(tmp); diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index 59b7c59..608d681 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h @@ -1,27 +1,31 @@ #ifndef WLANIMP_H #define WLANIMP_H #include "wlan.h" -#include <qpe/config.h> +class InterfaceSetupImp; +class Interface; +class Config; class WLANImp : public WLAN { Q_OBJECT public: - WLANImp( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); ~WLANImp( ); protected: void accept(); private: void readConfig(); bool writeConfig(); bool writeWirelessOpts( QString scheme = "*" ); bool writeWlanngOpts( QString scheme = "*" ); Config* config; + InterfaceSetupImp *interfaceSetup; + }; #endif diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index 9ab3b76..c8becb0 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp @@ -1,19 +1,21 @@ #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; @@ -44,46 +46,44 @@ QString WLANModule::getPixmapName(Interface* ){ */ bool WLANModule::isOwner(Interface *i){ WExtensions we(i->getInterfaceName()); if(!we.doesHaveWirelessExtensions()) return false; i->setHardwareName("802.11b"); list.append(i); return true; } /** - * 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. + * Create, and return the WLANConfigure Module + * @return QWidget* pointer to this modules configure. */ -QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ - WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose); - (*tabWidget) = wlanconfig->tabWidget; +QWidget *WLANModule::configure(Interface *i){ + WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); 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. + * Create, and return the Information Module + * @return QWidget* pointer to this modules info. */ -QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ +QWidget *WLANModule::information(Interface *i){ WExtensions we(i->getInterfaceName()); if(!we.doesHaveWirelessExtensions()) return NULL; WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); - (*tabWidget) = info->tabWidget; + 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; } diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h index 1418ce8..a81ccff 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.h +++ b/noncore/net/networksetup/wlan/wlanmodule.h @@ -5,26 +5,26 @@ class WLANModule : Module{ signals: void updateInterface(Interface *i); public: WLANModule(); ~WLANModule(); virtual void setProfile(QString newProfile); virtual bool isOwner(Interface *); - virtual QWidget *configure(Interface *i, QTabWidget **tabWidget); - virtual QWidget *information(Interface *i, QTabWidget **tabWidget); + virtual QWidget *configure(Interface *i); + virtual QWidget *information(Interface *i); virtual QList<Interface> getInterfaces(); virtual void possibleNewInterfaces(QMap<QString, QString> &){}; virtual Interface *addNewInterface(QString name); virtual bool remove(Interface* i); virtual QString getPixmapName(Interface* i); private: QList<Interface> list; QString profile; }; |