Diffstat (limited to 'noncore/net/networksetup/wlan') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 20 |
3 files changed, 12 insertions, 12 deletions
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp index ef4ba8f..e545bd1 100644 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/noncore/net/networksetup/wlan/wextensions.cpp | |||
@@ -136,40 +136,40 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){ | |||
136 | // gather link quality from /proc/net/wireless | 136 | // gather link quality from /proc/net/wireless |
137 | if(!QFile::exists(PROCNETWIRELESS)) | 137 | if(!QFile::exists(PROCNETWIRELESS)) |
138 | return false; | 138 | return false; |
139 | 139 | ||
140 | char c; | 140 | char c; |
141 | QString status; | 141 | QString status; |
142 | QString name; | 142 | QString name; |
143 | 143 | ||
144 | QFile wfile( PROCNETWIRELESS ); | 144 | QFile wfile( PROCNETWIRELESS ); |
145 | if(!wfile.open( IO_ReadOnly )) | 145 | if(!wfile.open( IO_ReadOnly )) |
146 | return false; | 146 | return false; |
147 | 147 | ||
148 | QTextStream wstream( &wfile ); | 148 | QTextStream wstream( &wfile ); |
149 | wstream.readLine(); // skip the first two lines | 149 | wstream.readLine(); // skip the first two lines |
150 | wstream.readLine(); // because they only contain headers | 150 | wstream.readLine(); // because they only contain headers |
151 | while(!wstream.atEnd()){ | 151 | while(!wstream.atEnd()){ |
152 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; | 152 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; |
153 | if(name == QString("%1:").arg(interface)){ | 153 | if(name == QString("%1:").arg(interface)){ |
154 | if ( quality > 92 ) | 154 | if ( quality > 92 ) |
155 | qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); | 155 | qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); |
156 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) | 156 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) |
157 | qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); | 157 | qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); |
158 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) | 158 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) |
159 | qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); | 159 | qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); |
160 | qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); | 160 | //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); |
161 | signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; | 161 | signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; |
162 | noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; | 162 | noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; |
163 | quality = ( quality*100 ) / 92; | 163 | quality = ( quality*100 ) / 92; |
164 | return true; | 164 | return true; |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | qDebug("WExtensions::statsCard no longer present."); | 168 | qDebug("WExtensions::statsCard no longer present."); |
169 | quality = -1; | 169 | quality = -1; |
170 | signal = IW_LOWER; | 170 | signal = IW_LOWER; |
171 | noise = IW_LOWER; | 171 | noise = IW_LOWER; |
172 | return false; | 172 | return false; |
173 | } | 173 | } |
174 | 174 | ||
175 | // wextensions.cpp | 175 | // wextensions.cpp |
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index ea19207..94c7518 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -1,43 +1,43 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | 2 | ||
3 | /* Config class */ | 3 | /* Config class */ |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | /* Global namespace */ | 5 | /* Global namespace */ |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | /* system() */ | 7 | /* system() */ |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qtextstream.h> | 11 | #include <qtextstream.h> |
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qspinbox.h> | 14 | #include <qspinbox.h> |
15 | #include <qradiobutton.h> | 15 | #include <qradiobutton.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qregexp.h> | 17 | #include <qregexp.h> |
18 | 18 | ||
19 | WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name){ | 19 | WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name, Qt::WDestructiveClose){ |
20 | config = new Config("wireless"); | 20 | config = new Config("wireless"); |
21 | readConfig(); | 21 | readConfig(); |
22 | } | 22 | } |
23 | 23 | ||
24 | WLANImp::~WLANImp( ){ | 24 | WLANImp::~WLANImp( ){ |
25 | delete config; | 25 | delete config; |
26 | } | 26 | } |
27 | 27 | ||
28 | void WLANImp::readConfig() | 28 | void WLANImp::readConfig() |
29 | { | 29 | { |
30 | qWarning( "WLANImp::readConfig() called." ); | 30 | qWarning( "WLANImp::readConfig() called." ); |
31 | config->setGroup( "Properties" ); | 31 | config->setGroup( "Properties" ); |
32 | QString ssid = config->readEntry( "SSID", "any" ); | 32 | QString ssid = config->readEntry( "SSID", "any" ); |
33 | if( ssid == "any" || ssid == "ANY" ){ | 33 | if( ssid == "any" || ssid == "ANY" ){ |
34 | essNon->setChecked( true ); | 34 | essNon->setChecked( true ); |
35 | } else { | 35 | } else { |
36 | essSpecific->setChecked( true ); | 36 | essSpecific->setChecked( true ); |
37 | essSpecificLineEdit->setText( ssid ); | 37 | essSpecificLineEdit->setText( ssid ); |
38 | } | 38 | } |
39 | QString mode = config->readEntry( "Mode", "Managed" ); | 39 | QString mode = config->readEntry( "Mode", "Managed" ); |
40 | if( mode == "adhoc" ) { | 40 | if( mode == "adhoc" ) { |
41 | network802->setChecked( true ); | 41 | network802->setChecked( true ); |
42 | } else { | 42 | } else { |
43 | networkInfrastructure->setChecked( true ); | 43 | networkInfrastructure->setChecked( true ); |
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index 73e753c..7507c54 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp | |||
@@ -1,118 +1,118 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include "wlanimp.h" | 2 | #include "wlanimp.h" |
3 | #include "info.h" | 3 | #include "info.h" |
4 | #include "wextensions.h" | 4 | #include "wextensions.h" |
5 | 5 | ||
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qprogressbar.h> | 7 | #include <qprogressbar.h> |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | WLANModule::WLANModule() : Module() { | 12 | WLANModule::WLANModule() : Module() { |
13 | // get output from iwconfig | ||
14 | } | 13 | } |
15 | 14 | ||
16 | /** | 15 | /** |
17 | */ | 16 | */ |
18 | WLANModule::~WLANModule(){ | 17 | WLANModule::~WLANModule(){ |
19 | Interface *i; | 18 | Interface *i; |
20 | for ( i=list.first(); i != 0; i=list.next() ) | 19 | for ( i=list.first(); i != 0; i=list.next() ) |
21 | delete i; | 20 | delete i; |
22 | } | 21 | } |
23 | 22 | ||
24 | /** | 23 | /** |
25 | * Change the current profile | 24 | * Change the current profile |
26 | */ | 25 | */ |
27 | void WLANModule::setProfile(QString newProfile){ | 26 | void WLANModule::setProfile(QString newProfile){ |
28 | profile = newProfile; | 27 | profile = newProfile; |
29 | } | 28 | } |
30 | 29 | ||
31 | /** | 30 | /** |
32 | * get the icon name for this device. | 31 | * get the icon name for this device. |
33 | * @param Interface* can be used in determining the icon. | 32 | * @param Interface* can be used in determining the icon. |
34 | * @return QString the icon name (minus .png, .gif etc) | 33 | * @return QString the icon name (minus .png, .gif etc) |
35 | */ | 34 | */ |
36 | QString WLANModule::getPixmapName(Interface* ){ | 35 | QString WLANModule::getPixmapName(Interface* ){ |
37 | return "wlan"; | 36 | return "wlan"; |
38 | } | 37 | } |
39 | 38 | ||
40 | /** | 39 | /** |
41 | * Check to see if the interface i is owned by this module. | 40 | * Check to see if the interface i is owned by this module. |
42 | * @param Interface* interface to check against | 41 | * @param Interface* interface to check against |
43 | * @return bool true if i is owned by this module, false otherwise. | 42 | * @return bool true if i is owned by this module, false otherwise. |
44 | */ | 43 | */ |
45 | bool WLANModule::isOwner(Interface *i){ | 44 | bool WLANModule::isOwner(Interface *i){ |
46 | WExtensions we(i->getInterfaceName()); | 45 | WExtensions we(i->getInterfaceName()); |
47 | if(!we.doesHaveWirelessExtensions()) | 46 | if(!we.doesHaveWirelessExtensions()) |
48 | return false; | 47 | return false; |
49 | 48 | ||
50 | //if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ | 49 | i->setHardwareName("802.11b"); |
51 | i->setHardwareName("802.11b"); | 50 | list.append(i); |
52 | list.append(i); | 51 | return true; |
53 | return true; | ||
54 | //} | ||
55 | //return false; | ||
56 | } | 52 | } |
57 | 53 | ||
58 | /** | 54 | /** |
59 | * Create, set tabWiget and return the WLANConfigure Module | 55 | * Create, set tabWiget and return the WLANConfigure Module |
60 | * @param tabWidget a pointer to the tab widget that this configure has. | 56 | * @param tabWidget a pointer to the tab widget that this configure has. |
61 | * @return QWidget* pointer to the tab widget in this modules configure. | 57 | * @return QWidget* pointer to the tab widget in this modules configure. |
62 | */ | 58 | */ |
63 | QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ | 59 | QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ |
64 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); | 60 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); |
65 | (*tabWidget) = wlanconfig->tabWidget; | 61 | (*tabWidget) = wlanconfig->tabWidget; |
66 | return wlanconfig; | 62 | return wlanconfig; |
67 | } | 63 | } |
68 | 64 | ||
69 | /** | 65 | /** |
70 | * Create, set tabWiget and return the Information Module | 66 | * Create, set tabWiget and return the Information Module |
71 | * @param tabWidget a pointer to the tab widget that this information has. | 67 | * @param tabWidget a pointer to the tab widget that this information has. |
72 | * @return QWidget* pointer to the tab widget in this modules info. | 68 | * @return QWidget* pointer to the tab widget in this modules info. |
73 | */ | 69 | */ |
74 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ | 70 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ |
75 | WExtensions we(i->getInterfaceName()); | 71 | WExtensions we(i->getInterfaceName()); |
76 | if(!we.doesHaveWirelessExtensions()) | 72 | if(!we.doesHaveWirelessExtensions()) |
77 | return NULL; | 73 | return NULL; |
78 | 74 | ||
79 | WlanInfo *info = new WlanInfo(0, "wireless info"); | 75 | WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); |
80 | (*tabWidget) = info->tabWidget; | 76 | (*tabWidget) = info->tabWidget; |
81 | 77 | ||
82 | info->essidLabel->setText(we.essid()); | 78 | info->essidLabel->setText(we.essid()); |
83 | info->apLabel->setText(we.ap()); | 79 | info->apLabel->setText(we.ap()); |
84 | info->stationLabel->setText(we.station()); | 80 | info->stationLabel->setText(we.station()); |
85 | info->modeLabel->setText(we.mode()); | 81 | info->modeLabel->setText(we.mode()); |
86 | info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); | 82 | info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); |
87 | int signal = 0; | 83 | int signal = 0; |
88 | int noise = 0; | 84 | int noise = 0; |
89 | int quality = 0; | 85 | int quality = 0; |
90 | we.stats(signal, noise, quality); | 86 | we.stats(signal, noise, quality); |
91 | info->signalProgressBar->setProgress(signal); | 87 | info->signalProgressBar->setProgress(signal); |
92 | info->noiseProgressBar->setProgress(noise); | 88 | info->noiseProgressBar->setProgress(noise); |
93 | info->qualityProgressBar->setProgress(quality); | 89 | info->qualityProgressBar->setProgress(quality); |
94 | info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); | 90 | info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); |
91 | //WlanInfo info (0, "wireless info", true); | ||
92 | //info.show(); | ||
93 | //return NULL; | ||
94 | |||
95 | return info; | 95 | return info; |
96 | } | 96 | } |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * Get all active (up or down) interfaces | 99 | * Get all active (up or down) interfaces |
100 | * @return QList<Interface> A list of interfaces that exsist that havn't | 100 | * @return QList<Interface> A list of interfaces that exsist that havn't |
101 | * been called by isOwner() | 101 | * been called by isOwner() |
102 | */ | 102 | */ |
103 | QList<Interface> WLANModule::getInterfaces(){ | 103 | QList<Interface> WLANModule::getInterfaces(){ |
104 | return list; | 104 | return list; |
105 | } | 105 | } |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Attempt to add a new interface as defined by name | 108 | * Attempt to add a new interface as defined by name |
109 | * @param name the name of the type of interface that should be created given | 109 | * @param name the name of the type of interface that should be created given |
110 | * by possibleNewInterfaces(); | 110 | * by possibleNewInterfaces(); |
111 | * @return Interface* NULL if it was unable to be created. | 111 | * @return Interface* NULL if it was unable to be created. |
112 | */ | 112 | */ |
113 | Interface *WLANModule::addNewInterface(QString ){ | 113 | Interface *WLANModule::addNewInterface(QString ){ |
114 | // We can't add a 802.11 interface, either the hardware will be there | 114 | // We can't add a 802.11 interface, either the hardware will be there |
115 | // or it wont. | 115 | // or it wont. |
116 | return NULL; | 116 | return NULL; |
117 | } | 117 | } |
118 | 118 | ||