Diffstat (limited to 'noncore/settings/networksettings/wlan/wlanmodule.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index e6f082c..bc467bb 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -3,19 +3,25 @@ | |||
3 | #include "infoimp.h" | 3 | #include "infoimp.h" |
4 | #include "wextensions.h" | 4 | #include "wextensions.h" |
5 | #include "interfaceinformationimp.h" | 5 | #include "interfaceinformationimp.h" |
6 | 6 | ||
7 | #include <qcheckbox.h> | ||
8 | #include <qcombobox.h> | ||
7 | #include <qlabel.h> | 9 | #include <qlabel.h> |
8 | #include <qprogressbar.h> | 10 | #include <qprogressbar.h> |
11 | #include <qspinbox.h> | ||
9 | #include <qtabwidget.h> | 12 | #include <qtabwidget.h> |
10 | 13 | ||
11 | 14 | ||
12 | 15 | ||
13 | 16 | ||
14 | /** | 17 | /** |
15 | * Constructor, find all of the possible interfaces | 18 | * Constructor, find all of the possible interfaces |
16 | */ | 19 | */ |
17 | WLANModule::WLANModule() : Module() { | 20 | WLANModule::WLANModule() |
21 | : Module(), | ||
22 | wlanconfigWiget(0) | ||
23 | { | ||
18 | } | 24 | } |
19 | 25 | ||
20 | /** | 26 | /** |
21 | * Delete any interfaces that we own. | 27 | * Delete any interfaces that we own. |
@@ -114,9 +120,9 @@ void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | |||
114 | { | 120 | { |
115 | qDebug("WLANModule::receive "+param); | 121 | qDebug("WLANModule::receive "+param); |
116 | QStringList params = QStringList::split(",",param); | 122 | QStringList params = QStringList::split(",",param); |
117 | int count = params.count(); | 123 | int count = params.count(); |
118 | qDebug("got %i params", count ); | 124 | qDebug("WLANModule got %i params", count ); |
119 | if (count < 2){ | 125 | if (count < 2){ |
120 | qDebug("Erorr less than 2 parameter"); | 126 | qDebug("Erorr less than 2 parameter"); |
121 | qDebug("RETURNING"); | 127 | qDebug("RETURNING"); |
122 | return; | 128 | return; |
@@ -127,20 +133,20 @@ void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | |||
127 | QString action; | 133 | QString action; |
128 | 134 | ||
129 | stream >> interface; | 135 | stream >> interface; |
130 | stream >> action; | 136 | stream >> action; |
131 | qDebug("got interface %s and acion %s", interface.latin1(), action.latin1()); | 137 | qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1()); |
132 | // find interfaces | 138 | // find interfaces |
133 | Interface *ifa=0; | 139 | Interface *ifa=0; |
134 | for ( Interface *i=list.first(); i != 0; i=list.next() ){ | 140 | for ( Interface *i=list.first(); i != 0; i=list.next() ){ |
135 | if (i->getInterfaceName() == interface){ | 141 | if (i->getInterfaceName() == interface){ |
136 | qDebug("found interface %s",interface.latin1()); | 142 | qDebug("WLANModule found interface %s",interface.latin1()); |
137 | ifa = i; | 143 | ifa = i; |
138 | } | 144 | } |
139 | } | 145 | } |
140 | 146 | ||
141 | if (ifa == 0){ | 147 | if (ifa == 0){ |
142 | qFatal("Did not find %s",interface.latin1()); | 148 | qFatal("WLANModule Did not find %s",interface.latin1()); |
143 | } | 149 | } |
144 | 150 | ||
145 | if (count == 2){ | 151 | if (count == 2){ |
146 | // those should call the interface directly | 152 | // those should call the interface directly |
@@ -157,23 +163,38 @@ void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | |||
157 | ifa->refresh(); | 163 | ifa->refresh(); |
158 | } | 164 | } |
159 | }else if (count == 3){ | 165 | }else if (count == 3){ |
160 | QString value; | 166 | QString value; |
167 | if (!wlanconfigWiget){ | ||
168 | //FIXME: what if it got closed meanwhile? | ||
169 | wlanconfigWiget = (WLANImp*) configure(ifa); | ||
170 | } | ||
171 | wlanconfigWiget->showMaximized(); | ||
161 | stream >> value; | 172 | stream >> value; |
162 | qDebug("setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); | 173 | qDebug("WLANModule is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); |
163 | if ( action.contains("ESSID") ){ | 174 | if ( action.contains("ESSID") ){ |
164 | qDebug("Setting ESSID not yet impl"); | 175 | QComboBox *combo = wlanconfigWiget->essid; |
176 | bool found = false; | ||
177 | for ( int i = 0; i < combo->count(); i++) | ||
178 | if ( combo->text( i ) == value ){ | ||
179 | combo->setCurrentItem( i ); | ||
180 | found = true; | ||
181 | } | ||
182 | if (!found) combo->insertItem( value, 0 ); | ||
183 | }else if ( action.contains("Mode") ){ | ||
184 | QComboBox *combo = wlanconfigWiget->mode; | ||
185 | for ( int i = 0; i < combo->count(); i++) | ||
186 | if ( combo->text( i ) == value ){ | ||
187 | combo->setCurrentItem( i ); | ||
188 | } | ||
189 | |||
165 | }else if (action.contains("Channel")){ | 190 | }else if (action.contains("Channel")){ |
166 | qDebug("Setting Channel not yet impl"); | 191 | wlanconfigWiget->specifyChan->setChecked( true ); |
192 | wlanconfigWiget->networkChannel->setValue( value.toInt() ); | ||
167 | }else | 193 | }else |
168 | qDebug("wlan plugin has no clue"); | 194 | qDebug("wlan plugin has no clue"); |
169 | } | 195 | } |
170 | // if (param.contains("QString,QString,QString")) { | 196 | |
171 | // QDataStream stream(arg,IO_ReadOnly); | ||
172 | // QString arg1, arg2, arg3; | ||
173 | // stream >> arg1 >> arg2 >> arg3 ; | ||
174 | // qDebug("interface >%s< setting >%s< value >%s<",arg1.latin1(),arg2.latin1(),arg3.latin1()); | ||
175 | // } | ||
176 | } | 197 | } |
177 | 198 | ||
178 | QWidget *WLANModule::getInfo( Interface *i) | 199 | QWidget *WLANModule::getInfo( Interface *i) |
179 | { | 200 | { |
@@ -184,4 +205,5 @@ QWidget *WLANModule::getInfo( Interface *i) | |||
184 | 205 | ||
185 | qDebug("WLANModule::getInfo return"); | 206 | qDebug("WLANModule::getInfo return"); |
186 | return info; | 207 | return info; |
187 | } | 208 | } |
209 | |||