summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/TODO26
-rw-r--r--noncore/net/networksetup/mainwindow.ui2
-rw-r--r--noncore/net/networksetup/opie-networksetup.control2
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp3
-rw-r--r--noncore/settings/networksettings/TODO26
-rw-r--r--noncore/settings/networksettings/mainwindow.ui2
-rw-r--r--noncore/settings/networksettings/opie-networksettings.control2
-rw-r--r--noncore/settings/networksettings/opie-networksetup.control2
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp3
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 @@
1Types:
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
1test WEP 12test WEP
2WEP key in file wireless.conf is not encrypted !, therefore it is very easy to get the key out of the zaurus.. 13Add WEP transimtion rate
3WEP transimtion rat
41 or 2 141 or 2
55.5 155.5
61 161
7Auto 17Auto
8 18
9udchcp needs to output the dhcp information so interfaces can read it 19udchcp needs to output the dhcp information so interfaces can read it
10 20
11interfacesetupimp really doesn't need a interface* pointer 21interfacesetupimp really doesn't need a interface* pointer
12 22
13Possible other modules to write: ppp, ipsec, bluetooth, ipchains
14
15PPP module needs to scan pppd.tdb to see what is currently active 23PPP module needs to scan pppd.tdb to see what is currently active
16 24
17WLAN - add possiblity to input text or hex without knowing "s:" 25WLAN
26- add possiblity to input text or hex without knowing "s:"
27- Handle "any" and any the same way in config
18 28
19Interface setupimp needs to use kernel calls. 29Interface setupimp needs to use kernel calls.
20 30
31Add a route/DNS editor under the ViewAdvancedInfo button
32
33Use a true TCP/IP widget
34
35Make it so that pcmcia doesn't need to be stopped/started for wlan
36
21Automaticly update the main list of interfaces: 37Automaticly 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
26You can look up the meaning of the packets you receive, or you can just go 42You can look up the meaning of the packets you receive, or you can just go
27poll for changes you might be interested in each time you receive _any_ 43poll for changes you might be interested in each time you receive _any_
28packet. Anything's better than periodic polling. 44packet. Anything's better than periodic polling.
29 45
30Note that you can't do this as non-root on some kernels. There's a patch 46Note that you can't do this as non-root on some kernels. There's a patch
31which can go into the hh.org kernel if it's not already there. 47which can go into the hh.org kernel if it's not already there.
32cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2 48cf. 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
40int main(int argc, char **argv) 56int 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,212 +1,212 @@
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>&amp;Add</string> 166 <string>&amp;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>&amp;Information</string> 177 <string>&amp;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>&amp;Configure</string> 188 <string>&amp;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>&amp;Remove</string> 199 <string>&amp;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>
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 @@
1Files: 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 1Files: 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
2Priority: optional 2Priority: optional
3Section: opie/settings 3Section: opie/settings
4Maintainer: Ben Meyer <meyerb@sharpsec.com> 4Maintainer: Ben Meyer <meyerb@sharpsec.com>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: Opie network setup tool 8Description: 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
@@ -42,203 +42,206 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W
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
47void WLANImp::typeChanged(int mod){ 47void 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 */
55void WLANImp::setProfile(const QString &profile){ 55void 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 */
63void WLANImp::parseSettingFile(){ 63void 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 */
138void WLANImp::changeAndSaveSettingFile(){ 138void 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 */
208void WLANImp::accept(){ 208void 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 @@
1Types:
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
1test WEP 12test WEP
2WEP key in file wireless.conf is not encrypted !, therefore it is very easy to get the key out of the zaurus.. 13Add WEP transimtion rate
3WEP transimtion rat
41 or 2 141 or 2
55.5 155.5
61 161
7Auto 17Auto
8 18
9udchcp needs to output the dhcp information so interfaces can read it 19udchcp needs to output the dhcp information so interfaces can read it
10 20
11interfacesetupimp really doesn't need a interface* pointer 21interfacesetupimp really doesn't need a interface* pointer
12 22
13Possible other modules to write: ppp, ipsec, bluetooth, ipchains
14
15PPP module needs to scan pppd.tdb to see what is currently active 23PPP module needs to scan pppd.tdb to see what is currently active
16 24
17WLAN - add possiblity to input text or hex without knowing "s:" 25WLAN
26- add possiblity to input text or hex without knowing "s:"
27- Handle "any" and any the same way in config
18 28
19Interface setupimp needs to use kernel calls. 29Interface setupimp needs to use kernel calls.
20 30
31Add a route/DNS editor under the ViewAdvancedInfo button
32
33Use a true TCP/IP widget
34
35Make it so that pcmcia doesn't need to be stopped/started for wlan
36
21Automaticly update the main list of interfaces: 37Automaticly 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
26You can look up the meaning of the packets you receive, or you can just go 42You can look up the meaning of the packets you receive, or you can just go
27poll for changes you might be interested in each time you receive _any_ 43poll for changes you might be interested in each time you receive _any_
28packet. Anything's better than periodic polling. 44packet. Anything's better than periodic polling.
29 45
30Note that you can't do this as non-root on some kernels. There's a patch 46Note that you can't do this as non-root on some kernels. There's a patch
31which can go into the hh.org kernel if it's not already there. 47which can go into the hh.org kernel if it's not already there.
32cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2 48cf. 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
40int main(int argc, char **argv) 56int 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,212 +1,212 @@
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>&amp;Add</string> 166 <string>&amp;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>&amp;Information</string> 177 <string>&amp;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>&amp;Configure</string> 188 <string>&amp;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>&amp;Remove</string> 199 <string>&amp;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>
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 @@
1Files: 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 1Files: 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
2Priority: optional 2Priority: optional
3Section: opie/settings 3Section: opie/settings
4Maintainer: Ben Meyer <meyerb@sharpsec.com> 4Maintainer: Ben Meyer <meyerb@sharpsec.com>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: Opie network setup tool 8Description: 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 @@
1Files: 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 1Files: 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
2Priority: optional 2Priority: optional
3Section: opie/settings 3Section: opie/settings
4Maintainer: Ben Meyer <meyerb@sharpsec.com> 4Maintainer: Ben Meyer <meyerb@sharpsec.com>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: Opie network setup tool 8Description: 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
@@ -42,203 +42,206 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W
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
47void WLANImp::typeChanged(int mod){ 47void 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 */
55void WLANImp::setProfile(const QString &profile){ 55void 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 */
63void WLANImp::parseSettingFile(){ 63void 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 */
138void WLANImp::changeAndSaveSettingFile(){ 138void 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 */
208void WLANImp::accept(){ 208void 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