summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/networksetup/TODO93
-rw-r--r--noncore/net/networksetup/addconnection.ui158
-rw-r--r--noncore/net/networksetup/addconnectionimp.cpp37
-rw-r--r--noncore/net/networksetup/addconnectionimp.h29
-rw-r--r--noncore/net/networksetup/config.in12
-rw-r--r--noncore/net/networksetup/defaultmodule.h26
-rw-r--r--noncore/net/networksetup/interfaces/config.in4
-rw-r--r--noncore/net/networksetup/interfaces/interface.cpp297
-rw-r--r--noncore/net/networksetup/interfaces/interface.h72
-rw-r--r--noncore/net/networksetup/interfaces/interfaceadvanced.ui344
-rw-r--r--noncore/net/networksetup/interfaces/interfaceinformation.ui343
-rw-r--r--noncore/net/networksetup/interfaces/interfaceinformationimp.cpp76
-rw-r--r--noncore/net/networksetup/interfaces/interfaceinformationimp.h28
-rw-r--r--noncore/net/networksetup/interfaces/interfaces.cpp643
-rw-r--r--noncore/net/networksetup/interfaces/interfaces.h77
-rw-r--r--noncore/net/networksetup/interfaces/interfaces.pro12
-rw-r--r--noncore/net/networksetup/interfaces/interfacesetup.ui242
-rw-r--r--noncore/net/networksetup/interfaces/interfacesetupimp.cpp136
-rw-r--r--noncore/net/networksetup/interfaces/interfacesetupimp.h55
-rw-r--r--noncore/net/networksetup/main.cpp13
-rw-r--r--noncore/net/networksetup/mainwindow.ui449
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp521
-rw-r--r--noncore/net/networksetup/mainwindowimp.h58
-rw-r--r--noncore/net/networksetup/module.h86
-rw-r--r--noncore/net/networksetup/networksetup.pro11
-rw-r--r--noncore/net/networksetup/opie-networksetup.control8
-rw-r--r--noncore/net/networksetup/ppp/ppp.pro12
-rw-r--r--noncore/net/networksetup/ppp/ppp.ui770
-rw-r--r--noncore/net/networksetup/ppp/pppimp.cpp39
-rw-r--r--noncore/net/networksetup/ppp/pppimp.h25
-rw-r--r--noncore/net/networksetup/ppp/pppmodule.cpp107
-rw-r--r--noncore/net/networksetup/ppp/pppmodule.h41
-rw-r--r--noncore/net/networksetup/wlan/config.in4
-rw-r--r--noncore/net/networksetup/wlan/info.ui321
-rw-r--r--noncore/net/networksetup/wlan/infoimp.cpp56
-rw-r--r--noncore/net/networksetup/wlan/infoimp.h27
-rw-r--r--noncore/net/networksetup/wlan/wextensions.cpp200
-rw-r--r--noncore/net/networksetup/wlan/wextensions.h34
-rw-r--r--noncore/net/networksetup/wlan/wlan.pro12
-rw-r--r--noncore/net/networksetup/wlan/wlan.ui491
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp247
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.h34
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.cpp113
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.h41
44 files changed, 0 insertions, 6404 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO
deleted file mode 100644
index 6457836..0000000
--- a/noncore/net/networksetup/TODO
+++ b/dev/null
@@ -1,93 +0,0 @@
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
12test WEP
13Add WEP transimtion rate
141 or 2
155.5
161
17Auto
18
19udchcp needs to output the dhcp information so interfaces can read it
20
21interfacesetupimp really doesn't need a interface* pointer
22
23PPP module needs to scan pppd.tdb to see what is currently active
24
25WLAN
26- add possiblity to input text or hex without knowing "s:"
27- Handle "any" and any the same way in config
28
29Interface setupimp needs to use kernel calls.
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
37Automaticly update the main list of interfaces:
38> That would be me. :-D netlink, can you point me in the right
39> direction where I can get more info on it? (I figured there was some
40> kenel call)
41
42You can look up the meaning of the packets you receive, or you can just go
43poll for changes you might be interested in each time you receive _any_
44packet. Anything's better than periodic polling.
45
46Note that you can't do this as non-root on some kernels. There's a patch
47which can go into the hh.org kernel if it's not already there.
48cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2
49
50
51#include <asm/types.h>
52#include <sys/socket.h>
53#include <linux/netlink.h>
54#include <linux/rtnetlink.h>
55
56int main(int argc, char **argv)
57{
58 int fd;
59 unsigned char buf[4096];
60 int ret;
61 int i, j;
62 struct sockaddr_nl snl;
63
64 fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
65 if (fd < 0) {
66 perror("socket");
67 exit(1);
68 }
69
70 snl.nl_family = AF_NETLINK;
71 snl.nl_pad = 0;
72 snl.nl_pid = getpid();
73 snl.nl_groups = RTM_NEWLINK|RTM_DELLINK;
74
75 if (bind(fd, &snl, sizeof(snl)) < 0) {
76 perror("bind");
77 exit(1);
78 }
79 while (1) {
80 ret = recv(fd, buf, 4096, 0);
81 if (ret < 0) {
82 perror("recv");
83 exit(1);
84 }
85 for (i=0; i<ret; i++) {
86 printf("%02x ", buf[i]);
87 }
88 printf("\n");
89 }
90
91}
92--
93
diff --git a/noncore/net/networksetup/addconnection.ui b/noncore/net/networksetup/addconnection.ui
deleted file mode 100644
index da6cf06..0000000
--- a/noncore/net/networksetup/addconnection.ui
+++ b/dev/null
@@ -1,158 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>AddConnection</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>AddConnection</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>229</width>
15 <height>268</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Add Network Connection</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget row="3" column="1" >
32 <class>QPushButton</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>cancelButton</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>&amp;Cancel</string>
40 </property>
41 </widget>
42 <widget row="3" column="0" >
43 <class>QPushButton</class>
44 <property stdset="1">
45 <name>name</name>
46 <cstring>addButton</cstring>
47 </property>
48 <property stdset="1">
49 <name>text</name>
50 <string>&amp;Add</string>
51 </property>
52 </widget>
53 <widget row="0" column="0" rowspan="1" colspan="2" >
54 <class>QListView</class>
55 <column>
56 <property>
57 <name>text</name>
58 <string>Services</string>
59 </property>
60 <property>
61 <name>clickable</name>
62 <bool>true</bool>
63 </property>
64 <property>
65 <name>resizeable</name>
66 <bool>true</bool>
67 </property>
68 </column>
69 <property stdset="1">
70 <name>name</name>
71 <cstring>registeredServicesList</cstring>
72 </property>
73 <property stdset="1">
74 <name>sizePolicy</name>
75 <sizepolicy>
76 <hsizetype>7</hsizetype>
77 <vsizetype>3</vsizetype>
78 </sizepolicy>
79 </property>
80 <property stdset="1">
81 <name>minimumSize</name>
82 <size>
83 <width>0</width>
84 <height>75</height>
85 </size>
86 </property>
87 </widget>
88 <spacer row="2" column="1" >
89 <property>
90 <name>name</name>
91 <cstring>Spacer12</cstring>
92 </property>
93 <property stdset="1">
94 <name>orientation</name>
95 <enum>Vertical</enum>
96 </property>
97 <property stdset="1">
98 <name>sizeType</name>
99 <enum>Expanding</enum>
100 </property>
101 <property>
102 <name>sizeHint</name>
103 <size>
104 <width>20</width>
105 <height>20</height>
106 </size>
107 </property>
108 </spacer>
109 <widget row="1" column="0" rowspan="1" colspan="2" >
110 <class>QLabel</class>
111 <property stdset="1">
112 <name>name</name>
113 <cstring>help</cstring>
114 </property>
115 <property stdset="1">
116 <name>sizePolicy</name>
117 <sizepolicy>
118 <hsizetype>5</hsizetype>
119 <vsizetype>4</vsizetype>
120 </sizepolicy>
121 </property>
122 <property stdset="1">
123 <name>text</name>
124 <string></string>
125 </property>
126 <property stdset="1">
127 <name>alignment</name>
128 <set>WordBreak|AlignTop|AlignLeft</set>
129 </property>
130 <property>
131 <name>vAlign</name>
132 </property>
133 <property>
134 <name>wordwrap</name>
135 </property>
136 </widget>
137 </grid>
138</widget>
139<connections>
140 <connection>
141 <sender>cancelButton</sender>
142 <signal>clicked()</signal>
143 <receiver>AddConnection</receiver>
144 <slot>reject()</slot>
145 </connection>
146 <connection>
147 <sender>addButton</sender>
148 <signal>clicked()</signal>
149 <receiver>AddConnection</receiver>
150 <slot>accept()</slot>
151 </connection>
152</connections>
153<tabstops>
154 <tabstop>registeredServicesList</tabstop>
155 <tabstop>addButton</tabstop>
156 <tabstop>cancelButton</tabstop>
157</tabstops>
158</UI>
diff --git a/noncore/net/networksetup/addconnectionimp.cpp b/noncore/net/networksetup/addconnectionimp.cpp
deleted file mode 100644
index 07545f7..0000000
--- a/noncore/net/networksetup/addconnectionimp.cpp
+++ b/dev/null
@@ -1,37 +0,0 @@
1#include "addconnectionimp.h"
2#include <qlistview.h>
3#include <qlist.h>
4#include <qlabel.h>
5#include <qheader.h>
6
7/**
8 * Constructor
9 */
10AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){
11 connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed()));
12 registeredServicesList->header()->hide();
13};
14
15/**
16 * The current item changed, update the discription.
17 */
18void AddConnectionImp::changed(){
19 QListViewItem *item = registeredServicesList->currentItem();
20 if(item)
21 help->setText(list[item->text(0)]);
22}
23
24/**
25 * Save a copy of newList for the discriptions and append them all to the view
26 * @param newList the new list of possible interfaces
27 */
28void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){
29 list = newList;
30 QMap<QString, QString>::Iterator it;
31 for( it = list.begin(); it != list.end(); ++it )
32 QListViewItem *item = new QListViewItem(registeredServicesList, it.key());
33 registeredServicesList->setCurrentItem(registeredServicesList->firstChild());
34}
35
36// addserviceimp.cpp
37
diff --git a/noncore/net/networksetup/addconnectionimp.h b/noncore/net/networksetup/addconnectionimp.h
deleted file mode 100644
index 680a502..0000000
--- a/noncore/net/networksetup/addconnectionimp.h
+++ b/dev/null
@@ -1,29 +0,0 @@
1#ifndef ADDCONNECTIONIMP_H
2#define ADDCONNECTIONIMP_H
3
4#include "addconnection.h"
5#include <qmap.h>
6#include <qlist.h>
7
8class QListViewItem;
9
10class AddConnectionImp : public AddConnection {
11
12Q_OBJECT
13
14public:
15 AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0);
16 void addConnections(const QMap<QString, QString> &newList);
17
18private slots:
19 void changed();
20
21private:
22 QMap<QString, QString> list;
23
24};
25
26#endif
27
28// addconectionimp.h
29
diff --git a/noncore/net/networksetup/config.in b/noncore/net/networksetup/config.in
deleted file mode 100644
index 0f2c878..0000000
--- a/noncore/net/networksetup/config.in
+++ b/dev/null
@@ -1,12 +0,0 @@
1config NETWORKSETUP
2 boolean "Networksetup"
3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
5
6config NETWORKSETUP-CORE
7 boolean
8 default "y" if NETWORKSETUP
9 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && INTERFACES
10
11 source noncore/net/networksetup/wlan/config.in
12 source noncore/net/networksetup/interfaces/config.in
diff --git a/noncore/net/networksetup/defaultmodule.h b/noncore/net/networksetup/defaultmodule.h
deleted file mode 100644
index c7791d5..0000000
--- a/noncore/net/networksetup/defaultmodule.h
+++ b/dev/null
@@ -1,26 +0,0 @@
1#ifndef MODULE_H
2#define MODULE_H
3
4#include "module.h"
5
6class QWidget;
7
8class DefaultModule : Module{
9
10public:
11 DefaultModule(){};
12
13 virtual bool isOwner(Interface *i);
14 virtual QWidget *configure();
15 virtual QWidget *information()};
16 virtual QList<Interface> getInterfaces();
17 virtual QMap<QString, QString> possibleNewInterfaces();
18 virtual Interface *addNewInterface(QString name);
19 virtual bool remove(Interface* i);
20
21};
22
23#endif
24
25// module.h
26
diff --git a/noncore/net/networksetup/interfaces/config.in b/noncore/net/networksetup/interfaces/config.in
deleted file mode 100644
index 6c21aeb..0000000
--- a/noncore/net/networksetup/interfaces/config.in
+++ b/dev/null
@@ -1,4 +0,0 @@
1 config INTERFACES
2 boolean
3 default "y" if NETWORKSETUP
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
diff --git a/noncore/net/networksetup/interfaces/interface.cpp b/noncore/net/networksetup/interfaces/interface.cpp
deleted file mode 100644
index d964961..0000000
--- a/noncore/net/networksetup/interfaces/interface.cpp
+++ b/dev/null
@@ -1,297 +0,0 @@
1#include "interface.h"
2#include <qdatetime.h>
3#include <qfile.h>
4#include <qdir.h>
5#include <qfileinfo.h>
6#include <qtextstream.h>
7
8#define IFCONFIG "/sbin/ifconfig"
9#define DHCP_INFO_DIR "/etc/dhcpc"
10
11#include <stdio.h>
12#include <stdlib.h>
13
14Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), hardwareName("Unknown"), moduleOwner(NULL), status(newSatus), attached(false), dhcp(false), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"){
15 refresh();
16}
17
18/**
19 * Set status
20 * @param newStatus - the new status
21 * emit updateInterface
22 */
23void Interface::setStatus(bool newStatus){
24 if(status != newStatus){
25 status = newStatus;
26 refresh();
27 }
28};
29
30/**
31 * Set if attached or not (802.11 card pulled out for example)
32 * @param isAttached - if attached
33 * emit updateInterface
34 */
35void Interface::setAttached(bool isAttached){
36 attached = isAttached;
37 emit(updateInterface(this));
38};
39
40/**
41 * Set Hardware name
42 * @param name - the new name
43 * emit updateInterface
44 */
45void Interface::setHardwareName(const QString &name){
46 hardwareName = name;
47 emit(updateInterface(this));
48};
49
50/**
51 * Set Module owner
52 * @param owner - the new owner
53 * emit updateInterface
54 */
55void Interface::setModuleOwner(Module *owner){
56 moduleOwner = owner;
57 emit(updateInterface(this));
58};
59
60
61/**
62 * Try to start the interface.
63 */
64void Interface::start(){
65 // check to see if we are already running.
66 if(true == status){
67 emit (updateMessage("Unable to start interface,\n already started"));
68 return;
69 }
70
71 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
72 // See if it was successfull...
73 if(ret != 0){
74 emit (updateMessage("Starting interface failed"));
75 return;
76 }
77
78 status = true;
79 refresh();
80 emit (updateMessage("Start successfull"));
81}
82
83/**
84 * Try to stop the interface.
85 */
86void Interface::stop(){
87 // check to see if we are already stopped.
88 if(false == status){
89 emit (updateMessage("Unable to stop interface,\n already stopped"));
90 return;
91 }
92
93 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
94 if(ret != 0){
95 emit (updateMessage("Stopping interface failed"));
96 return;
97 }
98
99 status = false;
100 refresh();
101 emit (updateMessage("Stop successfull"));
102}
103
104/**
105 * Try to restart the interface.
106 */
107void Interface::restart(){
108 stop();
109 start();
110}
111
112/**
113 * Try to refresh the information about the interface.
114 * First call ifconfig, then check the dhcp-info file
115 * @return bool true if successfull.
116 */
117bool Interface::refresh(){
118 // See if we are up.
119 if(status == false){
120 macAddress = "";
121 ip = "0.0.0.0";
122 subnetMask = "0.0.0.0";
123 broadcast = "";
124 dhcp = false;
125 dhcpServerIp = "";
126 leaseObtained = "";
127 leaseExpires = "";
128 emit(updateInterface(this));
129 return true;
130 }
131
132 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
133 int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
134 if(ret != 0){
135 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
136 return false;
137 }
138
139 QFile file(fileName);
140 if (!file.open(IO_ReadOnly)){
141 qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
142 return false;
143 }
144
145 // Set to the defaults
146 macAddress = "";
147 ip = "0.0.0.0";
148 subnetMask = "0.0.0.0";
149 broadcast = "";
150
151 QTextStream stream( &file );
152 QString line;
153 while ( !stream.eof() ) {
154 line = stream.readLine();
155 if(line.contains("HWaddr")){
156 int mac = line.find("HWaddr");
157 macAddress = line.mid(mac+7, line.length());
158 }
159 if(line.contains("inet addr")){
160 int ipl = line.find("inet addr");
161 int space = line.find(" ", ipl+10);
162 ip = line.mid(ipl+10, space-ipl-10);
163 }
164 if(line.contains("Mask")){
165 int mask = line.find("Mask");
166 subnetMask = line.mid(mask+5, line.length());
167 }
168 if(line.contains("Bcast")){
169 int mask = line.find("Bcast");
170 int space = line.find(" ", mask+6);
171 broadcast = line.mid(mask+6, space-mask-6);
172 }
173 }
174 file.close();
175 QFile::remove(fileName);
176
177 // DHCP TESTING
178 // reset DHCP info
179 dhcpServerIp = "";
180 leaseObtained = "";
181 leaseExpires = "";
182 dhcp = false;
183
184 QString dhcpDirectory(DHCP_INFO_DIR);
185 QDir d(dhcpDirectory);
186 if(!d.exists(dhcpDirectory))
187 dhcpDirectory = "/var/run";
188
189 // See if we have
190 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
191 // If there is no DHCP information then exit now with no errors.
192 if(!QFile::exists(dhcpFile)){
193 emit(updateInterface(this));
194 return true;
195 }
196
197 file.setName(dhcpFile);
198 if (!file.open(IO_ReadOnly)){
199 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
200 return false;
201 }
202
203 // leaseTime and renewalTime and used if pid and deamon exe can be accessed.
204 int leaseTime = 0;
205 int renewalTime = 0;
206
207 stream.setDevice( &file );
208 while ( !stream.eof() ) {
209 line = stream.readLine();
210 if(line.contains("DHCPSIADDR="))
211 dhcpServerIp = line.mid(11, line.length());
212 if(line.contains("LEASETIME="))
213 leaseTime = line.mid(10, line.length()).toInt();
214 if(line.contains("RENEWALTIME="))
215 renewalTime = line.mid(12, line.length()).toInt();
216 }
217 file.close();
218 //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1());
219 //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1());
220
221 // Get the pid of the deamond
222 dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name()));
223 file.setName(dhcpFile);
224 if (!file.open(IO_ReadOnly)){
225 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
226 return false;
227 }
228
229 int pid = -1;
230 stream.setDevice( &file );
231 while ( !stream.eof() ) {
232 line = stream.readLine();
233 pid = line.toInt();
234 }
235 file.close();
236
237 if( pid == -1){
238 qDebug("Interface: Could not get pid of dhcpc deamon.");
239 return false;
240 }
241
242 // Get the start running time of the deamon
243 fileName = (QString("/proc/%1/stat").arg(pid));
244 file.setName(fileName);
245 stream.setDevice( &file );
246 if (!file.open(IO_ReadOnly)){
247 qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
248 return false;
249 }
250 while ( !stream.eof() ) {
251 line = stream.readLine();
252 }
253 file.close();
254 long time = 0;
255 // Grab the start time
256 // pid com state ppid pgrp session tty_nr tpgid flags
257 sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u "
258 // minflt cminflt majflt cmajflt utime stime cutime cstime priority
259 "%*u %*u %*u %*u %*u %*u %*d %*d %*d "
260 // nice 0 itrealvalue starttime
261 "%*d %*d %*d %lu", (long*) &time);
262 time = time/100;
263
264 QDateTime datetime(QDateTime::currentDateTime());
265
266 // Get the uptime of the computer.
267 QFile f("/proc/uptime");
268 if ( f.open(IO_ReadOnly) ) { // file opened successfully
269 QTextStream t( &f ); // use a text stream
270 int sec = 0;
271 t >> sec;
272 datetime = datetime.addSecs((-1*sec));
273 f.close();
274 }
275 else{
276 qDebug("Interface: Can't open /proc/uptime to retrive uptime.");
277 return false;
278 }
279
280 datetime = datetime.addSecs(time);
281 //qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1());
282
283 // Calculate the start and renew times
284 leaseObtained= datetime.toString();
285
286 // Calculate the start and renew times
287 datetime = datetime.addSecs(leaseTime);
288 leaseExpires = datetime.toString();
289
290 dhcp = true;
291
292 emit(updateInterface(this));
293 return true;
294}
295
296// interface.cpp
297
diff --git a/noncore/net/networksetup/interfaces/interface.h b/noncore/net/networksetup/interfaces/interface.h
deleted file mode 100644
index d37834a..0000000
--- a/noncore/net/networksetup/interfaces/interface.h
+++ b/dev/null
@@ -1,72 +0,0 @@
1#ifndef INTERFACE_H
2#define INTERFACE_H
3
4#include <qstring.h>
5#include <qobject.h>
6
7class Module;
8
9class Interface : public QObject{
10 Q_OBJECT
11
12signals:
13 void updateInterface(Interface *i);
14 void updateMessage(const QString &message);
15
16public:
17 Interface(QObject * parent=0, const char * name= "unknown", bool status = false);
18
19 QString getInterfaceName() const { QString n(this->name()); return n; };
20
21 bool getStatus() const { return status; };
22 void setStatus(bool newStatus);
23
24 bool isAttached() const { return attached; };
25 void setAttached(bool isAttached=false);
26
27 QString getHardwareName() const { return hardwareName; };
28 void setHardwareName(const QString &name="Unknown");
29
30 Module* getModuleOwner() const { return moduleOwner; };
31 void setModuleOwner(Module *owner=NULL);
32
33 // inet information.
34 QString getMacAddress() const { return macAddress; };
35 QString getIp() const { return ip; };
36 QString getSubnetMask() const { return subnetMask; };
37 QString getBroadcast() const { return broadcast; };
38 bool isDhcp() const { return dhcp; };
39 QString getDhcpServerIp() const { return dhcpServerIp; };
40 QString getLeaseObtained() const { return leaseObtained; };
41 QString getLeaseExpires() const { return leaseExpires; };
42
43public slots:
44 bool refresh();
45 void start();
46 void stop();
47 void restart();
48
49private:
50 // Interface information
51 QString hardwareName;
52 Module *moduleOwner;
53 bool status;
54 bool attached;
55
56 // Network information
57 bool dhcp;
58 QString dhcpServerIp;
59 QString leaseObtained;
60 QString leaseExpires;
61
62 QString macAddress;
63 QString ip;
64 QString broadcast;
65 QString subnetMask;
66
67};
68
69#endif
70
71// interface.h
72
diff --git a/noncore/net/networksetup/interfaces/interfaceadvanced.ui b/noncore/net/networksetup/interfaces/interfaceadvanced.ui
deleted file mode 100644
index 9d9f98e..0000000
--- a/noncore/net/networksetup/interfaces/interfaceadvanced.ui
+++ b/dev/null
@@ -1,344 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>InterfaceAdvanced</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>InterfaceAdvanced</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>214</width>
15 <height>290</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>maximumSize</name>
20 <size>
21 <width>240</width>
22 <height>32767</height>
23 </size>
24 </property>
25 <property stdset="1">
26 <name>caption</name>
27 <string>Advanced Interface Information</string>
28 </property>
29 <grid>
30 <property stdset="1">
31 <name>margin</name>
32 <number>11</number>
33 </property>
34 <property stdset="1">
35 <name>spacing</name>
36 <number>6</number>
37 </property>
38 <widget row="0" column="1" >
39 <class>QLabel</class>
40 <property stdset="1">
41 <name>name</name>
42 <cstring>interfaceName</cstring>
43 </property>
44 <property stdset="1">
45 <name>frameShape</name>
46 <enum>Panel</enum>
47 </property>
48 <property stdset="1">
49 <name>frameShadow</name>
50 <enum>Sunken</enum>
51 </property>
52 <property stdset="1">
53 <name>text</name>
54 <string>eth0</string>
55 </property>
56 </widget>
57 <widget row="1" column="0" >
58 <class>QLabel</class>
59 <property stdset="1">
60 <name>name</name>
61 <cstring>TextLabel3</cstring>
62 </property>
63 <property stdset="1">
64 <name>text</name>
65 <string>IP Address</string>
66 </property>
67 </widget>
68 <widget row="0" column="0" >
69 <class>QLabel</class>
70 <property stdset="1">
71 <name>name</name>
72 <cstring>TextLabel7</cstring>
73 </property>
74 <property stdset="1">
75 <name>text</name>
76 <string>Interface</string>
77 </property>
78 </widget>
79 <widget row="2" column="0" >
80 <class>QLabel</class>
81 <property stdset="1">
82 <name>name</name>
83 <cstring>TextLabel4</cstring>
84 </property>
85 <property stdset="1">
86 <name>enabled</name>
87 <bool>true</bool>
88 </property>
89 <property stdset="1">
90 <name>text</name>
91 <string>Subnet Mask</string>
92 </property>
93 </widget>
94 <widget row="1" column="1" >
95 <class>QLabel</class>
96 <property stdset="1">
97 <name>name</name>
98 <cstring>ipAddressLabel</cstring>
99 </property>
100 <property stdset="1">
101 <name>frameShape</name>
102 <enum>Panel</enum>
103 </property>
104 <property stdset="1">
105 <name>frameShadow</name>
106 <enum>Sunken</enum>
107 </property>
108 <property stdset="1">
109 <name>text</name>
110 <string>0.0.0.0</string>
111 </property>
112 </widget>
113 <widget row="2" column="1" >
114 <class>QLabel</class>
115 <property stdset="1">
116 <name>name</name>
117 <cstring>subnetMaskLabel</cstring>
118 </property>
119 <property stdset="1">
120 <name>frameShape</name>
121 <enum>Panel</enum>
122 </property>
123 <property stdset="1">
124 <name>frameShadow</name>
125 <enum>Sunken</enum>
126 </property>
127 <property stdset="1">
128 <name>text</name>
129 <string>0.0.0.0</string>
130 </property>
131 </widget>
132 <spacer row="6" column="1" >
133 <property>
134 <name>name</name>
135 <cstring>Spacer2</cstring>
136 </property>
137 <property stdset="1">
138 <name>orientation</name>
139 <enum>Vertical</enum>
140 </property>
141 <property stdset="1">
142 <name>sizeType</name>
143 <enum>Expanding</enum>
144 </property>
145 <property>
146 <name>sizeHint</name>
147 <size>
148 <width>20</width>
149 <height>20</height>
150 </size>
151 </property>
152 </spacer>
153 <widget row="5" column="0" rowspan="1" colspan="2" >
154 <class>QGroupBox</class>
155 <property stdset="1">
156 <name>name</name>
157 <cstring>dhcpInformation</cstring>
158 </property>
159 <property stdset="1">
160 <name>title</name>
161 <string>DHCP Information</string>
162 </property>
163 <grid>
164 <property stdset="1">
165 <name>margin</name>
166 <number>11</number>
167 </property>
168 <property stdset="1">
169 <name>spacing</name>
170 <number>6</number>
171 </property>
172 <widget row="0" column="0" >
173 <class>QLabel</class>
174 <property stdset="1">
175 <name>name</name>
176 <cstring>TextLabel6</cstring>
177 </property>
178 <property stdset="1">
179 <name>text</name>
180 <string>DHCP Server</string>
181 </property>
182 </widget>
183 <widget row="2" column="1" >
184 <class>QLabel</class>
185 <property stdset="1">
186 <name>name</name>
187 <cstring>leaseExpiresLabel</cstring>
188 </property>
189 <property stdset="1">
190 <name>frameShape</name>
191 <enum>Panel</enum>
192 </property>
193 <property stdset="1">
194 <name>frameShadow</name>
195 <enum>Sunken</enum>
196 </property>
197 <property stdset="1">
198 <name>text</name>
199 <string></string>
200 </property>
201 </widget>
202 <widget row="1" column="1" >
203 <class>QLabel</class>
204 <property stdset="1">
205 <name>name</name>
206 <cstring>leaseObtainedLabel</cstring>
207 </property>
208 <property stdset="1">
209 <name>frameShape</name>
210 <enum>Panel</enum>
211 </property>
212 <property stdset="1">
213 <name>frameShadow</name>
214 <enum>Sunken</enum>
215 </property>
216 <property stdset="1">
217 <name>text</name>
218 <string></string>
219 </property>
220 </widget>
221 <widget row="2" column="0" >
222 <class>QLabel</class>
223 <property stdset="1">
224 <name>name</name>
225 <cstring>TextLabel9</cstring>
226 </property>
227 <property stdset="1">
228 <name>text</name>
229 <string>Lease Expires</string>
230 </property>
231 </widget>
232 <widget row="1" column="0" >
233 <class>QLabel</class>
234 <property stdset="1">
235 <name>name</name>
236 <cstring>TextLabel8</cstring>
237 </property>
238 <property stdset="1">
239 <name>text</name>
240 <string>Lease Obtained</string>
241 </property>
242 </widget>
243 <widget row="0" column="1" >
244 <class>QLabel</class>
245 <property stdset="1">
246 <name>name</name>
247 <cstring>dhcpServerLabel</cstring>
248 </property>
249 <property stdset="1">
250 <name>frameShape</name>
251 <enum>Panel</enum>
252 </property>
253 <property stdset="1">
254 <name>frameShadow</name>
255 <enum>Sunken</enum>
256 </property>
257 <property stdset="1">
258 <name>text</name>
259 <string></string>
260 </property>
261 </widget>
262 </grid>
263 </widget>
264 <widget row="4" column="0" >
265 <class>QLabel</class>
266 <property stdset="1">
267 <name>name</name>
268 <cstring>TextLabel2</cstring>
269 </property>
270 <property stdset="1">
271 <name>text</name>
272 <string>Broadcast</string>
273 </property>
274 </widget>
275 <widget row="4" column="1" >
276 <class>QLabel</class>
277 <property stdset="1">
278 <name>name</name>
279 <cstring>broadcastLabel</cstring>
280 </property>
281 <property stdset="1">
282 <name>frameShape</name>
283 <enum>Panel</enum>
284 </property>
285 <property stdset="1">
286 <name>frameShadow</name>
287 <enum>Sunken</enum>
288 </property>
289 </widget>
290 <widget row="3" column="0" >
291 <class>QLabel</class>
292 <property stdset="1">
293 <name>name</name>
294 <cstring>TextLabel1</cstring>
295 </property>
296 <property stdset="1">
297 <name>text</name>
298 <string>MAC Address</string>
299 </property>
300 </widget>
301 <widget row="3" column="1" >
302 <class>QLabel</class>
303 <property stdset="1">
304 <name>name</name>
305 <cstring>macAddressLabel</cstring>
306 </property>
307 <property stdset="1">
308 <name>frameShape</name>
309 <enum>Panel</enum>
310 </property>
311 <property stdset="1">
312 <name>frameShadow</name>
313 <enum>Sunken</enum>
314 </property>
315 <property stdset="1">
316 <name>text</name>
317 <string>00:00:00:00:00:00</string>
318 </property>
319 </widget>
320 </grid>
321</widget>
322<customwidgets>
323 <customwidget>
324 <class>QWidget</class>
325 <header location="local">qwidget.h</header>
326 <sizehint>
327 <width>100</width>
328 <height>100</height>
329 </sizehint>
330 <container>0</container>
331 <sizepolicy>
332 <hordata>7</hordata>
333 <verdata>7</verdata>
334 </sizepolicy>
335 <pixmap>image0</pixmap>
336 </customwidget>
337</customwidgets>
338<images>
339 <image>
340 <name>image0</name>
341 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
342 </image>
343</images>
344</UI>
diff --git a/noncore/net/networksetup/interfaces/interfaceinformation.ui b/noncore/net/networksetup/interfaces/interfaceinformation.ui
deleted file mode 100644
index e49e09f..0000000
--- a/noncore/net/networksetup/interfaces/interfaceinformation.ui
+++ b/dev/null
@@ -1,343 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>InterfaceInformation</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>InterfaceInformation</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>219</width>
15 <height>255</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Interface Information</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget row="4" column="0" rowspan="1" colspan="2" >
32 <class>QLayoutWidget</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>Layout1</cstring>
36 </property>
37 <grid>
38 <property stdset="1">
39 <name>margin</name>
40 <number>0</number>
41 </property>
42 <property stdset="1">
43 <name>spacing</name>
44 <number>6</number>
45 </property>
46 <widget row="1" column="0" >
47 <class>QPushButton</class>
48 <property stdset="1">
49 <name>name</name>
50 <cstring>refreshButton</cstring>
51 </property>
52 <property stdset="1">
53 <name>text</name>
54 <string>&amp;Refresh</string>
55 </property>
56 </widget>
57 <widget row="0" column="1" >
58 <class>QPushButton</class>
59 <property stdset="1">
60 <name>name</name>
61 <cstring>stopButton</cstring>
62 </property>
63 <property stdset="1">
64 <name>text</name>
65 <string>S&amp;top</string>
66 </property>
67 </widget>
68 <widget row="1" column="1" >
69 <class>QPushButton</class>
70 <property stdset="1">
71 <name>name</name>
72 <cstring>restartButton</cstring>
73 </property>
74 <property stdset="1">
75 <name>text</name>
76 <string>R&amp;estart</string>
77 </property>
78 </widget>
79 <widget row="0" column="0" >
80 <class>QPushButton</class>
81 <property stdset="1">
82 <name>name</name>
83 <cstring>startButton</cstring>
84 </property>
85 <property stdset="1">
86 <name>text</name>
87 <string>&amp;Start</string>
88 </property>
89 </widget>
90 </grid>
91 </widget>
92 <widget row="0" column="0" >
93 <class>Line</class>
94 <property stdset="1">
95 <name>name</name>
96 <cstring>Line1</cstring>
97 </property>
98 <property stdset="1">
99 <name>orientation</name>
100 <enum>Horizontal</enum>
101 </property>
102 </widget>
103 <widget row="0" column="0" >
104 <class>QLabel</class>
105 <property stdset="1">
106 <name>name</name>
107 <cstring>TextLabel22</cstring>
108 </property>
109 <property stdset="1">
110 <name>text</name>
111 <string>IP Address</string>
112 </property>
113 </widget>
114 <widget row="1" column="0" >
115 <class>QLabel</class>
116 <property stdset="1">
117 <name>name</name>
118 <cstring>TextLabel23</cstring>
119 </property>
120 <property stdset="1">
121 <name>text</name>
122 <string>Subnet Mask</string>
123 </property>
124 </widget>
125 <widget row="2" column="0" >
126 <class>QLabel</class>
127 <property stdset="1">
128 <name>name</name>
129 <cstring>TextLabel21</cstring>
130 </property>
131 <property stdset="1">
132 <name>text</name>
133 <string>MAC Address</string>
134 </property>
135 </widget>
136 <widget row="3" column="0" >
137 <class>QLabel</class>
138 <property stdset="1">
139 <name>name</name>
140 <cstring>TextLabel24</cstring>
141 </property>
142 <property stdset="1">
143 <name>frameShape</name>
144 <enum>MShape</enum>
145 </property>
146 <property stdset="1">
147 <name>frameShadow</name>
148 <enum>MShadow</enum>
149 </property>
150 <property stdset="1">
151 <name>text</name>
152 <string>Broadcast</string>
153 </property>
154 </widget>
155 <widget row="1" column="1" >
156 <class>QLabel</class>
157 <property stdset="1">
158 <name>name</name>
159 <cstring>subnetMaskLabel</cstring>
160 </property>
161 <property stdset="1">
162 <name>frameShape</name>
163 <enum>Panel</enum>
164 </property>
165 <property stdset="1">
166 <name>frameShadow</name>
167 <enum>Sunken</enum>
168 </property>
169 <property stdset="1">
170 <name>text</name>
171 <string>0.0.0.0</string>
172 </property>
173 </widget>
174 <widget row="2" column="1" >
175 <class>QLabel</class>
176 <property stdset="1">
177 <name>name</name>
178 <cstring>macAddressLabel</cstring>
179 </property>
180 <property stdset="1">
181 <name>frameShape</name>
182 <enum>Panel</enum>
183 </property>
184 <property stdset="1">
185 <name>frameShadow</name>
186 <enum>Sunken</enum>
187 </property>
188 <property stdset="1">
189 <name>text</name>
190 <string>00:00:00:00:00:00</string>
191 </property>
192 </widget>
193 <widget row="3" column="1" >
194 <class>QLabel</class>
195 <property stdset="1">
196 <name>name</name>
197 <cstring>broadcastLabel</cstring>
198 </property>
199 <property stdset="1">
200 <name>frameShape</name>
201 <enum>Panel</enum>
202 </property>
203 <property stdset="1">
204 <name>frameShadow</name>
205 <enum>Sunken</enum>
206 </property>
207 <property stdset="1">
208 <name>text</name>
209 <string></string>
210 </property>
211 </widget>
212 <widget row="0" column="1" >
213 <class>QLabel</class>
214 <property stdset="1">
215 <name>name</name>
216 <cstring>ipAddressLabel</cstring>
217 </property>
218 <property stdset="1">
219 <name>frameShape</name>
220 <enum>Panel</enum>
221 </property>
222 <property stdset="1">
223 <name>frameShadow</name>
224 <enum>Sunken</enum>
225 </property>
226 <property stdset="1">
227 <name>text</name>
228 <string>0.0.0.0</string>
229 </property>
230 </widget>
231 <spacer row="7" column="1" >
232 <property>
233 <name>name</name>
234 <cstring>Spacer18</cstring>
235 </property>
236 <property stdset="1">
237 <name>orientation</name>
238 <enum>Vertical</enum>
239 </property>
240 <property stdset="1">
241 <name>sizeType</name>
242 <enum>Expanding</enum>
243 </property>
244 <property>
245 <name>sizeHint</name>
246 <size>
247 <width>20</width>
248 <height>20</height>
249 </size>
250 </property>
251 </spacer>
252 <widget row="6" column="0" rowspan="1" colspan="2" >
253 <class>QLayoutWidget</class>
254 <property stdset="1">
255 <name>name</name>
256 <cstring>Layout2</cstring>
257 </property>
258 <hbox>
259 <property stdset="1">
260 <name>margin</name>
261 <number>0</number>
262 </property>
263 <property stdset="1">
264 <name>spacing</name>
265 <number>6</number>
266 </property>
267 <spacer>
268 <property>
269 <name>name</name>
270 <cstring>Spacer10</cstring>
271 </property>
272 <property stdset="1">
273 <name>orientation</name>
274 <enum>Horizontal</enum>
275 </property>
276 <property stdset="1">
277 <name>sizeType</name>
278 <enum>Expanding</enum>
279 </property>
280 <property>
281 <name>sizeHint</name>
282 <size>
283 <width>20</width>
284 <height>20</height>
285 </size>
286 </property>
287 </spacer>
288 <widget>
289 <class>QPushButton</class>
290 <property stdset="1">
291 <name>name</name>
292 <cstring>advancedButton</cstring>
293 </property>
294 <property stdset="1">
295 <name>text</name>
296 <string>&amp;View Advanced Information</string>
297 </property>
298 </widget>
299 </hbox>
300 </widget>
301 <widget row="5" column="0" rowspan="1" colspan="2" >
302 <class>Line</class>
303 <property stdset="1">
304 <name>name</name>
305 <cstring>Line5</cstring>
306 </property>
307 <property stdset="1">
308 <name>orientation</name>
309 <enum>Horizontal</enum>
310 </property>
311 </widget>
312 </grid>
313</widget>
314<customwidgets>
315 <customwidget>
316 <class>QWidget</class>
317 <header location="local">qwidget.h</header>
318 <sizehint>
319 <width>100</width>
320 <height>100</height>
321 </sizehint>
322 <container>0</container>
323 <sizepolicy>
324 <hordata>7</hordata>
325 <verdata>7</verdata>
326 </sizepolicy>
327 <pixmap>image0</pixmap>
328 </customwidget>
329</customwidgets>
330<images>
331 <image>
332 <name>image0</name>
333 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
334 </image>
335</images>
336<tabstops>
337 <tabstop>startButton</tabstop>
338 <tabstop>stopButton</tabstop>
339 <tabstop>refreshButton</tabstop>
340 <tabstop>restartButton</tabstop>
341 <tabstop>advancedButton</tabstop>
342</tabstops>
343</UI>
diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp
deleted file mode 100644
index 1fa5d38..0000000
--- a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp
+++ b/dev/null
@@ -1,76 +0,0 @@
1#include "interfaceinformationimp.h"
2#include "interfaceadvanced.h"
3
4#include <qpushbutton.h>
5#include <qlabel.h>
6#include <qgroupbox.h>
7#include <qmessagebox.h>
8
9/**
10 * Constructor for the InterfaceInformationImp class. This class pretty much
11 * just display's information about the interface that is passed to it.
12 */
13InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){
14 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
15 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
16 updateInterface(interface);
17 connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
18 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
19 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
20 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
21 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
22}
23
24/**
25 * Update the interface information and buttons.
26 * @param Intarface *i the interface to update (should be the one we already
27 * know about).
28 */
29void InterfaceInformationImp::updateInterface(Interface *){
30 if(interface->getStatus()){
31 startButton->setEnabled(false);
32 stopButton->setEnabled(true);
33 restartButton->setEnabled(true);
34 }
35 else{
36 startButton->setEnabled(true);
37 stopButton->setEnabled(false);
38 restartButton->setEnabled(false);
39 }
40 macAddressLabel->setText(interface->getMacAddress());
41 ipAddressLabel->setText(interface->getIp());
42 subnetMaskLabel->setText(interface->getSubnetMask());
43 broadcastLabel->setText(interface->getBroadcast());
44}
45
46/**
47 * Create the advanced widget. Fill it with the current interface's information.
48 * Display it.
49 */
50void InterfaceInformationImp::advanced(){
51 InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced");
52 a->interfaceName->setText(interface->getInterfaceName());
53 a->macAddressLabel->setText(interface->getMacAddress());
54 a->ipAddressLabel->setText(interface->getIp());
55 a->subnetMaskLabel->setText(interface->getSubnetMask());
56 a->broadcastLabel->setText(interface->getBroadcast());
57 a->dhcpServerLabel->setText(interface->getDhcpServerIp());
58 a->leaseObtainedLabel->setText(interface->getLeaseObtained());
59 a->leaseExpiresLabel->setText(interface->getLeaseExpires());
60 a->dhcpInformation->setEnabled(interface->isDhcp());
61
62 a->showMaximized();
63 a->show();
64}
65
66/**
67 * Messages from the interface if start/stop went as planned.
68 * Purly for user feedback.
69 * @param message the message to display.
70 */
71void InterfaceInformationImp::showMessage(const QString &message){
72 QMessageBox::information(this, "Message", message, QMessageBox::Ok);
73}
74
75// infoimp.cpp
76
diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.h b/noncore/net/networksetup/interfaces/interfaceinformationimp.h
deleted file mode 100644
index 65cdfe0..0000000
--- a/noncore/net/networksetup/interfaces/interfaceinformationimp.h
+++ b/dev/null
@@ -1,28 +0,0 @@
1#ifndef INTERFACEINFORMATIONIMP_H
2#define INTERFACEINFORMATIONIMP_H
3
4#include "interfaceinformation.h"
5#include "interface.h"
6
7class InterfaceInformationImp : public InterfaceInformation {
8
9Q_OBJECT
10
11public:
12 InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0);
13 ~InterfaceInformationImp(){};
14
15private slots:
16 void advanced();
17 void updateInterface(Interface *i);
18 void showMessage(const QString &message);
19
20private:
21 Interface *interface;
22
23};
24
25#endif
26
27// addserviceimp.h
28
diff --git a/noncore/net/networksetup/interfaces/interfaces.cpp b/noncore/net/networksetup/interfaces/interfaces.cpp
deleted file mode 100644
index 8f685fe..0000000
--- a/noncore/net/networksetup/interfaces/interfaces.cpp
+++ b/dev/null
@@ -1,643 +0,0 @@
1#include "interfaces.h"
2
3#include <qfile.h>
4#include <qtextstream.h>
5#include <qregexp.h>
6
7// The three stanza's
8#define AUTO "auto"
9#define IFACE "iface"
10#define MAPPING "mapping"
11
12/**
13 * Constructor. Reads in the interfaces file and then split the file up by
14 * the \n for interfaces variable.
15 * @param useInterfacesFile if an interface file other then the default is
16 * desired to be used it should be passed in.
17 */
18Interfaces::Interfaces(QString useInterfacesFile){
19 acceptedFamily.append(INTERFACES_FAMILY_INET);
20 acceptedFamily.append(INTERFACES_FAMILY_IPX);
21 acceptedFamily.append(INTERFACES_FAMILY_INET6);
22
23 interfacesFile = useInterfacesFile;
24 QFile file(interfacesFile);
25 if (!file.open(IO_ReadOnly)){
26 qDebug(QString("Interfaces: Can't open file: %1 for reading.").arg(interfacesFile).latin1());
27 currentIface = interfaces.end();
28 currentMapping = interfaces.end();
29 return;
30 }
31 QTextStream stream( &file );
32 QString line;
33 while ( !stream.eof() ) {
34 line += stream.readLine();
35 line += "\n";
36 }
37 file.close();
38 interfaces = QStringList::split("\n", line, true);
39
40 currentIface = interfaces.end();
41 currentMapping = interfaces.end();
42}
43
44
45/**
46 * Get a list of all interfaces in the interface file. Usefull for
47 * hardware that is not currently connected such as an 802.11b card
48 * not plugged in, but configured for when it is plugged in.
49 * @return Return string list of interfaces.
50 **/
51QStringList Interfaces::getInterfaceList(){
52 QStringList list;
53 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
54 QString line = (*it).simplifyWhiteSpace();
55 if(line.contains(IFACE) && line.at(0) != '#'){
56 line = line.mid(QString(IFACE).length() +1, line.length());
57 line = line.simplifyWhiteSpace();
58 int findSpace = line.find(" ");
59 if( findSpace >= 0){
60 line = line.mid(0, findSpace);
61 list.append(line);
62 }
63 }
64 }
65 return list;
66}
67
68/**
69 * Find out if interface is in an "auto" group or not.
70 * Report any duplicates such as eth0 being in two differnt auto's
71 * @param interface interface to check to see if it is on or not.
72 * @return true is interface is in auto
73 */
74bool Interfaces::isAuto(const QString &interface) const {
75 QStringList autoLines = interfaces.grep(QRegExp(AUTO));
76 QStringList awi = autoLines.grep(QRegExp(interface));
77 if(awi.count() > 1)
78 qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1());
79 if(awi.count() < 1)
80 return false;
81 return true;
82}
83
84/**
85 * Attempt to set the auto option for interface to setAuto.
86 * @param interface the interface to set
87 * @param setAuto the value to set interface to.
88 * @return false if already set to setAuto.
89 * */
90bool Interfaces::setAuto(const QString &interface, bool setAuto){
91 // Don't need to set it if it is already set.
92 if(isAuto(interface) == setAuto)
93 return false;
94
95 bool changed = false;
96 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
97 if((*it).contains(AUTO)){
98 //We know that they are not in any group so let add to this auto.
99 if(setAuto){
100 (*it) = (*it) += " " + interface;
101 // Don't care to have such thins as: auto eth0 lo usb0
102 (*it) = (*it).simplifyWhiteSpace();
103 changed = true;
104 break;
105 }
106 // else see if we need to remove from this one
107 else{
108 if((*it).contains(interface)){
109 (*it) = (*it).replace(QRegExp(interface), "");
110 // if AUTO is the only thing left clear the line
111 if(((*it).simplifyWhiteSpace()).replace(QRegExp(" "),"") == AUTO)
112 (*it) = "";
113 changed = true;
114 // Don't break because we want to make sure we remove all cases.
115 }
116 }
117 }
118 }
119 // In the case where there is no AUTO field add one.
120 if(!changed && setAuto)
121 interfaces.append(QString(AUTO" %1").arg(interface));
122 return true;
123}
124
125/**
126 * Set the current interface to interface. This needs to be done before you
127 * can call getFamily(), getMethod, and get/setOption().
128 * @param interface the name of the interface to set. All whitespace is
129 * removed from the interface name.
130 * @return bool true if it is successfull.
131 */
132bool Interfaces::setInterface(QString interface){
133 interface = interface.simplifyWhiteSpace();
134 interface = interface.replace(QRegExp(" "), "");
135 return setStanza(IFACE, interface, currentIface);
136}
137
138/**
139 * A quick helper funtion to see if the current interface is set.
140 * @return bool true if set, false otherwise.
141 */
142bool Interfaces::isInterfaceSet() const {
143 return (interfaces.end() != currentIface);
144}
145
146/**
147 * Add a new interface of with the settings - family and method
148 * @param interface the name of the interface to set. All whitespace is
149 * removed from the interface name.
150 * @param family the family of this interface inet or inet, ipx or inet6
151 * Must of one of the families defined in interfaces.h
152 * @param method for the family. see interfaces man page for family methods.
153 * @return true if successfull.
154 */
155bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
156 if(0 == acceptedFamily.contains(family))
157 return false;
158 QString newInterface = interface.simplifyWhiteSpace();
159 newInterface = newInterface.replace(QRegExp(" "), "");
160 interfaces.append("");
161 interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method));
162 return true;
163}
164
165/**
166 * Copies interface with name interface to name newInterface
167 * @param newInterface name of the new interface.
168 * @return bool true if successfull
169 */
170bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
171 if(!setInterface(interface))
172 return false;
173
174 // Store the old interface and bump past the stanza line.
175 QStringList::Iterator it = currentIface;
176 it++;
177
178 // Add the new interface
179 bool error;
180 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error));
181 if(!setInterface(newInterface))
182 return false;
183
184 QStringList::Iterator newIface = currentIface;
185 newIface++;
186
187 // Copy all of the lines
188 for ( ; it != interfaces.end(); ++it ){
189 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)))
190 break;
191 newIface = interfaces.insert(newIface, *it);
192 }
193
194 return true;
195}
196
197/**
198 * Remove the currently selected interface and all of its options.
199 * @return bool if successfull or not.
200 */
201bool Interfaces::removeInterface(){
202 return removeStanza(currentIface);
203}
204
205/**
206 * Gets the hardware name of the interface that is currently selected.
207 * @return QString name of the hardware interface (eth0, usb2, wlan1...).
208 * @param error set to true if any error occurs, false otherwise.
209 */
210QString Interfaces::getInterfaceName(bool &error){
211 if(currentIface == interfaces.end()){
212 error = true;
213 return QString();
214 }
215 QString line = (*currentIface);
216 line = line.mid(QString(IFACE).length() +1, line.length());
217 line = line.simplifyWhiteSpace();
218 int findSpace = line.find(" ");
219 if( findSpace < 0){
220 error = true;
221 return QString();
222 }
223 error = false;
224 return line.mid(0, findSpace);
225}
226
227/**
228 * Gets the family name of the interface that is currently selected.
229 * @return QString name of the family (inet, inet6, ipx).
230 * @param error set to true if any error occurs, false otherwise.
231 */
232QString Interfaces::getInterfaceFamily(bool &error){
233 QString name = getInterfaceName(error);
234 if(error)
235 return QString();
236 QString line = (*currentIface);
237 line = line.mid(QString(IFACE).length() +1, line.length());
238 line = line.mid(name.length()+1, line.length());
239 line = line.simplifyWhiteSpace();
240 int findSpace = line.find(" ");
241 if( findSpace < 0){
242 error = true;
243 return QString();
244 }
245 error = false;
246 return line.mid(0, findSpace);
247}
248
249/**
250 * Gets the method of the interface that is currently selected.
251 * @return QString name of the method such as staic or dhcp.
252 * See the man page of interfaces for possible methods depending on the family.
253 * @param error set to true if any error occurs, false otherwise.
254 */
255QString Interfaces::getInterfaceMethod(bool &error){
256 QString name = getInterfaceName(error);
257 if(error)
258 return QString();
259 QString family = getInterfaceFamily(error);
260 if(error)
261 return QString();
262 QString line = (*currentIface);
263 line = line.mid(QString(IFACE).length()+1, line.length());
264 line = line.mid(name.length()+1, line.length());
265 line = line.mid(family.length()+1, line.length());
266 line = line.simplifyWhiteSpace();
267 error = false;
268 return line;
269}
270
271/**
272 * Sets the interface name to newName.
273 * @param newName the new name of the interface. All whitespace is removed.
274 * @return bool true if successfull.
275 */
276bool Interfaces::setInterfaceName(const QString &newName){
277 if(currentIface == interfaces.end())
278 return false;
279 QString name = newName.simplifyWhiteSpace();
280 name = name.replace(QRegExp(" "), "");
281 bool returnValue = false;
282 (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
283 return !returnValue;
284}
285
286/**
287 * Sets the interface family to newName.
288 * @param newName the new name of the interface. Must be one of the families
289 * defined in the interfaces.h file.
290 * @return bool true if successfull.
291 */
292bool Interfaces::setInterfaceFamily(const QString &newName){
293 if(currentIface == interfaces.end())
294 return false;
295 if(acceptedFamily.contains(newName)==0)
296 return false;
297 bool returnValue = false;
298 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(newName).arg(getInterfaceMethod(returnValue));
299 return !returnValue;
300}
301
302/**
303 * Sets the interface method to newName
304 * @param newName the new name of the interface
305 * @return bool true if successfull.
306 */
307bool Interfaces::setInterfaceMethod(const QString &newName){
308 if(currentIface == interfaces.end())
309 return false;
310 bool returnValue = false;
311 (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName);
312 return !returnValue;
313}
314
315/**
316 * Get a value for an option in the currently selected interface. For example
317 * calling getInterfaceOption("address") on the following stanza would
318 * return 192.168.1.1.
319 * iface eth0 static
320 * address 192.168.1.1
321 * @param option the options to get the value.
322 * @param error set to true if any error occurs, false otherwise.
323 * @return QString the options value. QString::null if error == true
324 */
325QString Interfaces::getInterfaceOption(const QString &option, bool &error){
326 return getOption(currentIface, option, error);
327}
328
329/**
330 * Set a value for an option in the currently selected interface. If option
331 * doesn't exist then it is added along with the value.
332 * @param option the options to set the value.
333 * @param value the value that option should be set to.
334 * @param error set to true if any error occurs, false otherwise.
335 * @return QString the options value. QString::null if error == true
336 */
337bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
338 return setOption(currentIface, option, value);
339}
340
341/**
342 * Removes a value for an option in the currently selected interface.
343 * @param option the options to set the value.
344 * @param value the value that option should be set to.
345 * @param error set to true if any error occurs, false otherwise.
346 * @return QString the options value. QString::null if error == true
347 */
348bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){
349 return removeOption(currentIface, option, value);
350}
351
352/**
353 * Removes all of the options from the currently selected interface.
354 * @return bool error if if successfull
355 */
356bool Interfaces::removeAllInterfaceOptions(){
357 return removeAllOptions(currentIface);
358}
359
360/**
361 * Set the current map to interface's map. This needs to be done before you
362 * can call addMapping(), set/getMap(), and get/setScript().
363 * @param interface the name of the interface to set. All whitespace is
364 * removed from the interface name.
365 * @return bool true if it is successfull.
366 */
367bool Interfaces::setMapping(const QString &interface){
368 QString interfaceName = interface.simplifyWhiteSpace();
369 interfaceName = interfaceName.replace(QRegExp(" "), "");
370 return setStanza(MAPPING, interfaceName, currentMapping);
371}
372
373/**
374 * Adds a new Mapping to the interfaces file with interfaces.
375 * @param interface the name(s) of the interfaces to set to this mapping
376 */
377void Interfaces::addMapping(const QString &option){
378 interfaces.append("");
379 interfaces.append(QString(MAPPING " %1").arg(option));
380}
381
382/**
383 * Remove the currently selected map and all of its options.
384 * @return bool if successfull or not.
385 */
386bool Interfaces::removeMapping(){
387 return removeStanza(currentMapping);
388}
389
390/**
391 * Set a map option within a mapping.
392 * @param map map to use
393 * @param value value to go with map
394 * @return bool true if it is successfull.
395 */
396bool Interfaces::setMap(const QString &map, const QString &value){
397 return setOption(currentMapping, map, value);
398}
399
400/**
401 * Removes a map option within a mapping.
402 * @param map map to use
403 * @param value value to go with map
404 * @return bool true if it is successfull.
405 */
406bool Interfaces::removeMap(const QString &map, const QString &value){
407 return removeOption(currentMapping, map, value);
408}
409
410/**
411 * Get a map value within a mapping.
412 * @param map map to get value of
413 * @param bool true if it is successfull.
414 * @return value that goes to the map
415 */
416QString Interfaces::getMap(const QString &map, bool &error){
417 return getOption(currentMapping, map, error);
418}
419
420/**
421 * Sets a script value of the current mapping to argument.
422 * @param argument the script name.
423 * @return true if successfull.
424 */
425bool Interfaces::setScript(const QString &argument){
426 return setOption(currentMapping, "script", argument);
427}
428
429/**
430 * @param error true if could not retrieve the current script argument.
431 * @return QString the argument of the script for the current mapping.
432 */
433QString Interfaces::getScript(bool &error){
434 return getOption(currentMapping, "script", error);
435}
436
437
438
439/**
440 * Helper function used to parse through the QStringList and put pointers in
441 * the correct place.
442 * @param stanza The stanza (auto, iface, mapping) to look for.
443 * @param option string that must be in the stanza's main line.
444 * @param interator interator to place at location of stanza if successfull.
445 * @return bool true if the stanza is found.
446 */
447bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){
448 bool found = false;
449 iterator = interfaces.end();
450 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
451 QString line = (*it).simplifyWhiteSpace();
452 if(line.contains(stanza) && line.contains(option) && line.at(0) != '#'){
453 uint point = line.find(option);
454 bool valid = true;
455 if(point > 0){
456 // There are more chars in the line. check +1
457 if(line.at(point-1) != ' ')
458 valid = false;
459 }
460 point += option.length();
461 if(point < line.length()-1){
462 // There are more chars in the line. check -1
463 if(line.at(point) != ' ')
464 valid = false;
465 }
466 if(valid){
467 if(found == true){
468 qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1());
469 }
470 found = true;
471 iterator = it;
472 }
473 }
474 }
475 return found;
476}
477
478/**
479 * Sets a value of an option in a stanza
480 * @param start the start of the stanza
481 * @param option the option to use when setting value.
482 * @return bool true if successfull, false otherwise.
483 */
484bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
485 if(start == interfaces.end())
486 return false;
487
488 bool found = false;
489 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
490 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
491 if(!found && value != ""){
492 // Got to the end of the stanza without finding it, so append it.
493 interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
494 }
495 found = true;
496 break;
497 }
498 if((*it).contains(option) && it != start && (*it).at(0) != '#'){
499 // Found it in stanza so replace it.
500 if(found)
501 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
502 found = true;
503 (*it) = QString("\t%1 %2").arg(option).arg(value);
504 }
505 }
506 if(!found){
507 QStringList::Iterator p = start;
508 interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
509 found = true;
510 }
511 return found;
512}
513
514/**
515 * Removes a stanza and all of its options
516 * @param stanza the stanza to remove
517 * @return bool true if successfull.
518 */
519bool Interfaces::removeStanza(QStringList::Iterator &stanza){
520 if(stanza == interfaces.end())
521 return false;
522 (*stanza) = "";
523 return removeAllOptions(stanza);
524}
525
526/**
527 * Removes a option in a stanza
528 * @param start the start of the stanza
529 * @param option the option to use when setting value.
530 * @return bool true if successfull, false otherwise.
531 */
532bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){
533 if(start == interfaces.end())
534 return false;
535
536 bool found = false;
537 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
538 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
539 // got to the end without finding it
540 break;
541 }
542 if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){
543 // Found it in stanza so replace it.
544 if(found)
545 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
546 found = true;
547 (*it) = "";
548 }
549 }
550 return found;
551}
552
553/**
554 * Removes all options in a stanza
555 * @param start the start of the stanza
556 * @return bool true if successfull, false otherwise.
557 */
558bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
559 if(start == interfaces.end())
560 return false;
561
562 QStringList::Iterator it = start;
563 it = ++it;
564 for (; it != interfaces.end(); ++it ) {
565 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
566 break;
567 }
568 it = interfaces.remove(it);
569 it = --it;
570 }
571 // Leave a space between this interface and the next.
572 interfaces.insert(it, QString(""));
573 return true;
574}
575
576/**
577 * Gets a value of an option in a stanza
578 * @param start the start of the stanza
579 * @param option the option to use when getting the value.
580 * @param bool true if errors false otherwise.
581 * @return QString the value of option QString::null() if error == true.
582 */
583QString Interfaces::getOption(const QStringList::Iterator &start, const QString &option, bool &error){
584 if(start == interfaces.end()){
585 error = false;
586 return QString();
587 }
588
589 QString value;
590 bool found = false;
591 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
592 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
593 break;
594 }
595 if((*it).contains(option) && (*it).at(0) != '#'){
596 if(found)
597 qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1());
598 found = true;
599 QString line = (*it).simplifyWhiteSpace();
600 int space = line.find(" ", option.length());
601 if(space != -1){
602 value = line.mid(space+1, line.length());
603 break;
604 }
605 }
606 }
607 error = !found;
608 return value;
609}
610
611/**
612 * Write out the interfaces file to the file passed into the constructor.
613 * Removes any excess blank lines over 1 line long.
614 * @return bool true if successfull, false if not.
615 */
616bool Interfaces::write(){
617 QFile::remove(interfacesFile);
618 QFile file(interfacesFile);
619
620 if (!file.open(IO_ReadWrite)){
621 qDebug(QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1());
622 return false;
623 }
624 QTextStream stream( &file );
625 int whiteSpaceCount = 0;
626 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
627 QString line = (*it).simplifyWhiteSpace();
628 line = line.replace(QRegExp(" "),"");
629 if(line.length() == 0)
630 whiteSpaceCount++;
631 else
632 whiteSpaceCount = 0;
633 if(whiteSpaceCount < 2){
634 qDebug((*it).latin1());
635 stream << (*it) << '\n';
636 }
637 }
638 file.close();
639 return true;
640}
641
642// interfaces.cpp
643
diff --git a/noncore/net/networksetup/interfaces/interfaces.h b/noncore/net/networksetup/interfaces/interfaces.h
deleted file mode 100644
index bac2a7e..0000000
--- a/noncore/net/networksetup/interfaces/interfaces.h
+++ b/dev/null
@@ -1,77 +0,0 @@
1#ifndef INTERFACES_H
2#define INTERFACES_H
3
4#include <qstring.h>
5#include <qstringlist.h>
6
7#define INTERFACES_LOOPBACK "loopback"
8
9#define INTERFACES_FAMILY_INET "inet"
10#define INTERFACES_FAMILY_IPX "ipx"
11#define INTERFACES_FAMILY_INET6 "inet6"
12
13#define INTERFACES_METHOD_DHCP "dhcp"
14#define INTERFACES_METHOD_STATIC "static"
15#define INTERFACES_METHOD_PPP "ppp"
16
17/**
18 * This class provides a clean frontend for parsing the network interfaces file.
19 * It provides helper functions to minipulate the options within the file.
20 * See the interfaces man page for the syntax rules.
21 */
22class Interfaces {
23
24public:
25 Interfaces(QString useInterfacesFile = "/etc/network/interfaces");
26 QStringList getInterfaceList();
27
28 bool isAuto(const QString &interface) const ;
29 bool setAuto(const QString &interface, bool setAuto);
30
31 bool removeInterface();
32 bool addInterface(const QString &interface, const QString &family, const QString &method);
33 bool copyInterface(const QString &oldInterface, const QString &newInterface);
34 bool setInterface(QString interface);
35 bool isInterfaceSet() const ;
36 QString getInterfaceName(bool &error);
37 bool setInterfaceName(const QString &newName);
38 QString getInterfaceFamily(bool &error);
39 bool setInterfaceFamily(const QString &newName);
40 QString getInterfaceMethod(bool &error);
41 bool setInterfaceMethod(const QString &newName);
42 QString getInterfaceOption(const QString &option, bool &error);
43 bool setInterfaceOption(const QString &option, const QString &value);
44 bool removeInterfaceOption(const QString &option, const QString &value);
45 bool removeAllInterfaceOptions();
46
47 bool setMapping(const QString &interface);
48 bool removeMapping();
49 void addMapping(const QString &options);
50 bool setMap(const QString &map, const QString &value);
51 bool removeMap(const QString &map, const QString &value);
52 QString getMap(const QString &map, bool &error);
53 bool setScript(const QString &argument);
54 QString getScript(bool &error);
55
56 bool write();
57
58private:
59 bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator);
60 bool removeStanza(QStringList::Iterator &stanza);
61 bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value);
62 bool removeAllOptions(const QStringList::Iterator &start);
63 bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value);
64 QString getOption(const QStringList::Iterator &start, const QString &option, bool &error);
65
66 QString interfacesFile;
67 QStringList interfaces;
68 QStringList::Iterator currentIface;
69 QStringList::Iterator currentMapping;
70
71 QStringList acceptedFamily;
72};
73
74#endif
75
76// interfaces
77
diff --git a/noncore/net/networksetup/interfaces/interfaces.pro b/noncore/net/networksetup/interfaces/interfaces.pro
deleted file mode 100644
index 9a024f6..0000000
--- a/noncore/net/networksetup/interfaces/interfaces.pro
+++ b/dev/null
@@ -1,12 +0,0 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug
4 DESTDIR = $(QTDIR)/lib$(PROJMAK)
5 HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h
6 SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include ../
8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe
10 INTERFACES= interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui
11 TARGET = interfaces
12 VERSION = 1.0.0
diff --git a/noncore/net/networksetup/interfaces/interfacesetup.ui b/noncore/net/networksetup/interfaces/interfacesetup.ui
deleted file mode 100644
index 2b45d49..0000000
--- a/noncore/net/networksetup/interfaces/interfacesetup.ui
+++ b/dev/null
@@ -1,242 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>InterfaceSetup</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>InterfaceSetup</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>286</width>
15 <height>280</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Interface Configuration</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QCheckBox</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>autoStart</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>Automatically bring up</string>
40 </property>
41 </widget>
42 <widget>
43 <class>QCheckBox</class>
44 <property stdset="1">
45 <name>name</name>
46 <cstring>dhcpCheckBox</cstring>
47 </property>
48 <property stdset="1">
49 <name>text</name>
50 <string>DHCP</string>
51 </property>
52 <property stdset="1">
53 <name>checked</name>
54 <bool>true</bool>
55 </property>
56 </widget>
57 <widget>
58 <class>QGroupBox</class>
59 <property stdset="1">
60 <name>name</name>
61 <cstring>staticGroupBox</cstring>
62 </property>
63 <property stdset="1">
64 <name>enabled</name>
65 <bool>false</bool>
66 </property>
67 <property stdset="1">
68 <name>frameShape</name>
69 <enum>Box</enum>
70 </property>
71 <property stdset="1">
72 <name>frameShadow</name>
73 <enum>Sunken</enum>
74 </property>
75 <property stdset="1">
76 <name>title</name>
77 <string>Static Ip Configuration</string>
78 </property>
79 <grid>
80 <property stdset="1">
81 <name>margin</name>
82 <number>11</number>
83 </property>
84 <property stdset="1">
85 <name>spacing</name>
86 <number>6</number>
87 </property>
88 <widget row="1" column="0" >
89 <class>QLabel</class>
90 <property stdset="1">
91 <name>name</name>
92 <cstring>TextLabel5</cstring>
93 </property>
94 <property stdset="1">
95 <name>text</name>
96 <string>Subnet Mask</string>
97 </property>
98 </widget>
99 <widget row="2" column="1" >
100 <class>QLineEdit</class>
101 <property stdset="1">
102 <name>name</name>
103 <cstring>gatewayEdit</cstring>
104 </property>
105 </widget>
106 <widget row="1" column="1" >
107 <class>QLineEdit</class>
108 <property stdset="1">
109 <name>name</name>
110 <cstring>subnetMaskEdit</cstring>
111 </property>
112 </widget>
113 <widget row="0" column="1" >
114 <class>QLineEdit</class>
115 <property stdset="1">
116 <name>name</name>
117 <cstring>ipAddressEdit</cstring>
118 </property>
119 </widget>
120 <widget row="3" column="0" >
121 <class>QLabel</class>
122 <property stdset="1">
123 <name>name</name>
124 <cstring>TextLabel2</cstring>
125 </property>
126 <property stdset="1">
127 <name>text</name>
128 <string>First DNS</string>
129 </property>
130 </widget>
131 <widget row="0" column="0" >
132 <class>QLabel</class>
133 <property stdset="1">
134 <name>name</name>
135 <cstring>TextLabel4</cstring>
136 </property>
137 <property stdset="1">
138 <name>text</name>
139 <string>IP Address</string>
140 </property>
141 </widget>
142 <widget row="2" column="0" >
143 <class>QLabel</class>
144 <property stdset="1">
145 <name>name</name>
146 <cstring>TextLabel1_2</cstring>
147 </property>
148 <property stdset="1">
149 <name>text</name>
150 <string>Gateway</string>
151 </property>
152 </widget>
153 <widget row="4" column="0" >
154 <class>QLabel</class>
155 <property stdset="1">
156 <name>name</name>
157 <cstring>TextLabel3</cstring>
158 </property>
159 <property stdset="1">
160 <name>text</name>
161 <string>Second DNS</string>
162 </property>
163 </widget>
164 <widget row="3" column="1" >
165 <class>QLineEdit</class>
166 <property stdset="1">
167 <name>name</name>
168 <cstring>firstDNSLineEdit</cstring>
169 </property>
170 </widget>
171 <widget row="4" column="1" >
172 <class>QLineEdit</class>
173 <property stdset="1">
174 <name>name</name>
175 <cstring>secondDNSLineEdit</cstring>
176 </property>
177 </widget>
178 </grid>
179 </widget>
180 <spacer>
181 <property>
182 <name>name</name>
183 <cstring>Spacer9</cstring>
184 </property>
185 <property stdset="1">
186 <name>orientation</name>
187 <enum>Vertical</enum>
188 </property>
189 <property stdset="1">
190 <name>sizeType</name>
191 <enum>Expanding</enum>
192 </property>
193 <property>
194 <name>sizeHint</name>
195 <size>
196 <width>20</width>
197 <height>20</height>
198 </size>
199 </property>
200 </spacer>
201 </vbox>
202</widget>
203<customwidgets>
204 <customwidget>
205 <class>QWidget</class>
206 <header location="local">qwidget.h</header>
207 <sizehint>
208 <width>100</width>
209 <height>100</height>
210 </sizehint>
211 <container>0</container>
212 <sizepolicy>
213 <hordata>7</hordata>
214 <verdata>7</verdata>
215 </sizepolicy>
216 <pixmap>image0</pixmap>
217 </customwidget>
218</customwidgets>
219<images>
220 <image>
221 <name>image0</name>
222 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
223 </image>
224</images>
225<connections>
226 <connection>
227 <sender>dhcpCheckBox</sender>
228 <signal>toggled(bool)</signal>
229 <receiver>staticGroupBox</receiver>
230 <slot>setDisabled(bool)</slot>
231 </connection>
232</connections>
233<tabstops>
234 <tabstop>autoStart</tabstop>
235 <tabstop>dhcpCheckBox</tabstop>
236 <tabstop>ipAddressEdit</tabstop>
237 <tabstop>subnetMaskEdit</tabstop>
238 <tabstop>gatewayEdit</tabstop>
239 <tabstop>firstDNSLineEdit</tabstop>
240 <tabstop>secondDNSLineEdit</tabstop>
241</tabstops>
242</UI>
diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp
deleted file mode 100644
index 56bbe93..0000000
--- a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp
+++ b/dev/null
@@ -1,136 +0,0 @@
1#include "interfacesetupimp.h"
2#include "interface.h"
3
4#include <qcheckbox.h>
5#include <qlineedit.h>
6#include <qspinbox.h>
7#include <qgroupbox.h>
8#include <qlabel.h>
9
10#include <qmessagebox.h>
11
12#define DNSSCRIPT "changedns"
13
14/**
15 * Constuctor. Set up the connection. A profile must be set.
16 */
17InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i){
18}
19
20/**
21 * Save the current settings, then write out the interfaces file and close.
22 */
23bool InterfaceSetupImp::saveChanges(){
24 if(!saveSettings())
25 return false;
26 interfaces.write();
27 return true;
28}
29
30/**
31 * Save the settings for the current Interface.
32 * @return bool true if successfull, false otherwise
33 */
34bool InterfaceSetupImp::saveSettings(){
35 // eh can't really do anything about it other then return. :-D
36 if(!interfaces.isInterfaceSet())
37 return true;
38
39 bool error = false;
40 // Loopback case
41 if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){
42 interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked());
43 return true;
44 }
45
46 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
47 QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok);
48 return false;
49 }
50 interfaces.removeAllInterfaceOptions();
51
52 // DHCP
53 if(dhcpCheckBox->isChecked())
54 interfaces.setInterfaceMethod(INTERFACES_METHOD_DHCP);
55 else{
56 interfaces.setInterfaceMethod("static");
57 interfaces.setInterfaceOption("address", ipAddressEdit->text());
58 interfaces.setInterfaceOption("netmask", subnetMaskEdit->text());
59 interfaces.setInterfaceOption("gateway", gatewayEdit->text());
60 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
61 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
62 interfaces.setInterfaceOption("up "DNSSCRIPT" -a ", dns);
63 interfaces.setInterfaceOption("down "DNSSCRIPT" -r ", dns);
64 }
65 }
66
67 // IP Information
68 interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked());
69 return true;
70}
71
72/**
73 * The Profile has changed.
74 * @param QString profile the new profile.
75 */
76void InterfaceSetupImp::setProfile(const QString &profile){
77 /*
78 bool error = false;
79 if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){
80 staticGroupBox->hide();
81 dhcpCheckBox->hide();
82 leaseTime->hide();
83 leaseHoursLabel->hide();
84 }
85 */
86
87 QString newInterfaceName = interface->getInterfaceName();
88 if(profile.length() > 0)
89 newInterfaceName += "_" + profile;
90 // See if we have to make a interface.
91 if(!interfaces.setInterface(newInterfaceName)){
92 // Add making for this new interface if need too
93 if(profile != ""){
94 interfaces.copyInterface(interface->getInterfaceName(), newInterfaceName);
95 if(!interfaces.setMapping(interface->getInterfaceName())){
96 interfaces.addMapping(interface->getInterfaceName());
97 if(!interfaces.setMapping(interface->getInterfaceName())){
98 qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface.");
99 return;
100 }
101 }
102 interfaces.setMap("map", newInterfaceName);
103 interfaces.setScript("getprofile.sh");
104 }
105 else{
106 interfaces.addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
107 if(!interfaces.setInterface(newInterfaceName)){
108 qDebug("InterfaceSetupImp: Added interface, but still can't setInterface.");
109 return;
110 }
111 }
112 }
113
114 // We must have a valid interface to get this far so read some settings.
115
116 // DHCP
117 bool error = false;
118 if(interfaces.getInterfaceMethod(error) == INTERFACES_METHOD_DHCP)
119 dhcpCheckBox->setChecked(true);
120 else
121 dhcpCheckBox->setChecked(false);
122
123 // IP Information
124 autoStart->setChecked(interfaces.isAuto(interface->getInterfaceName()));
125 QString dns = interfaces.getInterfaceOption("up "DNSSCRIPT" -a", error);
126 if(dns.contains(" ")){
127 firstDNSLineEdit->setText(dns.mid(0, dns.find(" ")));
128 secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length()));
129 }
130 ipAddressEdit->setText(interfaces.getInterfaceOption("address", error));
131 subnetMaskEdit->setText(interfaces.getInterfaceOption("netmask", error));
132 gatewayEdit->setText(interfaces.getInterfaceOption("gateway", error));
133}
134
135// interfacesetup.cpp
136
diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.h b/noncore/net/networksetup/interfaces/interfacesetupimp.h
deleted file mode 100644
index 9ec526c..0000000
--- a/noncore/net/networksetup/interfaces/interfacesetupimp.h
+++ b/dev/null
@@ -1,55 +0,0 @@
1#ifndef INTERFACESETUPIMP_H
2#define INTERFACESETUPIMP_H
3
4#include "interfacesetup.h"
5#include "interfaces.h"
6#include <qdialog.h>
7
8class Interface;
9
10class InterfaceSetupImp : public InterfaceSetup {
11 Q_OBJECT
12
13public:
14 InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0);
15 bool saveChanges();
16
17public slots:
18 void setProfile(const QString &profile);
19 bool saveSettings();
20
21private:
22 Interfaces interfaces;
23 Interface *interface;
24};
25
26
27#include <qlayout.h>
28
29class InterfaceSetupImpDialog : public QDialog {
30Q_OBJECT
31
32public:
33 InterfaceSetupImpDialog(QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = false, WFlags fl = 0) : QDialog(parent, name, modal, fl){
34 QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this );
35 setCaption("Interface Setup");
36 interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl);
37 InterfaceSetupLayout->addWidget( interfaceSetup );
38 };
39 void setProfile(QString &profile){ interfaceSetup->setProfile(profile);};
40
41private:
42 InterfaceSetupImp *interfaceSetup;
43
44protected slots:
45 void accept(){
46 if(interfaceSetup->saveChanges())
47 QDialog::accept();
48 };
49
50};
51
52#endif
53
54// interfacesetupimp.h
55
diff --git a/noncore/net/networksetup/main.cpp b/noncore/net/networksetup/main.cpp
deleted file mode 100644
index a9d1a87..0000000
--- a/noncore/net/networksetup/main.cpp
+++ b/dev/null
@@ -1,13 +0,0 @@
1#include "mainwindowimp.h"
2#include <qpe/qpeapplication.h>
3
4int main(int argc, char **argv)
5{
6 QPEApplication app(argc, argv);
7 MainWindowImp window;
8 app.showMainWidget(&window);
9 return app.exec();
10}
11
12// main.cpp
13
diff --git a/noncore/net/networksetup/mainwindow.ui b/noncore/net/networksetup/mainwindow.ui
deleted file mode 100644
index dcabc52..0000000
--- a/noncore/net/networksetup/mainwindow.ui
+++ b/dev/null
@@ -1,449 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>MainWindow</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>MainWindow</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>240</width>
15 <height>289</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Network Settings</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>0</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QTabWidget</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>tabWidget</cstring>
36 </property>
37 <property>
38 <name>layoutMargin</name>
39 </property>
40 <widget>
41 <class>QWidget</class>
42 <property stdset="1">
43 <name>name</name>
44 <cstring>Widget3</cstring>
45 </property>
46 <attribute>
47 <name>title</name>
48 <string>Connections</string>
49 </attribute>
50 <vbox>
51 <property stdset="1">
52 <name>margin</name>
53 <number>0</number>
54 </property>
55 <property stdset="1">
56 <name>spacing</name>
57 <number>6</number>
58 </property>
59 <widget>
60 <class>QListView</class>
61 <column>
62 <property>
63 <name>text</name>
64 <string>s</string>
65 </property>
66 <property>
67 <name>clickable</name>
68 <bool>true</bool>
69 </property>
70 <property>
71 <name>resizeable</name>
72 <bool>true</bool>
73 </property>
74 </column>
75 <column>
76 <property>
77 <name>text</name>
78 <string>t</string>
79 </property>
80 <property>
81 <name>clickable</name>
82 <bool>true</bool>
83 </property>
84 <property>
85 <name>resizeable</name>
86 <bool>true</bool>
87 </property>
88 </column>
89 <column>
90 <property>
91 <name>text</name>
92 <string>Name</string>
93 </property>
94 <property>
95 <name>clickable</name>
96 <bool>true</bool>
97 </property>
98 <property>
99 <name>resizeable</name>
100 <bool>true</bool>
101 </property>
102 </column>
103 <column>
104 <property>
105 <name>text</name>
106 <string>in</string>
107 </property>
108 <property>
109 <name>clickable</name>
110 <bool>true</bool>
111 </property>
112 <property>
113 <name>resizeable</name>
114 <bool>true</bool>
115 </property>
116 </column>
117 <column>
118 <property>
119 <name>text</name>
120 <string>IP</string>
121 </property>
122 <property>
123 <name>clickable</name>
124 <bool>true</bool>
125 </property>
126 <property>
127 <name>resizeable</name>
128 <bool>true</bool>
129 </property>
130 </column>
131 <property stdset="1">
132 <name>name</name>
133 <cstring>connectionList</cstring>
134 </property>
135 <property stdset="1">
136 <name>allColumnsShowFocus</name>
137 <bool>true</bool>
138 </property>
139 </widget>
140 <widget>
141 <class>QLayoutWidget</class>
142 <property stdset="1">
143 <name>name</name>
144 <cstring>Layout2</cstring>
145 </property>
146 <property>
147 <name>layoutMargin</name>
148 </property>
149 <grid>
150 <property stdset="1">
151 <name>margin</name>
152 <number>5</number>
153 </property>
154 <property stdset="1">
155 <name>spacing</name>
156 <number>6</number>
157 </property>
158 <widget row="1" column="0" >
159 <class>QPushButton</class>
160 <property stdset="1">
161 <name>name</name>
162 <cstring>addConnectionButton</cstring>
163 </property>
164 <property stdset="1">
165 <name>text</name>
166 <string>&amp;Add</string>
167 </property>
168 </widget>
169 <widget row="0" column="0" >
170 <class>QPushButton</class>
171 <property stdset="1">
172 <name>name</name>
173 <cstring>informationConnectionButton</cstring>
174 </property>
175 <property stdset="1">
176 <name>text</name>
177 <string>&amp;Information</string>
178 </property>
179 </widget>
180 <widget row="0" column="1" >
181 <class>QPushButton</class>
182 <property stdset="1">
183 <name>name</name>
184 <cstring>configureConnectionButton</cstring>
185 </property>
186 <property stdset="1">
187 <name>text</name>
188 <string>&amp;Configure</string>
189 </property>
190 </widget>
191 <widget row="1" column="1" >
192 <class>QPushButton</class>
193 <property stdset="1">
194 <name>name</name>
195 <cstring>removeConnectionButton</cstring>
196 </property>
197 <property stdset="1">
198 <name>text</name>
199 <string>&amp;Remove</string>
200 </property>
201 </widget>
202 </grid>
203 </widget>
204 </vbox>
205 </widget>
206 <widget>
207 <class>QWidget</class>
208 <property stdset="1">
209 <name>name</name>
210 <cstring>tab</cstring>
211 </property>
212 <attribute>
213 <name>title</name>
214 <string>Profiles</string>
215 </attribute>
216 <grid>
217 <property stdset="1">
218 <name>margin</name>
219 <number>11</number>
220 </property>
221 <property stdset="1">
222 <name>spacing</name>
223 <number>6</number>
224 </property>
225 <spacer row="7" column="2" >
226 <property>
227 <name>name</name>
228 <cstring>Spacer16</cstring>
229 </property>
230 <property stdset="1">
231 <name>orientation</name>
232 <enum>Vertical</enum>
233 </property>
234 <property stdset="1">
235 <name>sizeType</name>
236 <enum>Expanding</enum>
237 </property>
238 <property>
239 <name>sizeHint</name>
240 <size>
241 <width>20</width>
242 <height>20</height>
243 </size>
244 </property>
245 </spacer>
246 <widget row="0" column="1" >
247 <class>QLabel</class>
248 <property stdset="1">
249 <name>name</name>
250 <cstring>currentProfileLabel</cstring>
251 </property>
252 <property stdset="1">
253 <name>frameShape</name>
254 <enum>Panel</enum>
255 </property>
256 <property stdset="1">
257 <name>frameShadow</name>
258 <enum>Sunken</enum>
259 </property>
260 <property stdset="1">
261 <name>text</name>
262 <string>All</string>
263 </property>
264 </widget>
265 <widget row="3" column="2" >
266 <class>QPushButton</class>
267 <property stdset="1">
268 <name>name</name>
269 <cstring>setCurrentProfileButton</cstring>
270 </property>
271 <property stdset="1">
272 <name>text</name>
273 <string>&amp;Set Current</string>
274 </property>
275 </widget>
276 <widget row="5" column="0" rowspan="1" colspan="3" >
277 <class>Line</class>
278 <property stdset="1">
279 <name>name</name>
280 <cstring>Line6</cstring>
281 </property>
282 <property stdset="1">
283 <name>orientation</name>
284 <enum>Horizontal</enum>
285 </property>
286 </widget>
287 <widget row="1" column="0" rowspan="1" colspan="3" >
288 <class>Line</class>
289 <property stdset="1">
290 <name>name</name>
291 <cstring>Line1</cstring>
292 </property>
293 <property stdset="1">
294 <name>orientation</name>
295 <enum>Horizontal</enum>
296 </property>
297 </widget>
298 <widget row="0" column="0" >
299 <class>QLabel</class>
300 <property stdset="1">
301 <name>name</name>
302 <cstring>TextLabel1</cstring>
303 </property>
304 <property stdset="1">
305 <name>text</name>
306 <string>Current Profile</string>
307 </property>
308 </widget>
309 <widget row="4" column="2" >
310 <class>QPushButton</class>
311 <property stdset="1">
312 <name>name</name>
313 <cstring>removeProfileButton</cstring>
314 </property>
315 <property stdset="1">
316 <name>text</name>
317 <string>&amp;Remove</string>
318 </property>
319 </widget>
320 <widget row="3" column="0" rowspan="2" colspan="2" >
321 <class>QListBox</class>
322 <property stdset="1">
323 <name>name</name>
324 <cstring>profilesList</cstring>
325 </property>
326 </widget>
327 <spacer row="0" column="2" >
328 <property>
329 <name>name</name>
330 <cstring>Spacer2</cstring>
331 </property>
332 <property stdset="1">
333 <name>orientation</name>
334 <enum>Horizontal</enum>
335 </property>
336 <property stdset="1">
337 <name>sizeType</name>
338 <enum>Expanding</enum>
339 </property>
340 <property>
341 <name>sizeHint</name>
342 <size>
343 <width>20</width>
344 <height>20</height>
345 </size>
346 </property>
347 </spacer>
348 <widget row="2" column="0" >
349 <class>QLabel</class>
350 <property stdset="1">
351 <name>name</name>
352 <cstring>TextLabel1_2</cstring>
353 </property>
354 <property stdset="1">
355 <name>text</name>
356 <string>Profiles</string>
357 </property>
358 </widget>
359 <widget row="6" column="0" rowspan="1" colspan="3" >
360 <class>QLayoutWidget</class>
361 <property stdset="1">
362 <name>name</name>
363 <cstring>Layout6</cstring>
364 </property>
365 <hbox>
366 <property stdset="1">
367 <name>margin</name>
368 <number>0</number>
369 </property>
370 <property stdset="1">
371 <name>spacing</name>
372 <number>6</number>
373 </property>
374 <widget>
375 <class>QLabel</class>
376 <property stdset="1">
377 <name>name</name>
378 <cstring>TextLabel1_3</cstring>
379 </property>
380 <property stdset="1">
381 <name>text</name>
382 <string>New Profile</string>
383 </property>
384 </widget>
385 <widget>
386 <class>QLineEdit</class>
387 <property stdset="1">
388 <name>name</name>
389 <cstring>newProfile</cstring>
390 </property>
391 </widget>
392 <widget>
393 <class>QPushButton</class>
394 <property stdset="1">
395 <name>name</name>
396 <cstring>newProfileButton</cstring>
397 </property>
398 <property stdset="1">
399 <name>enabled</name>
400 <bool>false</bool>
401 </property>
402 <property stdset="1">
403 <name>text</name>
404 <string>&amp;Add</string>
405 </property>
406 </widget>
407 </hbox>
408 </widget>
409 </grid>
410 </widget>
411 </widget>
412 </vbox>
413</widget>
414<customwidgets>
415 <customwidget>
416 <class>QWidget</class>
417 <header location="local">qwidget.h</header>
418 <sizehint>
419 <width>100</width>
420 <height>100</height>
421 </sizehint>
422 <container>0</container>
423 <sizepolicy>
424 <hordata>7</hordata>
425 <verdata>7</verdata>
426 </sizepolicy>
427 <pixmap>image0</pixmap>
428 </customwidget>
429</customwidgets>
430<images>
431 <image>
432 <name>image0</name>
433 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
434 </image>
435</images>
436<tabstops>
437 <tabstop>tabWidget</tabstop>
438 <tabstop>connectionList</tabstop>
439 <tabstop>informationConnectionButton</tabstop>
440 <tabstop>configureConnectionButton</tabstop>
441 <tabstop>addConnectionButton</tabstop>
442 <tabstop>removeConnectionButton</tabstop>
443 <tabstop>profilesList</tabstop>
444 <tabstop>setCurrentProfileButton</tabstop>
445 <tabstop>removeProfileButton</tabstop>
446 <tabstop>newProfile</tabstop>
447 <tabstop>newProfileButton</tabstop>
448</tabstops>
449</UI>
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp
deleted file mode 100644
index 9a17743..0000000
--- a/noncore/net/networksetup/mainwindowimp.cpp
+++ b/dev/null
@@ -1,521 +0,0 @@
1#include "mainwindowimp.h"
2#include "addconnectionimp.h"
3#include "interfaceinformationimp.h"
4#include "interfacesetupimp.h"
5#include "interfaces.h"
6#include "module.h"
7
8#include <qpushbutton.h>
9#include <qlistbox.h>
10#include <qlineedit.h>
11#include <qlistview.h>
12#include <qheader.h>
13#include <qlabel.h>
14
15#include <qmainwindow.h>
16#include <qmessagebox.h>
17
18#include <qpe/config.h>
19#include <qpe/qlibrary.h>
20#include <qpe/resource.h>
21#include <qpe/qpeapplication.h>
22
23#include <qlist.h>
24#include <qdir.h>
25#include <qfile.h>
26#include <qtextstream.h>
27
28#include <net/if.h>
29#include <sys/ioctl.h>
30
31#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
32
33MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){
34 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
35 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
36 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
37 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
38
39 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
40 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
41 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
42
43 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
44 // Load connections.
45 loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
46 getAllInterfaces();
47
48 Interfaces i;
49 QStringList list = i.getInterfaceList();
50 QMap<QString, Interface*>::Iterator it;
51 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
52 bool found = false;
53 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
54 if(it.key() == (*ni))
55 found = true;
56 }
57 if(!found){
58 if(!(*ni).contains("_")){
59 Interface *i = new Interface(this, *ni, false);
60 i->setAttached(false);
61 i->setHardwareName("Disconnected");
62 interfaceNames.insert(i->getInterfaceName(), i);
63 updateInterface(i);
64 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
65 }
66 }
67 }
68
69 //getInterfaceList();
70 connectionList->header()->hide();
71
72 Config cfg("NetworkSetup");
73 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
74 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
75 profilesList->insertItem((*it));
76 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
77 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
78 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
79
80 QFile file(scheme);
81 if ( file.open(IO_ReadOnly) ) { // file opened successfully
82 QTextStream stream( &file ); // use a text stream
83 while ( !stream.eof() ) { // until end of file...
84 QString line = stream.readLine(); // line of text excluding '\n'
85 if(line.contains("SCHEME")){
86 line = line.mid(7, line.length());
87 currentProfileLabel->setText(line);
88 break;
89 }
90 }
91 file.close();
92 }
93}
94
95/**
96 * Deconstructor. Save profiles. Delete loaded libraries.
97 */
98MainWindowImp::~MainWindowImp(){
99 // Save profiles.
100 Config cfg("NetworkSetup");
101 cfg.setGroup("General");
102 cfg.writeEntry("Profiles", profiles.join(" "));
103
104 // Delete all interfaces that don't have owners.
105 QMap<Interface*, QListViewItem*>::Iterator iIt;
106 for( iIt = items.begin(); iIt != items.end(); ++iIt ){
107 if(iIt.key()->getModuleOwner() == NULL)
108 delete iIt.key();
109 }
110
111 // Delete Modules and Libraries
112 QMap<Module*, QLibrary*>::Iterator it;
113 for( it = libraries.begin(); it != libraries.end(); ++it ){
114 delete it.key();
115 // I wonder why I can't delete the libraries
116 // What fucking shit this is.
117 //delete it.data();
118 }
119}
120
121/**
122 * Query the kernel for all of the interfaces.
123 */
124void MainWindowImp::getAllInterfaces(){
125 int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
126 if(sockfd == -1)
127 return;
128
129 char buf[8*1024];
130 struct ifconf ifc;
131 ifc.ifc_len = sizeof(buf);
132 ifc.ifc_req = (struct ifreq *) buf;
133 int result=ioctl(sockfd, SIOCGIFCONF, &ifc);
134
135 for (char* ptr = buf; ptr < buf + ifc.ifc_len; ){
136 struct ifreq *ifr =(struct ifreq *) ptr;
137 int len = sizeof(struct sockaddr);
138#ifdef HAVE_SOCKADDR_SA_LEN
139 if (ifr->ifr_addr.sa_len > len)
140 len = ifr->ifr_addr.sa_len; /* length > 16 */
141#endif
142 ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */
143
144 int flags;
145 struct sockaddr_in *sinptr;
146 Interface *i = NULL;
147 switch (ifr->ifr_addr.sa_family){
148 case AF_INET:
149 sinptr = (struct sockaddr_in *) &ifr->ifr_addr;
150 flags=0;
151
152 struct ifreq ifcopy;
153 ifcopy=*ifr;
154 result=ioctl(sockfd,SIOCGIFFLAGS,&ifcopy);
155 flags=ifcopy.ifr_flags;
156 i = new Interface(this, ifr->ifr_name, false);
157 i->setAttached(true);
158 if ((flags & IFF_UP) == IFF_UP)
159 i->setStatus(true);
160 else
161 i->setStatus(false);
162
163 if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
164 i->setHardwareName("Ethernet");
165 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
166 i->setHardwareName("Point to Point");
167 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
168 i->setHardwareName("Multicast");
169 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
170 i->setHardwareName("Loopback");
171 else
172 i->setHardwareName("Unknown");
173
174 interfaceNames.insert(i->getInterfaceName(), i);
175 updateInterface(i);
176 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
177 break;
178
179 default:
180 qDebug(ifr->ifr_name);
181 qDebug(QString("%1").arg(ifr->ifr_addr.sa_family).latin1());
182 break;
183 }
184 }
185}
186
187/**
188 * Load all modules that are found in the path
189 * @param path a directory that is scaned for any plugins that can be loaded
190 * and attempts to load them
191 */
192void MainWindowImp::loadModules(const QString &path){
193 //qDebug(path.latin1());
194 QDir d(path);
195 if(!d.exists())
196 return;
197
198 // Don't want sym links
199 d.setFilter( QDir::Files | QDir::NoSymLinks );
200 const QFileInfoList *list = d.entryInfoList();
201 QFileInfoListIterator it( *list );
202 QFileInfo *fi;
203 while ( (fi=it.current()) ) {
204 if(fi->fileName().contains(".so")){
205 loadPlugin(path + "/" + fi->fileName());
206 }
207 ++it;
208 }
209}
210
211/**
212 * Attempt to load a function and resolve a function.
213 * @param pluginFileName - the name of the file in which to attempt to load
214 * @param resolveString - function pointer to resolve
215 * @return pointer to the function with name resolveString or NULL
216 */
217Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){
218 //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
219 QLibrary *lib = new QLibrary(pluginFileName);
220 void *functionPointer = lib->resolve(resolveString);
221 if( !functionPointer ){
222 qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
223 delete lib;
224 return NULL;
225 }
226
227 // Try to get an object.
228 Module *object = ((Module* (*)()) functionPointer)();
229 if(object == NULL){
230 qDebug("MainWindowImp: Couldn't create object, but did load library!");
231 delete lib;
232 return NULL;
233 }
234
235 // Store for deletion later
236 libraries.insert(object, lib);
237 return object;
238}
239
240/**
241 * The Add button was clicked. Bring up the add dialog and if OK is hit
242 * load the plugin and append it to the list
243 */
244void MainWindowImp::addClicked(){
245 QMap<Module*, QLibrary*>::Iterator it;
246 QMap<QString, QString> list;
247 QMap<QString, Module*> newInterfaceOwners;
248 //list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
249 //list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
250 for( it = libraries.begin(); it != libraries.end(); ++it ){
251 if(it.key()){
252 (it.key())->possibleNewInterfaces(list);
253 }
254 }
255 // See if the list has anything that we can add.
256 if(list.count() == 0){
257 QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok);
258 return;
259 }
260 AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
261 addNewConnection.addConnections(list);
262 addNewConnection.showMaximized();
263 if(QDialog::Accepted == addNewConnection.exec()){
264 QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
265 if(!item)
266 return;
267
268 for( it = libraries.begin(); it != libraries.end(); ++it ){
269 if(it.key()){
270 Interface *i = (it.key())->addNewInterface(item->text(0));
271 if(i){
272 interfaceNames.insert(i->getInterfaceName(), i);
273 updateInterface(i);
274 }
275 }
276 }
277 }
278}
279
280/**
281 * Prompt the user to see if they really want to do this.
282 * If they do then remove from the list and unload.
283 */
284void MainWindowImp::removeClicked(){
285 QListViewItem *item = connectionList->currentItem();
286 if(!item) {
287 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
288 return;
289 }
290
291 Interface *i = interfaceItems[item];
292 if(i->getModuleOwner() == NULL){
293 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok);
294 }
295 else{
296 if(!i->getModuleOwner()->remove(i))
297 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok);
298 else{
299 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok);
300 // TODO memory managment....
301 // who deletes the interface?
302 }
303 }
304}
305
306/**
307 * Pull up the configure about the currently selected interface.
308 * Report an error if no interface is selected.
309 * If the interface has a module owner then request its configure.
310 */
311void MainWindowImp::configureClicked(){
312 QListViewItem *item = connectionList->currentItem();
313 if(!item){
314 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
315 return;
316 }
317
318 Interface *i = interfaceItems[item];
319 if(i->getModuleOwner()){
320 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
321 if(moduleConfigure != NULL){
322 moduleConfigure->showMaximized();
323 return;
324 }
325 }
326
327 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose);
328 QString currentProfileText = currentProfileLabel->text();
329 if(currentProfileText.upper() == "ALL");
330 currentProfileText = "";
331 configure->setProfile(currentProfileText);
332 configure->showMaximized();
333}
334
335/**
336 * Pull up the information about the currently selected interface.
337 * Report an error if no interface is selected.
338 * If the interface has a module owner then request its configure.
339 */
340void MainWindowImp::informationClicked(){
341 QListViewItem *item = connectionList->currentItem();
342 if(!item){
343 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
344 return;
345 }
346
347 Interface *i = interfaceItems[item];
348 if(!i->isAttached()){
349 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
350 return;
351 }
352
353 if(i->getModuleOwner()){
354 QWidget *moduleInformation = i->getModuleOwner()->information(i);
355 if(moduleInformation != NULL){
356 moduleInformation->showMaximized();
357 return;
358 }
359 }
360 InterfaceInformationImp information(0, "InterfaceSetupImp", i);
361 information.showMaximized();
362}
363
364/**
365 * Update this interface. If no QListViewItem exists create one.
366 * @param Interface* pointer to the interface that needs to be updated.
367 */
368void MainWindowImp::updateInterface(Interface *i){
369 if(!advancedUserMode){
370 if(i->getInterfaceName() == "lo")
371 return;
372 }
373
374 QListViewItem *item = NULL;
375
376 // Find the interface, making it if needed.
377 if(items.find(i) == items.end()){
378 item = new QListViewItem(connectionList, "", "", "");
379 // See if you can't find a module owner for this interface
380 QMap<Module*, QLibrary*>::Iterator it;
381 for( it = libraries.begin(); it != libraries.end(); ++it ){
382 if(it.key()->isOwner(i))
383 i->setModuleOwner(it.key());
384 }
385 items.insert(i, item);
386 interfaceItems.insert(item, i);
387 }
388 else
389 item = items[i];
390
391 // Update the icons and information
392 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
393
394 QString typeName = "lan";
395 if(i->getHardwareName().contains("Local Loopback"))
396 typeName = "lo";
397 if(i->getInterfaceName().contains("irda"))
398 typeName = "irda";
399 if(i->getInterfaceName().contains("wlan"))
400 typeName = "wlan";
401 if(i->getInterfaceName().contains("usb"))
402 typeName = "usb";
403
404 if(!i->isAttached())
405 typeName = "connect_no";
406 // Actually try to use the Module
407 if(i->getModuleOwner() != NULL)
408 typeName = i->getModuleOwner()->getPixmapName(i);
409
410 item->setPixmap(1, (Resource::loadPixmap(QString("networksetup/") + typeName)));
411 item->setText(2, i->getHardwareName());
412 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
413 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
414}
415
416void MainWindowImp::newProfileChanged(const QString& newText){
417 if(newText.length() > 0)
418 newProfileButton->setEnabled(true);
419 else
420 newProfileButton->setEnabled(false);
421}
422
423/**
424 * Adds a new profile to the list of profiles.
425 * Don't add profiles that already exists.
426 * Appends to the list and QStringList
427 */
428void MainWindowImp::addProfile(){
429 QString newProfileName = newProfile->text();
430 if(profiles.grep(newProfileName).count() > 0){
431 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok);
432 return;
433 }
434 profiles.append(newProfileName);
435 profilesList->insertItem(newProfileName);
436}
437
438/**
439 * Removes the currently selected profile in the combo.
440 * Doesn't delete if there are less then 2 profiles.
441 */
442void MainWindowImp::removeProfile(){
443 if(profilesList->count() <= 1){
444 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok);
445 return;
446 }
447 QString profileToRemove = profilesList->currentText();
448 if(profileToRemove == "All"){
449 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok);
450 return;
451 }
452 // Can't remove the curent profile
453 if(profileToRemove == currentProfileLabel->text()){
454 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok);
455 return;
456
457 }
458
459 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){
460 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
461 profilesList->clear();
462 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
463 profilesList->insertItem((*it));
464
465 // Remove any interface settings and mappings.
466 Interfaces interfaces;
467 // Go through them one by one
468 QMap<Interface*, QListViewItem*>::Iterator it;
469 for( it = items.begin(); it != items.end(); ++it ){
470 QString interfaceName = it.key()->getInterfaceName();
471 qDebug(interfaceName.latin1());
472 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){
473 interfaces.removeInterface();
474 if(interfaces.setMapping(interfaceName)){
475 if(profilesList->count() == 1)
476 interfaces.removeMapping();
477 else{
478 interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
479 }
480 }
481 interfaces.write();
482 break;
483 }
484 }
485 }
486}
487
488/**
489 * A new profile has been selected, change.
490 * @param newProfile the new profile.
491 */
492void MainWindowImp::changeProfile(){
493 if(profilesList->currentItem() == -1){
494 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok);
495 return;
496 }
497 QString newProfile = profilesList->text(profilesList->currentItem());
498 if(newProfile != currentProfileLabel->text()){
499 currentProfileLabel->setText(newProfile);
500 QFile::remove(scheme);
501 QFile file(scheme);
502 if ( file.open(IO_ReadWrite) ) {
503 QTextStream stream( &file );
504 stream << QString("SCHEME=%1").arg(newProfile);
505 file.close();
506 }
507 // restart all up devices?
508 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){
509 // Go through them one by one
510 QMap<Interface*, QListViewItem*>::Iterator it;
511 for( it = items.begin(); it != items.end(); ++it ){
512 if(it.key()->getStatus() == true)
513 it.key()->restart();
514 }
515 }
516 }
517 // TODO change the profile in the modules
518}
519
520// mainwindowimp.cpp
521
diff --git a/noncore/net/networksetup/mainwindowimp.h b/noncore/net/networksetup/mainwindowimp.h
deleted file mode 100644
index 4f09d6c..0000000
--- a/noncore/net/networksetup/mainwindowimp.h
+++ b/dev/null
@@ -1,58 +0,0 @@
1#ifndef MAINWINOWIMP_H
2#define MAINWINOWIMP_H
3
4#include "mainwindow.h"
5#include <qmap.h>
6#include <qstringlist.h>
7
8class Module;
9class Interface;
10class QLibrary;
11class KProcess;
12
13class MainWindowImp : public MainWindow {
14 Q_OBJECT
15
16public:
17 MainWindowImp(QWidget *parent=0, const char *name=0);
18 ~MainWindowImp();
19
20private slots:
21 void getAllInterfaces();
22
23 void addClicked();
24 void removeClicked();
25 void configureClicked();
26 void informationClicked();
27
28 void addProfile();
29 void removeProfile();
30 void changeProfile();
31
32 void updateInterface(Interface *i);
33 void newProfileChanged(const QString& newText);
34
35private:
36 void loadModules(const QString &path);
37
38 Module* loadPlugin(const QString &pluginFileName,
39 const QString &resolveString = "create_plugin");
40
41 // For our local list of names
42 QMap<QString, Interface*> interfaceNames;
43
44 QMap<Module*, QLibrary*> libraries;
45 QMap<Interface*, QListViewItem*> items;
46 QMap<QListViewItem*, Interface*> interfaceItems;
47
48 QMap<KProcess*, QString> threads;
49 QStringList profiles;
50
51 bool advancedUserMode;
52 QString scheme;
53};
54
55#endif
56
57// mainwindowimp.h
58
diff --git a/noncore/net/networksetup/module.h b/noncore/net/networksetup/module.h
deleted file mode 100644
index 2e6272b..0000000
--- a/noncore/net/networksetup/module.h
+++ b/dev/null
@@ -1,86 +0,0 @@
1#ifndef NETCONF_MODULE_H
2#define NETCONF_MODULE_H
3
4#include <qobject.h>
5#include <qlist.h>
6#include <qmap.h>
7#include "interface.h"
8
9class QWidget;
10class QTabWidget;
11
12class Module : QObject{
13
14signals:
15 void updateInterface(Interface *i);
16
17public:
18 Module(){};
19
20 /**
21 * The current profile has been changed and the module should do any
22 * neccesary changes also.
23 * @param newProfile what the profile should be changed to.
24 */
25 virtual void setProfile(const QString &newProfile) = 0;
26
27 /**
28 * get the icon name for this device.
29 * @param Interface* can be used in determining the icon.
30 * @return QString the icon name (minus .png, .gif etc)
31 */
32 virtual QString getPixmapName(Interface *) = 0;
33
34 /**
35 * Check to see if the interface i is owned by this module.
36 * @param Interface* interface to check against
37 * @return bool true if i is owned by this module, false otherwise.
38 */
39 virtual bool isOwner(Interface *){ return false; };
40
41 /**
42 * Create and return the WLANConfigure Module
43 * @param Interface *i the interface to configure.
44 * @return QWidget* pointer to this modules configure.
45 */
46 virtual QWidget *configure(Interface *){ return NULL; } ;
47
48 /**
49 * Create, and return the Information Module
50 * @param Interface *i the interface to get info on.
51 * @return QWidget* pointer to this modules info.
52 */
53 virtual QWidget *information(Interface *){ return NULL; };
54
55 /**
56 * Get all active (up or down) interfaces
57 * @return QList<Interface> A list of interfaces that exsist that havn't
58 * been called by isOwner()
59 */
60 virtual QList<Interface> getInterfaces() = 0;
61
62 /**
63 * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp),
64 * modem ppp)
65 */
66 virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
67
68 /**
69 * Attempts to create a new interface from name
70 * @return Interface* NULL if it was unable to be created.
71 * @param name the type of interface to create
72 */
73 virtual Interface *addNewInterface(const QString &name) = 0;
74
75 /**
76 * Attempts to remove the interface, doesn't delete i
77 * @return bool true if successfull, false otherwise.
78 */
79 virtual bool remove(Interface* i) = 0;
80
81};
82
83#endif
84
85// module.h
86
diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro
deleted file mode 100644
index 3789464..0000000
--- a/noncore/net/networksetup/networksetup.pro
+++ b/dev/null
@@ -1,11 +0,0 @@
1DESTDIR = $(OPIEDIR)/bin
2TEMPLATE = app
3#CONFIG = qt warn_on debug
4CONFIG = qt warn_on release
5HEADERS = mainwindowimp.h addconnectionimp.h defaultmodule.h module.h
6SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp
7INCLUDEPATH += $(OPIEDIR)/include interfaces/
8DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan/
9LIBS += -lqpe -L$(OPIEDIR)/plugins/networksetup -Linterfaces/ -linterfaces
10INTERFACES = mainwindow.ui addconnection.ui
11TARGET = networksetup
diff --git a/noncore/net/networksetup/opie-networksetup.control b/noncore/net/networksetup/opie-networksetup.control
deleted file mode 100644
index 585e50e..0000000
--- a/noncore/net/networksetup/opie-networksetup.control
+++ b/dev/null
@@ -1,8 +0,0 @@
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
3Section: opie/settings
4Maintainer: Ben Meyer <meyerb@sharpsec.com>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION)
8Description: Network settings
diff --git a/noncore/net/networksetup/ppp/ppp.pro b/noncore/net/networksetup/ppp/ppp.pro
deleted file mode 100644
index 075cc5f..0000000
--- a/noncore/net/networksetup/ppp/ppp.pro
+++ b/dev/null
@@ -1,12 +0,0 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug
4DESTDIR = $(OPIEDIR)/plugins/networksetup
5 HEADERS = pppimp.h pppmodule.h
6 SOURCES = pppimp.cpp pppmodule.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe -L../interfaces/ -linterfaces
10 INTERFACES= ppp.ui
11 TARGET = pppplugin
12 VERSION = 1.0.0
diff --git a/noncore/net/networksetup/ppp/ppp.ui b/noncore/net/networksetup/ppp/ppp.ui
deleted file mode 100644
index 56e1621..0000000
--- a/noncore/net/networksetup/ppp/ppp.ui
+++ b/dev/null
@@ -1,770 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>PPP</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>PPP</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>277</width>
15 <height>340</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Dial-up </string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>1</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>0</number>
36 </property>
37 <widget>
38 <class>QTabWidget</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>TabWidget2</cstring>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
48 </property>
49 <widget>
50 <class>QWidget</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>tab</cstring>
54 </property>
55 <attribute>
56 <name>title</name>
57 <string>Account</string>
58 </attribute>
59 <grid>
60 <property stdset="1">
61 <name>margin</name>
62 <number>6</number>
63 </property>
64 <property stdset="1">
65 <name>spacing</name>
66 <number>4</number>
67 </property>
68 <widget row="3" column="1" >
69 <class>QLineEdit</class>
70 <property stdset="1">
71 <name>name</name>
72 <cstring>password</cstring>
73 </property>
74 <property stdset="1">
75 <name>echoMode</name>
76 <enum>Password</enum>
77 </property>
78 </widget>
79 <widget row="2" column="1" >
80 <class>QLineEdit</class>
81 <property stdset="1">
82 <name>name</name>
83 <cstring>username</cstring>
84 </property>
85 </widget>
86 <widget row="2" column="0" >
87 <class>QLabel</class>
88 <property stdset="1">
89 <name>name</name>
90 <cstring>TextLabel1</cstring>
91 </property>
92 <property stdset="1">
93 <name>text</name>
94 <string>Username</string>
95 </property>
96 </widget>
97 <widget row="3" column="0" >
98 <class>QLabel</class>
99 <property stdset="1">
100 <name>name</name>
101 <cstring>TextLabel2</cstring>
102 </property>
103 <property stdset="1">
104 <name>text</name>
105 <string>Password</string>
106 </property>
107 </widget>
108 <widget row="5" column="0" >
109 <class>QLabel</class>
110 <property stdset="1">
111 <name>name</name>
112 <cstring>TextLabel1_2_2</cstring>
113 </property>
114 <property stdset="1">
115 <name>text</name>
116 <string>Phone #</string>
117 </property>
118 </widget>
119 <widget row="5" column="1" >
120 <class>QLineEdit</class>
121 <property stdset="1">
122 <name>name</name>
123 <cstring>phone</cstring>
124 </property>
125 </widget>
126 <widget row="4" column="0" rowspan="1" colspan="2" >
127 <class>Line</class>
128 <property stdset="1">
129 <name>name</name>
130 <cstring>Line3</cstring>
131 </property>
132 <property stdset="1">
133 <name>orientation</name>
134 <enum>Horizontal</enum>
135 </property>
136 </widget>
137 <widget row="0" column="1" >
138 <class>QLineEdit</class>
139 <property stdset="1">
140 <name>name</name>
141 <cstring>acname</cstring>
142 </property>
143 </widget>
144 <widget row="0" column="0" >
145 <class>QLabel</class>
146 <property stdset="1">
147 <name>name</name>
148 <cstring>TextLabel1_2</cstring>
149 </property>
150 <property stdset="1">
151 <name>text</name>
152 <string>Name</string>
153 </property>
154 </widget>
155 <widget row="1" column="0" rowspan="1" colspan="2" >
156 <class>Line</class>
157 <property stdset="1">
158 <name>name</name>
159 <cstring>Line4</cstring>
160 </property>
161 <property stdset="1">
162 <name>orientation</name>
163 <enum>Horizontal</enum>
164 </property>
165 </widget>
166 <spacer row="9" column="1" >
167 <property>
168 <name>name</name>
169 <cstring>Spacer4</cstring>
170 </property>
171 <property stdset="1">
172 <name>orientation</name>
173 <enum>Vertical</enum>
174 </property>
175 <property stdset="1">
176 <name>sizeType</name>
177 <enum>Expanding</enum>
178 </property>
179 <property>
180 <name>sizeHint</name>
181 <size>
182 <width>20</width>
183 <height>20</height>
184 </size>
185 </property>
186 </spacer>
187 </grid>
188 </widget>
189 <widget>
190 <class>QWidget</class>
191 <property stdset="1">
192 <name>name</name>
193 <cstring>tab</cstring>
194 </property>
195 <attribute>
196 <name>title</name>
197 <string>Modem</string>
198 </attribute>
199 <grid>
200 <property stdset="1">
201 <name>margin</name>
202 <number>6</number>
203 </property>
204 <property stdset="1">
205 <name>spacing</name>
206 <number>4</number>
207 </property>
208 <widget row="0" column="0" >
209 <class>QLabel</class>
210 <property stdset="1">
211 <name>name</name>
212 <cstring>TextLabel3_2_2</cstring>
213 </property>
214 <property stdset="1">
215 <name>text</name>
216 <string>AT-dial</string>
217 </property>
218 </widget>
219 <widget row="0" column="1" rowspan="1" colspan="3" >
220 <class>QComboBox</class>
221 <item>
222 <property>
223 <name>text</name>
224 <string>ATDT</string>
225 </property>
226 </item>
227 <item>
228 <property>
229 <name>text</name>
230 <string>ATDP</string>
231 </property>
232 </item>
233 <property stdset="1">
234 <name>name</name>
235 <cstring>atdial</cstring>
236 </property>
237 <property stdset="1">
238 <name>editable</name>
239 <bool>true</bool>
240 </property>
241 </widget>
242 <widget row="1" column="0" >
243 <class>QLabel</class>
244 <property stdset="1">
245 <name>name</name>
246 <cstring>TextLabel1_4</cstring>
247 </property>
248 <property stdset="1">
249 <name>text</name>
250 <string>Speed</string>
251 </property>
252 </widget>
253 <widget row="1" column="1" rowspan="1" colspan="3" >
254 <class>QComboBox</class>
255 <item>
256 <property>
257 <name>text</name>
258 <string>4800</string>
259 </property>
260 </item>
261 <item>
262 <property>
263 <name>text</name>
264 <string>9600</string>
265 </property>
266 </item>
267 <item>
268 <property>
269 <name>text</name>
270 <string>19200</string>
271 </property>
272 </item>
273 <item>
274 <property>
275 <name>text</name>
276 <string>38400</string>
277 </property>
278 </item>
279 <item>
280 <property>
281 <name>text</name>
282 <string>57600</string>
283 </property>
284 </item>
285 <item>
286 <property>
287 <name>text</name>
288 <string>115200</string>
289 </property>
290 </item>
291 <property stdset="1">
292 <name>name</name>
293 <cstring>speed</cstring>
294 </property>
295 <property stdset="1">
296 <name>currentItem</name>
297 <number>5</number>
298 </property>
299 </widget>
300 <widget row="3" column="1" >
301 <class>QSlider</class>
302 <property stdset="1">
303 <name>name</name>
304 <cstring>connectdelay</cstring>
305 </property>
306 <property stdset="1">
307 <name>minValue</name>
308 <number>1</number>
309 </property>
310 <property stdset="1">
311 <name>maxValue</name>
312 <number>180</number>
313 </property>
314 <property stdset="1">
315 <name>value</name>
316 <number>6</number>
317 </property>
318 <property stdset="1">
319 <name>orientation</name>
320 <enum>Horizontal</enum>
321 </property>
322 </widget>
323 <widget row="3" column="0" >
324 <class>QLabel</class>
325 <property stdset="1">
326 <name>name</name>
327 <cstring>TextLabel1_3</cstring>
328 </property>
329 <property stdset="1">
330 <name>text</name>
331 <string>Wait time</string>
332 </property>
333 </widget>
334 <widget row="3" column="2" >
335 <class>QLabel</class>
336 <property stdset="1">
337 <name>name</name>
338 <cstring>connectdelay_text</cstring>
339 </property>
340 <property stdset="1">
341 <name>minimumSize</name>
342 <size>
343 <width>15</width>
344 <height>0</height>
345 </size>
346 </property>
347 <property stdset="1">
348 <name>text</name>
349 <string>6</string>
350 </property>
351 <property stdset="1">
352 <name>alignment</name>
353 <set>AlignVCenter|AlignRight</set>
354 </property>
355 <property>
356 <name>hAlign</name>
357 </property>
358 </widget>
359 <widget row="3" column="3" >
360 <class>QLabel</class>
361 <property stdset="1">
362 <name>name</name>
363 <cstring>TextLabel5</cstring>
364 </property>
365 <property stdset="1">
366 <name>text</name>
367 <string>sec</string>
368 </property>
369 </widget>
370 <widget row="2" column="0" >
371 <class>QLabel</class>
372 <property stdset="1">
373 <name>name</name>
374 <cstring>TextLabel3</cstring>
375 </property>
376 <property stdset="1">
377 <name>text</name>
378 <string>Flow control</string>
379 </property>
380 </widget>
381 <widget row="2" column="1" rowspan="1" colspan="3" >
382 <class>QCheckBox</class>
383 <property stdset="1">
384 <name>name</name>
385 <cstring>crtscts</cstring>
386 </property>
387 <property stdset="1">
388 <name>text</name>
389 <string>Hardware flow control</string>
390 </property>
391 <property stdset="1">
392 <name>checked</name>
393 <bool>true</bool>
394 </property>
395 </widget>
396 <spacer row="4" column="1" >
397 <property>
398 <name>name</name>
399 <cstring>Spacer5</cstring>
400 </property>
401 <property stdset="1">
402 <name>orientation</name>
403 <enum>Vertical</enum>
404 </property>
405 <property stdset="1">
406 <name>sizeType</name>
407 <enum>Expanding</enum>
408 </property>
409 <property>
410 <name>sizeHint</name>
411 <size>
412 <width>20</width>
413 <height>20</height>
414 </size>
415 </property>
416 </spacer>
417 <widget row="5" column="0" rowspan="1" colspan="4" >
418 <class>QButtonGroup</class>
419 <property stdset="1">
420 <name>name</name>
421 <cstring>dialmode</cstring>
422 </property>
423 <property stdset="1">
424 <name>title</name>
425 <string>Demand Dialing</string>
426 </property>
427 <grid>
428 <property stdset="1">
429 <name>margin</name>
430 <number>11</number>
431 </property>
432 <property stdset="1">
433 <name>spacing</name>
434 <number>6</number>
435 </property>
436 <widget row="0" column="0" rowspan="1" colspan="2" >
437 <class>QRadioButton</class>
438 <property stdset="1">
439 <name>name</name>
440 <cstring>dial_manual</cstring>
441 </property>
442 <property stdset="1">
443 <name>text</name>
444 <string>Manual connect and disconnect</string>
445 </property>
446 </widget>
447 <widget row="3" column="1" >
448 <class>QSpinBox</class>
449 <property stdset="1">
450 <name>name</name>
451 <cstring>idletime</cstring>
452 </property>
453 <property stdset="1">
454 <name>suffix</name>
455 <string> seconds</string>
456 </property>
457 <property stdset="1">
458 <name>maxValue</name>
459 <number>3600</number>
460 </property>
461 <property stdset="1">
462 <name>lineStep</name>
463 <number>30</number>
464 </property>
465 <property stdset="1">
466 <name>value</name>
467 <number>120</number>
468 </property>
469 </widget>
470 <widget row="3" column="0" >
471 <class>QLabel</class>
472 <property stdset="1">
473 <name>name</name>
474 <cstring>TextLabel1_5</cstring>
475 </property>
476 <property stdset="1">
477 <name>sizePolicy</name>
478 <sizepolicy>
479 <hsizetype>7</hsizetype>
480 <vsizetype>1</vsizetype>
481 </sizepolicy>
482 </property>
483 <property stdset="1">
484 <name>text</name>
485 <string>Idle timeout:</string>
486 </property>
487 <property stdset="1">
488 <name>alignment</name>
489 <set>AlignVCenter|AlignRight</set>
490 </property>
491 <property>
492 <name>hAlign</name>
493 </property>
494 </widget>
495 <widget row="2" column="0" rowspan="1" colspan="2" >
496 <class>QRadioButton</class>
497 <property stdset="1">
498 <name>name</name>
499 <cstring>dial_demand</cstring>
500 </property>
501 <property stdset="1">
502 <name>text</name>
503 <string>Automatic connect and disconnect</string>
504 </property>
505 <property stdset="1">
506 <name>checked</name>
507 <bool>true</bool>
508 </property>
509 <property stdset="1">
510 <name>buttonGroupId</name>
511 <number>2</number>
512 </property>
513 </widget>
514 <widget row="1" column="0" rowspan="1" colspan="2" >
515 <class>QRadioButton</class>
516 <property stdset="1">
517 <name>name</name>
518 <cstring>dial_idle</cstring>
519 </property>
520 <property stdset="1">
521 <name>text</name>
522 <string>Manual connect, automatic disconnect</string>
523 </property>
524 <property stdset="1">
525 <name>buttonGroupId</name>
526 <number>1</number>
527 </property>
528 </widget>
529 </grid>
530 </widget>
531 </grid>
532 </widget>
533 <widget>
534 <class>QWidget</class>
535 <property stdset="1">
536 <name>name</name>
537 <cstring>tab</cstring>
538 </property>
539 <attribute>
540 <name>title</name>
541 <string>Network</string>
542 </attribute>
543 <grid>
544 <property stdset="1">
545 <name>margin</name>
546 <number>6</number>
547 </property>
548 <property stdset="1">
549 <name>spacing</name>
550 <number>4</number>
551 </property>
552 <spacer row="4" column="1" >
553 <property>
554 <name>name</name>
555 <cstring>Spacer8</cstring>
556 </property>
557 <property stdset="1">
558 <name>orientation</name>
559 <enum>Vertical</enum>
560 </property>
561 <property stdset="1">
562 <name>sizeType</name>
563 <enum>Expanding</enum>
564 </property>
565 <property>
566 <name>sizeHint</name>
567 <size>
568 <width>20</width>
569 <height>20</height>
570 </size>
571 </property>
572 </spacer>
573 <widget row="2" column="0" >
574 <class>QCheckBox</class>
575 <property stdset="1">
576 <name>name</name>
577 <cstring>usepeerdns</cstring>
578 </property>
579 <property stdset="1">
580 <name>text</name>
581 <string>Auto-detect name servers</string>
582 </property>
583 <property stdset="1">
584 <name>checked</name>
585 <bool>true</bool>
586 </property>
587 </widget>
588 <widget row="1" column="0" rowspan="1" colspan="2" >
589 <class>QGroupBox</class>
590 <property stdset="1">
591 <name>name</name>
592 <cstring>gatewaybox</cstring>
593 </property>
594 <property stdset="1">
595 <name>enabled</name>
596 <bool>false</bool>
597 </property>
598 <property stdset="1">
599 <name>title</name>
600 <string></string>
601 </property>
602 <hbox>
603 <property stdset="1">
604 <name>margin</name>
605 <number>11</number>
606 </property>
607 <property stdset="1">
608 <name>spacing</name>
609 <number>6</number>
610 </property>
611 <widget>
612 <class>QLabel</class>
613 <property stdset="1">
614 <name>name</name>
615 <cstring>TextLabel4_2</cstring>
616 </property>
617 <property stdset="1">
618 <name>text</name>
619 <string>Gateway</string>
620 </property>
621 </widget>
622 <widget>
623 <class>QLineEdit</class>
624 <property stdset="1">
625 <name>name</name>
626 <cstring>gateway</cstring>
627 </property>
628 <property stdset="1">
629 <name>text</name>
630 <string></string>
631 </property>
632 </widget>
633 </hbox>
634 </widget>
635 <widget row="0" column="0" rowspan="1" colspan="2" >
636 <class>QCheckBox</class>
637 <property stdset="1">
638 <name>name</name>
639 <cstring>defaultroute</cstring>
640 </property>
641 <property stdset="1">
642 <name>text</name>
643 <string>Auto-detect routing</string>
644 </property>
645 <property stdset="1">
646 <name>checked</name>
647 <bool>true</bool>
648 </property>
649 </widget>
650 <widget row="3" column="0" rowspan="1" colspan="2" >
651 <class>QGroupBox</class>
652 <property stdset="1">
653 <name>name</name>
654 <cstring>dnsbox</cstring>
655 </property>
656 <property stdset="1">
657 <name>enabled</name>
658 <bool>false</bool>
659 </property>
660 <property stdset="1">
661 <name>title</name>
662 <string></string>
663 </property>
664 <grid>
665 <property stdset="1">
666 <name>margin</name>
667 <number>11</number>
668 </property>
669 <property stdset="1">
670 <name>spacing</name>
671 <number>6</number>
672 </property>
673 <widget row="0" column="1" >
674 <class>QLineEdit</class>
675 <property stdset="1">
676 <name>name</name>
677 <cstring>dns1</cstring>
678 </property>
679 <property stdset="1">
680 <name>text</name>
681 <string></string>
682 </property>
683 </widget>
684 <widget row="1" column="1" >
685 <class>QLineEdit</class>
686 <property stdset="1">
687 <name>name</name>
688 <cstring>dns2</cstring>
689 </property>
690 <property stdset="1">
691 <name>text</name>
692 <string></string>
693 </property>
694 </widget>
695 <widget row="0" column="0" >
696 <class>QLabel</class>
697 <property stdset="1">
698 <name>name</name>
699 <cstring>TextLabel1_2_3</cstring>
700 </property>
701 <property stdset="1">
702 <name>text</name>
703 <string>First DNS</string>
704 </property>
705 </widget>
706 <widget row="1" column="0" >
707 <class>QLabel</class>
708 <property stdset="1">
709 <name>name</name>
710 <cstring>TextLabel1_2_2_2</cstring>
711 </property>
712 <property stdset="1">
713 <name>text</name>
714 <string>Second DNS</string>
715 </property>
716 </widget>
717 </grid>
718 </widget>
719 </grid>
720 </widget>
721 </widget>
722 </vbox>
723</widget>
724<connections>
725 <connection>
726 <sender>defaultroute</sender>
727 <signal>toggled(bool)</signal>
728 <receiver>gatewaybox</receiver>
729 <slot>setDisabled(bool)</slot>
730 </connection>
731 <connection>
732 <sender>usepeerdns</sender>
733 <signal>toggled(bool)</signal>
734 <receiver>dnsbox</receiver>
735 <slot>setDisabled(bool)</slot>
736 </connection>
737 <connection>
738 <sender>dial_manual</sender>
739 <signal>toggled(bool)</signal>
740 <receiver>idletime</receiver>
741 <slot>setDisabled(bool)</slot>
742 </connection>
743 <connection>
744 <sender>connectdelay</sender>
745 <signal>valueChanged(int)</signal>
746 <receiver>connectdelay_text</receiver>
747 <slot>setNum(int)</slot>
748 </connection>
749</connections>
750<tabstops>
751 <tabstop>TabWidget2</tabstop>
752 <tabstop>acname</tabstop>
753 <tabstop>username</tabstop>
754 <tabstop>password</tabstop>
755 <tabstop>phone</tabstop>
756 <tabstop>atdial</tabstop>
757 <tabstop>speed</tabstop>
758 <tabstop>crtscts</tabstop>
759 <tabstop>connectdelay</tabstop>
760 <tabstop>dial_demand</tabstop>
761 <tabstop>idletime</tabstop>
762 <tabstop>defaultroute</tabstop>
763 <tabstop>gateway</tabstop>
764 <tabstop>usepeerdns</tabstop>
765 <tabstop>dns1</tabstop>
766 <tabstop>dns2</tabstop>
767 <tabstop>dial_manual</tabstop>
768 <tabstop>dial_idle</tabstop>
769</tabstops>
770</UI>
diff --git a/noncore/net/networksetup/ppp/pppimp.cpp b/noncore/net/networksetup/ppp/pppimp.cpp
deleted file mode 100644
index d3094fc..0000000
--- a/noncore/net/networksetup/ppp/pppimp.cpp
+++ b/dev/null
@@ -1,39 +0,0 @@
1#include "pppimp.h"
2
3PPPConfigureImp::PPPConfigureImp( QWidget* parent, const char* name, bool modal, WFlags fl) : PPP(parent, name, modal, fl) {
4
5}
6
7/**
8 * Open up the peers file and read any set settings
9 * @param peer the peer file to edit.
10 */
11void PPPConfigureImp::setPeer(const QString &newPeer){
12 peer = newPeer;
13}
14
15/**
16 * Save the settings for the current peer.
17 */
18void PPPConfigureImp::accept(){
19 // Check to make sure that all of the inputs are valid.
20
21 // Save settings.
22/**
23/dev/modem or just modem
24<speed> any
25defaultroute - automaticly add route
26noipdefault - get an ip from the server
27usepeerdns - automaticly add dns
28crtscts - flow control enabled
29name <name> - user name (and do secret file)
30*/
31
32 // Make sure it is set in interfaces so pon/off can be used.
33
34 // Close out the dialog
35 QDialog::accept();
36}
37
38// pppconfigureimp.h
39
diff --git a/noncore/net/networksetup/ppp/pppimp.h b/noncore/net/networksetup/ppp/pppimp.h
deleted file mode 100644
index 1bc1fad..0000000
--- a/noncore/net/networksetup/ppp/pppimp.h
+++ b/dev/null
@@ -1,25 +0,0 @@
1#ifndef PPPIMP_H
2#define PPPIMP_H
3
4#include "ppp.h"
5
6class PPPConfigureImp : public PPP {
7
8Q_OBJECT
9
10public:
11 PPPConfigureImp(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
12 void setPeer(const QString &peer);
13
14protected:
15 void accept();
16
17private:
18 QString peer;
19
20};
21
22#endif
23
24// pppconfigureimp.h
25
diff --git a/noncore/net/networksetup/ppp/pppmodule.cpp b/noncore/net/networksetup/ppp/pppmodule.cpp
deleted file mode 100644
index 72cd45e..0000000
--- a/noncore/net/networksetup/ppp/pppmodule.cpp
+++ b/dev/null
@@ -1,107 +0,0 @@
1#include "pppmodule.h"
2#include "pppimp.h"
3#include "interfaceinformationimp.h"
4
5/**
6 * Constructor, find all of the possible interfaces
7 */
8PPPModule::PPPModule() : Module() {
9}
10
11/**
12 * Delete any interfaces that we own.
13 */
14PPPModule::~PPPModule(){
15 Interface *i;
16 for ( i=list.first(); i != 0; i=list.next() )
17 delete i;
18}
19
20/**
21 * Change the current profile
22 */
23void PPPModule::setProfile(const QString &newProfile){
24 profile = newProfile;
25}
26
27/**
28 * get the icon name for this device.
29 * @param Interface* can be used in determining the icon.
30 * @return QString the icon name (minus .png, .gif etc)
31 */
32QString PPPModule::getPixmapName(Interface* ){
33 return "ppp";
34}
35
36/**
37 * Check to see if the interface i is owned by this module.
38 * @param Interface* interface to check against
39 * @return bool true if i is owned by this module, false otherwise.
40 */
41bool PPPModule::isOwner(Interface *i){
42 if(!i->getInterfaceName().upper().contains("PPP"))
43 return false;
44
45 i->setHardwareName("PPP");
46 list.append(i);
47 return true;
48}
49
50/**
51 * Create, and return the WLANConfigure Module
52 * @return QWidget* pointer to this modules configure.
53 */
54QWidget *PPPModule::configure(Interface *i){
55 return NULL;
56 //PPPConfigureImp *pppconfig = new PPPConfigureImp(0, "PPPConfig", i, false, Qt::WDestructiveClose);
57 //pppconfig->setProfile(profile);
58 //return wlanconfig;
59}
60
61/**
62 * Create, and return the Information Module
63 * @return QWidget* pointer to this modules info.
64 */
65QWidget *PPPModule::information(Interface *i){
66 // We don't have any advanced pppd information widget yet :-D
67 // TODO ^
68 InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i);
69 return information;
70}
71
72/**
73 * Get all active (up or down) interfaces
74 * @return QList<Interface> A list of interfaces that exsist that havn't
75 * been called by isOwner()
76 */
77QList<Interface> PPPModule::getInterfaces(){
78 // List all of the files in the peer directory
79 return list;
80}
81
82/**
83 * Attempt to add a new interface as defined by name
84 * @param name the name of the type of interface that should be created given
85 * by possibleNewInterfaces();
86 * @return Interface* NULL if it was unable to be created.
87 */
88Interface *PPPModule::addNewInterface(const QString &newInterface){
89 // If the
90 PPPConfigureImp imp(0, "PPPConfigImp");
91 if(imp.exec() == QDialog::Accepted ){
92
93 }
94 return NULL;
95}
96
97/**
98 * Attempts to remove the interface, doesn't delete i
99 * @return bool true if successfull, false otherwise.
100 */
101bool PPPModule::remove(Interface*){
102 // Can't remove a hardware device, you can stop it though.
103 return false;
104}
105
106// pppmodule.cpp
107
diff --git a/noncore/net/networksetup/ppp/pppmodule.h b/noncore/net/networksetup/ppp/pppmodule.h
deleted file mode 100644
index c8e77e2..0000000
--- a/noncore/net/networksetup/ppp/pppmodule.h
+++ b/dev/null
@@ -1,41 +0,0 @@
1#ifndef PPP_MODULE_H
2#define PPP_MODULE_H
3
4#include "module.h"
5
6class PPPModule : Module {
7
8signals:
9 void updateInterface(Interface *i);
10
11public:
12 PPPModule();
13 ~PPPModule();
14
15 virtual void setProfile(const QString &newProfile);
16 virtual bool isOwner(Interface *);
17 virtual QWidget *configure(Interface *i);
18 virtual QWidget *information(Interface *i);
19 virtual QList<Interface> getInterfaces();
20 virtual void possibleNewInterfaces(QMap<QString, QString> &){};
21 virtual Interface *addNewInterface(const QString &name);
22 virtual bool remove(Interface* i);
23 virtual QString getPixmapName(Interface* i);
24
25private:
26 QList<Interface> list;
27 QString profile;
28
29};
30
31extern "C"
32{
33 void* create_plugin() {
34 return new PPPModule();
35 }
36};
37
38#endif
39
40// pppmodule.h
41
diff --git a/noncore/net/networksetup/wlan/config.in b/noncore/net/networksetup/wlan/config.in
deleted file mode 100644
index 36ced3a..0000000
--- a/noncore/net/networksetup/wlan/config.in
+++ b/dev/null
@@ -1,4 +0,0 @@
1 config WLAN
2 boolean "Wireless LAN Module"
3 default "y" if NETWORKSETUP
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES
diff --git a/noncore/net/networksetup/wlan/info.ui b/noncore/net/networksetup/wlan/info.ui
deleted file mode 100644
index 7a5bf0b..0000000
--- a/noncore/net/networksetup/wlan/info.ui
+++ b/dev/null
@@ -1,321 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>WlanInfo</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>WlanInfo</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>238</width>
15 <height>316</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Interface Information</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>0</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>0</number>
30 </property>
31 <widget>
32 <class>QTabWidget</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>tabWidget</cstring>
36 </property>
37 <widget>
38 <class>QWidget</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>Widget2</cstring>
42 </property>
43 <attribute>
44 <name>title</name>
45 <string>802.11b</string>
46 </attribute>
47 <grid>
48 <property stdset="1">
49 <name>margin</name>
50 <number>11</number>
51 </property>
52 <property stdset="1">
53 <name>spacing</name>
54 <number>6</number>
55 </property>
56 <widget row="3" column="0" >
57 <class>QLabel</class>
58 <property stdset="1">
59 <name>name</name>
60 <cstring>TextLabel4</cstring>
61 </property>
62 <property stdset="1">
63 <name>text</name>
64 <string>Channel</string>
65 </property>
66 </widget>
67 <widget row="2" column="0" >
68 <class>QLabel</class>
69 <property stdset="1">
70 <name>name</name>
71 <cstring>TextLabel3</cstring>
72 </property>
73 <property stdset="1">
74 <name>text</name>
75 <string>Mode</string>
76 </property>
77 </widget>
78 <widget row="1" column="0" >
79 <class>QLabel</class>
80 <property stdset="1">
81 <name>name</name>
82 <cstring>TextLabel2</cstring>
83 </property>
84 <property stdset="1">
85 <name>text</name>
86 <string>ESSID</string>
87 </property>
88 </widget>
89 <widget row="0" column="0" >
90 <class>QLabel</class>
91 <property stdset="1">
92 <name>name</name>
93 <cstring>TextLabel1</cstring>
94 </property>
95 <property stdset="1">
96 <name>text</name>
97 <string>Station</string>
98 </property>
99 </widget>
100 <widget row="4" column="0" >
101 <class>QLabel</class>
102 <property stdset="1">
103 <name>name</name>
104 <cstring>TextLabel9</cstring>
105 </property>
106 <property stdset="1">
107 <name>text</name>
108 <string>AP</string>
109 </property>
110 </widget>
111 <widget row="4" column="1" >
112 <class>QLabel</class>
113 <property stdset="1">
114 <name>name</name>
115 <cstring>apLabel</cstring>
116 </property>
117 <property stdset="1">
118 <name>frameShape</name>
119 <enum>Panel</enum>
120 </property>
121 <property stdset="1">
122 <name>frameShadow</name>
123 <enum>Sunken</enum>
124 </property>
125 </widget>
126 <widget row="2" column="1" >
127 <class>QLabel</class>
128 <property stdset="1">
129 <name>name</name>
130 <cstring>modeLabel</cstring>
131 </property>
132 <property stdset="1">
133 <name>frameShape</name>
134 <enum>Panel</enum>
135 </property>
136 <property stdset="1">
137 <name>frameShadow</name>
138 <enum>Sunken</enum>
139 </property>
140 </widget>
141 <widget row="1" column="1" >
142 <class>QLabel</class>
143 <property stdset="1">
144 <name>name</name>
145 <cstring>essidLabel</cstring>
146 </property>
147 <property stdset="1">
148 <name>frameShape</name>
149 <enum>Panel</enum>
150 </property>
151 <property stdset="1">
152 <name>frameShadow</name>
153 <enum>Sunken</enum>
154 </property>
155 </widget>
156 <widget row="0" column="1" >
157 <class>QLabel</class>
158 <property stdset="1">
159 <name>name</name>
160 <cstring>stationLabel</cstring>
161 </property>
162 <property stdset="1">
163 <name>frameShape</name>
164 <enum>Panel</enum>
165 </property>
166 <property stdset="1">
167 <name>frameShadow</name>
168 <enum>Sunken</enum>
169 </property>
170 </widget>
171 <widget row="3" column="1" >
172 <class>QLabel</class>
173 <property stdset="1">
174 <name>name</name>
175 <cstring>channelLabel</cstring>
176 </property>
177 <property stdset="1">
178 <name>frameShape</name>
179 <enum>Panel</enum>
180 </property>
181 <property stdset="1">
182 <name>frameShadow</name>
183 <enum>Sunken</enum>
184 </property>
185 </widget>
186 <spacer row="9" column="1" >
187 <property>
188 <name>name</name>
189 <cstring>Spacer7</cstring>
190 </property>
191 <property stdset="1">
192 <name>orientation</name>
193 <enum>Vertical</enum>
194 </property>
195 <property stdset="1">
196 <name>sizeType</name>
197 <enum>Expanding</enum>
198 </property>
199 <property>
200 <name>sizeHint</name>
201 <size>
202 <width>20</width>
203 <height>20</height>
204 </size>
205 </property>
206 </spacer>
207 <widget row="5" column="1" >
208 <class>QProgressBar</class>
209 <property stdset="1">
210 <name>name</name>
211 <cstring>signalProgressBar</cstring>
212 </property>
213 </widget>
214 <widget row="6" column="1" >
215 <class>QProgressBar</class>
216 <property stdset="1">
217 <name>name</name>
218 <cstring>noiseProgressBar</cstring>
219 </property>
220 </widget>
221 <widget row="7" column="1" >
222 <class>QProgressBar</class>
223 <property stdset="1">
224 <name>name</name>
225 <cstring>qualityProgressBar</cstring>
226 </property>
227 </widget>
228 <widget row="8" column="1" >
229 <class>QLabel</class>
230 <property stdset="1">
231 <name>name</name>
232 <cstring>rateLabel</cstring>
233 </property>
234 <property stdset="1">
235 <name>sizePolicy</name>
236 <sizepolicy>
237 <hsizetype>7</hsizetype>
238 <vsizetype>1</vsizetype>
239 </sizepolicy>
240 </property>
241 <property stdset="1">
242 <name>frameShape</name>
243 <enum>Panel</enum>
244 </property>
245 <property stdset="1">
246 <name>frameShadow</name>
247 <enum>Sunken</enum>
248 </property>
249 </widget>
250 <widget row="8" column="0" >
251 <class>QLabel</class>
252 <property stdset="1">
253 <name>name</name>
254 <cstring>TextLabel4_2</cstring>
255 </property>
256 <property stdset="1">
257 <name>text</name>
258 <string>Rate</string>
259 </property>
260 </widget>
261 <widget row="7" column="0" >
262 <class>QLabel</class>
263 <property stdset="1">
264 <name>name</name>
265 <cstring>TextLabel3_2</cstring>
266 </property>
267 <property stdset="1">
268 <name>text</name>
269 <string>Quality</string>
270 </property>
271 </widget>
272 <widget row="6" column="0" >
273 <class>QLabel</class>
274 <property stdset="1">
275 <name>name</name>
276 <cstring>TextLabel2_2</cstring>
277 </property>
278 <property stdset="1">
279 <name>text</name>
280 <string>Noise</string>
281 </property>
282 </widget>
283 <widget row="5" column="0" >
284 <class>QLabel</class>
285 <property stdset="1">
286 <name>name</name>
287 <cstring>TextLabel1_2</cstring>
288 </property>
289 <property stdset="1">
290 <name>text</name>
291 <string>Signal</string>
292 </property>
293 </widget>
294 </grid>
295 </widget>
296 </widget>
297 </vbox>
298</widget>
299<customwidgets>
300 <customwidget>
301 <class>QWidget</class>
302 <header location="local">qwidget.h</header>
303 <sizehint>
304 <width>100</width>
305 <height>100</height>
306 </sizehint>
307 <container>0</container>
308 <sizepolicy>
309 <hordata>7</hordata>
310 <verdata>7</verdata>
311 </sizepolicy>
312 <pixmap>image0</pixmap>
313 </customwidget>
314</customwidgets>
315<images>
316 <image>
317 <name>image0</name>
318 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
319 </image>
320</images>
321</UI>
diff --git a/noncore/net/networksetup/wlan/infoimp.cpp b/noncore/net/networksetup/wlan/infoimp.cpp
deleted file mode 100644
index bd56678..0000000
--- a/noncore/net/networksetup/wlan/infoimp.cpp
+++ b/dev/null
@@ -1,56 +0,0 @@
1#include "infoimp.h"
2#include "wextensions.h"
3
4#include <qtimer.h>
5#include <qprogressbar.h>
6#include <qlabel.h>
7
8/**
9 * Constructor. If wireless extensions are enabled on device name then
10 * start a timer that every second will update the information.
11 */
12WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){
13 WExtensions *wExtensions = new WExtensions(name);
14 if(!wExtensions->doesHaveWirelessExtensions()){
15 delete wExtensions;
16 qDebug("WlanInfoImp::No wireless extension");
17 return;
18 }
19 delete wExtensions;
20 timer = new QTimer( this );
21 connect( timer, SIGNAL(timeout()), this, SLOT(update()));
22 timer->start( 1000, false );
23}
24
25/**
26 * Updates the information about the wireless device.
27 */
28void WlanInfoImp::update(){
29 WExtensions *wExtensions = new WExtensions(this->name());
30 if(!wExtensions->doesHaveWirelessExtensions()){
31 qDebug("No extension");
32 delete wExtensions;
33 timer->stop();
34 return;
35 }
36 essidLabel->setText(wExtensions->essid());
37 apLabel->setText(wExtensions->ap());
38 stationLabel->setText(wExtensions->station());
39 modeLabel->setText(wExtensions->mode());
40 channelLabel->setText(QString("%1").arg(wExtensions->channel()));
41 int signal = 0;
42 int noise = 0;
43 int quality = 0;
44 wExtensions->stats(signal, noise, quality);
45 if(signalProgressBar->progress() != signal)
46 signalProgressBar->setProgress(signal);
47 if(noiseProgressBar->progress() != noise)
48 noiseProgressBar->setProgress(noise);
49 if(qualityProgressBar->progress() != quality)
50 qualityProgressBar->setProgress(quality);
51 rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate()));
52 delete wExtensions;
53}
54
55// infoimp.cpp
56
diff --git a/noncore/net/networksetup/wlan/infoimp.h b/noncore/net/networksetup/wlan/infoimp.h
deleted file mode 100644
index 8f7f0d6..0000000
--- a/noncore/net/networksetup/wlan/infoimp.h
+++ b/dev/null
@@ -1,27 +0,0 @@
1#ifndef INFOIMP_H
2#define INFOIMP_H
3
4#include "info.h"
5
6class QTimer;
7//class WExtensions;
8
9class WlanInfoImp : public WlanInfo {
10 Q_OBJECT
11
12public:
13 WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
14
15private slots:
16 void update();
17
18private:
19 //WExtensions *wExtensions;
20 QTimer *timer;
21
22};
23
24#endif
25
26// infoimp.h
27
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp
deleted file mode 100644
index 827d075..0000000
--- a/noncore/net/networksetup/wlan/wextensions.cpp
+++ b/dev/null
@@ -1,200 +0,0 @@
1#include "wextensions.h"
2
3#include <qfile.h>
4#include <qtextstream.h>
5
6#include <arpa/inet.h>
7#include <sys/socket.h>
8#include <sys/ioctl.h>
9
10#include <math.h>
11
12#define PROCNETWIRELESS "/proc/net/wireless"
13#define IW_LOWER 0
14#define IW_UPPER 256
15
16/**
17 * Constructor. Sets hasWirelessExtensions
18 */
19WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) {
20 fd = socket( AF_INET, SOCK_DGRAM, 0 );
21 if(fd == -1)
22 return;
23
24 const char* buffer[200];
25 memset( &iwr, 0, sizeof( iwr ) );
26 iwr.u.essid.pointer = (caddr_t) buffer;
27 iwr.u.essid.length = IW_ESSID_MAX_SIZE;
28 iwr.u.essid.flags = 0;
29
30 // check if it is an IEEE 802.11 standard conform
31 // wireless device by sending SIOCGIWESSID
32 // which also gives back the Extended Service Set ID
33 // (see IEEE 802.11 for more information)
34
35 const char* iname = interface.latin1();
36 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname );
37 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) )
38 hasWirelessExtensions = true;
39}
40
41/**
42 * @return QString the station name of the access point.
43 */
44QString WExtensions::station(){
45 if(!hasWirelessExtensions)
46 return QString();
47 const char* buffer[200];
48 iwr.u.data.pointer = (caddr_t) buffer;
49 iwr.u.data.length = IW_ESSID_MAX_SIZE;
50 iwr.u.data.flags = 0;
51 if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){
52 iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0';
53 return QString(iwr.u.data.pointer);
54 }
55 return QString();
56}
57
58/**
59 * @return QString the essid of the host 802.11 access point.
60 */
61QString WExtensions::essid(){
62 if(!hasWirelessExtensions)
63 return QString();
64 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){
65 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0';
66 return QString(iwr.u.essid.pointer);
67 }
68 return QString();
69}
70
71/**
72 * @return QString the mode of interface
73 */
74QString WExtensions::mode(){
75 if(!hasWirelessExtensions)
76 return QString();
77 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) )
78 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed");
79 return QString();
80}
81
82/**
83 * Get the frequency that the interface is running at.
84 * @return int the frequency that the interfacae is running at.
85 */
86double WExtensions::frequency(){
87 if(!hasWirelessExtensions)
88 return 0;
89 if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr ))
90 return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
91 return 0;
92}
93
94/**
95 * Get the channel that the interface is running at.
96 * @return int the channel that the interfacae is running at.
97 */
98int WExtensions::channel(){
99 if(!hasWirelessExtensions)
100 return 0;
101 if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr ))
102 return 0;
103
104 // http://www.elanix.com/pdf/an137e.pdf
105
106 double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
107 double left = 2.401;
108 double right = 2.416;
109 for(int channel = 1; channel<= 15; channel++){
110 if( num >= left && num <= right )
111 return channel;
112 left += 0.005;
113 right += 0.005;
114 }
115 qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1());
116 return -1;
117}
118
119/***
120 * Get the current rate that the card is transmiting at.
121 * @return double the rate, 0 if error.
122 */
123double WExtensions::rate(){
124 if(!hasWirelessExtensions)
125 return 0;
126 if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){
127 return ((double)iwr.u.bitrate.value)/1000000;
128 }
129 return 0;
130}
131
132
133/**
134 * @return QString the AccessPoint that the interface is connected to.
135 */
136QString WExtensions::ap(){
137 if(!hasWirelessExtensions)
138 return QString();
139 if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){
140 QString ap;
141 ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
142 iwr.u.ap_addr.sa_data[0]&0xff,
143 iwr.u.ap_addr.sa_data[1]&0xff,
144 iwr.u.ap_addr.sa_data[2]&0xff,
145 iwr.u.ap_addr.sa_data[3]&0xff,
146 iwr.u.ap_addr.sa_data[4]&0xff,
147 iwr.u.ap_addr.sa_data[5]&0xff );
148 return ap;
149 }
150 else return QString();
151}
152
153/**
154 * Get the stats for interfaces
155 * @param signal the signal strength of interface
156 * @param noise the noise level of the interface
157 * @param quality the quality level of the interface
158 * @return bool true if successfull
159 */
160bool WExtensions::stats(int &signal, int &noise, int &quality){
161 // gather link quality from /proc/net/wireless
162 if(!QFile::exists(PROCNETWIRELESS))
163 return false;
164
165 char c;
166 QString status;
167 QString name;
168
169 QFile wfile( PROCNETWIRELESS );
170 if(!wfile.open( IO_ReadOnly ))
171 return false;
172
173 QTextStream wstream( &wfile );
174 wstream.readLine(); // skip the first two lines
175 wstream.readLine(); // because they only contain headers
176 while(!wstream.atEnd()){
177 wstream >> name >> status >> quality >> c >> signal >> c >> noise;
178 if(name == QString("%1:").arg(interface)){
179 if ( quality > 92 )
180 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
181 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
182 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
183 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
184 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
185 //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1());
186 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER;
187 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
188 quality = ( quality*100 ) / 92;
189 return true;
190 }
191 }
192
193 qDebug("WExtensions::statsCard no longer present.");
194 quality = -1;
195 signal = IW_LOWER;
196 noise = IW_LOWER;
197 return false;
198}
199
200// wextensions.cpp
diff --git a/noncore/net/networksetup/wlan/wextensions.h b/noncore/net/networksetup/wlan/wextensions.h
deleted file mode 100644
index a89e33a..0000000
--- a/noncore/net/networksetup/wlan/wextensions.h
+++ b/dev/null
@@ -1,34 +0,0 @@
1#ifndef WEXTENSIONS_H
2#define WEXTENSIONS_H
3
4#include <qstring.h>
5
6#include <netinet/ip.h>
7#include <linux/wireless.h>
8
9class WExtensions {
10
11public:
12 WExtensions(QString interfaceName);
13 QString getInterfaceName(){return interface;};
14 bool doesHaveWirelessExtensions(){return hasWirelessExtensions;};
15 QString station();
16 QString essid();
17 QString mode();
18 double frequency();
19 int channel();
20 double rate();
21 QString ap();
22 bool stats( int &signal, int &noise, int &quality);
23
24private:
25 bool hasWirelessExtensions;
26 QString interface;
27
28 // Used in we calls
29 struct iwreq iwr;
30 int fd;
31
32};
33
34#endif
diff --git a/noncore/net/networksetup/wlan/wlan.pro b/noncore/net/networksetup/wlan/wlan.pro
deleted file mode 100644
index 23fc39a..0000000
--- a/noncore/net/networksetup/wlan/wlan.pro
+++ b/dev/null
@@ -1,12 +0,0 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug
4DESTDIR = $(OPIEDIR)/plugins/networksetup
5 HEADERS = wlanimp.h infoimp.h wlanmodule.h wextensions.h
6 SOURCES = wlanimp.cpp infoimp.cpp wlanmodule.cpp wextensions.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe -L../interfaces/ -linterfaces
10 INTERFACES= wlan.ui info.ui
11 TARGET = wlanplugin
12 VERSION = 1.0.0
diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui
deleted file mode 100644
index 744c559..0000000
--- a/noncore/net/networksetup/wlan/wlan.ui
+++ b/dev/null
@@ -1,491 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>WLAN</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>WLAN</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>239</width>
15 <height>277</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Wireless LAN Setting</string>
21 </property>
22 <property stdset="1">
23 <name>sizeGripEnabled</name>
24 <bool>true</bool>
25 </property>
26 <property>
27 <name>layoutMargin</name>
28 </property>
29 <vbox>
30 <property stdset="1">
31 <name>margin</name>
32 <number>0</number>
33 </property>
34 <property stdset="1">
35 <name>spacing</name>
36 <number>6</number>
37 </property>
38 <widget>
39 <class>QTabWidget</class>
40 <property stdset="1">
41 <name>name</name>
42 <cstring>tabWidget</cstring>
43 </property>
44 <property stdset="1">
45 <name>enabled</name>
46 <bool>true</bool>
47 </property>
48 <widget>
49 <class>QWidget</class>
50 <property stdset="1">
51 <name>name</name>
52 <cstring>ConfigPage</cstring>
53 </property>
54 <attribute>
55 <name>title</name>
56 <string>General</string>
57 </attribute>
58 <vbox>
59 <property stdset="1">
60 <name>margin</name>
61 <number>11</number>
62 </property>
63 <property stdset="1">
64 <name>spacing</name>
65 <number>6</number>
66 </property>
67 <widget>
68 <class>QCheckBox</class>
69 <property stdset="1">
70 <name>name</name>
71 <cstring>essAny</cstring>
72 </property>
73 <property stdset="1">
74 <name>text</name>
75 <string>&amp;Specify Access Point</string>
76 </property>
77 </widget>
78 <widget>
79 <class>QGroupBox</class>
80 <property stdset="1">
81 <name>name</name>
82 <cstring>GroupBox1</cstring>
83 </property>
84 <property stdset="1">
85 <name>enabled</name>
86 <bool>false</bool>
87 </property>
88 <property stdset="1">
89 <name>title</name>
90 <string>Specific &amp;Access Point Settings</string>
91 </property>
92 <grid>
93 <property stdset="1">
94 <name>margin</name>
95 <number>11</number>
96 </property>
97 <property stdset="1">
98 <name>spacing</name>
99 <number>6</number>
100 </property>
101 <widget row="0" column="0" >
102 <class>QLabel</class>
103 <property stdset="1">
104 <name>name</name>
105 <cstring>TextLabel1</cstring>
106 </property>
107 <property stdset="1">
108 <name>text</name>
109 <string>ESS-ID</string>
110 </property>
111 </widget>
112 <widget row="1" column="0" >
113 <class>QLabel</class>
114 <property stdset="1">
115 <name>name</name>
116 <cstring>TextLabel2</cstring>
117 </property>
118 <property stdset="1">
119 <name>text</name>
120 <string>Network Type</string>
121 </property>
122 </widget>
123 <widget row="0" column="1" rowspan="1" colspan="2" >
124 <class>QLineEdit</class>
125 <property stdset="1">
126 <name>name</name>
127 <cstring>essSpecificLineEdit</cstring>
128 </property>
129 </widget>
130 <widget row="1" column="1" rowspan="1" colspan="2" >
131 <class>QComboBox</class>
132 <item>
133 <property>
134 <name>text</name>
135 <string>Infrastructure</string>
136 </property>
137 </item>
138 <item>
139 <property>
140 <name>text</name>
141 <string>Ad-Hoc</string>
142 </property>
143 </item>
144 <property stdset="1">
145 <name>name</name>
146 <cstring>networkType</cstring>
147 </property>
148 </widget>
149 <widget row="2" column="0" >
150 <class>QLabel</class>
151 <property stdset="1">
152 <name>name</name>
153 <cstring>channelLabel</cstring>
154 </property>
155 <property stdset="1">
156 <name>text</name>
157 <string>Channel</string>
158 </property>
159 </widget>
160 <widget row="2" column="1" >
161 <class>QSpinBox</class>
162 <property stdset="1">
163 <name>name</name>
164 <cstring>networkChannel</cstring>
165 </property>
166 <property stdset="1">
167 <name>enabled</name>
168 <bool>false</bool>
169 </property>
170 <property stdset="1">
171 <name>maxValue</name>
172 <number>15</number>
173 </property>
174 <property stdset="1">
175 <name>minValue</name>
176 <number>1</number>
177 </property>
178 <property stdset="1">
179 <name>value</name>
180 <number>6</number>
181 </property>
182 </widget>
183 <spacer row="2" column="2" >
184 <property>
185 <name>name</name>
186 <cstring>Spacer4</cstring>
187 </property>
188 <property stdset="1">
189 <name>orientation</name>
190 <enum>Horizontal</enum>
191 </property>
192 <property stdset="1">
193 <name>sizeType</name>
194 <enum>Expanding</enum>
195 </property>
196 <property>
197 <name>sizeHint</name>
198 <size>
199 <width>20</width>
200 <height>20</height>
201 </size>
202 </property>
203 </spacer>
204 </grid>
205 </widget>
206 <spacer>
207 <property>
208 <name>name</name>
209 <cstring>Spacer31</cstring>
210 </property>
211 <property stdset="1">
212 <name>orientation</name>
213 <enum>Vertical</enum>
214 </property>
215 <property stdset="1">
216 <name>sizeType</name>
217 <enum>Expanding</enum>
218 </property>
219 <property>
220 <name>sizeHint</name>
221 <size>
222 <width>20</width>
223 <height>20</height>
224 </size>
225 </property>
226 </spacer>
227 </vbox>
228 </widget>
229 <widget>
230 <class>QWidget</class>
231 <property stdset="1">
232 <name>name</name>
233 <cstring>WepPage</cstring>
234 </property>
235 <attribute>
236 <name>title</name>
237 <string>Encryption</string>
238 </attribute>
239 <vbox>
240 <property stdset="1">
241 <name>margin</name>
242 <number>11</number>
243 </property>
244 <property stdset="1">
245 <name>spacing</name>
246 <number>6</number>
247 </property>
248 <widget>
249 <class>QCheckBox</class>
250 <property stdset="1">
251 <name>name</name>
252 <cstring>wepEnabled</cstring>
253 </property>
254 <property stdset="1">
255 <name>text</name>
256 <string>&amp;Enable WEP</string>
257 </property>
258 </widget>
259 <widget>
260 <class>QButtonGroup</class>
261 <property stdset="1">
262 <name>name</name>
263 <cstring>ButtonGroup43</cstring>
264 </property>
265 <property stdset="1">
266 <name>enabled</name>
267 <bool>false</bool>
268 </property>
269 <property stdset="1">
270 <name>title</name>
271 <string>&amp;Authentication Type</string>
272 </property>
273 <hbox>
274 <property stdset="1">
275 <name>margin</name>
276 <number>11</number>
277 </property>
278 <property stdset="1">
279 <name>spacing</name>
280 <number>6</number>
281 </property>
282 <widget>
283 <class>QRadioButton</class>
284 <property stdset="1">
285 <name>name</name>
286 <cstring>authOpen</cstring>
287 </property>
288 <property stdset="1">
289 <name>text</name>
290 <string>&amp;Open System</string>
291 </property>
292 <property stdset="1">
293 <name>checked</name>
294 <bool>true</bool>
295 </property>
296 </widget>
297 <widget>
298 <class>QRadioButton</class>
299 <property stdset="1">
300 <name>name</name>
301 <cstring>authShared</cstring>
302 </property>
303 <property stdset="1">
304 <name>text</name>
305 <string>&amp;Shared Key</string>
306 </property>
307 </widget>
308 </hbox>
309 </widget>
310 <widget>
311 <class>QButtonGroup</class>
312 <property stdset="1">
313 <name>name</name>
314 <cstring>KeyButtonGroup</cstring>
315 </property>
316 <property stdset="1">
317 <name>enabled</name>
318 <bool>false</bool>
319 </property>
320 <property stdset="1">
321 <name>title</name>
322 <string>&amp;Key Setting</string>
323 </property>
324 <grid>
325 <property stdset="1">
326 <name>margin</name>
327 <number>11</number>
328 </property>
329 <property stdset="1">
330 <name>spacing</name>
331 <number>6</number>
332 </property>
333 <widget row="0" column="1" >
334 <class>QLineEdit</class>
335 <property stdset="1">
336 <name>name</name>
337 <cstring>keyLineEdit0</cstring>
338 </property>
339 <property stdset="1">
340 <name>echoMode</name>
341 <enum>Password</enum>
342 </property>
343 </widget>
344 <widget row="1" column="1" >
345 <class>QLineEdit</class>
346 <property stdset="1">
347 <name>name</name>
348 <cstring>keyLineEdit1</cstring>
349 </property>
350 <property stdset="1">
351 <name>echoMode</name>
352 <enum>Password</enum>
353 </property>
354 </widget>
355 <widget row="2" column="1" >
356 <class>QLineEdit</class>
357 <property stdset="1">
358 <name>name</name>
359 <cstring>keyLineEdit2</cstring>
360 </property>
361 <property stdset="1">
362 <name>echoMode</name>
363 <enum>Password</enum>
364 </property>
365 </widget>
366 <widget row="3" column="1" >
367 <class>QLineEdit</class>
368 <property stdset="1">
369 <name>name</name>
370 <cstring>keyLineEdit3</cstring>
371 </property>
372 <property stdset="1">
373 <name>echoMode</name>
374 <enum>Password</enum>
375 </property>
376 </widget>
377 <widget row="0" column="0" >
378 <class>QRadioButton</class>
379 <property stdset="1">
380 <name>name</name>
381 <cstring>keyRadio0</cstring>
382 </property>
383 <property stdset="1">
384 <name>text</name>
385 <string>Key 1</string>
386 </property>
387 <property stdset="1">
388 <name>checked</name>
389 <bool>true</bool>
390 </property>
391 </widget>
392 <widget row="1" column="0" >
393 <class>QRadioButton</class>
394 <property stdset="1">
395 <name>name</name>
396 <cstring>keyRadio1</cstring>
397 </property>
398 <property stdset="1">
399 <name>text</name>
400 <string>Key 2</string>
401 </property>
402 </widget>
403 <widget row="2" column="0" >
404 <class>QRadioButton</class>
405 <property stdset="1">
406 <name>name</name>
407 <cstring>keyRadio2</cstring>
408 </property>
409 <property stdset="1">
410 <name>text</name>
411 <string>Key 3</string>
412 </property>
413 </widget>
414 <widget row="3" column="0" >
415 <class>QRadioButton</class>
416 <property stdset="1">
417 <name>name</name>
418 <cstring>keyRadio3</cstring>
419 </property>
420 <property stdset="1">
421 <name>text</name>
422 <string>Key 4</string>
423 </property>
424 </widget>
425 </grid>
426 </widget>
427 <spacer>
428 <property>
429 <name>name</name>
430 <cstring>Spacer30</cstring>
431 </property>
432 <property stdset="1">
433 <name>orientation</name>
434 <enum>Vertical</enum>
435 </property>
436 <property stdset="1">
437 <name>sizeType</name>
438 <enum>Expanding</enum>
439 </property>
440 <property>
441 <name>sizeHint</name>
442 <size>
443 <width>20</width>
444 <height>20</height>
445 </size>
446 </property>
447 </spacer>
448 </vbox>
449 </widget>
450 </widget>
451 </vbox>
452</widget>
453<connections>
454 <connection>
455 <sender>wepEnabled</sender>
456 <signal>toggled(bool)</signal>
457 <receiver>ButtonGroup43</receiver>
458 <slot>setEnabled(bool)</slot>
459 </connection>
460 <connection>
461 <sender>wepEnabled</sender>
462 <signal>toggled(bool)</signal>
463 <receiver>KeyButtonGroup</receiver>
464 <slot>setEnabled(bool)</slot>
465 </connection>
466 <connection>
467 <sender>essAny</sender>
468 <signal>toggled(bool)</signal>
469 <receiver>GroupBox1</receiver>
470 <slot>setEnabled(bool)</slot>
471 </connection>
472</connections>
473<tabstops>
474 <tabstop>tabWidget</tabstop>
475 <tabstop>essAny</tabstop>
476 <tabstop>essSpecificLineEdit</tabstop>
477 <tabstop>networkType</tabstop>
478 <tabstop>networkChannel</tabstop>
479 <tabstop>wepEnabled</tabstop>
480 <tabstop>authOpen</tabstop>
481 <tabstop>authShared</tabstop>
482 <tabstop>keyRadio0</tabstop>
483 <tabstop>keyLineEdit0</tabstop>
484 <tabstop>keyRadio1</tabstop>
485 <tabstop>keyLineEdit1</tabstop>
486 <tabstop>keyRadio2</tabstop>
487 <tabstop>keyLineEdit2</tabstop>
488 <tabstop>keyRadio3</tabstop>
489 <tabstop>keyLineEdit3</tabstop>
490</tabstops>
491</UI>
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp
deleted file mode 100644
index 1782c22..0000000
--- a/noncore/net/networksetup/wlan/wlanimp.cpp
+++ b/dev/null
@@ -1,247 +0,0 @@
1#include "wlanimp.h"
2#include "interfacesetupimp.h"
3
4#include <qfile.h>
5#include <qdir.h>
6#include <qtextstream.h>
7#include <qmessagebox.h>
8#include <qlineedit.h>
9#include <qlabel.h>
10#include <qspinbox.h>
11#include <qradiobutton.h>
12#include <qcheckbox.h>
13#include <qtabwidget.h>
14#include <qcombobox.h>
15
16/* system() */
17#include <stdlib.h>
18
19#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts"
20
21/**
22 * Constructor, read in the wireless.opts file for parsing later.
23 */
24WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") {
25 interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i);
26 tabWidget->insertTab(interfaceSetup, "TCP/IP");
27
28 // Read in the config file.
29 QString wlanFile = WIRELESS_OPTS;
30 QFile file(wlanFile);
31 if (file.open(IO_ReadOnly)){
32 QTextStream stream( &file );
33 QString line = "";
34 while ( !stream.eof() ) {
35 line += stream.readLine();
36 line += "\n";
37 }
38 file.close();
39 settingsFileText = QStringList::split("\n", line, true);
40 parseSettingFile();
41 }
42 else
43 qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1());
44 connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
45}
46
47void WLANImp::typeChanged(int mod){
48 networkChannel->setEnabled(mod);
49 channelLabel->setEnabled(mod);
50}
51
52/**
53 * Change the profile for both wireless settings and network settings.
54 */
55void WLANImp::setProfile(const QString &profile){
56 interfaceSetup->setProfile(profile);
57 parseSettingFile();
58}
59
60/**
61 * Parses the settings file that was read in and gets any setting from it.
62 */
63void WLANImp::parseSettingFile(){
64 bool foundCase = false;
65 bool found = false;
66 for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) {
67 QString line = (*it).simplifyWhiteSpace();
68 if(line.contains("case"))
69 foundCase = true;
70 // See if we found our scheme to write or the sceme couldn't be found
71 if((foundCase && line.contains("esac")) ||
72 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#'))
73 found = true;
74
75 if(line.contains(";;"))
76 found = false;
77 if(found){
78 // write out scheme
79 if(line.contains("ESSID=")){
80 QString id = line.mid(line.find("ESSID=")+6, line.length());
81 if(id == "any"){
82 essAny->setChecked(false);
83 }else{
84 essAny->setChecked(true);
85 essSpecificLineEdit->setText(id);
86 }
87 }
88 if(line.contains("MODE=")){
89 QString mode = line.mid(line.find("MODE=")+5, line.length());
90 if(mode == "Managed"){
91 networkType->setCurrentItem(0);
92 channelLabel->setEnabled(false);
93 networkChannel->setEnabled(false);
94 }
95 else{
96 networkType->setCurrentItem(1);
97 networkChannel->setEnabled(true);
98 channelLabel->setEnabled(true);
99 }
100 }
101 if(line.contains("#KEY0="))
102 keyLineEdit0->setText(line.mid(6, line.length()));
103 if(line.contains("#KEY1="))
104 keyLineEdit1->setText(line.mid(6, line.length()));
105 if(line.contains("#KEY2="))
106 keyLineEdit2->setText(line.mid(6, line.length()));
107 if(line.contains("#KEY3="))
108 keyLineEdit3->setText(line.mid(6, line.length()));
109
110 if(line.contains("KEY=")){
111 wepEnabled->setChecked(true);
112 QString key;
113 if(line.right(5) == (" open")){
114 key = line.mid(4, line.length()-5);
115 authOpen->setChecked(true);
116 authShared->setChecked(false);
117 }
118 else{
119 authOpen->setChecked(false);
120 authShared->setChecked(true);
121 key = line.mid(4, line.length());
122 }
123 if(key == keyLineEdit0->text()) keyRadio0->setChecked(true);
124 if(key == keyLineEdit1->text()) keyRadio1->setChecked(true);
125 if(key == keyLineEdit2->text()) keyRadio2->setChecked(true);
126 if(key == keyLineEdit3->text()) keyRadio3->setChecked(true);
127 }
128 if(line.contains("CHANNEL=")){
129 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt());
130 }
131 }
132 }
133}
134
135/**
136 * Saves settings to the wireless.opts file using the current profile
137 */
138void WLANImp::changeAndSaveSettingFile(){
139 QString wlanFile = WIRELESS_OPTS;
140 QFile::remove(wlanFile);
141 QFile file(wlanFile);
142
143 if (!file.open(IO_ReadWrite)){
144 qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1());
145 return;
146 }
147
148 QTextStream stream( &file );
149 bool foundCase = false;
150 bool found = false;
151 bool output = true;
152 for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) {
153 QString line = (*it).simplifyWhiteSpace();
154 if(line.contains("case"))
155 foundCase = true;
156 // See if we found our scheme to write or the sceme couldn't be found
157 if((foundCase && line.contains("esac") && !found) ||
158 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){
159 // write out scheme
160 found = true;
161 output = false;
162
163 if(!line.contains("esac"))
164 stream << line << "\n";
165 if(!essAny->isChecked() == true){
166 stream << "\tESSID=any\n";
167 stream << "\tMODE=Managed\n";
168 }
169 else{
170 stream << "\tESSID=" << essSpecificLineEdit->text() << '\n';
171 stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n';
172 stream << "\tCHANNEL=" << networkChannel->value() << "\n";
173 }
174
175 stream << "\t#KEY0=" << keyLineEdit0->text() << "\n";
176 stream << "\t#KEY1=" << keyLineEdit1->text() << "\n";
177 stream << "\t#KEY2=" << keyLineEdit2->text() << "\n";
178 stream << "\t#KEY3=" << keyLineEdit3->text() << "\n";
179
180 if(wepEnabled->isChecked()){
181 stream << "\tKEY=\"";
182 if(keyRadio0->isChecked()) stream << keyLineEdit0->text();
183 if(keyRadio1->isChecked()) stream << keyLineEdit1->text();
184 if(keyRadio2->isChecked()) stream << keyLineEdit2->text();
185 if(keyRadio3->isChecked()) stream << keyLineEdit3->text();
186 if(authOpen->isChecked())
187 stream << " open";
188 else
189 stream << " restricted";
190 stream << "\"\n";
191 }
192 stream << "\tRATE=auto\n";
193 if(line.contains("esac"))
194 stream << line << "\n";
195 }
196 if(line.contains(";;"))
197 output = true;
198 if(output && (*it).length() )
199 stream << (*it) << '\n';
200 }
201 file.close();
202}
203
204/**
205 * Check to see if the current config is valid
206 * Save wireless.opts, save interfaces
207 */
208void WLANImp::accept(){
209 if(wepEnabled->isChecked()){
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);
212 return;
213 }
214 }
215
216 if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){
217 QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok);
218 return;
219 }
220
221 // Ok settings are good here, save
222 changeAndSaveSettingFile();
223
224 // Try to save the interfaces settings.
225 if(!interfaceSetup->saveChanges())
226 return;
227
228 // Restart the device now that the settings have changed
229 QString initpath;
230 if( QDir("/etc/rc.d/init.d").exists() )
231 initpath = "/etc/rc.d/init.d";
232 else if( QDir("/etc/init.d").exists() )
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
237 if( initpath )
238 system(QString("%1/pcmcia stop").arg(initpath));
239 if( initpath )
240 system(QString("%1/pcmcia start").arg(initpath));
241
242 // Close out the dialog
243 QDialog::accept();
244}
245
246// wlanimp.cpp
247
diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h
deleted file mode 100644
index 310836c..0000000
--- a/noncore/net/networksetup/wlan/wlanimp.h
+++ b/dev/null
@@ -1,34 +0,0 @@
1#ifndef WLANIMP_H
2#define WLANIMP_H
3
4#include "wlan.h"
5#include <qstringlist.h>
6
7class InterfaceSetupImp;
8class Interface;
9class Config;
10
11class WLANImp : public WLAN {
12 Q_OBJECT
13
14public:
15 WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 );
16 void setProfile(const QString &profile);
17
18protected:
19 void accept();
20
21private slots:
22 void typeChanged(int);
23
24private:
25 void parseSettingFile();
26 void changeAndSaveSettingFile();
27
28 InterfaceSetupImp *interfaceSetup;
29 QStringList settingsFileText;
30 QString currentProfile;
31};
32
33#endif
34
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp
deleted file mode 100644
index 3979e60..0000000
--- a/noncore/net/networksetup/wlan/wlanmodule.cpp
+++ b/dev/null
@@ -1,113 +0,0 @@
1#include "wlanmodule.h"
2#include "wlanimp.h"
3#include "infoimp.h"
4#include "wextensions.h"
5#include "interfaceinformationimp.h"
6
7#include <qlabel.h>
8#include <qprogressbar.h>
9#include <qtabwidget.h>
10
11/**
12 * Constructor, find all of the possible interfaces
13 */
14WLANModule::WLANModule() : Module() {
15}
16
17/**
18 * Delete any interfaces that we own.
19 */
20WLANModule::~WLANModule(){
21 Interface *i;
22 for ( i=list.first(); i != 0; i=list.next() )
23 delete i;
24}
25
26/**
27 * Change the current profile
28 */
29void WLANModule::setProfile(const QString &newProfile){
30 profile = newProfile;
31}
32
33/**
34 * get the icon name for this device.
35 * @param Interface* can be used in determining the icon.
36 * @return QString the icon name (minus .png, .gif etc)
37 */
38QString WLANModule::getPixmapName(Interface* ){
39 return "wlan";
40}
41
42/**
43 * Check to see if the interface i is owned by this module.
44 * @param Interface* interface to check against
45 * @return bool true if i is owned by this module, false otherwise.
46 */
47bool WLANModule::isOwner(Interface *i){
48 WExtensions we(i->getInterfaceName());
49 if(!we.doesHaveWirelessExtensions())
50 return false;
51
52 i->setHardwareName("802.11b");
53 list.append(i);
54 return true;
55}
56
57/**
58 * Create, and return the WLANConfigure Module
59 * @return QWidget* pointer to this modules configure.
60 */
61QWidget *WLANModule::configure(Interface *i){
62 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose);
63 wlanconfig->setProfile(profile);
64 return wlanconfig;
65}
66
67/**
68 * Create, and return the Information Module
69 * @return QWidget* pointer to this modules info.
70 */
71QWidget *WLANModule::information(Interface *i){
72 WExtensions we(i->getInterfaceName());
73 if(!we.doesHaveWirelessExtensions())
74 return NULL;
75
76 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
77 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
78 info->tabWidget->insertTab(information, "TCP/IP");
79 return info;
80}
81
82/**
83 * Get all active (up or down) interfaces
84 * @return QList<Interface> A list of interfaces that exsist that havn't
85 * been called by isOwner()
86 */
87QList<Interface> WLANModule::getInterfaces(){
88 return list;
89}
90
91/**
92 * Attempt to add a new interface as defined by name
93 * @param name the name of the type of interface that should be created given
94 * by possibleNewInterfaces();
95 * @return Interface* NULL if it was unable to be created.
96 */
97Interface *WLANModule::addNewInterface(const QString &){
98 // We can't add a 802.11 interface, either the hardware will be there
99 // or it wont.
100 return NULL;
101}
102
103/**
104 * Attempts to remove the interface, doesn't delete i
105 * @return bool true if successfull, false otherwise.
106 */
107bool WLANModule::remove(Interface*){
108 // Can't remove a hardware device, you can stop it though.
109 return false;
110}
111
112// wlanmodule.cpp
113
diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h
deleted file mode 100644
index 3a54de6..0000000
--- a/noncore/net/networksetup/wlan/wlanmodule.h
+++ b/dev/null
@@ -1,41 +0,0 @@
1#ifndef WLAN_MODULE_H
2#define WLAN_MODULE_H
3
4#include "module.h"
5
6class WLANModule : Module{
7
8signals:
9 void updateInterface(Interface *i);
10
11public:
12 WLANModule();
13 ~WLANModule();
14
15 void setProfile(const QString &newProfile);
16 bool isOwner(Interface *);
17 QWidget *configure(Interface *i);
18 QWidget *information(Interface *i);
19 QList<Interface> getInterfaces();
20 void possibleNewInterfaces(QMap<QString, QString> &){};
21 Interface *addNewInterface(const QString &name);
22 bool remove(Interface* i);
23 QString getPixmapName(Interface* i);
24
25private:
26 QList<Interface> list;
27 QString profile;
28
29};
30
31extern "C"
32{
33 void* create_plugin() {
34 return new WLANModule();
35 }
36};
37
38#endif
39
40// wlanmodule.h
41