summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp7
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.cpp5
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp7
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp5
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
@@ -38,96 +38,103 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par
38 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 38 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
39 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 39 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
40 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 40 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
41 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 41 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
42 42
43 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 43 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
44 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 44 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
45 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 45 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
46 46
47 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 47 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
48 // Load connections. 48 // Load connections.
49 loadModules(QPEApplication::qpeDir() + "/plugins/networksetup"); 49 loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
50 getInterfaceList(); 50 getInterfaceList();
51 connectionList->header()->hide(); 51 connectionList->header()->hide();
52 52
53 53
54 Config cfg("NetworkSetup"); 54 Config cfg("NetworkSetup");
55 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 55 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
56 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 56 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
57 profilesList->insertItem((*it)); 57 profilesList->insertItem((*it));
58 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); 58 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
59 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 59 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
60 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); 60 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
61 61
62 QFile file(scheme); 62 QFile file(scheme);
63 if ( file.open(IO_ReadOnly) ) { // file opened successfully 63 if ( file.open(IO_ReadOnly) ) { // file opened successfully
64 QTextStream stream( &file ); // use a text stream 64 QTextStream stream( &file ); // use a text stream
65 while ( !stream.eof() ) { // until end of file... 65 while ( !stream.eof() ) { // until end of file...
66 QString line = stream.readLine(); // line of text excluding '\n' 66 QString line = stream.readLine(); // line of text excluding '\n'
67 if(line.contains("SCHEME")){ 67 if(line.contains("SCHEME")){
68 line = line.mid(7, line.length()); 68 line = line.mid(7, line.length());
69 currentProfileLabel->setText(line); 69 currentProfileLabel->setText(line);
70 break; 70 break;
71 } 71 }
72 } 72 }
73 file.close(); 73 file.close();
74 } 74 }
75} 75}
76 76
77/** 77/**
78 * Deconstructor. Save profiles. Delete loaded libraries. 78 * Deconstructor. Save profiles. Delete loaded libraries.
79 */ 79 */
80MainWindowImp::~MainWindowImp(){ 80MainWindowImp::~MainWindowImp(){
81 // Save profiles. 81 // Save profiles.
82 Config cfg("NetworkSetup"); 82 Config cfg("NetworkSetup");
83 cfg.setGroup("General"); 83 cfg.setGroup("General");
84 cfg.writeEntry("Profiles", profiles.join(" ")); 84 cfg.writeEntry("Profiles", profiles.join(" "));
85 85
86 // Delete all interfaces that don't have owners.
87 QMap<Interface*, QListViewItem*>::Iterator iIt;
88 for( iIt = items.begin(); iIt != items.end(); ++iIt ){
89 if(iIt.key()->getModuleOwner() == NULL)
90 delete iIt.key();
91 }
92
86 // Delete Modules and Libraries 93 // Delete Modules and Libraries
87 QMap<Module*, QLibrary*>::Iterator it; 94 QMap<Module*, QLibrary*>::Iterator it;
88 for( it = libraries.begin(); it != libraries.end(); ++it ){ 95 for( it = libraries.begin(); it != libraries.end(); ++it ){
89 delete it.key(); 96 delete it.key();
90 delete it.data(); 97 delete it.data();
91 } 98 }
92} 99}
93 100
94/** 101/**
95 * Load all modules that are found in the path 102 * Load all modules that are found in the path
96 * @param path a directory that is scaned for any plugins that can be loaded 103 * @param path a directory that is scaned for any plugins that can be loaded
97 * and attempts to load them 104 * and attempts to load them
98 */ 105 */
99void MainWindowImp::loadModules(QString path){ 106void MainWindowImp::loadModules(QString path){
100 //qDebug(path.latin1()); 107 //qDebug(path.latin1());
101 QDir d(path); 108 QDir d(path);
102 if(!d.exists()) 109 if(!d.exists())
103 return; 110 return;
104 111
105 // Don't want sym links 112 // Don't want sym links
106 d.setFilter( QDir::Files | QDir::NoSymLinks ); 113 d.setFilter( QDir::Files | QDir::NoSymLinks );
107 const QFileInfoList *list = d.entryInfoList(); 114 const QFileInfoList *list = d.entryInfoList();
108 QFileInfoListIterator it( *list ); 115 QFileInfoListIterator it( *list );
109 QFileInfo *fi; 116 QFileInfo *fi;
110 while ( (fi=it.current()) ) { 117 while ( (fi=it.current()) ) {
111 if(fi->fileName().contains(".so")){ 118 if(fi->fileName().contains(".so")){
112 loadPlugin(path + "/" + fi->fileName()); 119 loadPlugin(path + "/" + fi->fileName());
113 } 120 }
114 ++it; 121 ++it;
115 } 122 }
116} 123}
117 124
118/** 125/**
119 * Attempt to load a function and resolve a function. 126 * Attempt to load a function and resolve a function.
120 * @param pluginFileName - the name of the file in which to attempt to load 127 * @param pluginFileName - the name of the file in which to attempt to load
121 * @param resolveString - function pointer to resolve 128 * @param resolveString - function pointer to resolve
122 * @return pointer to the function with name resolveString or NULL 129 * @return pointer to the function with name resolveString or NULL
123 */ 130 */
124Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ 131Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
125 //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); 132 //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
126 QLibrary *lib = new QLibrary(pluginFileName); 133 QLibrary *lib = new QLibrary(pluginFileName);
127 void *functionPointer = lib->resolve(resolveString); 134 void *functionPointer = lib->resolve(resolveString);
128 if( !functionPointer ){ 135 if( !functionPointer ){
129 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 136 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
130 delete lib; 137 delete lib;
131 return NULL; 138 return NULL;
132 } 139 }
133 140
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,124 +1,123 @@
1#include "wlanmodule.h" 1#include "wlanmodule.h"
2#include <qpe/config.h>
3#include "wlanimp.h" 2#include "wlanimp.h"
4#include "info.h" 3#include "info.h"
5 4
6
7#include <arpa/inet.h> 5#include <arpa/inet.h>
8#include <sys/socket.h> 6#include <sys/socket.h>
9#include <linux/if_ether.h> 7#include <linux/if_ether.h>
10#include <netinet/ip.h> 8#include <netinet/ip.h>
11#include <sys/ioctl.h> 9#include <sys/ioctl.h>
12#include <linux/wireless.h> 10#include <linux/wireless.h>
13 11
14#include <unistd.h> 12#include <unistd.h>
15#include <math.h> 13#include <math.h>
16#include <errno.h> 14#include <errno.h>
17#include <string.h> 15#include <string.h>
18#include <stdio.h> 16#include <stdio.h>
19 17
20#include <stdlib.h> 18#include <stdlib.h>
21 19
22#include <qlabel.h> 20#include <qlabel.h>
23 21
24/** 22/**
25 * Constructor, find all of the possible interfaces 23 * Constructor, find all of the possible interfaces
26 */ 24 */
27WLANModule::WLANModule() : Module() { 25WLANModule::WLANModule() : Module() {
28 // get output from iwconfig 26 // get output from iwconfig
29} 27}
30 28
31/** 29/**
32 * Change the current profile 30 * Change the current profile
33 */ 31 */
34void WLANModule::setProfile(QString newProfile){ 32void WLANModule::setProfile(QString newProfile){
35 profile = newProfile; 33 profile = newProfile;
36} 34}
37 35
38/** 36/**
39 * get the icon name for this device. 37 * get the icon name for this device.
40 * @param Interface* can be used in determining the icon. 38 * @param Interface* can be used in determining the icon.
41 * @return QString the icon name (minus .png, .gif etc) 39 * @return QString the icon name (minus .png, .gif etc)
42 */ 40 */
43QString WLANModule::getPixmapName(Interface* ){ 41QString WLANModule::getPixmapName(Interface* ){
44 return "wlan"; 42 return "wlan";
45} 43}
46 44
47/** 45/**
48 * Check to see if the interface i is owned by this module. 46 * Check to see if the interface i is owned by this module.
49 * @param Interface* interface to check against 47 * @param Interface* interface to check against
50 * @return bool true if i is owned by this module, false otherwise. 48 * @return bool true if i is owned by this module, false otherwise.
51 */ 49 */
52bool WLANModule::isOwner(Interface *i){ 50bool WLANModule::isOwner(Interface *i){
53 if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ 51 if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){
54 i->setHardwareName("802.11b"); 52 i->setHardwareName("802.11b");
55 return true; 53 return true;
56 } 54 }
57 return false; 55 return false;
58} 56}
59 57
60/** 58/**
61 * Create, set tabWiget and return the WLANConfigure Module 59 * Create, set tabWiget and return the WLANConfigure Module
62 * @param tabWidget a pointer to the tab widget that this configure has. 60 * @param tabWidget a pointer to the tab widget that this configure has.
63 * @return QWidget* pointer to the tab widget in this modules configure. 61 * @return QWidget* pointer to the tab widget in this modules configure.
64 */ 62 */
65QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ 63QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){
66 WLANImp *wlanconfig = new WLANImp( ); 64 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig");
67 (*tabWidget) = wlanconfig->tabWidget; 65 (*tabWidget) = wlanconfig->tabWidget;
68 return wlanconfig; 66 return wlanconfig;
69} 67}
70 68
71/** 69/**
72 * Create, set tabWiget and return the Information Module 70 * Create, set tabWiget and return the Information Module
73 * @param tabWidget a pointer to the tab widget that this information has. 71 * @param tabWidget a pointer to the tab widget that this information has.
74 * @return QWidget* pointer to the tab widget in this modules info. 72 * @return QWidget* pointer to the tab widget in this modules info.
75 */ 73 */
76QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ 74QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
75 return NULL;
77 WlanInfo *info = new WlanInfo(0, "wireless info"); 76 WlanInfo *info = new WlanInfo(0, "wireless info");
78 (*tabWidget) = info->tabWidget; 77 (*tabWidget) = info->tabWidget;
79 78
80 struct ifreq ifr; 79 struct ifreq ifr;
81 struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; 80 struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
82 int fd = socket( AF_INET, SOCK_DGRAM, 0 ); 81 int fd = socket( AF_INET, SOCK_DGRAM, 0 );
83 82
84 const char* buffer[200]; 83 const char* buffer[200];
85 struct iwreq iwr; 84 struct iwreq iwr;
86 memset( &iwr, 0, sizeof( iwr ) ); 85 memset( &iwr, 0, sizeof( iwr ) );
87 iwr.u.essid.pointer = (caddr_t) buffer; 86 iwr.u.essid.pointer = (caddr_t) buffer;
88 iwr.u.essid.length = IW_ESSID_MAX_SIZE; 87 iwr.u.essid.length = IW_ESSID_MAX_SIZE;
89 iwr.u.essid.flags = 0; 88 iwr.u.essid.flags = 0;
90 89
91 // check if it is an IEEE 802.11 standard conform 90 // check if it is an IEEE 802.11 standard conform
92 // wireless device by sending SIOCGIWESSID 91 // wireless device by sending SIOCGIWESSID
93 // which also gives back the Extended Service Set ID 92 // which also gives back the Extended Service Set ID
94 // (see IEEE 802.11 for more information) 93 // (see IEEE 802.11 for more information)
95 94
96 QString n = (i->getInterfaceName()); 95 QString n = (i->getInterfaceName());
97 const char* iname = n.latin1(); 96 const char* iname = n.latin1();
98 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); 97 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname );
99 int result = ioctl( fd, SIOCGIWESSID, &iwr ); 98 int result = ioctl( fd, SIOCGIWESSID, &iwr );
100 if ( result == 0 ){ 99 if ( result == 0 ){
101 //hasWirelessExtensions = true; 100 //hasWirelessExtensions = true;
102 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0'; 101 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0';
103 info->essidLabel->setText(QString(iwr.u.essid.pointer)); 102 info->essidLabel->setText(QString(iwr.u.essid.pointer));
104 } 103 }
105 else 104 else
106 return info; 105 return info;
107 //info->essidLabel->setText("*** Unknown ***"); 106 //info->essidLabel->setText("*** Unknown ***");
108 107
109 // Address of associated access-point 108 // Address of associated access-point
110 result = ioctl( fd, SIOCGIWAP, &iwr ); 109 result = ioctl( fd, SIOCGIWAP, &iwr );
111 if ( result == 0 ){ 110 if ( result == 0 ){
112 QString foo = foo.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", 111 QString foo = foo.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
113 iwr.u.ap_addr.sa_data[0]&0xff, 112 iwr.u.ap_addr.sa_data[0]&0xff,
114 iwr.u.ap_addr.sa_data[1]&0xff, 113 iwr.u.ap_addr.sa_data[1]&0xff,
115 iwr.u.ap_addr.sa_data[2]&0xff, 114 iwr.u.ap_addr.sa_data[2]&0xff,
116 iwr.u.ap_addr.sa_data[3]&0xff, 115 iwr.u.ap_addr.sa_data[3]&0xff,
117 iwr.u.ap_addr.sa_data[4]&0xff, 116 iwr.u.ap_addr.sa_data[4]&0xff,
118 iwr.u.ap_addr.sa_data[5]&0xff ); 117 iwr.u.ap_addr.sa_data[5]&0xff );
119 info->apLabel->setText(foo); 118 info->apLabel->setText(foo);
120 } 119 }
121 else info->apLabel->setText("*** Unknown ***"); 120 else info->apLabel->setText("*** Unknown ***");
122 121
123 iwr.u.data.pointer = (caddr_t) buffer; 122 iwr.u.data.pointer = (caddr_t) buffer;
124 iwr.u.data.length = IW_ESSID_MAX_SIZE; 123 iwr.u.data.length = IW_ESSID_MAX_SIZE;
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
@@ -38,96 +38,103 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par
38 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 38 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
39 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 39 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
40 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 40 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
41 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 41 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
42 42
43 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 43 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
44 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 44 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
45 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 45 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
46 46
47 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 47 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
48 // Load connections. 48 // Load connections.
49 loadModules(QPEApplication::qpeDir() + "/plugins/networksetup"); 49 loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
50 getInterfaceList(); 50 getInterfaceList();
51 connectionList->header()->hide(); 51 connectionList->header()->hide();
52 52
53 53
54 Config cfg("NetworkSetup"); 54 Config cfg("NetworkSetup");
55 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 55 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
56 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 56 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
57 profilesList->insertItem((*it)); 57 profilesList->insertItem((*it));
58 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); 58 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
59 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 59 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
60 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); 60 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
61 61
62 QFile file(scheme); 62 QFile file(scheme);
63 if ( file.open(IO_ReadOnly) ) { // file opened successfully 63 if ( file.open(IO_ReadOnly) ) { // file opened successfully
64 QTextStream stream( &file ); // use a text stream 64 QTextStream stream( &file ); // use a text stream
65 while ( !stream.eof() ) { // until end of file... 65 while ( !stream.eof() ) { // until end of file...
66 QString line = stream.readLine(); // line of text excluding '\n' 66 QString line = stream.readLine(); // line of text excluding '\n'
67 if(line.contains("SCHEME")){ 67 if(line.contains("SCHEME")){
68 line = line.mid(7, line.length()); 68 line = line.mid(7, line.length());
69 currentProfileLabel->setText(line); 69 currentProfileLabel->setText(line);
70 break; 70 break;
71 } 71 }
72 } 72 }
73 file.close(); 73 file.close();
74 } 74 }
75} 75}
76 76
77/** 77/**
78 * Deconstructor. Save profiles. Delete loaded libraries. 78 * Deconstructor. Save profiles. Delete loaded libraries.
79 */ 79 */
80MainWindowImp::~MainWindowImp(){ 80MainWindowImp::~MainWindowImp(){
81 // Save profiles. 81 // Save profiles.
82 Config cfg("NetworkSetup"); 82 Config cfg("NetworkSetup");
83 cfg.setGroup("General"); 83 cfg.setGroup("General");
84 cfg.writeEntry("Profiles", profiles.join(" ")); 84 cfg.writeEntry("Profiles", profiles.join(" "));
85 85
86 // Delete all interfaces that don't have owners.
87 QMap<Interface*, QListViewItem*>::Iterator iIt;
88 for( iIt = items.begin(); iIt != items.end(); ++iIt ){
89 if(iIt.key()->getModuleOwner() == NULL)
90 delete iIt.key();
91 }
92
86 // Delete Modules and Libraries 93 // Delete Modules and Libraries
87 QMap<Module*, QLibrary*>::Iterator it; 94 QMap<Module*, QLibrary*>::Iterator it;
88 for( it = libraries.begin(); it != libraries.end(); ++it ){ 95 for( it = libraries.begin(); it != libraries.end(); ++it ){
89 delete it.key(); 96 delete it.key();
90 delete it.data(); 97 delete it.data();
91 } 98 }
92} 99}
93 100
94/** 101/**
95 * Load all modules that are found in the path 102 * Load all modules that are found in the path
96 * @param path a directory that is scaned for any plugins that can be loaded 103 * @param path a directory that is scaned for any plugins that can be loaded
97 * and attempts to load them 104 * and attempts to load them
98 */ 105 */
99void MainWindowImp::loadModules(QString path){ 106void MainWindowImp::loadModules(QString path){
100 //qDebug(path.latin1()); 107 //qDebug(path.latin1());
101 QDir d(path); 108 QDir d(path);
102 if(!d.exists()) 109 if(!d.exists())
103 return; 110 return;
104 111
105 // Don't want sym links 112 // Don't want sym links
106 d.setFilter( QDir::Files | QDir::NoSymLinks ); 113 d.setFilter( QDir::Files | QDir::NoSymLinks );
107 const QFileInfoList *list = d.entryInfoList(); 114 const QFileInfoList *list = d.entryInfoList();
108 QFileInfoListIterator it( *list ); 115 QFileInfoListIterator it( *list );
109 QFileInfo *fi; 116 QFileInfo *fi;
110 while ( (fi=it.current()) ) { 117 while ( (fi=it.current()) ) {
111 if(fi->fileName().contains(".so")){ 118 if(fi->fileName().contains(".so")){
112 loadPlugin(path + "/" + fi->fileName()); 119 loadPlugin(path + "/" + fi->fileName());
113 } 120 }
114 ++it; 121 ++it;
115 } 122 }
116} 123}
117 124
118/** 125/**
119 * Attempt to load a function and resolve a function. 126 * Attempt to load a function and resolve a function.
120 * @param pluginFileName - the name of the file in which to attempt to load 127 * @param pluginFileName - the name of the file in which to attempt to load
121 * @param resolveString - function pointer to resolve 128 * @param resolveString - function pointer to resolve
122 * @return pointer to the function with name resolveString or NULL 129 * @return pointer to the function with name resolveString or NULL
123 */ 130 */
124Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ 131Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){
125 //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); 132 //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
126 QLibrary *lib = new QLibrary(pluginFileName); 133 QLibrary *lib = new QLibrary(pluginFileName);
127 void *functionPointer = lib->resolve(resolveString); 134 void *functionPointer = lib->resolve(resolveString);
128 if( !functionPointer ){ 135 if( !functionPointer ){
129 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 136 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
130 delete lib; 137 delete lib;
131 return NULL; 138 return NULL;
132 } 139 }
133 140
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,124 +1,123 @@
1#include "wlanmodule.h" 1#include "wlanmodule.h"
2#include <qpe/config.h>
3#include "wlanimp.h" 2#include "wlanimp.h"
4#include "info.h" 3#include "info.h"
5 4
6
7#include <arpa/inet.h> 5#include <arpa/inet.h>
8#include <sys/socket.h> 6#include <sys/socket.h>
9#include <linux/if_ether.h> 7#include <linux/if_ether.h>
10#include <netinet/ip.h> 8#include <netinet/ip.h>
11#include <sys/ioctl.h> 9#include <sys/ioctl.h>
12#include <linux/wireless.h> 10#include <linux/wireless.h>
13 11
14#include <unistd.h> 12#include <unistd.h>
15#include <math.h> 13#include <math.h>
16#include <errno.h> 14#include <errno.h>
17#include <string.h> 15#include <string.h>
18#include <stdio.h> 16#include <stdio.h>
19 17
20#include <stdlib.h> 18#include <stdlib.h>
21 19
22#include <qlabel.h> 20#include <qlabel.h>
23 21
24/** 22/**
25 * Constructor, find all of the possible interfaces 23 * Constructor, find all of the possible interfaces
26 */ 24 */
27WLANModule::WLANModule() : Module() { 25WLANModule::WLANModule() : Module() {
28 // get output from iwconfig 26 // get output from iwconfig
29} 27}
30 28
31/** 29/**
32 * Change the current profile 30 * Change the current profile
33 */ 31 */
34void WLANModule::setProfile(QString newProfile){ 32void WLANModule::setProfile(QString newProfile){
35 profile = newProfile; 33 profile = newProfile;
36} 34}
37 35
38/** 36/**
39 * get the icon name for this device. 37 * get the icon name for this device.
40 * @param Interface* can be used in determining the icon. 38 * @param Interface* can be used in determining the icon.
41 * @return QString the icon name (minus .png, .gif etc) 39 * @return QString the icon name (minus .png, .gif etc)
42 */ 40 */
43QString WLANModule::getPixmapName(Interface* ){ 41QString WLANModule::getPixmapName(Interface* ){
44 return "wlan"; 42 return "wlan";
45} 43}
46 44
47/** 45/**
48 * Check to see if the interface i is owned by this module. 46 * Check to see if the interface i is owned by this module.
49 * @param Interface* interface to check against 47 * @param Interface* interface to check against
50 * @return bool true if i is owned by this module, false otherwise. 48 * @return bool true if i is owned by this module, false otherwise.
51 */ 49 */
52bool WLANModule::isOwner(Interface *i){ 50bool WLANModule::isOwner(Interface *i){
53 if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ 51 if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){
54 i->setHardwareName("802.11b"); 52 i->setHardwareName("802.11b");
55 return true; 53 return true;
56 } 54 }
57 return false; 55 return false;
58} 56}
59 57
60/** 58/**
61 * Create, set tabWiget and return the WLANConfigure Module 59 * Create, set tabWiget and return the WLANConfigure Module
62 * @param tabWidget a pointer to the tab widget that this configure has. 60 * @param tabWidget a pointer to the tab widget that this configure has.
63 * @return QWidget* pointer to the tab widget in this modules configure. 61 * @return QWidget* pointer to the tab widget in this modules configure.
64 */ 62 */
65QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ 63QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){
66 WLANImp *wlanconfig = new WLANImp( ); 64 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig");
67 (*tabWidget) = wlanconfig->tabWidget; 65 (*tabWidget) = wlanconfig->tabWidget;
68 return wlanconfig; 66 return wlanconfig;
69} 67}
70 68
71/** 69/**
72 * Create, set tabWiget and return the Information Module 70 * Create, set tabWiget and return the Information Module
73 * @param tabWidget a pointer to the tab widget that this information has. 71 * @param tabWidget a pointer to the tab widget that this information has.
74 * @return QWidget* pointer to the tab widget in this modules info. 72 * @return QWidget* pointer to the tab widget in this modules info.
75 */ 73 */
76QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ 74QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
75 return NULL;
77 WlanInfo *info = new WlanInfo(0, "wireless info"); 76 WlanInfo *info = new WlanInfo(0, "wireless info");
78 (*tabWidget) = info->tabWidget; 77 (*tabWidget) = info->tabWidget;
79 78
80 struct ifreq ifr; 79 struct ifreq ifr;
81 struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; 80 struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
82 int fd = socket( AF_INET, SOCK_DGRAM, 0 ); 81 int fd = socket( AF_INET, SOCK_DGRAM, 0 );
83 82
84 const char* buffer[200]; 83 const char* buffer[200];
85 struct iwreq iwr; 84 struct iwreq iwr;
86 memset( &iwr, 0, sizeof( iwr ) ); 85 memset( &iwr, 0, sizeof( iwr ) );
87 iwr.u.essid.pointer = (caddr_t) buffer; 86 iwr.u.essid.pointer = (caddr_t) buffer;
88 iwr.u.essid.length = IW_ESSID_MAX_SIZE; 87 iwr.u.essid.length = IW_ESSID_MAX_SIZE;
89 iwr.u.essid.flags = 0; 88 iwr.u.essid.flags = 0;
90 89
91 // check if it is an IEEE 802.11 standard conform 90 // check if it is an IEEE 802.11 standard conform
92 // wireless device by sending SIOCGIWESSID 91 // wireless device by sending SIOCGIWESSID
93 // which also gives back the Extended Service Set ID 92 // which also gives back the Extended Service Set ID
94 // (see IEEE 802.11 for more information) 93 // (see IEEE 802.11 for more information)
95 94
96 QString n = (i->getInterfaceName()); 95 QString n = (i->getInterfaceName());
97 const char* iname = n.latin1(); 96 const char* iname = n.latin1();
98 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); 97 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname );
99 int result = ioctl( fd, SIOCGIWESSID, &iwr ); 98 int result = ioctl( fd, SIOCGIWESSID, &iwr );
100 if ( result == 0 ){ 99 if ( result == 0 ){
101 //hasWirelessExtensions = true; 100 //hasWirelessExtensions = true;
102 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0'; 101 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0';
103 info->essidLabel->setText(QString(iwr.u.essid.pointer)); 102 info->essidLabel->setText(QString(iwr.u.essid.pointer));
104 } 103 }
105 else 104 else
106 return info; 105 return info;
107 //info->essidLabel->setText("*** Unknown ***"); 106 //info->essidLabel->setText("*** Unknown ***");
108 107
109 // Address of associated access-point 108 // Address of associated access-point
110 result = ioctl( fd, SIOCGIWAP, &iwr ); 109 result = ioctl( fd, SIOCGIWAP, &iwr );
111 if ( result == 0 ){ 110 if ( result == 0 ){
112 QString foo = foo.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", 111 QString foo = foo.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
113 iwr.u.ap_addr.sa_data[0]&0xff, 112 iwr.u.ap_addr.sa_data[0]&0xff,
114 iwr.u.ap_addr.sa_data[1]&0xff, 113 iwr.u.ap_addr.sa_data[1]&0xff,
115 iwr.u.ap_addr.sa_data[2]&0xff, 114 iwr.u.ap_addr.sa_data[2]&0xff,
116 iwr.u.ap_addr.sa_data[3]&0xff, 115 iwr.u.ap_addr.sa_data[3]&0xff,
117 iwr.u.ap_addr.sa_data[4]&0xff, 116 iwr.u.ap_addr.sa_data[4]&0xff,
118 iwr.u.ap_addr.sa_data[5]&0xff ); 117 iwr.u.ap_addr.sa_data[5]&0xff );
119 info->apLabel->setText(foo); 118 info->apLabel->setText(foo);
120 } 119 }
121 else info->apLabel->setText("*** Unknown ***"); 120 else info->apLabel->setText("*** Unknown ***");
122 121
123 iwr.u.data.pointer = (caddr_t) buffer; 122 iwr.u.data.pointer = (caddr_t) buffer;
124 iwr.u.data.length = IW_ESSID_MAX_SIZE; 123 iwr.u.data.length = IW_ESSID_MAX_SIZE;