-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,148 +1,148 @@ | |||
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> |
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 | |||
@@ -106,139 +106,142 @@ void WLANImp::parseSettingFile(){ | |||
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,148 +1,148 @@ | |||
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> |
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 | |||
@@ -106,139 +106,142 @@ void WLANImp::parseSettingFile(){ | |||
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 | ||