summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-24 15:16:18 (UTC)
committer mickeyl <mickeyl>2004-04-24 15:16:18 (UTC)
commitc9f1383f79380e7f50f257670a11f9b10024e958 (patch) (unidiff)
tree01715900a7715125b7090a5127189c28b607bb37
parentf870c0ba65ce95e1a010de95a4fb961b0c812850 (diff)
downloadopie-c9f1383f79380e7f50f257670a11f9b10024e958.zip
opie-c9f1383f79380e7f50f257670a11f9b10024e958.tar.gz
opie-c9f1383f79380e7f50f257670a11f9b10024e958.tar.bz2
gcc 3.4 fixlet
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index ba89fa4..7953f7c 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -1,257 +1,257 @@
1 1
2#include "wlanmodule.h" 2#include "wlanmodule.h"
3#include "wlanimp2.h" 3#include "wlanimp2.h"
4#include "infoimp.h" 4#include "infoimp.h"
5#include "wextensions.h" 5#include "wextensions.h"
6#include "interfaceinformationimp.h" 6#include "interfaceinformationimp.h"
7 7
8/* OPIE */ 8/* OPIE */
9#include <opie2/odebug.h> 9#include <opie2/odebug.h>
10#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
11using namespace Opie::Core; 11using namespace Opie::Core;
12 12
13/* QT */ 13/* QT */
14#include <qcheckbox.h> 14#include <qcheckbox.h>
15#include <qcombobox.h> 15#include <qcombobox.h>
16#include <qlabel.h> 16#include <qlabel.h>
17#include <qlineedit.h> 17#include <qlineedit.h>
18#include <qprogressbar.h> 18#include <qprogressbar.h>
19#include <qspinbox.h> 19#include <qspinbox.h>
20#include <qtabwidget.h> 20#include <qtabwidget.h>
21 21
22 22
23/** 23/**
24 * Constructor, find all of the possible interfaces 24 * Constructor, find all of the possible interfaces
25 */ 25 */
26WLANModule::WLANModule() 26WLANModule::WLANModule()
27 : Module(), 27 : Module(),
28 wlanconfigWiget(0) 28 wlanconfigWiget(0)
29{ 29{
30} 30}
31 31
32/** 32/**
33 * Delete any interfaces that we own. 33 * Delete any interfaces that we own.
34 */ 34 */
35WLANModule::~WLANModule(){ 35WLANModule::~WLANModule(){
36 Interface *i; 36 Interface *i;
37 for ( i=list.first(); i != 0; i=list.next() ) 37 for ( i=list.first(); i != 0; i=list.next() )
38 delete i; 38 delete i;
39 39
40} 40}
41 41
42/** 42/**
43 * Change the current profile 43 * Change the current profile
44 */ 44 */
45void WLANModule::setProfile(const QString &newProfile){ 45void WLANModule::setProfile(const QString &newProfile){
46 profile = newProfile; 46 profile = newProfile;
47} 47}
48 48
49/** 49/**
50 * get the icon name for this device. 50 * get the icon name for this device.
51 * @param Interface* can be used in determining the icon. 51 * @param Interface* can be used in determining the icon.
52 * @return QString the icon name (minus .png, .gif etc) 52 * @return QString the icon name (minus .png, .gif etc)
53 */ 53 */
54QString WLANModule::getPixmapName(Interface* ){ 54QString WLANModule::getPixmapName(Interface* ){
55 return "wlan"; 55 return "wlan";
56} 56}
57 57
58/** 58/**
59 * Check to see if the interface i is owned by this module. 59 * Check to see if the interface i is owned by this module.
60 * @param Interface* interface to check against 60 * @param Interface* interface to check against
61 * @return bool true if i is owned by this module, false otherwise. 61 * @return bool true if i is owned by this module, false otherwise.
62 */ 62 */
63bool WLANModule::isOwner(Interface *i){ 63bool WLANModule::isOwner(Interface *i){
64 WExtensions we(i->getInterfaceName()); 64 WExtensions we(i->getInterfaceName());
65 if(!we.doesHaveWirelessExtensions()) 65 if(!we.doesHaveWirelessExtensions())
66 return false; 66 return false;
67 67
68 i->setHardwareName("802.11b"); 68 i->setHardwareName("802.11b");
69 list.append(i); 69 list.append(i);
70 return true; 70 return true;
71} 71}
72 72
73/** 73/**
74 * Create, and return the WLANConfigure Module 74 * Create, and return the WLANConfigure Module
75 * @return QWidget* pointer to this modules configure. 75 * @return QWidget* pointer to this modules configure.
76 */ 76 */
77QWidget *WLANModule::configure(Interface *i){ 77QWidget *WLANModule::configure(Interface *i){
78 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, true, Qt::WDestructiveClose); 78 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, true, ::Qt::WDestructiveClose);
79 wlanconfig->setProfile(profile); 79 wlanconfig->setProfile(profile);
80 return wlanconfig; 80 return wlanconfig;
81} 81}
82 82
83/** 83/**
84 * Create, and return the Information Module 84 * Create, and return the Information Module
85 * @return QWidget* pointer to this modules info. 85 * @return QWidget* pointer to this modules info.
86 */ 86 */
87QWidget *WLANModule::information(Interface *i){ 87QWidget *WLANModule::information(Interface *i){
88 WExtensions we(i->getInterfaceName()); 88 WExtensions we(i->getInterfaceName());
89 if(!we.doesHaveWirelessExtensions()) 89 if(!we.doesHaveWirelessExtensions())
90 return NULL; 90 return NULL;
91 91
92 return getInfo( i ); 92 return getInfo( i );
93} 93}
94 94
95/** 95/**
96 * Get all active (up or down) interfaces 96 * Get all active (up or down) interfaces
97 * @return QList<Interface> A list of interfaces that exsist that havn't 97 * @return QList<Interface> A list of interfaces that exist that havn't
98 * been called by isOwner() 98 * been called by isOwner()
99 */ 99 */
100QList<Interface> WLANModule::getInterfaces(){ 100QList<Interface> WLANModule::getInterfaces(){
101 return list; 101 return list;
102} 102}
103 103
104/** 104/**
105 * Attempt to add a new interface as defined by name 105 * Attempt to add a new interface as defined by name
106 * @param name the name of the type of interface that should be created given 106 * @param name the name of the type of interface that should be created given
107 * by possibleNewInterfaces(); 107 * by possibleNewInterfaces();
108 * @return Interface* NULL if it was unable to be created. 108 * @return Interface* NULL if it was unable to be created.
109 */ 109 */
110Interface *WLANModule::addNewInterface(const QString &){ 110Interface *WLANModule::addNewInterface(const QString &){
111 // We can't add a 802.11 interface, either the hardware will be there 111 // We can't add a 802.11 interface, either the hardware will be there
112 // or it wont. 112 // or it wont.
113 return NULL; 113 return NULL;
114} 114}
115 115
116/** 116/**
117 * Attempts to remove the interface, doesn't delete i 117 * Attempts to remove the interface, doesn't delete i
118 * @return bool true if successful, false otherwise. 118 * @return bool true if successful, false otherwise.
119 */ 119 */
120bool WLANModule::remove(Interface*){ 120bool WLANModule::remove(Interface*){
121 // Can't remove a hardware device, you can stop it though. 121 // Can't remove a hardware device, you can stop it though.
122 return false; 122 return false;
123} 123}
124 124
125void WLANModule::receive(const QCString &param, const QByteArray &arg) 125void WLANModule::receive(const QCString &param, const QByteArray &arg)
126{ 126{
127 odebug << "WLANModule::receive "+param << oendl; 127 odebug << "WLANModule::receive "+param << oendl;
128 QStringList params = QStringList::split(",",param); 128 QStringList params = QStringList::split(",",param);
129 int count = params.count(); 129 int count = params.count();
130 odebug << "WLANModule got " << count << " params" << oendl; 130 odebug << "WLANModule got " << count << " params" << oendl;
131 if (count < 2){ 131 if (count < 2){
132 odebug << "Erorr less than 2 parameter" << oendl; 132 odebug << "Erorr less than 2 parameter" << oendl;
133 odebug << "RETURNING" << oendl; 133 odebug << "RETURNING" << oendl;
134 return; 134 return;
135 } 135 }
136 136
137 QDataStream stream(arg,IO_ReadOnly); 137 QDataStream stream(arg,IO_ReadOnly);
138 QString interface; 138 QString interface;
139 QString action; 139 QString action;
140 int countMsgs = 0; 140 int countMsgs = 0;
141 stream >> interface; 141 stream >> interface;
142 odebug << "got count? >" << interface.latin1() << "<" << oendl; 142 odebug << "got count? >" << interface.latin1() << "<" << oendl;
143 if (interface == "count"){ 143 if (interface == "count"){
144 odebug << "got count" << oendl; 144 odebug << "got count" << oendl;
145 stream >> action; 145 stream >> action;
146 odebug << "Got count num >" << action.latin1() << "<" << oendl; 146 odebug << "Got count num >" << action.latin1() << "<" << oendl;
147 countMsgs = action.toInt(); 147 countMsgs = action.toInt();
148 } 148 }
149 149
150 QDialog *toShow; 150 QDialog *toShow;
151 //while (! stream.atEnd() ){ 151 //while (! stream.atEnd() ){
152 for (int i = 0; i < countMsgs; i++){ 152 for (int i = 0; i < countMsgs; i++){
153 odebug << "start stream " << i << "/" << countMsgs << "" << oendl; 153 odebug << "start stream " << i << "/" << countMsgs << "" << oendl;
154 if (stream.atEnd()){ 154 if (stream.atEnd()){
155 odebug << "end of stream" << oendl; 155 odebug << "end of stream" << oendl;
156 return; 156 return;
157 } 157 }
158 stream >> interface; 158 stream >> interface;
159 odebug << "got iface" << oendl; 159 odebug << "got iface" << oendl;
160 stream >> action; 160 stream >> action;
161 odebug << "WLANModule got interface " << interface.latin1() << " and acion " << action.latin1() << "" << oendl; 161 odebug << "WLANModule got interface " << interface.latin1() << " and acion " << action.latin1() << "" << oendl;
162 // find interfaces 162 // find interfaces
163 Interface *ifa=0; 163 Interface *ifa=0;
164 for ( Interface *i=list.first(); i != 0; i=list.next() ){ 164 for ( Interface *i=list.first(); i != 0; i=list.next() ){
165 if (i->getInterfaceName() == interface){ 165 if (i->getInterfaceName() == interface){
166 odebug << "WLANModule found interface " << interface.latin1() << "" << oendl; 166 odebug << "WLANModule found interface " << interface.latin1() << "" << oendl;
167 ifa = i; 167 ifa = i;
168 } 168 }
169 } 169 }
170 170
171 if (ifa == 0){ 171 if (ifa == 0){
172 odebug << "WLANModule Did not find " << interface.latin1() << "" << oendl; 172 odebug << "WLANModule Did not find " << interface.latin1() << "" << oendl;
173 odebug << "skipping" << oendl; 173 odebug << "skipping" << oendl;
174 count = 0; 174 count = 0;
175 } 175 }
176 176
177 if (count == 2){ 177 if (count == 2){
178 // those should call the interface directly 178 // those should call the interface directly
179 QWidget *info = getInfo( ifa ); 179 QWidget *info = getInfo( ifa );
180 QPEApplication::showWidget( info ); 180 QPEApplication::showWidget( info );
181 181
182 if ( action.contains("start" ) ){ 182 if ( action.contains("start" ) ){
183 ifa->start(); 183 ifa->start();
184 } else if ( action.contains("restart" ) ){ 184 } else if ( action.contains("restart" ) ){
185 ifa->restart(); 185 ifa->restart();
186 } else if ( action.contains("stop" ) ){ 186 } else if ( action.contains("stop" ) ){
187 ifa->stop(); 187 ifa->stop();
188 }else if ( action.contains("refresh" ) ){ 188 }else if ( action.contains("refresh" ) ){
189 ifa->refresh(); 189 ifa->refresh();
190 } 190 }
191 }else if (count == 3){ 191 }else if (count == 3){
192 QString value; 192 QString value;
193 if (!wlanconfigWiget){ 193 if (!wlanconfigWiget){
194 //FIXME: what if it got closed meanwhile? 194 //FIXME: what if it got closed meanwhile?
195 wlanconfigWiget = (WLANImp*) configure(ifa); 195 wlanconfigWiget = (WLANImp*) configure(ifa);
196 toShow = (QDialog*) wlanconfigWiget; 196 toShow = (QDialog*) wlanconfigWiget;
197 } 197 }
198 QPEApplication::showWidget( wlanconfigWiget ); 198 QPEApplication::showWidget( wlanconfigWiget );
199 stream >> value; 199 stream >> value;
200 odebug << "WLANModule (build 4) is setting " << action.latin1() << " of " << interface.latin1() << " to " << value.latin1() << "" << oendl; 200 odebug << "WLANModule (build 4) is setting " << action.latin1() << " of " << interface.latin1() << " to " << value.latin1() << "" << oendl;
201 if (value.isEmpty()){ 201 if (value.isEmpty()){
202 odebug << "value is empty!!!\nreturning" << oendl; 202 odebug << "value is empty!!!\nreturning" << oendl;
203 return; 203 return;
204 } 204 }
205 if ( action.contains("ESSID") ){ 205 if ( action.contains("ESSID") ){
206 QComboBox *combo = wlanconfigWiget->essid; 206 QComboBox *combo = wlanconfigWiget->essid;
207 bool found = false; 207 bool found = false;
208 for ( int i = 0; i < combo->count(); i++) 208 for ( int i = 0; i < combo->count(); i++)
209 if ( combo->text( i ) == value ){ 209 if ( combo->text( i ) == value ){
210 combo->setCurrentItem( i ); 210 combo->setCurrentItem( i );
211 found = true; 211 found = true;
212 } 212 }
213 if (!found) combo->insertItem( value, 0 ); 213 if (!found) combo->insertItem( value, 0 );
214 }else if ( action.contains("Mode") ){ 214 }else if ( action.contains("Mode") ){
215 QComboBox *combo = wlanconfigWiget->mode; 215 QComboBox *combo = wlanconfigWiget->mode;
216 for ( int i = 0; i < combo->count(); i++) 216 for ( int i = 0; i < combo->count(); i++)
217 if ( combo->text( i ) == value ){ 217 if ( combo->text( i ) == value ){
218 combo->setCurrentItem( i ); 218 combo->setCurrentItem( i );
219 } 219 }
220 220
221 }else if (action.contains("Channel")){ 221 }else if (action.contains("Channel")){
222 bool ok; 222 bool ok;
223 odebug << "converting channel" << oendl; 223 odebug << "converting channel" << oendl;
224 int chan = value.toInt( &ok ); 224 int chan = value.toInt( &ok );
225 if (ok){ 225 if (ok){
226 odebug << "ok setting channel" << oendl; 226 odebug << "ok setting channel" << oendl;
227 wlanconfigWiget->specifyChan->setChecked( true ); 227 wlanconfigWiget->specifyChan->setChecked( true );
228 wlanconfigWiget->networkChannel->setValue( chan ); 228 wlanconfigWiget->networkChannel->setValue( chan );
229 } 229 }
230 }else if (action.contains("MacAddr")){ 230 }else if (action.contains("MacAddr")){
231 wlanconfigWiget->specifyAp->setChecked( true ); 231 wlanconfigWiget->specifyAp->setChecked( true );
232 wlanconfigWiget->macEdit->setText( value ); 232 wlanconfigWiget->macEdit->setText( value );
233 }else 233 }else
234 odebug << "wlan plugin has no clue" << oendl; 234 odebug << "wlan plugin has no clue" << oendl;
235 } 235 }
236 odebug << "next stream" << oendl; 236 odebug << "next stream" << oendl;
237 }// while stream 237 }// while stream
238 odebug << "end of stream" << oendl; 238 odebug << "end of stream" << oendl;
239 if (toShow) toShow->exec(); 239 if (toShow) toShow->exec();
240 odebug << "returning" << oendl; 240 odebug << "returning" << oendl;
241} 241}
242 242
243QWidget *WLANModule::getInfo( Interface *i) 243QWidget *WLANModule::getInfo( Interface *i)
244{ 244{
245 odebug << "WLANModule::getInfo start" << oendl; 245 odebug << "WLANModule::getInfo start" << oendl;
246 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); 246 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), ::Qt::WDestructiveClose);
247 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); 247 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
248 info->tabWidget->insertTab(information, "TCP/IP", 0); 248 info->tabWidget->insertTab(information, "TCP/IP", 0);
249 info->tabWidget->setCurrentPage( 0 ); 249 info->tabWidget->setCurrentPage( 0 );
250 info->tabWidget->showPage( information ); 250 info->tabWidget->showPage( information );
251 if (info->tabWidget->currentPage() == information ) odebug << "infotab OK" << oendl; 251 if (info->tabWidget->currentPage() == information ) odebug << "infotab OK" << oendl;
252 else odebug << "infotab NOT OK" << oendl; 252 else odebug << "infotab NOT OK" << oendl;
253 odebug << "current idx " << info->tabWidget->currentPageIndex() << "" << oendl; 253 odebug << "current idx " << info->tabWidget->currentPageIndex() << "" << oendl;
254 odebug << "WLANModule::getInfo return" << oendl; 254 odebug << "WLANModule::getInfo return" << oendl;
255 return info; 255 return info;
256} 256}
257 257