-rw-r--r-- | noncore/net/networksetup/TODO | 26 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindow.ui | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/opie-networksetup.control | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/TODO | 26 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindow.ui | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/opie-networksettings.control | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/opie-networksetup.control | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 3 |
9 files changed, 53 insertions, 15 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO index 93cbab7..6457836 100644 --- a/noncore/net/networksetup/TODO +++ b/noncore/net/networksetup/TODO | |||
@@ -1,77 +1,93 @@ | |||
1 | Types: | ||
2 | -Ethernet Connection (Done) | ||
3 | -ISDN Connection | ||
4 | -Modem COnnection (Started) | ||
5 | -xDSL connection | ||
6 | -Token Ring Connection | ||
7 | -CIPE (VPN) connection (ipsec?) | ||
8 | -Wireless Connection (Done) | ||
9 | -Bluetooth | ||
10 | -IPChains? | ||
11 | |||
1 | test WEP | 12 | test WEP |
2 | WEP key in file wireless.conf is not encrypted !, therefore it is very easy to get the key out of the zaurus.. | 13 | Add WEP transimtion rate |
3 | WEP transimtion rat | ||
4 | 1 or 2 | 14 | 1 or 2 |
5 | 5.5 | 15 | 5.5 |
6 | 1 | 16 | 1 |
7 | Auto | 17 | Auto |
8 | 18 | ||
9 | udchcp needs to output the dhcp information so interfaces can read it | 19 | udchcp needs to output the dhcp information so interfaces can read it |
10 | 20 | ||
11 | interfacesetupimp really doesn't need a interface* pointer | 21 | interfacesetupimp really doesn't need a interface* pointer |
12 | 22 | ||
13 | Possible other modules to write: ppp, ipsec, bluetooth, ipchains | ||
14 | |||
15 | PPP module needs to scan pppd.tdb to see what is currently active | 23 | PPP module needs to scan pppd.tdb to see what is currently active |
16 | 24 | ||
17 | WLAN - add possiblity to input text or hex without knowing "s:" | 25 | WLAN |
26 | - add possiblity to input text or hex without knowing "s:" | ||
27 | - Handle "any" and any the same way in config | ||
18 | 28 | ||
19 | Interface setupimp needs to use kernel calls. | 29 | Interface setupimp needs to use kernel calls. |
20 | 30 | ||
31 | Add a route/DNS editor under the ViewAdvancedInfo button | ||
32 | |||
33 | Use a true TCP/IP widget | ||
34 | |||
35 | Make it so that pcmcia doesn't need to be stopped/started for wlan | ||
36 | |||
21 | Automaticly update the main list of interfaces: | 37 | Automaticly update the main list of interfaces: |
22 | > That would be me. :-D netlink, can you point me in the right | 38 | > That would be me. :-D netlink, can you point me in the right |
23 | > direction where I can get more info on it? (I figured there was some | 39 | > direction where I can get more info on it? (I figured there was some |
24 | > kenel call) | 40 | > kenel call) |
25 | 41 | ||
26 | You can look up the meaning of the packets you receive, or you can just go | 42 | You can look up the meaning of the packets you receive, or you can just go |
27 | poll for changes you might be interested in each time you receive _any_ | 43 | poll for changes you might be interested in each time you receive _any_ |
28 | packet. Anything's better than periodic polling. | 44 | packet. Anything's better than periodic polling. |
29 | 45 | ||
30 | Note that you can't do this as non-root on some kernels. There's a patch | 46 | Note that you can't do this as non-root on some kernels. There's a patch |
31 | which can go into the hh.org kernel if it's not already there. | 47 | which can go into the hh.org kernel if it's not already there. |
32 | cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2 | 48 | cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2 |
33 | 49 | ||
34 | 50 | ||
35 | #include <asm/types.h> | 51 | #include <asm/types.h> |
36 | #include <sys/socket.h> | 52 | #include <sys/socket.h> |
37 | #include <linux/netlink.h> | 53 | #include <linux/netlink.h> |
38 | #include <linux/rtnetlink.h> | 54 | #include <linux/rtnetlink.h> |
39 | 55 | ||
40 | int main(int argc, char **argv) | 56 | int main(int argc, char **argv) |
41 | { | 57 | { |
42 | int fd; | 58 | int fd; |
43 | unsigned char buf[4096]; | 59 | unsigned char buf[4096]; |
44 | int ret; | 60 | int ret; |
45 | int i, j; | 61 | int i, j; |
46 | struct sockaddr_nl snl; | 62 | struct sockaddr_nl snl; |
47 | 63 | ||
48 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); | 64 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); |
49 | if (fd < 0) { | 65 | if (fd < 0) { |
50 | perror("socket"); | 66 | perror("socket"); |
51 | exit(1); | 67 | exit(1); |
52 | } | 68 | } |
53 | 69 | ||
54 | snl.nl_family = AF_NETLINK; | 70 | snl.nl_family = AF_NETLINK; |
55 | snl.nl_pad = 0; | 71 | snl.nl_pad = 0; |
56 | snl.nl_pid = getpid(); | 72 | snl.nl_pid = getpid(); |
57 | snl.nl_groups = RTM_NEWLINK|RTM_DELLINK; | 73 | snl.nl_groups = RTM_NEWLINK|RTM_DELLINK; |
58 | 74 | ||
59 | if (bind(fd, &snl, sizeof(snl)) < 0) { | 75 | if (bind(fd, &snl, sizeof(snl)) < 0) { |
60 | perror("bind"); | 76 | perror("bind"); |
61 | exit(1); | 77 | exit(1); |
62 | } | 78 | } |
63 | while (1) { | 79 | while (1) { |
64 | ret = recv(fd, buf, 4096, 0); | 80 | ret = recv(fd, buf, 4096, 0); |
65 | if (ret < 0) { | 81 | if (ret < 0) { |
66 | perror("recv"); | 82 | perror("recv"); |
67 | exit(1); | 83 | exit(1); |
68 | } | 84 | } |
69 | for (i=0; i<ret; i++) { | 85 | for (i=0; i<ret; i++) { |
70 | printf("%02x ", buf[i]); | 86 | printf("%02x ", buf[i]); |
71 | } | 87 | } |
72 | printf("\n"); | 88 | printf("\n"); |
73 | } | 89 | } |
74 | 90 | ||
75 | } | 91 | } |
76 | -- | 92 | -- |
77 | 93 | ||
diff --git a/noncore/net/networksetup/mainwindow.ui b/noncore/net/networksetup/mainwindow.ui index 3d30994..dcabc52 100644 --- a/noncore/net/networksetup/mainwindow.ui +++ b/noncore/net/networksetup/mainwindow.ui | |||
@@ -1,404 +1,404 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>MainWindow</class> | 2 | <class>MainWindow</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>MainWindow</cstring> | 7 | <cstring>MainWindow</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>240</width> | 14 | <width>240</width> |
15 | <height>289</height> | 15 | <height>289</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Network Setup</string> | 20 | <string>Network Settings</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QTabWidget</class> | 32 | <class>QTabWidget</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>tabWidget</cstring> | 35 | <cstring>tabWidget</cstring> |
36 | </property> | 36 | </property> |
37 | <property> | 37 | <property> |
38 | <name>layoutMargin</name> | 38 | <name>layoutMargin</name> |
39 | </property> | 39 | </property> |
40 | <widget> | 40 | <widget> |
41 | <class>QWidget</class> | 41 | <class>QWidget</class> |
42 | <property stdset="1"> | 42 | <property stdset="1"> |
43 | <name>name</name> | 43 | <name>name</name> |
44 | <cstring>Widget3</cstring> | 44 | <cstring>Widget3</cstring> |
45 | </property> | 45 | </property> |
46 | <attribute> | 46 | <attribute> |
47 | <name>title</name> | 47 | <name>title</name> |
48 | <string>Connections</string> | 48 | <string>Connections</string> |
49 | </attribute> | 49 | </attribute> |
50 | <vbox> | 50 | <vbox> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>margin</name> | 52 | <name>margin</name> |
53 | <number>0</number> | 53 | <number>0</number> |
54 | </property> | 54 | </property> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>spacing</name> | 56 | <name>spacing</name> |
57 | <number>6</number> | 57 | <number>6</number> |
58 | </property> | 58 | </property> |
59 | <widget> | 59 | <widget> |
60 | <class>QListView</class> | 60 | <class>QListView</class> |
61 | <column> | 61 | <column> |
62 | <property> | 62 | <property> |
63 | <name>text</name> | 63 | <name>text</name> |
64 | <string>s</string> | 64 | <string>s</string> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>clickable</name> | 67 | <name>clickable</name> |
68 | <bool>true</bool> | 68 | <bool>true</bool> |
69 | </property> | 69 | </property> |
70 | <property> | 70 | <property> |
71 | <name>resizeable</name> | 71 | <name>resizeable</name> |
72 | <bool>true</bool> | 72 | <bool>true</bool> |
73 | </property> | 73 | </property> |
74 | </column> | 74 | </column> |
75 | <column> | 75 | <column> |
76 | <property> | 76 | <property> |
77 | <name>text</name> | 77 | <name>text</name> |
78 | <string>t</string> | 78 | <string>t</string> |
79 | </property> | 79 | </property> |
80 | <property> | 80 | <property> |
81 | <name>clickable</name> | 81 | <name>clickable</name> |
82 | <bool>true</bool> | 82 | <bool>true</bool> |
83 | </property> | 83 | </property> |
84 | <property> | 84 | <property> |
85 | <name>resizeable</name> | 85 | <name>resizeable</name> |
86 | <bool>true</bool> | 86 | <bool>true</bool> |
87 | </property> | 87 | </property> |
88 | </column> | 88 | </column> |
89 | <column> | 89 | <column> |
90 | <property> | 90 | <property> |
91 | <name>text</name> | 91 | <name>text</name> |
92 | <string>Name</string> | 92 | <string>Name</string> |
93 | </property> | 93 | </property> |
94 | <property> | 94 | <property> |
95 | <name>clickable</name> | 95 | <name>clickable</name> |
96 | <bool>true</bool> | 96 | <bool>true</bool> |
97 | </property> | 97 | </property> |
98 | <property> | 98 | <property> |
99 | <name>resizeable</name> | 99 | <name>resizeable</name> |
100 | <bool>true</bool> | 100 | <bool>true</bool> |
101 | </property> | 101 | </property> |
102 | </column> | 102 | </column> |
103 | <column> | 103 | <column> |
104 | <property> | 104 | <property> |
105 | <name>text</name> | 105 | <name>text</name> |
106 | <string>in</string> | 106 | <string>in</string> |
107 | </property> | 107 | </property> |
108 | <property> | 108 | <property> |
109 | <name>clickable</name> | 109 | <name>clickable</name> |
110 | <bool>true</bool> | 110 | <bool>true</bool> |
111 | </property> | 111 | </property> |
112 | <property> | 112 | <property> |
113 | <name>resizeable</name> | 113 | <name>resizeable</name> |
114 | <bool>true</bool> | 114 | <bool>true</bool> |
115 | </property> | 115 | </property> |
116 | </column> | 116 | </column> |
117 | <column> | 117 | <column> |
118 | <property> | 118 | <property> |
119 | <name>text</name> | 119 | <name>text</name> |
120 | <string>IP</string> | 120 | <string>IP</string> |
121 | </property> | 121 | </property> |
122 | <property> | 122 | <property> |
123 | <name>clickable</name> | 123 | <name>clickable</name> |
124 | <bool>true</bool> | 124 | <bool>true</bool> |
125 | </property> | 125 | </property> |
126 | <property> | 126 | <property> |
127 | <name>resizeable</name> | 127 | <name>resizeable</name> |
128 | <bool>true</bool> | 128 | <bool>true</bool> |
129 | </property> | 129 | </property> |
130 | </column> | 130 | </column> |
131 | <property stdset="1"> | 131 | <property stdset="1"> |
132 | <name>name</name> | 132 | <name>name</name> |
133 | <cstring>connectionList</cstring> | 133 | <cstring>connectionList</cstring> |
134 | </property> | 134 | </property> |
135 | <property stdset="1"> | 135 | <property stdset="1"> |
136 | <name>allColumnsShowFocus</name> | 136 | <name>allColumnsShowFocus</name> |
137 | <bool>true</bool> | 137 | <bool>true</bool> |
138 | </property> | 138 | </property> |
139 | </widget> | 139 | </widget> |
140 | <widget> | 140 | <widget> |
141 | <class>QLayoutWidget</class> | 141 | <class>QLayoutWidget</class> |
142 | <property stdset="1"> | 142 | <property stdset="1"> |
143 | <name>name</name> | 143 | <name>name</name> |
144 | <cstring>Layout2</cstring> | 144 | <cstring>Layout2</cstring> |
145 | </property> | 145 | </property> |
146 | <property> | 146 | <property> |
147 | <name>layoutMargin</name> | 147 | <name>layoutMargin</name> |
148 | </property> | 148 | </property> |
149 | <grid> | 149 | <grid> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>margin</name> | 151 | <name>margin</name> |
152 | <number>5</number> | 152 | <number>5</number> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>spacing</name> | 155 | <name>spacing</name> |
156 | <number>6</number> | 156 | <number>6</number> |
157 | </property> | 157 | </property> |
158 | <widget row="1" column="0" > | 158 | <widget row="1" column="0" > |
159 | <class>QPushButton</class> | 159 | <class>QPushButton</class> |
160 | <property stdset="1"> | 160 | <property stdset="1"> |
161 | <name>name</name> | 161 | <name>name</name> |
162 | <cstring>addConnectionButton</cstring> | 162 | <cstring>addConnectionButton</cstring> |
163 | </property> | 163 | </property> |
164 | <property stdset="1"> | 164 | <property stdset="1"> |
165 | <name>text</name> | 165 | <name>text</name> |
166 | <string>&Add</string> | 166 | <string>&Add</string> |
167 | </property> | 167 | </property> |
168 | </widget> | 168 | </widget> |
169 | <widget row="0" column="0" > | 169 | <widget row="0" column="0" > |
170 | <class>QPushButton</class> | 170 | <class>QPushButton</class> |
171 | <property stdset="1"> | 171 | <property stdset="1"> |
172 | <name>name</name> | 172 | <name>name</name> |
173 | <cstring>informationConnectionButton</cstring> | 173 | <cstring>informationConnectionButton</cstring> |
174 | </property> | 174 | </property> |
175 | <property stdset="1"> | 175 | <property stdset="1"> |
176 | <name>text</name> | 176 | <name>text</name> |
177 | <string>&Information</string> | 177 | <string>&Information</string> |
178 | </property> | 178 | </property> |
179 | </widget> | 179 | </widget> |
180 | <widget row="0" column="1" > | 180 | <widget row="0" column="1" > |
181 | <class>QPushButton</class> | 181 | <class>QPushButton</class> |
182 | <property stdset="1"> | 182 | <property stdset="1"> |
183 | <name>name</name> | 183 | <name>name</name> |
184 | <cstring>configureConnectionButton</cstring> | 184 | <cstring>configureConnectionButton</cstring> |
185 | </property> | 185 | </property> |
186 | <property stdset="1"> | 186 | <property stdset="1"> |
187 | <name>text</name> | 187 | <name>text</name> |
188 | <string>&Configure</string> | 188 | <string>&Configure</string> |
189 | </property> | 189 | </property> |
190 | </widget> | 190 | </widget> |
191 | <widget row="1" column="1" > | 191 | <widget row="1" column="1" > |
192 | <class>QPushButton</class> | 192 | <class>QPushButton</class> |
193 | <property stdset="1"> | 193 | <property stdset="1"> |
194 | <name>name</name> | 194 | <name>name</name> |
195 | <cstring>removeConnectionButton</cstring> | 195 | <cstring>removeConnectionButton</cstring> |
196 | </property> | 196 | </property> |
197 | <property stdset="1"> | 197 | <property stdset="1"> |
198 | <name>text</name> | 198 | <name>text</name> |
199 | <string>&Remove</string> | 199 | <string>&Remove</string> |
200 | </property> | 200 | </property> |
201 | </widget> | 201 | </widget> |
202 | </grid> | 202 | </grid> |
203 | </widget> | 203 | </widget> |
204 | </vbox> | 204 | </vbox> |
205 | </widget> | 205 | </widget> |
206 | <widget> | 206 | <widget> |
207 | <class>QWidget</class> | 207 | <class>QWidget</class> |
208 | <property stdset="1"> | 208 | <property stdset="1"> |
209 | <name>name</name> | 209 | <name>name</name> |
210 | <cstring>tab</cstring> | 210 | <cstring>tab</cstring> |
211 | </property> | 211 | </property> |
212 | <attribute> | 212 | <attribute> |
213 | <name>title</name> | 213 | <name>title</name> |
214 | <string>Profiles</string> | 214 | <string>Profiles</string> |
215 | </attribute> | 215 | </attribute> |
216 | <grid> | 216 | <grid> |
217 | <property stdset="1"> | 217 | <property stdset="1"> |
218 | <name>margin</name> | 218 | <name>margin</name> |
219 | <number>11</number> | 219 | <number>11</number> |
220 | </property> | 220 | </property> |
221 | <property stdset="1"> | 221 | <property stdset="1"> |
222 | <name>spacing</name> | 222 | <name>spacing</name> |
223 | <number>6</number> | 223 | <number>6</number> |
224 | </property> | 224 | </property> |
225 | <spacer row="7" column="2" > | 225 | <spacer row="7" column="2" > |
226 | <property> | 226 | <property> |
227 | <name>name</name> | 227 | <name>name</name> |
228 | <cstring>Spacer16</cstring> | 228 | <cstring>Spacer16</cstring> |
229 | </property> | 229 | </property> |
230 | <property stdset="1"> | 230 | <property stdset="1"> |
231 | <name>orientation</name> | 231 | <name>orientation</name> |
232 | <enum>Vertical</enum> | 232 | <enum>Vertical</enum> |
233 | </property> | 233 | </property> |
234 | <property stdset="1"> | 234 | <property stdset="1"> |
235 | <name>sizeType</name> | 235 | <name>sizeType</name> |
236 | <enum>Expanding</enum> | 236 | <enum>Expanding</enum> |
237 | </property> | 237 | </property> |
238 | <property> | 238 | <property> |
239 | <name>sizeHint</name> | 239 | <name>sizeHint</name> |
240 | <size> | 240 | <size> |
241 | <width>20</width> | 241 | <width>20</width> |
242 | <height>20</height> | 242 | <height>20</height> |
243 | </size> | 243 | </size> |
244 | </property> | 244 | </property> |
245 | </spacer> | 245 | </spacer> |
246 | <widget row="0" column="1" > | 246 | <widget row="0" column="1" > |
247 | <class>QLabel</class> | 247 | <class>QLabel</class> |
248 | <property stdset="1"> | 248 | <property stdset="1"> |
249 | <name>name</name> | 249 | <name>name</name> |
250 | <cstring>currentProfileLabel</cstring> | 250 | <cstring>currentProfileLabel</cstring> |
251 | </property> | 251 | </property> |
252 | <property stdset="1"> | 252 | <property stdset="1"> |
253 | <name>frameShape</name> | 253 | <name>frameShape</name> |
254 | <enum>Panel</enum> | 254 | <enum>Panel</enum> |
255 | </property> | 255 | </property> |
256 | <property stdset="1"> | 256 | <property stdset="1"> |
257 | <name>frameShadow</name> | 257 | <name>frameShadow</name> |
258 | <enum>Sunken</enum> | 258 | <enum>Sunken</enum> |
259 | </property> | 259 | </property> |
260 | <property stdset="1"> | 260 | <property stdset="1"> |
261 | <name>text</name> | 261 | <name>text</name> |
262 | <string>All</string> | 262 | <string>All</string> |
263 | </property> | 263 | </property> |
264 | </widget> | 264 | </widget> |
265 | <widget row="3" column="2" > | 265 | <widget row="3" column="2" > |
266 | <class>QPushButton</class> | 266 | <class>QPushButton</class> |
267 | <property stdset="1"> | 267 | <property stdset="1"> |
268 | <name>name</name> | 268 | <name>name</name> |
269 | <cstring>setCurrentProfileButton</cstring> | 269 | <cstring>setCurrentProfileButton</cstring> |
270 | </property> | 270 | </property> |
271 | <property stdset="1"> | 271 | <property stdset="1"> |
272 | <name>text</name> | 272 | <name>text</name> |
273 | <string>&Set Current</string> | 273 | <string>&Set Current</string> |
274 | </property> | 274 | </property> |
275 | </widget> | 275 | </widget> |
276 | <widget row="5" column="0" rowspan="1" colspan="3" > | 276 | <widget row="5" column="0" rowspan="1" colspan="3" > |
277 | <class>Line</class> | 277 | <class>Line</class> |
278 | <property stdset="1"> | 278 | <property stdset="1"> |
279 | <name>name</name> | 279 | <name>name</name> |
280 | <cstring>Line6</cstring> | 280 | <cstring>Line6</cstring> |
281 | </property> | 281 | </property> |
282 | <property stdset="1"> | 282 | <property stdset="1"> |
283 | <name>orientation</name> | 283 | <name>orientation</name> |
284 | <enum>Horizontal</enum> | 284 | <enum>Horizontal</enum> |
285 | </property> | 285 | </property> |
286 | </widget> | 286 | </widget> |
287 | <widget row="1" column="0" rowspan="1" colspan="3" > | 287 | <widget row="1" column="0" rowspan="1" colspan="3" > |
288 | <class>Line</class> | 288 | <class>Line</class> |
289 | <property stdset="1"> | 289 | <property stdset="1"> |
290 | <name>name</name> | 290 | <name>name</name> |
291 | <cstring>Line1</cstring> | 291 | <cstring>Line1</cstring> |
292 | </property> | 292 | </property> |
293 | <property stdset="1"> | 293 | <property stdset="1"> |
294 | <name>orientation</name> | 294 | <name>orientation</name> |
295 | <enum>Horizontal</enum> | 295 | <enum>Horizontal</enum> |
296 | </property> | 296 | </property> |
297 | </widget> | 297 | </widget> |
298 | <widget row="0" column="0" > | 298 | <widget row="0" column="0" > |
299 | <class>QLabel</class> | 299 | <class>QLabel</class> |
300 | <property stdset="1"> | 300 | <property stdset="1"> |
301 | <name>name</name> | 301 | <name>name</name> |
302 | <cstring>TextLabel1</cstring> | 302 | <cstring>TextLabel1</cstring> |
303 | </property> | 303 | </property> |
304 | <property stdset="1"> | 304 | <property stdset="1"> |
305 | <name>text</name> | 305 | <name>text</name> |
306 | <string>Current Profile</string> | 306 | <string>Current Profile</string> |
307 | </property> | 307 | </property> |
308 | </widget> | 308 | </widget> |
309 | <widget row="4" column="2" > | 309 | <widget row="4" column="2" > |
310 | <class>QPushButton</class> | 310 | <class>QPushButton</class> |
311 | <property stdset="1"> | 311 | <property stdset="1"> |
312 | <name>name</name> | 312 | <name>name</name> |
313 | <cstring>removeProfileButton</cstring> | 313 | <cstring>removeProfileButton</cstring> |
314 | </property> | 314 | </property> |
315 | <property stdset="1"> | 315 | <property stdset="1"> |
316 | <name>text</name> | 316 | <name>text</name> |
317 | <string>&Remove</string> | 317 | <string>&Remove</string> |
318 | </property> | 318 | </property> |
319 | </widget> | 319 | </widget> |
320 | <widget row="3" column="0" rowspan="2" colspan="2" > | 320 | <widget row="3" column="0" rowspan="2" colspan="2" > |
321 | <class>QListBox</class> | 321 | <class>QListBox</class> |
322 | <property stdset="1"> | 322 | <property stdset="1"> |
323 | <name>name</name> | 323 | <name>name</name> |
324 | <cstring>profilesList</cstring> | 324 | <cstring>profilesList</cstring> |
325 | </property> | 325 | </property> |
326 | </widget> | 326 | </widget> |
327 | <spacer row="0" column="2" > | 327 | <spacer row="0" column="2" > |
328 | <property> | 328 | <property> |
329 | <name>name</name> | 329 | <name>name</name> |
330 | <cstring>Spacer2</cstring> | 330 | <cstring>Spacer2</cstring> |
331 | </property> | 331 | </property> |
332 | <property stdset="1"> | 332 | <property stdset="1"> |
333 | <name>orientation</name> | 333 | <name>orientation</name> |
334 | <enum>Horizontal</enum> | 334 | <enum>Horizontal</enum> |
335 | </property> | 335 | </property> |
336 | <property stdset="1"> | 336 | <property stdset="1"> |
337 | <name>sizeType</name> | 337 | <name>sizeType</name> |
338 | <enum>Expanding</enum> | 338 | <enum>Expanding</enum> |
339 | </property> | 339 | </property> |
340 | <property> | 340 | <property> |
341 | <name>sizeHint</name> | 341 | <name>sizeHint</name> |
342 | <size> | 342 | <size> |
343 | <width>20</width> | 343 | <width>20</width> |
344 | <height>20</height> | 344 | <height>20</height> |
345 | </size> | 345 | </size> |
346 | </property> | 346 | </property> |
347 | </spacer> | 347 | </spacer> |
348 | <widget row="2" column="0" > | 348 | <widget row="2" column="0" > |
349 | <class>QLabel</class> | 349 | <class>QLabel</class> |
350 | <property stdset="1"> | 350 | <property stdset="1"> |
351 | <name>name</name> | 351 | <name>name</name> |
352 | <cstring>TextLabel1_2</cstring> | 352 | <cstring>TextLabel1_2</cstring> |
353 | </property> | 353 | </property> |
354 | <property stdset="1"> | 354 | <property stdset="1"> |
355 | <name>text</name> | 355 | <name>text</name> |
356 | <string>Profiles</string> | 356 | <string>Profiles</string> |
357 | </property> | 357 | </property> |
358 | </widget> | 358 | </widget> |
359 | <widget row="6" column="0" rowspan="1" colspan="3" > | 359 | <widget row="6" column="0" rowspan="1" colspan="3" > |
360 | <class>QLayoutWidget</class> | 360 | <class>QLayoutWidget</class> |
361 | <property stdset="1"> | 361 | <property stdset="1"> |
362 | <name>name</name> | 362 | <name>name</name> |
363 | <cstring>Layout6</cstring> | 363 | <cstring>Layout6</cstring> |
364 | </property> | 364 | </property> |
365 | <hbox> | 365 | <hbox> |
366 | <property stdset="1"> | 366 | <property stdset="1"> |
367 | <name>margin</name> | 367 | <name>margin</name> |
368 | <number>0</number> | 368 | <number>0</number> |
369 | </property> | 369 | </property> |
370 | <property stdset="1"> | 370 | <property stdset="1"> |
371 | <name>spacing</name> | 371 | <name>spacing</name> |
372 | <number>6</number> | 372 | <number>6</number> |
373 | </property> | 373 | </property> |
374 | <widget> | 374 | <widget> |
375 | <class>QLabel</class> | 375 | <class>QLabel</class> |
376 | <property stdset="1"> | 376 | <property stdset="1"> |
377 | <name>name</name> | 377 | <name>name</name> |
378 | <cstring>TextLabel1_3</cstring> | 378 | <cstring>TextLabel1_3</cstring> |
379 | </property> | 379 | </property> |
380 | <property stdset="1"> | 380 | <property stdset="1"> |
381 | <name>text</name> | 381 | <name>text</name> |
382 | <string>New Profile</string> | 382 | <string>New Profile</string> |
383 | </property> | 383 | </property> |
384 | </widget> | 384 | </widget> |
385 | <widget> | 385 | <widget> |
386 | <class>QLineEdit</class> | 386 | <class>QLineEdit</class> |
387 | <property stdset="1"> | 387 | <property stdset="1"> |
388 | <name>name</name> | 388 | <name>name</name> |
389 | <cstring>newProfile</cstring> | 389 | <cstring>newProfile</cstring> |
390 | </property> | 390 | </property> |
391 | </widget> | 391 | </widget> |
392 | <widget> | 392 | <widget> |
393 | <class>QPushButton</class> | 393 | <class>QPushButton</class> |
394 | <property stdset="1"> | 394 | <property stdset="1"> |
395 | <name>name</name> | 395 | <name>name</name> |
396 | <cstring>newProfileButton</cstring> | 396 | <cstring>newProfileButton</cstring> |
397 | </property> | 397 | </property> |
398 | <property stdset="1"> | 398 | <property stdset="1"> |
399 | <name>enabled</name> | 399 | <name>enabled</name> |
400 | <bool>false</bool> | 400 | <bool>false</bool> |
401 | </property> | 401 | </property> |
402 | <property stdset="1"> | 402 | <property stdset="1"> |
403 | <name>text</name> | 403 | <name>text</name> |
404 | <string>&Add</string> | 404 | <string>&Add</string> |
diff --git a/noncore/net/networksetup/opie-networksetup.control b/noncore/net/networksetup/opie-networksetup.control index 3d6a32c..585e50e 100644 --- a/noncore/net/networksetup/opie-networksetup.control +++ b/noncore/net/networksetup/opie-networksetup.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile | 1 | Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/settings | 3 | Section: opie/settings |
4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> | 4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Opie network setup tool | 8 | Description: Network settings |
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 648932f..1782c22 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -1,244 +1,247 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | #include "interfacesetupimp.h" | 2 | #include "interfacesetupimp.h" |
3 | 3 | ||
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qdir.h> | 5 | #include <qdir.h> |
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 <qlabel.h> |
10 | #include <qspinbox.h> | 10 | #include <qspinbox.h> |
11 | #include <qradiobutton.h> | 11 | #include <qradiobutton.h> |
12 | #include <qcheckbox.h> | 12 | #include <qcheckbox.h> |
13 | #include <qtabwidget.h> | 13 | #include <qtabwidget.h> |
14 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
15 | 15 | ||
16 | /* system() */ | 16 | /* system() */ |
17 | #include <stdlib.h> | 17 | #include <stdlib.h> |
18 | 18 | ||
19 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" | 19 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Constructor, read in the wireless.opts file for parsing later. | 22 | * Constructor, read in the wireless.opts file for parsing later. |
23 | */ | 23 | */ |
24 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") { | 24 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") { |
25 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i); | 25 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i); |
26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
27 | 27 | ||
28 | // Read in the config file. | 28 | // Read in the config file. |
29 | QString wlanFile = WIRELESS_OPTS; | 29 | QString wlanFile = WIRELESS_OPTS; |
30 | QFile file(wlanFile); | 30 | QFile file(wlanFile); |
31 | if (file.open(IO_ReadOnly)){ | 31 | if (file.open(IO_ReadOnly)){ |
32 | QTextStream stream( &file ); | 32 | QTextStream stream( &file ); |
33 | QString line = ""; | 33 | QString line = ""; |
34 | while ( !stream.eof() ) { | 34 | while ( !stream.eof() ) { |
35 | line += stream.readLine(); | 35 | line += stream.readLine(); |
36 | line += "\n"; | 36 | line += "\n"; |
37 | } | 37 | } |
38 | file.close(); | 38 | file.close(); |
39 | settingsFileText = QStringList::split("\n", line, true); | 39 | settingsFileText = QStringList::split("\n", line, true); |
40 | parseSettingFile(); | 40 | parseSettingFile(); |
41 | } | 41 | } |
42 | else | 42 | else |
43 | 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))); | 44 | connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); |
45 | } | 45 | } |
46 | 46 | ||
47 | void WLANImp::typeChanged(int mod){ | 47 | void WLANImp::typeChanged(int mod){ |
48 | networkChannel->setEnabled(mod); | 48 | networkChannel->setEnabled(mod); |
49 | channelLabel->setEnabled(mod); | 49 | channelLabel->setEnabled(mod); |
50 | } | 50 | } |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Change the profile for both wireless settings and network settings. | 53 | * Change the profile for both wireless settings and network settings. |
54 | */ | 54 | */ |
55 | void WLANImp::setProfile(const QString &profile){ | 55 | void WLANImp::setProfile(const QString &profile){ |
56 | interfaceSetup->setProfile(profile); | 56 | interfaceSetup->setProfile(profile); |
57 | parseSettingFile(); | 57 | parseSettingFile(); |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Parses the settings file that was read in and gets any setting from it. | 61 | * Parses the settings file that was read in and gets any setting from it. |
62 | */ | 62 | */ |
63 | void WLANImp::parseSettingFile(){ | 63 | void WLANImp::parseSettingFile(){ |
64 | bool foundCase = false; | 64 | bool foundCase = false; |
65 | bool found = false; | 65 | bool found = false; |
66 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { | 66 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
67 | QString line = (*it).simplifyWhiteSpace(); | 67 | QString line = (*it).simplifyWhiteSpace(); |
68 | if(line.contains("case")) | 68 | if(line.contains("case")) |
69 | foundCase = true; | 69 | foundCase = true; |
70 | // See if we found our scheme to write or the sceme couldn't be found | 70 | // See if we found our scheme to write or the sceme couldn't be found |
71 | if((foundCase && line.contains("esac")) || | 71 | if((foundCase && line.contains("esac")) || |
72 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) | 72 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) |
73 | found = true; | 73 | found = true; |
74 | 74 | ||
75 | if(line.contains(";;")) | 75 | if(line.contains(";;")) |
76 | found = false; | 76 | found = false; |
77 | if(found){ | 77 | if(found){ |
78 | // write out scheme | 78 | // write out scheme |
79 | if(line.contains("ESSID=")){ | 79 | if(line.contains("ESSID=")){ |
80 | QString id = line.mid(line.find("ESSID=")+6, line.length()); | 80 | QString id = line.mid(line.find("ESSID=")+6, line.length()); |
81 | if(id == "any"){ | 81 | if(id == "any"){ |
82 | essAny->setChecked(false); | 82 | essAny->setChecked(false); |
83 | }else{ | 83 | }else{ |
84 | essAny->setChecked(true); | 84 | essAny->setChecked(true); |
85 | essSpecificLineEdit->setText(id); | 85 | essSpecificLineEdit->setText(id); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | if(line.contains("MODE=")){ | 88 | if(line.contains("MODE=")){ |
89 | QString mode = line.mid(line.find("MODE=")+5, line.length()); | 89 | QString mode = line.mid(line.find("MODE=")+5, line.length()); |
90 | if(mode == "Managed"){ | 90 | if(mode == "Managed"){ |
91 | networkType->setCurrentItem(0); | 91 | networkType->setCurrentItem(0); |
92 | channelLabel->setEnabled(false); | 92 | channelLabel->setEnabled(false); |
93 | networkChannel->setEnabled(false); | 93 | networkChannel->setEnabled(false); |
94 | } | 94 | } |
95 | else{ | 95 | else{ |
96 | networkType->setCurrentItem(1); | 96 | networkType->setCurrentItem(1); |
97 | networkChannel->setEnabled(true); | 97 | networkChannel->setEnabled(true); |
98 | channelLabel->setEnabled(true); | 98 | channelLabel->setEnabled(true); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | if(line.contains("#KEY0=")) | 101 | if(line.contains("#KEY0=")) |
102 | keyLineEdit0->setText(line.mid(6, line.length())); | 102 | keyLineEdit0->setText(line.mid(6, line.length())); |
103 | if(line.contains("#KEY1=")) | 103 | if(line.contains("#KEY1=")) |
104 | keyLineEdit1->setText(line.mid(6, line.length())); | 104 | keyLineEdit1->setText(line.mid(6, line.length())); |
105 | if(line.contains("#KEY2=")) | 105 | if(line.contains("#KEY2=")) |
106 | keyLineEdit2->setText(line.mid(6, line.length())); | 106 | keyLineEdit2->setText(line.mid(6, line.length())); |
107 | if(line.contains("#KEY3=")) | 107 | if(line.contains("#KEY3=")) |
108 | keyLineEdit3->setText(line.mid(6, line.length())); | 108 | keyLineEdit3->setText(line.mid(6, line.length())); |
109 | 109 | ||
110 | if(line.contains("KEY=")){ | 110 | if(line.contains("KEY=")){ |
111 | wepEnabled->setChecked(true); | 111 | wepEnabled->setChecked(true); |
112 | QString key; | 112 | QString key; |
113 | if(line.right(5) == (" open")){ | 113 | if(line.right(5) == (" open")){ |
114 | key = line.mid(4, line.length()-5); | 114 | key = line.mid(4, line.length()-5); |
115 | authOpen->setChecked(true); | 115 | authOpen->setChecked(true); |
116 | authShared->setChecked(false); | 116 | authShared->setChecked(false); |
117 | } | 117 | } |
118 | else{ | 118 | else{ |
119 | authOpen->setChecked(false); | 119 | authOpen->setChecked(false); |
120 | authShared->setChecked(true); | 120 | authShared->setChecked(true); |
121 | key = line.mid(4, line.length()); | 121 | key = line.mid(4, line.length()); |
122 | } | 122 | } |
123 | if(key == keyLineEdit0->text()) keyRadio0->setChecked(true); | 123 | if(key == keyLineEdit0->text()) keyRadio0->setChecked(true); |
124 | if(key == keyLineEdit1->text()) keyRadio1->setChecked(true); | 124 | if(key == keyLineEdit1->text()) keyRadio1->setChecked(true); |
125 | if(key == keyLineEdit2->text()) keyRadio2->setChecked(true); | 125 | if(key == keyLineEdit2->text()) keyRadio2->setChecked(true); |
126 | if(key == keyLineEdit3->text()) keyRadio3->setChecked(true); | 126 | if(key == keyLineEdit3->text()) keyRadio3->setChecked(true); |
127 | } | 127 | } |
128 | if(line.contains("CHANNEL=")){ | 128 | if(line.contains("CHANNEL=")){ |
129 | networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); | 129 | networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Saves settings to the wireless.opts file using the current profile | 136 | * Saves settings to the wireless.opts file using the current profile |
137 | */ | 137 | */ |
138 | void WLANImp::changeAndSaveSettingFile(){ | 138 | void WLANImp::changeAndSaveSettingFile(){ |
139 | QString wlanFile = WIRELESS_OPTS; | 139 | QString wlanFile = WIRELESS_OPTS; |
140 | QFile::remove(wlanFile); | 140 | QFile::remove(wlanFile); |
141 | QFile file(wlanFile); | 141 | QFile file(wlanFile); |
142 | 142 | ||
143 | if (!file.open(IO_ReadWrite)){ | 143 | if (!file.open(IO_ReadWrite)){ |
144 | qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); | 144 | qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); |
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | 147 | ||
148 | QTextStream stream( &file ); | 148 | QTextStream stream( &file ); |
149 | bool foundCase = false; | 149 | bool foundCase = false; |
150 | bool found = false; | 150 | bool found = false; |
151 | bool output = true; | 151 | bool output = true; |
152 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { | 152 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
153 | QString line = (*it).simplifyWhiteSpace(); | 153 | QString line = (*it).simplifyWhiteSpace(); |
154 | if(line.contains("case")) | 154 | if(line.contains("case")) |
155 | foundCase = true; | 155 | foundCase = true; |
156 | // See if we found our scheme to write or the sceme couldn't be found | 156 | // See if we found our scheme to write or the sceme couldn't be found |
157 | if((foundCase && line.contains("esac") && !found) || | 157 | if((foundCase && line.contains("esac") && !found) || |
158 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ | 158 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ |
159 | // write out scheme | 159 | // write out scheme |
160 | found = true; | 160 | found = true; |
161 | output = false; | 161 | output = false; |
162 | 162 | ||
163 | if(!line.contains("esac")) | 163 | if(!line.contains("esac")) |
164 | stream << line << "\n"; | 164 | stream << line << "\n"; |
165 | if(!essAny->isChecked() == true){ | 165 | if(!essAny->isChecked() == true){ |
166 | stream << "\tESSID=any\n"; | 166 | stream << "\tESSID=any\n"; |
167 | stream << "\tMODE=Managed\n"; | 167 | stream << "\tMODE=Managed\n"; |
168 | } | 168 | } |
169 | else{ | 169 | else{ |
170 | stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; | 170 | stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; |
171 | stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; | 171 | stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; |
172 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; | 172 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; |
173 | } | 173 | } |
174 | 174 | ||
175 | stream << "\t#KEY0=" << keyLineEdit0->text() << "\n"; | 175 | stream << "\t#KEY0=" << keyLineEdit0->text() << "\n"; |
176 | stream << "\t#KEY1=" << keyLineEdit1->text() << "\n"; | 176 | stream << "\t#KEY1=" << keyLineEdit1->text() << "\n"; |
177 | stream << "\t#KEY2=" << keyLineEdit2->text() << "\n"; | 177 | stream << "\t#KEY2=" << keyLineEdit2->text() << "\n"; |
178 | stream << "\t#KEY3=" << keyLineEdit3->text() << "\n"; | 178 | stream << "\t#KEY3=" << keyLineEdit3->text() << "\n"; |
179 | 179 | ||
180 | if(wepEnabled->isChecked()){ | 180 | if(wepEnabled->isChecked()){ |
181 | stream << "\tKEY=\""; | 181 | stream << "\tKEY=\""; |
182 | if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); | 182 | if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); |
183 | if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); | 183 | if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); |
184 | if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); | 184 | if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); |
185 | if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); | 185 | if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); |
186 | if(authOpen->isChecked()) | 186 | if(authOpen->isChecked()) |
187 | stream << " open"; | 187 | stream << " open"; |
188 | else | 188 | else |
189 | stream << " restricted"; | 189 | stream << " restricted"; |
190 | stream << "\"\n"; | 190 | stream << "\"\n"; |
191 | } | 191 | } |
192 | stream << "\tRATE=auto\n"; | 192 | stream << "\tRATE=auto\n"; |
193 | if(line.contains("esac")) | 193 | if(line.contains("esac")) |
194 | stream << line << "\n"; | 194 | stream << line << "\n"; |
195 | } | 195 | } |
196 | if(line.contains(";;")) | 196 | if(line.contains(";;")) |
197 | output = true; | 197 | output = true; |
198 | if(output && (*it).length() ) | 198 | if(output && (*it).length() ) |
199 | stream << (*it) << '\n'; | 199 | stream << (*it) << '\n'; |
200 | } | 200 | } |
201 | file.close(); | 201 | file.close(); |
202 | } | 202 | } |
203 | 203 | ||
204 | /** | 204 | /** |
205 | * Check to see if the current config is valid | 205 | * Check to see if the current config is valid |
206 | * Save wireless.opts, save interfaces | 206 | * Save wireless.opts, save interfaces |
207 | */ | 207 | */ |
208 | void WLANImp::accept(){ | 208 | void WLANImp::accept(){ |
209 | if(wepEnabled->isChecked()){ | 209 | if(wepEnabled->isChecked()){ |
210 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){ | 210 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){ |
211 | QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); | 211 | QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ | 216 | if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ |
217 | QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); | 217 | QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); |
218 | return; | 218 | return; |
219 | } | 219 | } |
220 | 220 | ||
221 | // Ok settings are good here, save | 221 | // Ok settings are good here, save |
222 | changeAndSaveSettingFile(); | 222 | changeAndSaveSettingFile(); |
223 | 223 | ||
224 | // Try to save the interfaces settings. | 224 | // Try to save the interfaces settings. |
225 | if(!interfaceSetup->saveChanges()) | 225 | if(!interfaceSetup->saveChanges()) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | // Restart the device now that the settings have changed | 228 | // Restart the device now that the settings have changed |
229 | QString initpath; | 229 | QString initpath; |
230 | if( QDir("/etc/rc.d/init.d").exists() ) | 230 | if( QDir("/etc/rc.d/init.d").exists() ) |
231 | initpath = "/etc/rc.d/init.d"; | 231 | initpath = "/etc/rc.d/init.d"; |
232 | else if( QDir("/etc/init.d").exists() ) | 232 | else if( QDir("/etc/init.d").exists() ) |
233 | initpath = "/etc/init.d"; | 233 | initpath = "/etc/init.d"; |
234 | |||
235 | // It would be kinda cool if we didn't have to do this and could just to ifup/down | ||
236 | |||
234 | if( initpath ) | 237 | if( initpath ) |
235 | system(QString("%1/pcmcia stop").arg(initpath)); | 238 | system(QString("%1/pcmcia stop").arg(initpath)); |
236 | if( initpath ) | 239 | if( initpath ) |
237 | system(QString("%1/pcmcia start").arg(initpath)); | 240 | system(QString("%1/pcmcia start").arg(initpath)); |
238 | 241 | ||
239 | // Close out the dialog | 242 | // Close out the dialog |
240 | QDialog::accept(); | 243 | QDialog::accept(); |
241 | } | 244 | } |
242 | 245 | ||
243 | // wlanimp.cpp | 246 | // wlanimp.cpp |
244 | 247 | ||
diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO index 93cbab7..6457836 100644 --- a/noncore/settings/networksettings/TODO +++ b/noncore/settings/networksettings/TODO | |||
@@ -1,77 +1,93 @@ | |||
1 | Types: | ||
2 | -Ethernet Connection (Done) | ||
3 | -ISDN Connection | ||
4 | -Modem COnnection (Started) | ||
5 | -xDSL connection | ||
6 | -Token Ring Connection | ||
7 | -CIPE (VPN) connection (ipsec?) | ||
8 | -Wireless Connection (Done) | ||
9 | -Bluetooth | ||
10 | -IPChains? | ||
11 | |||
1 | test WEP | 12 | test WEP |
2 | WEP key in file wireless.conf is not encrypted !, therefore it is very easy to get the key out of the zaurus.. | 13 | Add WEP transimtion rate |
3 | WEP transimtion rat | ||
4 | 1 or 2 | 14 | 1 or 2 |
5 | 5.5 | 15 | 5.5 |
6 | 1 | 16 | 1 |
7 | Auto | 17 | Auto |
8 | 18 | ||
9 | udchcp needs to output the dhcp information so interfaces can read it | 19 | udchcp needs to output the dhcp information so interfaces can read it |
10 | 20 | ||
11 | interfacesetupimp really doesn't need a interface* pointer | 21 | interfacesetupimp really doesn't need a interface* pointer |
12 | 22 | ||
13 | Possible other modules to write: ppp, ipsec, bluetooth, ipchains | ||
14 | |||
15 | PPP module needs to scan pppd.tdb to see what is currently active | 23 | PPP module needs to scan pppd.tdb to see what is currently active |
16 | 24 | ||
17 | WLAN - add possiblity to input text or hex without knowing "s:" | 25 | WLAN |
26 | - add possiblity to input text or hex without knowing "s:" | ||
27 | - Handle "any" and any the same way in config | ||
18 | 28 | ||
19 | Interface setupimp needs to use kernel calls. | 29 | Interface setupimp needs to use kernel calls. |
20 | 30 | ||
31 | Add a route/DNS editor under the ViewAdvancedInfo button | ||
32 | |||
33 | Use a true TCP/IP widget | ||
34 | |||
35 | Make it so that pcmcia doesn't need to be stopped/started for wlan | ||
36 | |||
21 | Automaticly update the main list of interfaces: | 37 | Automaticly update the main list of interfaces: |
22 | > That would be me. :-D netlink, can you point me in the right | 38 | > That would be me. :-D netlink, can you point me in the right |
23 | > direction where I can get more info on it? (I figured there was some | 39 | > direction where I can get more info on it? (I figured there was some |
24 | > kenel call) | 40 | > kenel call) |
25 | 41 | ||
26 | You can look up the meaning of the packets you receive, or you can just go | 42 | You can look up the meaning of the packets you receive, or you can just go |
27 | poll for changes you might be interested in each time you receive _any_ | 43 | poll for changes you might be interested in each time you receive _any_ |
28 | packet. Anything's better than periodic polling. | 44 | packet. Anything's better than periodic polling. |
29 | 45 | ||
30 | Note that you can't do this as non-root on some kernels. There's a patch | 46 | Note that you can't do this as non-root on some kernels. There's a patch |
31 | which can go into the hh.org kernel if it's not already there. | 47 | which can go into the hh.org kernel if it's not already there. |
32 | cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2 | 48 | cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2 |
33 | 49 | ||
34 | 50 | ||
35 | #include <asm/types.h> | 51 | #include <asm/types.h> |
36 | #include <sys/socket.h> | 52 | #include <sys/socket.h> |
37 | #include <linux/netlink.h> | 53 | #include <linux/netlink.h> |
38 | #include <linux/rtnetlink.h> | 54 | #include <linux/rtnetlink.h> |
39 | 55 | ||
40 | int main(int argc, char **argv) | 56 | int main(int argc, char **argv) |
41 | { | 57 | { |
42 | int fd; | 58 | int fd; |
43 | unsigned char buf[4096]; | 59 | unsigned char buf[4096]; |
44 | int ret; | 60 | int ret; |
45 | int i, j; | 61 | int i, j; |
46 | struct sockaddr_nl snl; | 62 | struct sockaddr_nl snl; |
47 | 63 | ||
48 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); | 64 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); |
49 | if (fd < 0) { | 65 | if (fd < 0) { |
50 | perror("socket"); | 66 | perror("socket"); |
51 | exit(1); | 67 | exit(1); |
52 | } | 68 | } |
53 | 69 | ||
54 | snl.nl_family = AF_NETLINK; | 70 | snl.nl_family = AF_NETLINK; |
55 | snl.nl_pad = 0; | 71 | snl.nl_pad = 0; |
56 | snl.nl_pid = getpid(); | 72 | snl.nl_pid = getpid(); |
57 | snl.nl_groups = RTM_NEWLINK|RTM_DELLINK; | 73 | snl.nl_groups = RTM_NEWLINK|RTM_DELLINK; |
58 | 74 | ||
59 | if (bind(fd, &snl, sizeof(snl)) < 0) { | 75 | if (bind(fd, &snl, sizeof(snl)) < 0) { |
60 | perror("bind"); | 76 | perror("bind"); |
61 | exit(1); | 77 | exit(1); |
62 | } | 78 | } |
63 | while (1) { | 79 | while (1) { |
64 | ret = recv(fd, buf, 4096, 0); | 80 | ret = recv(fd, buf, 4096, 0); |
65 | if (ret < 0) { | 81 | if (ret < 0) { |
66 | perror("recv"); | 82 | perror("recv"); |
67 | exit(1); | 83 | exit(1); |
68 | } | 84 | } |
69 | for (i=0; i<ret; i++) { | 85 | for (i=0; i<ret; i++) { |
70 | printf("%02x ", buf[i]); | 86 | printf("%02x ", buf[i]); |
71 | } | 87 | } |
72 | printf("\n"); | 88 | printf("\n"); |
73 | } | 89 | } |
74 | 90 | ||
75 | } | 91 | } |
76 | -- | 92 | -- |
77 | 93 | ||
diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui index 3d30994..dcabc52 100644 --- a/noncore/settings/networksettings/mainwindow.ui +++ b/noncore/settings/networksettings/mainwindow.ui | |||
@@ -1,404 +1,404 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>MainWindow</class> | 2 | <class>MainWindow</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>MainWindow</cstring> | 7 | <cstring>MainWindow</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>240</width> | 14 | <width>240</width> |
15 | <height>289</height> | 15 | <height>289</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Network Setup</string> | 20 | <string>Network Settings</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QTabWidget</class> | 32 | <class>QTabWidget</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>tabWidget</cstring> | 35 | <cstring>tabWidget</cstring> |
36 | </property> | 36 | </property> |
37 | <property> | 37 | <property> |
38 | <name>layoutMargin</name> | 38 | <name>layoutMargin</name> |
39 | </property> | 39 | </property> |
40 | <widget> | 40 | <widget> |
41 | <class>QWidget</class> | 41 | <class>QWidget</class> |
42 | <property stdset="1"> | 42 | <property stdset="1"> |
43 | <name>name</name> | 43 | <name>name</name> |
44 | <cstring>Widget3</cstring> | 44 | <cstring>Widget3</cstring> |
45 | </property> | 45 | </property> |
46 | <attribute> | 46 | <attribute> |
47 | <name>title</name> | 47 | <name>title</name> |
48 | <string>Connections</string> | 48 | <string>Connections</string> |
49 | </attribute> | 49 | </attribute> |
50 | <vbox> | 50 | <vbox> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>margin</name> | 52 | <name>margin</name> |
53 | <number>0</number> | 53 | <number>0</number> |
54 | </property> | 54 | </property> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>spacing</name> | 56 | <name>spacing</name> |
57 | <number>6</number> | 57 | <number>6</number> |
58 | </property> | 58 | </property> |
59 | <widget> | 59 | <widget> |
60 | <class>QListView</class> | 60 | <class>QListView</class> |
61 | <column> | 61 | <column> |
62 | <property> | 62 | <property> |
63 | <name>text</name> | 63 | <name>text</name> |
64 | <string>s</string> | 64 | <string>s</string> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>clickable</name> | 67 | <name>clickable</name> |
68 | <bool>true</bool> | 68 | <bool>true</bool> |
69 | </property> | 69 | </property> |
70 | <property> | 70 | <property> |
71 | <name>resizeable</name> | 71 | <name>resizeable</name> |
72 | <bool>true</bool> | 72 | <bool>true</bool> |
73 | </property> | 73 | </property> |
74 | </column> | 74 | </column> |
75 | <column> | 75 | <column> |
76 | <property> | 76 | <property> |
77 | <name>text</name> | 77 | <name>text</name> |
78 | <string>t</string> | 78 | <string>t</string> |
79 | </property> | 79 | </property> |
80 | <property> | 80 | <property> |
81 | <name>clickable</name> | 81 | <name>clickable</name> |
82 | <bool>true</bool> | 82 | <bool>true</bool> |
83 | </property> | 83 | </property> |
84 | <property> | 84 | <property> |
85 | <name>resizeable</name> | 85 | <name>resizeable</name> |
86 | <bool>true</bool> | 86 | <bool>true</bool> |
87 | </property> | 87 | </property> |
88 | </column> | 88 | </column> |
89 | <column> | 89 | <column> |
90 | <property> | 90 | <property> |
91 | <name>text</name> | 91 | <name>text</name> |
92 | <string>Name</string> | 92 | <string>Name</string> |
93 | </property> | 93 | </property> |
94 | <property> | 94 | <property> |
95 | <name>clickable</name> | 95 | <name>clickable</name> |
96 | <bool>true</bool> | 96 | <bool>true</bool> |
97 | </property> | 97 | </property> |
98 | <property> | 98 | <property> |
99 | <name>resizeable</name> | 99 | <name>resizeable</name> |
100 | <bool>true</bool> | 100 | <bool>true</bool> |
101 | </property> | 101 | </property> |
102 | </column> | 102 | </column> |
103 | <column> | 103 | <column> |
104 | <property> | 104 | <property> |
105 | <name>text</name> | 105 | <name>text</name> |
106 | <string>in</string> | 106 | <string>in</string> |
107 | </property> | 107 | </property> |
108 | <property> | 108 | <property> |
109 | <name>clickable</name> | 109 | <name>clickable</name> |
110 | <bool>true</bool> | 110 | <bool>true</bool> |
111 | </property> | 111 | </property> |
112 | <property> | 112 | <property> |
113 | <name>resizeable</name> | 113 | <name>resizeable</name> |
114 | <bool>true</bool> | 114 | <bool>true</bool> |
115 | </property> | 115 | </property> |
116 | </column> | 116 | </column> |
117 | <column> | 117 | <column> |
118 | <property> | 118 | <property> |
119 | <name>text</name> | 119 | <name>text</name> |
120 | <string>IP</string> | 120 | <string>IP</string> |
121 | </property> | 121 | </property> |
122 | <property> | 122 | <property> |
123 | <name>clickable</name> | 123 | <name>clickable</name> |
124 | <bool>true</bool> | 124 | <bool>true</bool> |
125 | </property> | 125 | </property> |
126 | <property> | 126 | <property> |
127 | <name>resizeable</name> | 127 | <name>resizeable</name> |
128 | <bool>true</bool> | 128 | <bool>true</bool> |
129 | </property> | 129 | </property> |
130 | </column> | 130 | </column> |
131 | <property stdset="1"> | 131 | <property stdset="1"> |
132 | <name>name</name> | 132 | <name>name</name> |
133 | <cstring>connectionList</cstring> | 133 | <cstring>connectionList</cstring> |
134 | </property> | 134 | </property> |
135 | <property stdset="1"> | 135 | <property stdset="1"> |
136 | <name>allColumnsShowFocus</name> | 136 | <name>allColumnsShowFocus</name> |
137 | <bool>true</bool> | 137 | <bool>true</bool> |
138 | </property> | 138 | </property> |
139 | </widget> | 139 | </widget> |
140 | <widget> | 140 | <widget> |
141 | <class>QLayoutWidget</class> | 141 | <class>QLayoutWidget</class> |
142 | <property stdset="1"> | 142 | <property stdset="1"> |
143 | <name>name</name> | 143 | <name>name</name> |
144 | <cstring>Layout2</cstring> | 144 | <cstring>Layout2</cstring> |
145 | </property> | 145 | </property> |
146 | <property> | 146 | <property> |
147 | <name>layoutMargin</name> | 147 | <name>layoutMargin</name> |
148 | </property> | 148 | </property> |
149 | <grid> | 149 | <grid> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>margin</name> | 151 | <name>margin</name> |
152 | <number>5</number> | 152 | <number>5</number> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>spacing</name> | 155 | <name>spacing</name> |
156 | <number>6</number> | 156 | <number>6</number> |
157 | </property> | 157 | </property> |
158 | <widget row="1" column="0" > | 158 | <widget row="1" column="0" > |
159 | <class>QPushButton</class> | 159 | <class>QPushButton</class> |
160 | <property stdset="1"> | 160 | <property stdset="1"> |
161 | <name>name</name> | 161 | <name>name</name> |
162 | <cstring>addConnectionButton</cstring> | 162 | <cstring>addConnectionButton</cstring> |
163 | </property> | 163 | </property> |
164 | <property stdset="1"> | 164 | <property stdset="1"> |
165 | <name>text</name> | 165 | <name>text</name> |
166 | <string>&Add</string> | 166 | <string>&Add</string> |
167 | </property> | 167 | </property> |
168 | </widget> | 168 | </widget> |
169 | <widget row="0" column="0" > | 169 | <widget row="0" column="0" > |
170 | <class>QPushButton</class> | 170 | <class>QPushButton</class> |
171 | <property stdset="1"> | 171 | <property stdset="1"> |
172 | <name>name</name> | 172 | <name>name</name> |
173 | <cstring>informationConnectionButton</cstring> | 173 | <cstring>informationConnectionButton</cstring> |
174 | </property> | 174 | </property> |
175 | <property stdset="1"> | 175 | <property stdset="1"> |
176 | <name>text</name> | 176 | <name>text</name> |
177 | <string>&Information</string> | 177 | <string>&Information</string> |
178 | </property> | 178 | </property> |
179 | </widget> | 179 | </widget> |
180 | <widget row="0" column="1" > | 180 | <widget row="0" column="1" > |
181 | <class>QPushButton</class> | 181 | <class>QPushButton</class> |
182 | <property stdset="1"> | 182 | <property stdset="1"> |
183 | <name>name</name> | 183 | <name>name</name> |
184 | <cstring>configureConnectionButton</cstring> | 184 | <cstring>configureConnectionButton</cstring> |
185 | </property> | 185 | </property> |
186 | <property stdset="1"> | 186 | <property stdset="1"> |
187 | <name>text</name> | 187 | <name>text</name> |
188 | <string>&Configure</string> | 188 | <string>&Configure</string> |
189 | </property> | 189 | </property> |
190 | </widget> | 190 | </widget> |
191 | <widget row="1" column="1" > | 191 | <widget row="1" column="1" > |
192 | <class>QPushButton</class> | 192 | <class>QPushButton</class> |
193 | <property stdset="1"> | 193 | <property stdset="1"> |
194 | <name>name</name> | 194 | <name>name</name> |
195 | <cstring>removeConnectionButton</cstring> | 195 | <cstring>removeConnectionButton</cstring> |
196 | </property> | 196 | </property> |
197 | <property stdset="1"> | 197 | <property stdset="1"> |
198 | <name>text</name> | 198 | <name>text</name> |
199 | <string>&Remove</string> | 199 | <string>&Remove</string> |
200 | </property> | 200 | </property> |
201 | </widget> | 201 | </widget> |
202 | </grid> | 202 | </grid> |
203 | </widget> | 203 | </widget> |
204 | </vbox> | 204 | </vbox> |
205 | </widget> | 205 | </widget> |
206 | <widget> | 206 | <widget> |
207 | <class>QWidget</class> | 207 | <class>QWidget</class> |
208 | <property stdset="1"> | 208 | <property stdset="1"> |
209 | <name>name</name> | 209 | <name>name</name> |
210 | <cstring>tab</cstring> | 210 | <cstring>tab</cstring> |
211 | </property> | 211 | </property> |
212 | <attribute> | 212 | <attribute> |
213 | <name>title</name> | 213 | <name>title</name> |
214 | <string>Profiles</string> | 214 | <string>Profiles</string> |
215 | </attribute> | 215 | </attribute> |
216 | <grid> | 216 | <grid> |
217 | <property stdset="1"> | 217 | <property stdset="1"> |
218 | <name>margin</name> | 218 | <name>margin</name> |
219 | <number>11</number> | 219 | <number>11</number> |
220 | </property> | 220 | </property> |
221 | <property stdset="1"> | 221 | <property stdset="1"> |
222 | <name>spacing</name> | 222 | <name>spacing</name> |
223 | <number>6</number> | 223 | <number>6</number> |
224 | </property> | 224 | </property> |
225 | <spacer row="7" column="2" > | 225 | <spacer row="7" column="2" > |
226 | <property> | 226 | <property> |
227 | <name>name</name> | 227 | <name>name</name> |
228 | <cstring>Spacer16</cstring> | 228 | <cstring>Spacer16</cstring> |
229 | </property> | 229 | </property> |
230 | <property stdset="1"> | 230 | <property stdset="1"> |
231 | <name>orientation</name> | 231 | <name>orientation</name> |
232 | <enum>Vertical</enum> | 232 | <enum>Vertical</enum> |
233 | </property> | 233 | </property> |
234 | <property stdset="1"> | 234 | <property stdset="1"> |
235 | <name>sizeType</name> | 235 | <name>sizeType</name> |
236 | <enum>Expanding</enum> | 236 | <enum>Expanding</enum> |
237 | </property> | 237 | </property> |
238 | <property> | 238 | <property> |
239 | <name>sizeHint</name> | 239 | <name>sizeHint</name> |
240 | <size> | 240 | <size> |
241 | <width>20</width> | 241 | <width>20</width> |
242 | <height>20</height> | 242 | <height>20</height> |
243 | </size> | 243 | </size> |
244 | </property> | 244 | </property> |
245 | </spacer> | 245 | </spacer> |
246 | <widget row="0" column="1" > | 246 | <widget row="0" column="1" > |
247 | <class>QLabel</class> | 247 | <class>QLabel</class> |
248 | <property stdset="1"> | 248 | <property stdset="1"> |
249 | <name>name</name> | 249 | <name>name</name> |
250 | <cstring>currentProfileLabel</cstring> | 250 | <cstring>currentProfileLabel</cstring> |
251 | </property> | 251 | </property> |
252 | <property stdset="1"> | 252 | <property stdset="1"> |
253 | <name>frameShape</name> | 253 | <name>frameShape</name> |
254 | <enum>Panel</enum> | 254 | <enum>Panel</enum> |
255 | </property> | 255 | </property> |
256 | <property stdset="1"> | 256 | <property stdset="1"> |
257 | <name>frameShadow</name> | 257 | <name>frameShadow</name> |
258 | <enum>Sunken</enum> | 258 | <enum>Sunken</enum> |
259 | </property> | 259 | </property> |
260 | <property stdset="1"> | 260 | <property stdset="1"> |
261 | <name>text</name> | 261 | <name>text</name> |
262 | <string>All</string> | 262 | <string>All</string> |
263 | </property> | 263 | </property> |
264 | </widget> | 264 | </widget> |
265 | <widget row="3" column="2" > | 265 | <widget row="3" column="2" > |
266 | <class>QPushButton</class> | 266 | <class>QPushButton</class> |
267 | <property stdset="1"> | 267 | <property stdset="1"> |
268 | <name>name</name> | 268 | <name>name</name> |
269 | <cstring>setCurrentProfileButton</cstring> | 269 | <cstring>setCurrentProfileButton</cstring> |
270 | </property> | 270 | </property> |
271 | <property stdset="1"> | 271 | <property stdset="1"> |
272 | <name>text</name> | 272 | <name>text</name> |
273 | <string>&Set Current</string> | 273 | <string>&Set Current</string> |
274 | </property> | 274 | </property> |
275 | </widget> | 275 | </widget> |
276 | <widget row="5" column="0" rowspan="1" colspan="3" > | 276 | <widget row="5" column="0" rowspan="1" colspan="3" > |
277 | <class>Line</class> | 277 | <class>Line</class> |
278 | <property stdset="1"> | 278 | <property stdset="1"> |
279 | <name>name</name> | 279 | <name>name</name> |
280 | <cstring>Line6</cstring> | 280 | <cstring>Line6</cstring> |
281 | </property> | 281 | </property> |
282 | <property stdset="1"> | 282 | <property stdset="1"> |
283 | <name>orientation</name> | 283 | <name>orientation</name> |
284 | <enum>Horizontal</enum> | 284 | <enum>Horizontal</enum> |
285 | </property> | 285 | </property> |
286 | </widget> | 286 | </widget> |
287 | <widget row="1" column="0" rowspan="1" colspan="3" > | 287 | <widget row="1" column="0" rowspan="1" colspan="3" > |
288 | <class>Line</class> | 288 | <class>Line</class> |
289 | <property stdset="1"> | 289 | <property stdset="1"> |
290 | <name>name</name> | 290 | <name>name</name> |
291 | <cstring>Line1</cstring> | 291 | <cstring>Line1</cstring> |
292 | </property> | 292 | </property> |
293 | <property stdset="1"> | 293 | <property stdset="1"> |
294 | <name>orientation</name> | 294 | <name>orientation</name> |
295 | <enum>Horizontal</enum> | 295 | <enum>Horizontal</enum> |
296 | </property> | 296 | </property> |
297 | </widget> | 297 | </widget> |
298 | <widget row="0" column="0" > | 298 | <widget row="0" column="0" > |
299 | <class>QLabel</class> | 299 | <class>QLabel</class> |
300 | <property stdset="1"> | 300 | <property stdset="1"> |
301 | <name>name</name> | 301 | <name>name</name> |
302 | <cstring>TextLabel1</cstring> | 302 | <cstring>TextLabel1</cstring> |
303 | </property> | 303 | </property> |
304 | <property stdset="1"> | 304 | <property stdset="1"> |
305 | <name>text</name> | 305 | <name>text</name> |
306 | <string>Current Profile</string> | 306 | <string>Current Profile</string> |
307 | </property> | 307 | </property> |
308 | </widget> | 308 | </widget> |
309 | <widget row="4" column="2" > | 309 | <widget row="4" column="2" > |
310 | <class>QPushButton</class> | 310 | <class>QPushButton</class> |
311 | <property stdset="1"> | 311 | <property stdset="1"> |
312 | <name>name</name> | 312 | <name>name</name> |
313 | <cstring>removeProfileButton</cstring> | 313 | <cstring>removeProfileButton</cstring> |
314 | </property> | 314 | </property> |
315 | <property stdset="1"> | 315 | <property stdset="1"> |
316 | <name>text</name> | 316 | <name>text</name> |
317 | <string>&Remove</string> | 317 | <string>&Remove</string> |
318 | </property> | 318 | </property> |
319 | </widget> | 319 | </widget> |
320 | <widget row="3" column="0" rowspan="2" colspan="2" > | 320 | <widget row="3" column="0" rowspan="2" colspan="2" > |
321 | <class>QListBox</class> | 321 | <class>QListBox</class> |
322 | <property stdset="1"> | 322 | <property stdset="1"> |
323 | <name>name</name> | 323 | <name>name</name> |
324 | <cstring>profilesList</cstring> | 324 | <cstring>profilesList</cstring> |
325 | </property> | 325 | </property> |
326 | </widget> | 326 | </widget> |
327 | <spacer row="0" column="2" > | 327 | <spacer row="0" column="2" > |
328 | <property> | 328 | <property> |
329 | <name>name</name> | 329 | <name>name</name> |
330 | <cstring>Spacer2</cstring> | 330 | <cstring>Spacer2</cstring> |
331 | </property> | 331 | </property> |
332 | <property stdset="1"> | 332 | <property stdset="1"> |
333 | <name>orientation</name> | 333 | <name>orientation</name> |
334 | <enum>Horizontal</enum> | 334 | <enum>Horizontal</enum> |
335 | </property> | 335 | </property> |
336 | <property stdset="1"> | 336 | <property stdset="1"> |
337 | <name>sizeType</name> | 337 | <name>sizeType</name> |
338 | <enum>Expanding</enum> | 338 | <enum>Expanding</enum> |
339 | </property> | 339 | </property> |
340 | <property> | 340 | <property> |
341 | <name>sizeHint</name> | 341 | <name>sizeHint</name> |
342 | <size> | 342 | <size> |
343 | <width>20</width> | 343 | <width>20</width> |
344 | <height>20</height> | 344 | <height>20</height> |
345 | </size> | 345 | </size> |
346 | </property> | 346 | </property> |
347 | </spacer> | 347 | </spacer> |
348 | <widget row="2" column="0" > | 348 | <widget row="2" column="0" > |
349 | <class>QLabel</class> | 349 | <class>QLabel</class> |
350 | <property stdset="1"> | 350 | <property stdset="1"> |
351 | <name>name</name> | 351 | <name>name</name> |
352 | <cstring>TextLabel1_2</cstring> | 352 | <cstring>TextLabel1_2</cstring> |
353 | </property> | 353 | </property> |
354 | <property stdset="1"> | 354 | <property stdset="1"> |
355 | <name>text</name> | 355 | <name>text</name> |
356 | <string>Profiles</string> | 356 | <string>Profiles</string> |
357 | </property> | 357 | </property> |
358 | </widget> | 358 | </widget> |
359 | <widget row="6" column="0" rowspan="1" colspan="3" > | 359 | <widget row="6" column="0" rowspan="1" colspan="3" > |
360 | <class>QLayoutWidget</class> | 360 | <class>QLayoutWidget</class> |
361 | <property stdset="1"> | 361 | <property stdset="1"> |
362 | <name>name</name> | 362 | <name>name</name> |
363 | <cstring>Layout6</cstring> | 363 | <cstring>Layout6</cstring> |
364 | </property> | 364 | </property> |
365 | <hbox> | 365 | <hbox> |
366 | <property stdset="1"> | 366 | <property stdset="1"> |
367 | <name>margin</name> | 367 | <name>margin</name> |
368 | <number>0</number> | 368 | <number>0</number> |
369 | </property> | 369 | </property> |
370 | <property stdset="1"> | 370 | <property stdset="1"> |
371 | <name>spacing</name> | 371 | <name>spacing</name> |
372 | <number>6</number> | 372 | <number>6</number> |
373 | </property> | 373 | </property> |
374 | <widget> | 374 | <widget> |
375 | <class>QLabel</class> | 375 | <class>QLabel</class> |
376 | <property stdset="1"> | 376 | <property stdset="1"> |
377 | <name>name</name> | 377 | <name>name</name> |
378 | <cstring>TextLabel1_3</cstring> | 378 | <cstring>TextLabel1_3</cstring> |
379 | </property> | 379 | </property> |
380 | <property stdset="1"> | 380 | <property stdset="1"> |
381 | <name>text</name> | 381 | <name>text</name> |
382 | <string>New Profile</string> | 382 | <string>New Profile</string> |
383 | </property> | 383 | </property> |
384 | </widget> | 384 | </widget> |
385 | <widget> | 385 | <widget> |
386 | <class>QLineEdit</class> | 386 | <class>QLineEdit</class> |
387 | <property stdset="1"> | 387 | <property stdset="1"> |
388 | <name>name</name> | 388 | <name>name</name> |
389 | <cstring>newProfile</cstring> | 389 | <cstring>newProfile</cstring> |
390 | </property> | 390 | </property> |
391 | </widget> | 391 | </widget> |
392 | <widget> | 392 | <widget> |
393 | <class>QPushButton</class> | 393 | <class>QPushButton</class> |
394 | <property stdset="1"> | 394 | <property stdset="1"> |
395 | <name>name</name> | 395 | <name>name</name> |
396 | <cstring>newProfileButton</cstring> | 396 | <cstring>newProfileButton</cstring> |
397 | </property> | 397 | </property> |
398 | <property stdset="1"> | 398 | <property stdset="1"> |
399 | <name>enabled</name> | 399 | <name>enabled</name> |
400 | <bool>false</bool> | 400 | <bool>false</bool> |
401 | </property> | 401 | </property> |
402 | <property stdset="1"> | 402 | <property stdset="1"> |
403 | <name>text</name> | 403 | <name>text</name> |
404 | <string>&Add</string> | 404 | <string>&Add</string> |
diff --git a/noncore/settings/networksettings/opie-networksettings.control b/noncore/settings/networksettings/opie-networksettings.control index 3d6a32c..585e50e 100644 --- a/noncore/settings/networksettings/opie-networksettings.control +++ b/noncore/settings/networksettings/opie-networksettings.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile | 1 | Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/settings | 3 | Section: opie/settings |
4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> | 4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Opie network setup tool | 8 | Description: Network settings |
diff --git a/noncore/settings/networksettings/opie-networksetup.control b/noncore/settings/networksettings/opie-networksetup.control index 3d6a32c..585e50e 100644 --- a/noncore/settings/networksettings/opie-networksetup.control +++ b/noncore/settings/networksettings/opie-networksetup.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile | 1 | Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/settings | 3 | Section: opie/settings |
4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> | 4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Opie network setup tool | 8 | Description: Network settings |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 648932f..1782c22 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -1,244 +1,247 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | #include "interfacesetupimp.h" | 2 | #include "interfacesetupimp.h" |
3 | 3 | ||
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qdir.h> | 5 | #include <qdir.h> |
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 <qlabel.h> |
10 | #include <qspinbox.h> | 10 | #include <qspinbox.h> |
11 | #include <qradiobutton.h> | 11 | #include <qradiobutton.h> |
12 | #include <qcheckbox.h> | 12 | #include <qcheckbox.h> |
13 | #include <qtabwidget.h> | 13 | #include <qtabwidget.h> |
14 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
15 | 15 | ||
16 | /* system() */ | 16 | /* system() */ |
17 | #include <stdlib.h> | 17 | #include <stdlib.h> |
18 | 18 | ||
19 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" | 19 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Constructor, read in the wireless.opts file for parsing later. | 22 | * Constructor, read in the wireless.opts file for parsing later. |
23 | */ | 23 | */ |
24 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") { | 24 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") { |
25 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i); | 25 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i); |
26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
27 | 27 | ||
28 | // Read in the config file. | 28 | // Read in the config file. |
29 | QString wlanFile = WIRELESS_OPTS; | 29 | QString wlanFile = WIRELESS_OPTS; |
30 | QFile file(wlanFile); | 30 | QFile file(wlanFile); |
31 | if (file.open(IO_ReadOnly)){ | 31 | if (file.open(IO_ReadOnly)){ |
32 | QTextStream stream( &file ); | 32 | QTextStream stream( &file ); |
33 | QString line = ""; | 33 | QString line = ""; |
34 | while ( !stream.eof() ) { | 34 | while ( !stream.eof() ) { |
35 | line += stream.readLine(); | 35 | line += stream.readLine(); |
36 | line += "\n"; | 36 | line += "\n"; |
37 | } | 37 | } |
38 | file.close(); | 38 | file.close(); |
39 | settingsFileText = QStringList::split("\n", line, true); | 39 | settingsFileText = QStringList::split("\n", line, true); |
40 | parseSettingFile(); | 40 | parseSettingFile(); |
41 | } | 41 | } |
42 | else | 42 | else |
43 | 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))); | 44 | connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); |
45 | } | 45 | } |
46 | 46 | ||
47 | void WLANImp::typeChanged(int mod){ | 47 | void WLANImp::typeChanged(int mod){ |
48 | networkChannel->setEnabled(mod); | 48 | networkChannel->setEnabled(mod); |
49 | channelLabel->setEnabled(mod); | 49 | channelLabel->setEnabled(mod); |
50 | } | 50 | } |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Change the profile for both wireless settings and network settings. | 53 | * Change the profile for both wireless settings and network settings. |
54 | */ | 54 | */ |
55 | void WLANImp::setProfile(const QString &profile){ | 55 | void WLANImp::setProfile(const QString &profile){ |
56 | interfaceSetup->setProfile(profile); | 56 | interfaceSetup->setProfile(profile); |
57 | parseSettingFile(); | 57 | parseSettingFile(); |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Parses the settings file that was read in and gets any setting from it. | 61 | * Parses the settings file that was read in and gets any setting from it. |
62 | */ | 62 | */ |
63 | void WLANImp::parseSettingFile(){ | 63 | void WLANImp::parseSettingFile(){ |
64 | bool foundCase = false; | 64 | bool foundCase = false; |
65 | bool found = false; | 65 | bool found = false; |
66 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { | 66 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
67 | QString line = (*it).simplifyWhiteSpace(); | 67 | QString line = (*it).simplifyWhiteSpace(); |
68 | if(line.contains("case")) | 68 | if(line.contains("case")) |
69 | foundCase = true; | 69 | foundCase = true; |
70 | // See if we found our scheme to write or the sceme couldn't be found | 70 | // See if we found our scheme to write or the sceme couldn't be found |
71 | if((foundCase && line.contains("esac")) || | 71 | if((foundCase && line.contains("esac")) || |
72 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) | 72 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) |
73 | found = true; | 73 | found = true; |
74 | 74 | ||
75 | if(line.contains(";;")) | 75 | if(line.contains(";;")) |
76 | found = false; | 76 | found = false; |
77 | if(found){ | 77 | if(found){ |
78 | // write out scheme | 78 | // write out scheme |
79 | if(line.contains("ESSID=")){ | 79 | if(line.contains("ESSID=")){ |
80 | QString id = line.mid(line.find("ESSID=")+6, line.length()); | 80 | QString id = line.mid(line.find("ESSID=")+6, line.length()); |
81 | if(id == "any"){ | 81 | if(id == "any"){ |
82 | essAny->setChecked(false); | 82 | essAny->setChecked(false); |
83 | }else{ | 83 | }else{ |
84 | essAny->setChecked(true); | 84 | essAny->setChecked(true); |
85 | essSpecificLineEdit->setText(id); | 85 | essSpecificLineEdit->setText(id); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | if(line.contains("MODE=")){ | 88 | if(line.contains("MODE=")){ |
89 | QString mode = line.mid(line.find("MODE=")+5, line.length()); | 89 | QString mode = line.mid(line.find("MODE=")+5, line.length()); |
90 | if(mode == "Managed"){ | 90 | if(mode == "Managed"){ |
91 | networkType->setCurrentItem(0); | 91 | networkType->setCurrentItem(0); |
92 | channelLabel->setEnabled(false); | 92 | channelLabel->setEnabled(false); |
93 | networkChannel->setEnabled(false); | 93 | networkChannel->setEnabled(false); |
94 | } | 94 | } |
95 | else{ | 95 | else{ |
96 | networkType->setCurrentItem(1); | 96 | networkType->setCurrentItem(1); |
97 | networkChannel->setEnabled(true); | 97 | networkChannel->setEnabled(true); |
98 | channelLabel->setEnabled(true); | 98 | channelLabel->setEnabled(true); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | if(line.contains("#KEY0=")) | 101 | if(line.contains("#KEY0=")) |
102 | keyLineEdit0->setText(line.mid(6, line.length())); | 102 | keyLineEdit0->setText(line.mid(6, line.length())); |
103 | if(line.contains("#KEY1=")) | 103 | if(line.contains("#KEY1=")) |
104 | keyLineEdit1->setText(line.mid(6, line.length())); | 104 | keyLineEdit1->setText(line.mid(6, line.length())); |
105 | if(line.contains("#KEY2=")) | 105 | if(line.contains("#KEY2=")) |
106 | keyLineEdit2->setText(line.mid(6, line.length())); | 106 | keyLineEdit2->setText(line.mid(6, line.length())); |
107 | if(line.contains("#KEY3=")) | 107 | if(line.contains("#KEY3=")) |
108 | keyLineEdit3->setText(line.mid(6, line.length())); | 108 | keyLineEdit3->setText(line.mid(6, line.length())); |
109 | 109 | ||
110 | if(line.contains("KEY=")){ | 110 | if(line.contains("KEY=")){ |
111 | wepEnabled->setChecked(true); | 111 | wepEnabled->setChecked(true); |
112 | QString key; | 112 | QString key; |
113 | if(line.right(5) == (" open")){ | 113 | if(line.right(5) == (" open")){ |
114 | key = line.mid(4, line.length()-5); | 114 | key = line.mid(4, line.length()-5); |
115 | authOpen->setChecked(true); | 115 | authOpen->setChecked(true); |
116 | authShared->setChecked(false); | 116 | authShared->setChecked(false); |
117 | } | 117 | } |
118 | else{ | 118 | else{ |
119 | authOpen->setChecked(false); | 119 | authOpen->setChecked(false); |
120 | authShared->setChecked(true); | 120 | authShared->setChecked(true); |
121 | key = line.mid(4, line.length()); | 121 | key = line.mid(4, line.length()); |
122 | } | 122 | } |
123 | if(key == keyLineEdit0->text()) keyRadio0->setChecked(true); | 123 | if(key == keyLineEdit0->text()) keyRadio0->setChecked(true); |
124 | if(key == keyLineEdit1->text()) keyRadio1->setChecked(true); | 124 | if(key == keyLineEdit1->text()) keyRadio1->setChecked(true); |
125 | if(key == keyLineEdit2->text()) keyRadio2->setChecked(true); | 125 | if(key == keyLineEdit2->text()) keyRadio2->setChecked(true); |
126 | if(key == keyLineEdit3->text()) keyRadio3->setChecked(true); | 126 | if(key == keyLineEdit3->text()) keyRadio3->setChecked(true); |
127 | } | 127 | } |
128 | if(line.contains("CHANNEL=")){ | 128 | if(line.contains("CHANNEL=")){ |
129 | networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); | 129 | networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Saves settings to the wireless.opts file using the current profile | 136 | * Saves settings to the wireless.opts file using the current profile |
137 | */ | 137 | */ |
138 | void WLANImp::changeAndSaveSettingFile(){ | 138 | void WLANImp::changeAndSaveSettingFile(){ |
139 | QString wlanFile = WIRELESS_OPTS; | 139 | QString wlanFile = WIRELESS_OPTS; |
140 | QFile::remove(wlanFile); | 140 | QFile::remove(wlanFile); |
141 | QFile file(wlanFile); | 141 | QFile file(wlanFile); |
142 | 142 | ||
143 | if (!file.open(IO_ReadWrite)){ | 143 | if (!file.open(IO_ReadWrite)){ |
144 | qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); | 144 | qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); |
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | 147 | ||
148 | QTextStream stream( &file ); | 148 | QTextStream stream( &file ); |
149 | bool foundCase = false; | 149 | bool foundCase = false; |
150 | bool found = false; | 150 | bool found = false; |
151 | bool output = true; | 151 | bool output = true; |
152 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { | 152 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
153 | QString line = (*it).simplifyWhiteSpace(); | 153 | QString line = (*it).simplifyWhiteSpace(); |
154 | if(line.contains("case")) | 154 | if(line.contains("case")) |
155 | foundCase = true; | 155 | foundCase = true; |
156 | // See if we found our scheme to write or the sceme couldn't be found | 156 | // See if we found our scheme to write or the sceme couldn't be found |
157 | if((foundCase && line.contains("esac") && !found) || | 157 | if((foundCase && line.contains("esac") && !found) || |
158 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ | 158 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ |
159 | // write out scheme | 159 | // write out scheme |
160 | found = true; | 160 | found = true; |
161 | output = false; | 161 | output = false; |
162 | 162 | ||
163 | if(!line.contains("esac")) | 163 | if(!line.contains("esac")) |
164 | stream << line << "\n"; | 164 | stream << line << "\n"; |
165 | if(!essAny->isChecked() == true){ | 165 | if(!essAny->isChecked() == true){ |
166 | stream << "\tESSID=any\n"; | 166 | stream << "\tESSID=any\n"; |
167 | stream << "\tMODE=Managed\n"; | 167 | stream << "\tMODE=Managed\n"; |
168 | } | 168 | } |
169 | else{ | 169 | else{ |
170 | stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; | 170 | stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; |
171 | stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; | 171 | stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; |
172 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; | 172 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; |
173 | } | 173 | } |
174 | 174 | ||
175 | stream << "\t#KEY0=" << keyLineEdit0->text() << "\n"; | 175 | stream << "\t#KEY0=" << keyLineEdit0->text() << "\n"; |
176 | stream << "\t#KEY1=" << keyLineEdit1->text() << "\n"; | 176 | stream << "\t#KEY1=" << keyLineEdit1->text() << "\n"; |
177 | stream << "\t#KEY2=" << keyLineEdit2->text() << "\n"; | 177 | stream << "\t#KEY2=" << keyLineEdit2->text() << "\n"; |
178 | stream << "\t#KEY3=" << keyLineEdit3->text() << "\n"; | 178 | stream << "\t#KEY3=" << keyLineEdit3->text() << "\n"; |
179 | 179 | ||
180 | if(wepEnabled->isChecked()){ | 180 | if(wepEnabled->isChecked()){ |
181 | stream << "\tKEY=\""; | 181 | stream << "\tKEY=\""; |
182 | if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); | 182 | if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); |
183 | if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); | 183 | if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); |
184 | if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); | 184 | if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); |
185 | if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); | 185 | if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); |
186 | if(authOpen->isChecked()) | 186 | if(authOpen->isChecked()) |
187 | stream << " open"; | 187 | stream << " open"; |
188 | else | 188 | else |
189 | stream << " restricted"; | 189 | stream << " restricted"; |
190 | stream << "\"\n"; | 190 | stream << "\"\n"; |
191 | } | 191 | } |
192 | stream << "\tRATE=auto\n"; | 192 | stream << "\tRATE=auto\n"; |
193 | if(line.contains("esac")) | 193 | if(line.contains("esac")) |
194 | stream << line << "\n"; | 194 | stream << line << "\n"; |
195 | } | 195 | } |
196 | if(line.contains(";;")) | 196 | if(line.contains(";;")) |
197 | output = true; | 197 | output = true; |
198 | if(output && (*it).length() ) | 198 | if(output && (*it).length() ) |
199 | stream << (*it) << '\n'; | 199 | stream << (*it) << '\n'; |
200 | } | 200 | } |
201 | file.close(); | 201 | file.close(); |
202 | } | 202 | } |
203 | 203 | ||
204 | /** | 204 | /** |
205 | * Check to see if the current config is valid | 205 | * Check to see if the current config is valid |
206 | * Save wireless.opts, save interfaces | 206 | * Save wireless.opts, save interfaces |
207 | */ | 207 | */ |
208 | void WLANImp::accept(){ | 208 | void WLANImp::accept(){ |
209 | if(wepEnabled->isChecked()){ | 209 | if(wepEnabled->isChecked()){ |
210 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){ | 210 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){ |
211 | QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); | 211 | QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ | 216 | if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ |
217 | QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); | 217 | QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); |
218 | return; | 218 | return; |
219 | } | 219 | } |
220 | 220 | ||
221 | // Ok settings are good here, save | 221 | // Ok settings are good here, save |
222 | changeAndSaveSettingFile(); | 222 | changeAndSaveSettingFile(); |
223 | 223 | ||
224 | // Try to save the interfaces settings. | 224 | // Try to save the interfaces settings. |
225 | if(!interfaceSetup->saveChanges()) | 225 | if(!interfaceSetup->saveChanges()) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | // Restart the device now that the settings have changed | 228 | // Restart the device now that the settings have changed |
229 | QString initpath; | 229 | QString initpath; |
230 | if( QDir("/etc/rc.d/init.d").exists() ) | 230 | if( QDir("/etc/rc.d/init.d").exists() ) |
231 | initpath = "/etc/rc.d/init.d"; | 231 | initpath = "/etc/rc.d/init.d"; |
232 | else if( QDir("/etc/init.d").exists() ) | 232 | else if( QDir("/etc/init.d").exists() ) |
233 | initpath = "/etc/init.d"; | 233 | initpath = "/etc/init.d"; |
234 | |||
235 | // It would be kinda cool if we didn't have to do this and could just to ifup/down | ||
236 | |||
234 | if( initpath ) | 237 | if( initpath ) |
235 | system(QString("%1/pcmcia stop").arg(initpath)); | 238 | system(QString("%1/pcmcia stop").arg(initpath)); |
236 | if( initpath ) | 239 | if( initpath ) |
237 | system(QString("%1/pcmcia start").arg(initpath)); | 240 | system(QString("%1/pcmcia start").arg(initpath)); |
238 | 241 | ||
239 | // Close out the dialog | 242 | // Close out the dialog |
240 | QDialog::accept(); | 243 | QDialog::accept(); |
241 | } | 244 | } |
242 | 245 | ||
243 | // wlanimp.cpp | 246 | // wlanimp.cpp |
244 | 247 | ||