-rw-r--r-- | noncore/net/networksetup/wlan/wlan.ui | 167 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 43 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.h | 3 |
3 files changed, 102 insertions, 111 deletions
diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui index 47d6db6..09593b3 100644 --- a/noncore/net/networksetup/wlan/wlan.ui +++ b/noncore/net/networksetup/wlan/wlan.ui | |||
@@ -11,8 +11,8 @@ | |||
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>237</width> | 14 | <width>239</width> |
15 | <height>286</height> | 15 | <height>277</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
@@ -65,72 +65,29 @@ | |||
65 | <number>6</number> | 65 | <number>6</number> |
66 | </property> | 66 | </property> |
67 | <widget> | 67 | <widget> |
68 | <class>QButtonGroup</class> | 68 | <class>QCheckBox</class> |
69 | <property stdset="1"> | ||
70 | <name>name</name> | ||
71 | <cstring>ButtonGroup45</cstring> | ||
72 | </property> | ||
73 | <property stdset="1"> | ||
74 | <name>title</name> | ||
75 | <string>ESS ID</string> | ||
76 | </property> | ||
77 | <vbox> | ||
78 | <property stdset="1"> | ||
79 | <name>margin</name> | ||
80 | <number>11</number> | ||
81 | </property> | ||
82 | <property stdset="1"> | ||
83 | <name>spacing</name> | ||
84 | <number>6</number> | ||
85 | </property> | ||
86 | <widget> | ||
87 | <class>QRadioButton</class> | ||
88 | <property stdset="1"> | ||
89 | <name>name</name> | ||
90 | <cstring>essNon</cstring> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>text</name> | ||
94 | <string>Non-Spec ESSID: "ANY"</string> | ||
95 | </property> | ||
96 | <property stdset="1"> | ||
97 | <name>checked</name> | ||
98 | <bool>true</bool> | ||
99 | </property> | ||
100 | </widget> | ||
101 | <widget> | ||
102 | <class>QRadioButton</class> | ||
103 | <property stdset="1"> | 69 | <property stdset="1"> |
104 | <name>name</name> | 70 | <name>name</name> |
105 | <cstring>essSpecific</cstring> | 71 | <cstring>essAny</cstring> |
106 | </property> | 72 | </property> |
107 | <property stdset="1"> | 73 | <property stdset="1"> |
108 | <name>text</name> | 74 | <name>text</name> |
109 | <string>Specific ESSID</string> | 75 | <string>Sepecify Access Point</string> |
110 | </property> | 76 | </property> |
111 | </widget> | 77 | </widget> |
112 | <widget> | 78 | <widget> |
113 | <class>QLineEdit</class> | 79 | <class>QGroupBox</class> |
114 | <property stdset="1"> | 80 | <property stdset="1"> |
115 | <name>name</name> | 81 | <name>name</name> |
116 | <cstring>essSpecificLineEdit</cstring> | 82 | <cstring>GroupBox1</cstring> |
117 | </property> | 83 | </property> |
118 | <property stdset="1"> | 84 | <property stdset="1"> |
119 | <name>enabled</name> | 85 | <name>enabled</name> |
120 | <bool>false</bool> | 86 | <bool>false</bool> |
121 | </property> | 87 | </property> |
122 | </widget> | ||
123 | </vbox> | ||
124 | </widget> | ||
125 | <widget> | ||
126 | <class>QButtonGroup</class> | ||
127 | <property stdset="1"> | ||
128 | <name>name</name> | ||
129 | <cstring>ButtonGroup46</cstring> | ||
130 | </property> | ||
131 | <property stdset="1"> | 88 | <property stdset="1"> |
132 | <name>title</name> | 89 | <name>title</name> |
133 | <string>Network Type</string> | 90 | <string>Settings</string> |
134 | </property> | 91 | </property> |
135 | <grid> | 92 | <grid> |
136 | <property stdset="1"> | 93 | <property stdset="1"> |
@@ -141,45 +98,63 @@ | |||
141 | <name>spacing</name> | 98 | <name>spacing</name> |
142 | <number>6</number> | 99 | <number>6</number> |
143 | </property> | 100 | </property> |
144 | <widget row="0" column="0" rowspan="1" colspan="3" > | 101 | <widget row="0" column="0" > |
145 | <class>QRadioButton</class> | 102 | <class>QLabel</class> |
146 | <property stdset="1"> | 103 | <property stdset="1"> |
147 | <name>name</name> | 104 | <name>name</name> |
148 | <cstring>networkInfrastructure</cstring> | 105 | <cstring>TextLabel1</cstring> |
149 | </property> | 106 | </property> |
150 | <property stdset="1"> | 107 | <property stdset="1"> |
151 | <name>text</name> | 108 | <name>text</name> |
152 | <string>Infrastructure</string> | 109 | <string>ESS-ID</string> |
153 | </property> | ||
154 | <property stdset="1"> | ||
155 | <name>checked</name> | ||
156 | <bool>true</bool> | ||
157 | </property> | 110 | </property> |
158 | </widget> | 111 | </widget> |
159 | <widget row="2" column="0" > | 112 | <widget row="1" column="0" > |
160 | <class>QLabel</class> | 113 | <class>QLabel</class> |
161 | <property stdset="1"> | 114 | <property stdset="1"> |
162 | <name>name</name> | 115 | <name>name</name> |
163 | <cstring>TextLabel2</cstring> | 116 | <cstring>TextLabel2_2</cstring> |
164 | </property> | 117 | </property> |
165 | <property stdset="1"> | 118 | <property stdset="1"> |
166 | <name>enabled</name> | 119 | <name>text</name> |
167 | <bool>false</bool> | 120 | <string>Network Type</string> |
168 | </property> | 121 | </property> |
122 | </widget> | ||
123 | <widget row="0" column="1" rowspan="1" colspan="2" > | ||
124 | <class>QLineEdit</class> | ||
169 | <property stdset="1"> | 125 | <property stdset="1"> |
126 | <name>name</name> | ||
127 | <cstring>essSpecificLineEdit</cstring> | ||
128 | </property> | ||
129 | </widget> | ||
130 | <widget row="1" column="1" rowspan="1" colspan="2" > | ||
131 | <class>QComboBox</class> | ||
132 | <item> | ||
133 | <property> | ||
170 | <name>text</name> | 134 | <name>text</name> |
171 | <string>Channel</string> | 135 | <string>Infrastructure</string> |
136 | </property> | ||
137 | </item> | ||
138 | <item> | ||
139 | <property> | ||
140 | <name>text</name> | ||
141 | <string>Ad-Hoc</string> | ||
142 | </property> | ||
143 | </item> | ||
144 | <property stdset="1"> | ||
145 | <name>name</name> | ||
146 | <cstring>networkType</cstring> | ||
172 | </property> | 147 | </property> |
173 | </widget> | 148 | </widget> |
174 | <widget row="1" column="0" rowspan="1" colspan="2" > | 149 | <widget row="2" column="0" > |
175 | <class>QRadioButton</class> | 150 | <class>QLabel</class> |
176 | <property stdset="1"> | 151 | <property stdset="1"> |
177 | <name>name</name> | 152 | <name>name</name> |
178 | <cstring>network802</cstring> | 153 | <cstring>channelLabel</cstring> |
179 | </property> | 154 | </property> |
180 | <property stdset="1"> | 155 | <property stdset="1"> |
181 | <name>text</name> | 156 | <name>text</name> |
182 | <string>Ad-Hoc</string> | 157 | <string>Channel</string> |
183 | </property> | 158 | </property> |
184 | </widget> | 159 | </widget> |
185 | <widget row="2" column="1" > | 160 | <widget row="2" column="1" > |
@@ -194,7 +169,7 @@ | |||
194 | </property> | 169 | </property> |
195 | <property stdset="1"> | 170 | <property stdset="1"> |
196 | <name>maxValue</name> | 171 | <name>maxValue</name> |
197 | <number>11</number> | 172 | <number>15</number> |
198 | </property> | 173 | </property> |
199 | <property stdset="1"> | 174 | <property stdset="1"> |
200 | <name>minValue</name> | 175 | <name>minValue</name> |
@@ -208,7 +183,7 @@ | |||
208 | <spacer row="2" column="2" > | 183 | <spacer row="2" column="2" > |
209 | <property> | 184 | <property> |
210 | <name>name</name> | 185 | <name>name</name> |
211 | <cstring>Spacer32</cstring> | 186 | <cstring>Spacer4</cstring> |
212 | </property> | 187 | </property> |
213 | <property stdset="1"> | 188 | <property stdset="1"> |
214 | <name>orientation</name> | 189 | <name>orientation</name> |
@@ -336,7 +311,7 @@ | |||
336 | <class>QButtonGroup</class> | 311 | <class>QButtonGroup</class> |
337 | <property stdset="1"> | 312 | <property stdset="1"> |
338 | <name>name</name> | 313 | <name>name</name> |
339 | <cstring>ButtonGroup44</cstring> | 314 | <cstring>KeyButtonGroup</cstring> |
340 | </property> | 315 | </property> |
341 | <property stdset="1"> | 316 | <property stdset="1"> |
342 | <name>enabled</name> | 317 | <name>enabled</name> |
@@ -361,6 +336,10 @@ | |||
361 | <name>name</name> | 336 | <name>name</name> |
362 | <cstring>keyLineEdit0</cstring> | 337 | <cstring>keyLineEdit0</cstring> |
363 | </property> | 338 | </property> |
339 | <property stdset="1"> | ||
340 | <name>echoMode</name> | ||
341 | <enum>Password</enum> | ||
342 | </property> | ||
364 | </widget> | 343 | </widget> |
365 | <widget row="1" column="1" > | 344 | <widget row="1" column="1" > |
366 | <class>QLineEdit</class> | 345 | <class>QLineEdit</class> |
@@ -368,6 +347,10 @@ | |||
368 | <name>name</name> | 347 | <name>name</name> |
369 | <cstring>keyLineEdit1</cstring> | 348 | <cstring>keyLineEdit1</cstring> |
370 | </property> | 349 | </property> |
350 | <property stdset="1"> | ||
351 | <name>echoMode</name> | ||
352 | <enum>Password</enum> | ||
353 | </property> | ||
371 | </widget> | 354 | </widget> |
372 | <widget row="2" column="1" > | 355 | <widget row="2" column="1" > |
373 | <class>QLineEdit</class> | 356 | <class>QLineEdit</class> |
@@ -375,6 +358,10 @@ | |||
375 | <name>name</name> | 358 | <name>name</name> |
376 | <cstring>keyLineEdit2</cstring> | 359 | <cstring>keyLineEdit2</cstring> |
377 | </property> | 360 | </property> |
361 | <property stdset="1"> | ||
362 | <name>echoMode</name> | ||
363 | <enum>Password</enum> | ||
364 | </property> | ||
378 | </widget> | 365 | </widget> |
379 | <widget row="3" column="1" > | 366 | <widget row="3" column="1" > |
380 | <class>QLineEdit</class> | 367 | <class>QLineEdit</class> |
@@ -382,6 +369,10 @@ | |||
382 | <name>name</name> | 369 | <name>name</name> |
383 | <cstring>keyLineEdit3</cstring> | 370 | <cstring>keyLineEdit3</cstring> |
384 | </property> | 371 | </property> |
372 | <property stdset="1"> | ||
373 | <name>echoMode</name> | ||
374 | <enum>Password</enum> | ||
375 | </property> | ||
385 | </widget> | 376 | </widget> |
386 | <widget row="0" column="0" > | 377 | <widget row="0" column="0" > |
387 | <class>QRadioButton</class> | 378 | <class>QRadioButton</class> |
@@ -461,49 +452,29 @@ | |||
461 | </widget> | 452 | </widget> |
462 | <connections> | 453 | <connections> |
463 | <connection> | 454 | <connection> |
464 | <sender>essSpecific</sender> | 455 | <sender>wepEnabled</sender> |
465 | <signal>toggled(bool)</signal> | ||
466 | <receiver>essSpecificLineEdit</receiver> | ||
467 | <slot>setEnabled(bool)</slot> | ||
468 | </connection> | ||
469 | <connection> | ||
470 | <sender>network802</sender> | ||
471 | <signal>clicked()</signal> | ||
472 | <receiver>essSpecific</receiver> | ||
473 | <slot>animateClick()</slot> | ||
474 | </connection> | ||
475 | <connection> | ||
476 | <sender>network802</sender> | ||
477 | <signal>toggled(bool)</signal> | ||
478 | <receiver>TextLabel2</receiver> | ||
479 | <slot>setEnabled(bool)</slot> | ||
480 | </connection> | ||
481 | <connection> | ||
482 | <sender>network802</sender> | ||
483 | <signal>toggled(bool)</signal> | 456 | <signal>toggled(bool)</signal> |
484 | <receiver>networkChannel</receiver> | 457 | <receiver>ButtonGroup43</receiver> |
485 | <slot>setEnabled(bool)</slot> | 458 | <slot>setEnabled(bool)</slot> |
486 | </connection> | 459 | </connection> |
487 | <connection> | 460 | <connection> |
488 | <sender>wepEnabled</sender> | 461 | <sender>wepEnabled</sender> |
489 | <signal>toggled(bool)</signal> | 462 | <signal>toggled(bool)</signal> |
490 | <receiver>ButtonGroup43</receiver> | 463 | <receiver>KeyButtonGroup</receiver> |
491 | <slot>setEnabled(bool)</slot> | 464 | <slot>setEnabled(bool)</slot> |
492 | </connection> | 465 | </connection> |
493 | <connection> | 466 | <connection> |
494 | <sender>wepEnabled</sender> | 467 | <sender>essAny</sender> |
495 | <signal>toggled(bool)</signal> | 468 | <signal>toggled(bool)</signal> |
496 | <receiver>ButtonGroup44</receiver> | 469 | <receiver>GroupBox1</receiver> |
497 | <slot>setEnabled(bool)</slot> | 470 | <slot>setEnabled(bool)</slot> |
498 | </connection> | 471 | </connection> |
499 | </connections> | 472 | </connections> |
500 | <tabstops> | 473 | <tabstops> |
501 | <tabstop>tabWidget</tabstop> | 474 | <tabstop>tabWidget</tabstop> |
502 | <tabstop>essNon</tabstop> | 475 | <tabstop>essAny</tabstop> |
503 | <tabstop>essSpecific</tabstop> | ||
504 | <tabstop>essSpecificLineEdit</tabstop> | 476 | <tabstop>essSpecificLineEdit</tabstop> |
505 | <tabstop>networkInfrastructure</tabstop> | 477 | <tabstop>networkType</tabstop> |
506 | <tabstop>network802</tabstop> | ||
507 | <tabstop>networkChannel</tabstop> | 478 | <tabstop>networkChannel</tabstop> |
508 | <tabstop>wepEnabled</tabstop> | 479 | <tabstop>wepEnabled</tabstop> |
509 | <tabstop>authOpen</tabstop> | 480 | <tabstop>authOpen</tabstop> |
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 6a56358..ef7329e 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -6,10 +6,12 @@ | |||
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qlabel.h> | ||
9 | #include <qspinbox.h> | 10 | #include <qspinbox.h> |
10 | #include <qradiobutton.h> | 11 | #include <qradiobutton.h> |
11 | #include <qcheckbox.h> | 12 | #include <qcheckbox.h> |
12 | #include <qtabwidget.h> | 13 | #include <qtabwidget.h> |
14 | #include <qcombobox.h> | ||
13 | 15 | ||
14 | /* system() */ | 16 | /* system() */ |
15 | #include <stdlib.h> | 17 | #include <stdlib.h> |
@@ -39,6 +41,13 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W | |||
39 | } | 41 | } |
40 | else | 42 | else |
41 | qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); | 43 | qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); |
44 | connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); | ||
45 | |||
46 | } | ||
47 | |||
48 | void WLANImp::typeChanged(int mod){ | ||
49 | networkChannel->setEnabled(mod); | ||
50 | channelLabel->setEnabled(mod); | ||
42 | } | 51 | } |
43 | 52 | ||
44 | /** | 53 | /** |
@@ -71,23 +80,19 @@ void WLANImp::parseSettingFile(){ | |||
71 | if(line.contains("ESSID=")){ | 80 | if(line.contains("ESSID=")){ |
72 | QString id = line.mid(line.find("ESSID=")+6, line.length()); | 81 | QString id = line.mid(line.find("ESSID=")+6, line.length()); |
73 | if(id == "any"){ | 82 | if(id == "any"){ |
74 | essNon->setChecked(true); | 83 | essAny->setChecked(false); |
75 | essSpecific->setChecked(false); | ||
76 | }else{ | 84 | }else{ |
77 | essSpecific->setChecked(true); | 85 | essAny->setChecked(true); |
78 | essSpecificLineEdit->setText(id); | 86 | essSpecificLineEdit->setText(id); |
79 | essNon->setChecked(false); | ||
80 | } | 87 | } |
81 | } | 88 | } |
82 | if(line.contains("MODE=")){ | 89 | if(line.contains("MODE=")){ |
83 | QString mode = line.mid(line.find("MODE=")+5, line.length()); | 90 | QString mode = line.mid(line.find("MODE=")+5, line.length()); |
84 | if(mode == "Managed"){ | 91 | if(mode == "Managed"){ |
85 | network802->setChecked( false ); | 92 | networkType->setCurrentItem(0); |
86 | networkInfrastructure->setChecked( true ); | ||
87 | } | 93 | } |
88 | else{ | 94 | else{ |
89 | network802->setChecked( true ); | 95 | networkType->setCurrentItem(0); |
90 | networkInfrastructure->setChecked( false ); | ||
91 | } | 96 | } |
92 | } | 97 | } |
93 | if(line.contains("KEY0=")) | 98 | if(line.contains("KEY0=")) |
@@ -154,9 +159,16 @@ void WLANImp::changeAndSaveSettingFile(){ | |||
154 | 159 | ||
155 | if(!line.contains("esac")) | 160 | if(!line.contains("esac")) |
156 | stream << line << "\n"; | 161 | stream << line << "\n"; |
157 | 162 | if(!essAny->isChecked() == true){ | |
158 | stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; | 163 | stream << "\tESSID=any\n"; |
159 | stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "ad-hoc") << '\n'; | 164 | stream << "\tMODE=Managed\n"; |
165 | stream << "\tCHANNEL=6\n"; | ||
166 | } | ||
167 | else{ | ||
168 | stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; | ||
169 | stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; | ||
170 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; | ||
171 | } | ||
160 | 172 | ||
161 | stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; | 173 | stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; |
162 | stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; | 174 | stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; |
@@ -175,7 +187,6 @@ void WLANImp::changeAndSaveSettingFile(){ | |||
175 | stream << " restricted"; | 187 | stream << " restricted"; |
176 | stream << "\"\n"; | 188 | stream << "\"\n"; |
177 | } | 189 | } |
178 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; | ||
179 | stream << "\tRATE=auto\n"; | 190 | stream << "\tRATE=auto\n"; |
180 | if(line.contains("esac")) | 191 | if(line.contains("esac")) |
181 | stream << line << "\n"; | 192 | stream << line << "\n"; |
@@ -196,11 +207,16 @@ void WLANImp::accept(){ | |||
196 | if(wepEnabled->isChecked()){ | 207 | if(wepEnabled->isChecked()){ |
197 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) | 208 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) |
198 | { | 209 | { |
199 | QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); | 210 | QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); |
200 | return; | 211 | return; |
201 | } | 212 | } |
202 | } | 213 | } |
203 | 214 | ||
215 | if(essSpecificLineEdit->text().isEmpty()){ | ||
216 | QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); | ||
217 | return; | ||
218 | } | ||
219 | |||
204 | // Ok settings are good here, save | 220 | // Ok settings are good here, save |
205 | changeAndSaveSettingFile(); | 221 | changeAndSaveSettingFile(); |
206 | 222 | ||
@@ -208,6 +224,7 @@ void WLANImp::accept(){ | |||
208 | if(!interfaceSetup->saveChanges()) | 224 | if(!interfaceSetup->saveChanges()) |
209 | return; | 225 | return; |
210 | 226 | ||
227 | return; | ||
211 | // Restart the device now that the settings have changed | 228 | // Restart the device now that the settings have changed |
212 | QString initpath; | 229 | QString initpath; |
213 | if( QDir("/etc/rc.d/init.d").exists() ) | 230 | if( QDir("/etc/rc.d/init.d").exists() ) |
diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index df599af..310836c 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h | |||
@@ -18,6 +18,9 @@ public: | |||
18 | protected: | 18 | protected: |
19 | void accept(); | 19 | void accept(); |
20 | 20 | ||
21 | private slots: | ||
22 | void typeChanged(int); | ||
23 | |||
21 | private: | 24 | private: |
22 | void parseSettingFile(); | 25 | void parseSettingFile(); |
23 | void changeAndSaveSettingFile(); | 26 | void changeAndSaveSettingFile(); |