Diffstat (limited to 'noncore/settings/networksettings/wlan/wlanimp2.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp2.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index e7d6ff5..92339d6 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp | |||
@@ -7,49 +7,49 @@ | |||
7 | #include <assert.h> | 7 | #include <assert.h> |
8 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <string.h> | 9 | #include <string.h> |
10 | 10 | ||
11 | #include <qapplication.h> | 11 | #include <qapplication.h> |
12 | #include <qfile.h> | 12 | #include <qfile.h> |
13 | #include <qdir.h> | 13 | #include <qdir.h> |
14 | #include <qdialog.h> | 14 | #include <qdialog.h> |
15 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <qlineedit.h> | 17 | #include <qlineedit.h> |
18 | #include <qlabel.h> | 18 | #include <qlabel.h> |
19 | #include <qspinbox.h> | 19 | #include <qspinbox.h> |
20 | #include <qradiobutton.h> | 20 | #include <qradiobutton.h> |
21 | #include <qpushbutton.h> | 21 | #include <qpushbutton.h> |
22 | #include <qcheckbox.h> | 22 | #include <qcheckbox.h> |
23 | #include <qtabwidget.h> | 23 | #include <qtabwidget.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qvbox.h> | 26 | #include <qvbox.h> |
27 | #include <qprogressbar.h> | 27 | #include <qprogressbar.h> |
28 | 28 | ||
29 | #ifdef QWS | 29 | #ifdef QWS |
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <opie/oprocess.h> | 31 | #include <opie2/oprocess.h> |
32 | #include <opie2/onetwork.h> | 32 | #include <opie2/onetwork.h> |
33 | #include <opie2/opcap.h> | 33 | #include <opie2/opcap.h> |
34 | #else | 34 | #else |
35 | #define OProcess KProcess | 35 | #define OProcess KProcess |
36 | #include <kprocess.h> | 36 | #include <kprocess.h> |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" | 39 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
40 | #define PREUP "/etc/network/if-pre-up.d/wireless-tools" | 40 | #define PREUP "/etc/network/if-pre-up.d/wireless-tools" |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Constructor, read in the wireless.opts file for parsing later. | 43 | * Constructor, read in the wireless.opts file for parsing later. |
44 | */ | 44 | */ |
45 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { | 45 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { |
46 | interfaces = new Interfaces(); | 46 | interfaces = new Interfaces(); |
47 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); | 47 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); |
48 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 48 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
49 | 49 | ||
50 | // Check sanity - the existance of the wireless-tools if-pre-up script | 50 | // Check sanity - the existance of the wireless-tools if-pre-up script |
51 | QFile file(QString(PREUP)); | 51 | QFile file(QString(PREUP)); |
52 | if (file.exists()) { | 52 | if (file.exists()) { |
53 | qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); | 53 | qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); |
54 | } | 54 | } |
55 | 55 | ||
@@ -118,89 +118,89 @@ void WLANImp::parseKeyStr(QString keystr) { | |||
118 | QStringList keys = QStringList::split(QRegExp("\\s+"), keystr); | 118 | QStringList keys = QStringList::split(QRegExp("\\s+"), keystr); |
119 | int enc = -1; // encryption state | 119 | int enc = -1; // encryption state |
120 | 120 | ||
121 | for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) { | 121 | for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) { |
122 | if ((*it).left(3) == "off") { | 122 | if ((*it).left(3) == "off") { |
123 | // encryption disabled | 123 | // encryption disabled |
124 | enc = 0; | 124 | enc = 0; |
125 | } else if ((*it).left(2) == "on") { | 125 | } else if ((*it).left(2) == "on") { |
126 | // encryption enabled | 126 | // encryption enabled |
127 | enc = 1; | 127 | enc = 1; |
128 | } else if ((*it).left(4) == "open") { | 128 | } else if ((*it).left(4) == "open") { |
129 | // open mode, accept non encrypted packets | 129 | // open mode, accept non encrypted packets |
130 | acceptNonEnc->setChecked(true); | 130 | acceptNonEnc->setChecked(true); |
131 | } else if ((*it).left(10) == "restricted") { | 131 | } else if ((*it).left(10) == "restricted") { |
132 | // restricted mode, only accept encrypted packets | 132 | // restricted mode, only accept encrypted packets |
133 | rejectNonEnc->setChecked(true); | 133 | rejectNonEnc->setChecked(true); |
134 | } else if ((*it).left(3) == "key") { | 134 | } else if ((*it).left(3) == "key") { |
135 | // new set of options | 135 | // new set of options |
136 | } else if ((*it).left(1) == "[") { | 136 | } else if ((*it).left(1) == "[") { |
137 | index = (*it).mid(1, 1).toInt(); | 137 | index = (*it).mid(1, 1).toInt(); |
138 | // switch current key to index | 138 | // switch current key to index |
139 | switch (index) { | 139 | switch (index) { |
140 | case 1: | 140 | case 1: |
141 | keyRadio0->setChecked(true); | 141 | keyRadio0->setChecked(true); |
142 | break; | 142 | break; |
143 | case 2: | 143 | case 2: |
144 | keyRadio1->setChecked(true); | 144 | keyRadio1->setChecked(true); |
145 | break; | 145 | break; |
146 | case 3: | 146 | case 3: |
147 | keyRadio2->setChecked(true); | 147 | keyRadio2->setChecked(true); |
148 | break; | 148 | break; |
149 | case 4: | 149 | case 4: |
150 | keyRadio3->setChecked(true); | 150 | keyRadio3->setChecked(true); |
151 | break; | 151 | break; |
152 | } | 152 | } |
153 | } else { | 153 | } else { |
154 | // key | 154 | // key |
155 | key = (*it); | 155 | key = (*it); |
156 | } | 156 | } |
157 | if (! key.isNull()) { | 157 | if (! key.isNull()) { |
158 | if (enc == -1) | 158 | if (enc == -1) |
159 | enc = 1; | 159 | enc = 1; |
160 | QStringList::Iterator next = ++it; | 160 | QStringList::Iterator next = ++it; |
161 | if (it == keys.end()) { | 161 | if (it == keys.end()) { |
162 | break; | 162 | break; |
163 | } | 163 | } |
164 | if ((*(next)).left(1) == "[") { | 164 | if ((*(next)).left(1) == "[") { |
165 | // set key at index | 165 | // set key at index |
166 | index = (*(next)).mid(1, 1).toInt(); | 166 | index = (*(next)).mid(1, 1).toInt(); |
167 | } else { | 167 | } else { |
168 | index = 1; | 168 | index = 1; |
169 | } | 169 | } |
170 | switch (index) { | 170 | switch (index) { |
171 | case 1: | 171 | case 1: |
172 | keyLineEdit0->setText(key); | 172 | keyLineEdit0->setText(key); |
173 | break; | 173 | break; |
174 | case 2: | 174 | case 2: |
175 | keyLineEdit1->setText(key); | 175 | keyLineEdit1->setText(key); |
176 | break; | 176 | break; |
177 | case 3: | 177 | case 3: |
178 | keyLineEdit2->setText(key); | 178 | keyLineEdit2->setText(key); |
179 | break; | 179 | break; |
180 | case 4: | 180 | case 4: |
181 | keyLineEdit3->setText(key); | 181 | keyLineEdit3->setText(key); |
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | key = QString::null; | 184 | key = QString::null; |
185 | } | 185 | } |
186 | } | 186 | } |
187 | if (enc == 1) { | 187 | if (enc == 1) { |
188 | wepEnabled->setChecked(true); | 188 | wepEnabled->setChecked(true); |
189 | } else { | 189 | } else { |
190 | wepEnabled->setChecked(false); | 190 | wepEnabled->setChecked(false); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Check to see if the current config is valid | 195 | * Check to see if the current config is valid |
196 | * Save interfaces | 196 | * Save interfaces |
197 | */ | 197 | */ |
198 | void WLANImp::accept() { | 198 | void WLANImp::accept() { |
199 | if (wepEnabled->isChecked()) { | 199 | if (wepEnabled->isChecked()) { |
200 | if ((keyRadio0->isChecked() && keyLineEdit0->text().isEmpty()) || | 200 | if ((keyRadio0->isChecked() && keyLineEdit0->text().isEmpty()) || |
201 | (keyRadio1->isChecked() && keyLineEdit1->text().isEmpty()) || | 201 | (keyRadio1->isChecked() && keyLineEdit1->text().isEmpty()) || |
202 | (keyRadio2->isChecked() && keyLineEdit2->text().isEmpty()) || | 202 | (keyRadio2->isChecked() && keyLineEdit2->text().isEmpty()) || |
203 | (keyRadio3->isChecked() && keyLineEdit3->text().isEmpty())) { | 203 | (keyRadio3->isChecked() && keyLineEdit3->text().isEmpty())) { |
204 | QMessageBox::information(this, "Error", "Please enter a WEP key.", QMessageBox::Ok); | 204 | QMessageBox::information(this, "Error", "Please enter a WEP key.", QMessageBox::Ok); |
205 | return; | 205 | return; |
206 | } | 206 | } |