summaryrefslogtreecommitdiff
path: root/noncore/net/networksetup/wlan
authorbenmeyer <benmeyer>2002-10-25 19:34:32 (UTC)
committer benmeyer <benmeyer>2002-10-25 19:34:32 (UTC)
commitf16dd7fc272f3f8354dc696fcc881dfe74755a21 (patch) (side-by-side diff)
treeedaab125b322744d8684e6aee4d2c5955b68689b /noncore/net/networksetup/wlan
parent77347ba522a5913ff17561e6fd2c15981d42e86b (diff)
downloadopie-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.cpp6
-rw-r--r--noncore/net/networksetup/wlan/wlan.pro4
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp14
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.h8
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.cpp22
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.h4
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
@@ -13,15 +13,17 @@
#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;
@@ -32,14 +34,12 @@ WExtensions::WExtensions(QString interfaceName){
// (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(){
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
@@ -12,16 +12,24 @@
#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;
}
@@ -106,14 +114,16 @@ bool WLANImp::writeConfig()
}
/**
*/
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";
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,13 +1,15 @@
#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() {
}
@@ -50,34 +52,32 @@ bool WLANModule::isOwner(Interface *i){
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
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
@@ -11,14 +11,14 @@ signals:
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);