-rw-r--r-- | noncore/net/networksetup/interface.cpp | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/interface.h | 7 | ||||
-rw-r--r-- | noncore/net/networksetup/interfacesetup.ui | 258 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindow.ui | 74 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 59 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.h | 1 | ||||
-rw-r--r-- | noncore/net/networksetup/module.h | 7 | ||||
-rw-r--r-- | noncore/net/networksetup/networksetup.pro | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/interface.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/interface.h | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfacesetup.ui | 258 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindow.ui | 74 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 59 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.h | 1 | ||||
-rw-r--r-- | noncore/settings/networksettings/module.h | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/networksetup.pro | 4 |
16 files changed, 530 insertions, 294 deletions
diff --git a/noncore/net/networksetup/interface.cpp b/noncore/net/networksetup/interface.cpp index f6eed00..5b21364 100644 --- a/noncore/net/networksetup/interface.cpp +++ b/noncore/net/networksetup/interface.cpp | |||
@@ -1,205 +1,205 @@ | |||
1 | #include "interface.h" | 1 | #include "interface.h" |
2 | #include <qdatetime.h> | 2 | #include <qdatetime.h> |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <qfileinfo.h> | 4 | #include <qfileinfo.h> |
5 | #include <qtextstream.h> | 5 | #include <qtextstream.h> |
6 | 6 | ||
7 | #define IFCONFIG "/sbin/ifconfig" | 7 | #define IFCONFIG "/sbin/ifconfig" |
8 | #define HDCP_INFO_DIR "/etc/dhcpc" | 8 | #define HDCP_INFO_DIR "/etc/dhcpc" |
9 | 9 | ||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
12 | 12 | ||
13 | Interface::Interface(QString name, bool newSatus): status(newSatus), attached(false), interfaceName(name), hardareName("Unknown"), moduleOwner("Default"), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){ | 13 | Interface::Interface(QString name, bool newSatus): status(newSatus), attached(false), interfaceName(name), hardareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){ |
14 | refresh(); | 14 | refresh(); |
15 | } | 15 | } |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Try to start the interface. | 18 | * Try to start the interface. |
19 | * @return bool true if successfull. | 19 | * @return bool true if successfull. |
20 | */ | 20 | */ |
21 | bool Interface::start(){ | 21 | bool Interface::start(){ |
22 | // check to see if we are already running. | 22 | // check to see if we are already running. |
23 | if(status) | 23 | if(status) |
24 | return false; | 24 | return false; |
25 | 25 | ||
26 | int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1()); | 26 | int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1()); |
27 | if(ret != 0) | 27 | if(ret != 0) |
28 | return false; | 28 | return false; |
29 | 29 | ||
30 | status = true; | 30 | status = true; |
31 | refresh(); | 31 | refresh(); |
32 | return true; | 32 | return true; |
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Try to stop the interface. | 36 | * Try to stop the interface. |
37 | * @return bool true if successfull. | 37 | * @return bool true if successfull. |
38 | */ | 38 | */ |
39 | bool Interface::stop(){ | 39 | bool Interface::stop(){ |
40 | // check to see if we are already stopped. | 40 | // check to see if we are already stopped. |
41 | if(status == false) | 41 | if(status == false) |
42 | return false; | 42 | return false; |
43 | 43 | ||
44 | int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1()); | 44 | int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1()); |
45 | if(ret != 0) | 45 | if(ret != 0) |
46 | return false; | 46 | return false; |
47 | 47 | ||
48 | status = true; | 48 | status = true; |
49 | refresh(); | 49 | refresh(); |
50 | return true; | 50 | return true; |
51 | } | 51 | } |
52 | /** | 52 | /** |
53 | * Try to restart the interface. | 53 | * Try to restart the interface. |
54 | * @return bool true if successfull. | 54 | * @return bool true if successfull. |
55 | */ | 55 | */ |
56 | bool Interface::restart(){ | 56 | bool Interface::restart(){ |
57 | return (stop() && start()); | 57 | return (stop() && start()); |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Try to refresh the information about the interface. | 61 | * Try to refresh the information about the interface. |
62 | * First call ifconfig, then check the dhcp-info file | 62 | * First call ifconfig, then check the dhcp-info file |
63 | * @return bool true if successfull. | 63 | * @return bool true if successfull. |
64 | */ | 64 | */ |
65 | bool Interface::refresh(){ | 65 | bool Interface::refresh(){ |
66 | // See if we are up. | 66 | // See if we are up. |
67 | if(status == false){ | 67 | if(status == false){ |
68 | macAddress = ""; | 68 | macAddress = ""; |
69 | ip = "0.0.0.0"; | 69 | ip = "0.0.0.0"; |
70 | subnetMask = "0.0.0.0"; | 70 | subnetMask = "0.0.0.0"; |
71 | broadcast = ""; | 71 | broadcast = ""; |
72 | dhcp = false; | 72 | dhcp = false; |
73 | dhcpServerIp = ""; | 73 | dhcpServerIp = ""; |
74 | leaseObtained = ""; | 74 | leaseObtained = ""; |
75 | leaseExpires = ""; | 75 | leaseExpires = ""; |
76 | return true; | 76 | return true; |
77 | } | 77 | } |
78 | 78 | ||
79 | QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName); | 79 | QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName); |
80 | int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1()); | 80 | int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1()); |
81 | if(ret != 0){ | 81 | if(ret != 0){ |
82 | qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); | 82 | qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); |
83 | return false; | 83 | return false; |
84 | } | 84 | } |
85 | 85 | ||
86 | QFile file(fileName); | 86 | QFile file(fileName); |
87 | if (!file.open(IO_ReadOnly)){ | 87 | if (!file.open(IO_ReadOnly)){ |
88 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); | 88 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); |
89 | return false; | 89 | return false; |
90 | } | 90 | } |
91 | 91 | ||
92 | // Set to the defaults | 92 | // Set to the defaults |
93 | macAddress = ""; | 93 | macAddress = ""; |
94 | ip = "0.0.0.0"; | 94 | ip = "0.0.0.0"; |
95 | subnetMask = "0.0.0.0"; | 95 | subnetMask = "0.0.0.0"; |
96 | broadcast = ""; | 96 | broadcast = ""; |
97 | 97 | ||
98 | QTextStream stream( &file ); | 98 | QTextStream stream( &file ); |
99 | QString line; | 99 | QString line; |
100 | while ( !stream.eof() ) { | 100 | while ( !stream.eof() ) { |
101 | line = stream.readLine(); | 101 | line = stream.readLine(); |
102 | if(line.contains("HWaddr")){ | 102 | if(line.contains("HWaddr")){ |
103 | int mac = line.find("HWaddr"); | 103 | int mac = line.find("HWaddr"); |
104 | macAddress = line.mid(mac+7, line.length()); | 104 | macAddress = line.mid(mac+7, line.length()); |
105 | } | 105 | } |
106 | if(line.contains("inet addr")){ | 106 | if(line.contains("inet addr")){ |
107 | int ipl = line.find("inet addr"); | 107 | int ipl = line.find("inet addr"); |
108 | int space = line.find(" ", ipl+10); | 108 | int space = line.find(" ", ipl+10); |
109 | ip = line.mid(ipl+10, space-ipl-10); | 109 | ip = line.mid(ipl+10, space-ipl-10); |
110 | } | 110 | } |
111 | if(line.contains("Mask")){ | 111 | if(line.contains("Mask")){ |
112 | int mask = line.find("Mask"); | 112 | int mask = line.find("Mask"); |
113 | subnetMask = line.mid(mask+5, line.length()); | 113 | subnetMask = line.mid(mask+5, line.length()); |
114 | } | 114 | } |
115 | if(line.contains("Bcast")){ | 115 | if(line.contains("Bcast")){ |
116 | int mask = line.find("Bcast"); | 116 | int mask = line.find("Bcast"); |
117 | int space = line.find(" ", mask+6); | 117 | int space = line.find(" ", mask+6); |
118 | broadcast = line.mid(mask+6, space-mask-6); | 118 | broadcast = line.mid(mask+6, space-mask-6); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | file.close(); | 121 | file.close(); |
122 | QFile::remove(fileName); | 122 | QFile::remove(fileName); |
123 | 123 | ||
124 | // DHCP TESTING | 124 | // DHCP TESTING |
125 | // reset DHCP info | 125 | // reset DHCP info |
126 | dhcpServerIp = ""; | 126 | dhcpServerIp = ""; |
127 | leaseObtained = ""; | 127 | leaseObtained = ""; |
128 | leaseExpires = ""; | 128 | leaseExpires = ""; |
129 | dhcp = false; | 129 | dhcp = false; |
130 | 130 | ||
131 | // See if we have | 131 | // See if we have |
132 | QString dhcpFile(QString(HDCP_INFO_DIR "/dhcpcd-%1.info").arg(interfaceName)); | 132 | QString dhcpFile(QString(HDCP_INFO_DIR "/dhcpcd-%1.info").arg(interfaceName)); |
133 | // If there is no DHCP information then exit now with no errors. | 133 | // If there is no DHCP information then exit now with no errors. |
134 | if(!QFile::exists(dhcpFile)){ | 134 | if(!QFile::exists(dhcpFile)){ |
135 | return true; | 135 | return true; |
136 | } | 136 | } |
137 | 137 | ||
138 | file.setName(dhcpFile); | 138 | file.setName(dhcpFile); |
139 | if (!file.open(IO_ReadOnly)){ | 139 | if (!file.open(IO_ReadOnly)){ |
140 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); | 140 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); |
141 | return false; | 141 | return false; |
142 | } | 142 | } |
143 | 143 | ||
144 | // leaseTime and renewalTime and used if pid and deamon exe can be accessed. | 144 | // leaseTime and renewalTime and used if pid and deamon exe can be accessed. |
145 | int leaseTime = 0; | 145 | int leaseTime = 0; |
146 | int renewalTime = 0; | 146 | int renewalTime = 0; |
147 | 147 | ||
148 | stream.setDevice( &file ); | 148 | stream.setDevice( &file ); |
149 | while ( !stream.eof() ) { | 149 | while ( !stream.eof() ) { |
150 | line = stream.readLine(); | 150 | line = stream.readLine(); |
151 | if(line.contains("DHCPSID=")) | 151 | if(line.contains("DHCPSID=")) |
152 | dhcpServerIp = line.mid(8, line.length()); | 152 | dhcpServerIp = line.mid(8, line.length()); |
153 | if(line.contains("LEASETIME=")) | 153 | if(line.contains("LEASETIME=")) |
154 | leaseTime = line.mid(10, line.length()).toInt(); | 154 | leaseTime = line.mid(10, line.length()).toInt(); |
155 | if(line.contains("RENEWALTIME=")) | 155 | if(line.contains("RENEWALTIME=")) |
156 | renewalTime = line.mid(12, line.length()).toInt(); | 156 | renewalTime = line.mid(12, line.length()).toInt(); |
157 | } | 157 | } |
158 | file.close(); | 158 | file.close(); |
159 | //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); | 159 | //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); |
160 | //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); | 160 | //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); |
161 | 161 | ||
162 | // Get the pid of the deamond | 162 | // Get the pid of the deamond |
163 | dhcpFile = (QString(HDCP_INFO_DIR "/dhcpcd-%1.pid").arg(interfaceName)); | 163 | dhcpFile = (QString(HDCP_INFO_DIR "/dhcpcd-%1.pid").arg(interfaceName)); |
164 | file.setName(dhcpFile); | 164 | file.setName(dhcpFile); |
165 | if (!file.open(IO_ReadOnly)){ | 165 | if (!file.open(IO_ReadOnly)){ |
166 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); | 166 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); |
167 | return false; | 167 | return false; |
168 | } | 168 | } |
169 | 169 | ||
170 | int pid = -1; | 170 | int pid = -1; |
171 | stream.setDevice( &file ); | 171 | stream.setDevice( &file ); |
172 | while ( !stream.eof() ) { | 172 | while ( !stream.eof() ) { |
173 | line = stream.readLine(); | 173 | line = stream.readLine(); |
174 | pid = line.toInt(); | 174 | pid = line.toInt(); |
175 | } | 175 | } |
176 | file.close(); | 176 | file.close(); |
177 | 177 | ||
178 | if( pid == -1){ | 178 | if( pid == -1){ |
179 | qDebug("Interface: Could not get pid of dhcpc deamon."); | 179 | qDebug("Interface: Could not get pid of dhcpc deamon."); |
180 | return false; | 180 | return false; |
181 | } | 181 | } |
182 | 182 | ||
183 | // Get the start running time of the deamon | 183 | // Get the start running time of the deamon |
184 | fileName = (QString("/proc/%1/stat").arg(pid)); | 184 | fileName = (QString("/proc/%1/stat").arg(pid)); |
185 | file.setName(fileName); | 185 | file.setName(fileName); |
186 | stream.setDevice( &file ); | 186 | stream.setDevice( &file ); |
187 | if (!file.open(IO_ReadOnly)){ | 187 | if (!file.open(IO_ReadOnly)){ |
188 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); | 188 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); |
189 | return false; | 189 | return false; |
190 | } | 190 | } |
191 | while ( !stream.eof() ) { | 191 | while ( !stream.eof() ) { |
192 | line = stream.readLine(); | 192 | line = stream.readLine(); |
193 | } | 193 | } |
194 | file.close(); | 194 | file.close(); |
195 | long time = 0; | 195 | long time = 0; |
196 | // Grab the start time | 196 | // Grab the start time |
197 | // pid com state ppid pgrp session tty_nr tpgid flags | 197 | // pid com state ppid pgrp session tty_nr tpgid flags |
198 | sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " | 198 | sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " |
199 | // minflt cminflt majflt cmajflt utime stime cutime cstime priority | 199 | // minflt cminflt majflt cmajflt utime stime cutime cstime priority |
200 | "%*u %*u %*u %*u %*u %*u %*d %*d %*d " | 200 | "%*u %*u %*u %*u %*u %*u %*d %*d %*d " |
201 | // nice 0 itrealvalue starttime | 201 | // nice 0 itrealvalue starttime |
202 | "%*d %*d %*d %lu", (long*) &time); | 202 | "%*d %*d %*d %lu", (long*) &time); |
203 | time = time/100; | 203 | time = time/100; |
204 | 204 | ||
205 | QDateTime datetime(QDateTime::currentDateTime()); | 205 | QDateTime datetime(QDateTime::currentDateTime()); |
diff --git a/noncore/net/networksetup/interface.h b/noncore/net/networksetup/interface.h index 1ad71eb..5dc95a4 100644 --- a/noncore/net/networksetup/interface.h +++ b/noncore/net/networksetup/interface.h | |||
@@ -1,65 +1,66 @@ | |||
1 | #ifndef INTERFACE_H | 1 | #ifndef INTERFACE_H |
2 | #define INTERFACE_H | 2 | #define INTERFACE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | class Module; | ||
6 | class Interface { | 7 | class Interface { |
7 | 8 | ||
8 | public: | 9 | public: |
9 | Interface(QString name = "unknown", bool status = false); | 10 | Interface(QString name = "unknown", bool status = false); |
10 | virtual ~Interface(){}; | 11 | virtual ~Interface(){}; |
11 | 12 | ||
12 | virtual bool getStatus(){ return status; }; | 13 | virtual bool getStatus(){ return status; }; |
13 | virtual void setStatus(bool newSatus){ status = newSatus; refresh(); }; | 14 | virtual void setStatus(bool newSatus){ status = newSatus; refresh(); }; |
14 | 15 | ||
15 | virtual bool isAttached(){ return attached; }; | 16 | virtual bool isAttached(){ return attached; }; |
16 | virtual void setAttached(bool isAttached=false){ attached = isAttached; }; | 17 | virtual void setAttached(bool isAttached=false){ attached = isAttached; }; |
17 | 18 | ||
18 | virtual QString getInterfaceName(){ return interfaceName; }; | 19 | virtual QString getInterfaceName(){ return interfaceName; }; |
19 | virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; }; | 20 | virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; }; |
20 | 21 | ||
21 | virtual QString getHardwareName(){ return hardareName; }; | 22 | virtual QString getHardwareName(){ return hardareName; }; |
22 | virtual void setHardwareName(QString name="Unknown"){ hardareName = name; }; | 23 | virtual void setHardwareName(QString name="Unknown"){ hardareName = name; }; |
23 | 24 | ||
24 | virtual QString getModuleOwner(){ return moduleOwner; }; | 25 | virtual Module* getModuleOwner(){ return moduleOwner; }; |
25 | virtual void setModuleOwner(QString owner="Default"){ moduleOwner = owner; }; | 26 | virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; }; |
26 | 27 | ||
27 | // inet information. | 28 | // inet information. |
28 | QString getMacAddress(){ return macAddress; }; | 29 | QString getMacAddress(){ return macAddress; }; |
29 | QString getIp(){ return ip; }; | 30 | QString getIp(){ return ip; }; |
30 | QString getSubnetMask(){ return subnetMask; }; | 31 | QString getSubnetMask(){ return subnetMask; }; |
31 | QString getBroadcast(){ return broadcast; }; | 32 | QString getBroadcast(){ return broadcast; }; |
32 | bool isDhcp(){ return dhcp; }; | 33 | bool isDhcp(){ return dhcp; }; |
33 | QString getDhcpServerIp(){ return dhcpServerIp; }; | 34 | QString getDhcpServerIp(){ return dhcpServerIp; }; |
34 | QString getLeaseObtained(){ return leaseObtained; }; | 35 | QString getLeaseObtained(){ return leaseObtained; }; |
35 | QString getLeaseExpires(){ return leaseExpires; }; | 36 | QString getLeaseExpires(){ return leaseExpires; }; |
36 | 37 | ||
37 | bool refresh(); | 38 | bool refresh(); |
38 | bool start(); | 39 | bool start(); |
39 | bool stop(); | 40 | bool stop(); |
40 | bool restart(); | 41 | bool restart(); |
41 | 42 | ||
42 | private: | 43 | private: |
43 | // Interface information | 44 | // Interface information |
44 | bool status; | 45 | bool status; |
45 | bool attached; | 46 | bool attached; |
46 | QString interfaceName; | 47 | QString interfaceName; |
47 | QString hardareName; | 48 | QString hardareName; |
48 | QString moduleOwner; | 49 | Module *moduleOwner; |
49 | 50 | ||
50 | // Network information | 51 | // Network information |
51 | QString macAddress; | 52 | QString macAddress; |
52 | QString ip; | 53 | QString ip; |
53 | QString broadcast; | 54 | QString broadcast; |
54 | QString subnetMask; | 55 | QString subnetMask; |
55 | bool dhcp; | 56 | bool dhcp; |
56 | QString dhcpServerIp; | 57 | QString dhcpServerIp; |
57 | QString leaseObtained; | 58 | QString leaseObtained; |
58 | QString leaseExpires; | 59 | QString leaseExpires; |
59 | 60 | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | #endif | 63 | #endif |
63 | 64 | ||
64 | // interface.h | 65 | // interface.h |
65 | 66 | ||
diff --git a/noncore/net/networksetup/interfacesetup.ui b/noncore/net/networksetup/interfacesetup.ui index ff9810e..d367608 100644 --- a/noncore/net/networksetup/interfacesetup.ui +++ b/noncore/net/networksetup/interfacesetup.ui | |||
@@ -1,284 +1,336 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>InterfaceSetup</class> | 2 | <class>InterfaceSetup</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>InterfaceSetup</cstring> | 7 | <cstring>InterfaceSetup</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>177</width> | 14 | <width>271</width> |
15 | <height>320</height> | 15 | <height>280</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Interface Configuration</string> | 20 | <string>Interface Configuration</string> |
21 | </property> | 21 | </property> |
22 | <grid> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>11</number> | 25 | <number>11</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget row="1" column="0" rowspan="1" colspan="2" > | 31 | <widget> |
32 | <class>Line</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>Line1</cstring> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>orientation</name> | ||
39 | <enum>Horizontal</enum> | ||
40 | </property> | ||
41 | </widget> | ||
42 | <widget row="0" column="0" rowspan="1" colspan="2" > | ||
43 | <class>QCheckBox</class> | 32 | <class>QCheckBox</class> |
44 | <property stdset="1"> | 33 | <property stdset="1"> |
45 | <name>name</name> | 34 | <name>name</name> |
46 | <cstring>autoStart</cstring> | 35 | <cstring>autoStart</cstring> |
47 | </property> | 36 | </property> |
48 | <property stdset="1"> | 37 | <property stdset="1"> |
49 | <name>text</name> | 38 | <name>text</name> |
50 | <string>Automaticly bring up</string> | 39 | <string>Automaticly bring up</string> |
51 | </property> | 40 | </property> |
52 | </widget> | 41 | </widget> |
53 | <widget row="2" column="1" > | 42 | <widget> |
54 | <class>QComboBox</class> | 43 | <class>QLayoutWidget</class> |
55 | <item> | ||
56 | <property> | ||
57 | <name>text</name> | ||
58 | <string>All</string> | ||
59 | </property> | ||
60 | </item> | ||
61 | <property stdset="1"> | 44 | <property stdset="1"> |
62 | <name>name</name> | 45 | <name>name</name> |
63 | <cstring>profileCombo</cstring> | 46 | <cstring>Layout8</cstring> |
64 | </property> | ||
65 | </widget> | ||
66 | <widget row="4" column="0" > | ||
67 | <class>QLabel</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>leaseHoursLabel</cstring> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>text</name> | ||
74 | <string>Requested Lease</string> | ||
75 | </property> | ||
76 | </widget> | ||
77 | <widget row="3" column="0" rowspan="1" colspan="2" > | ||
78 | <class>QCheckBox</class> | ||
79 | <property stdset="1"> | ||
80 | <name>name</name> | ||
81 | <cstring>dhcpCheckBox</cstring> | ||
82 | </property> | ||
83 | <property stdset="1"> | ||
84 | <name>text</name> | ||
85 | <string>DHCP</string> | ||
86 | </property> | ||
87 | <property stdset="1"> | ||
88 | <name>checked</name> | ||
89 | <bool>true</bool> | ||
90 | </property> | ||
91 | </widget> | ||
92 | <widget row="2" column="0" > | ||
93 | <class>QLabel</class> | ||
94 | <property stdset="1"> | ||
95 | <name>name</name> | ||
96 | <cstring>TextLabel1</cstring> | ||
97 | </property> | ||
98 | <property stdset="1"> | ||
99 | <name>text</name> | ||
100 | <string>Profile:</string> | ||
101 | </property> | 47 | </property> |
48 | <hbox> | ||
49 | <property stdset="1"> | ||
50 | <name>margin</name> | ||
51 | <number>0</number> | ||
52 | </property> | ||
53 | <property stdset="1"> | ||
54 | <name>spacing</name> | ||
55 | <number>6</number> | ||
56 | </property> | ||
57 | <widget> | ||
58 | <class>QLabel</class> | ||
59 | <property stdset="1"> | ||
60 | <name>name</name> | ||
61 | <cstring>TextLabel1</cstring> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>text</name> | ||
65 | <string>Profile</string> | ||
66 | </property> | ||
67 | </widget> | ||
68 | <widget> | ||
69 | <class>QComboBox</class> | ||
70 | <item> | ||
71 | <property> | ||
72 | <name>text</name> | ||
73 | <string>All</string> | ||
74 | </property> | ||
75 | </item> | ||
76 | <property stdset="1"> | ||
77 | <name>name</name> | ||
78 | <cstring>profileCombo</cstring> | ||
79 | </property> | ||
80 | </widget> | ||
81 | <spacer> | ||
82 | <property> | ||
83 | <name>name</name> | ||
84 | <cstring>Spacer20</cstring> | ||
85 | </property> | ||
86 | <property stdset="1"> | ||
87 | <name>orientation</name> | ||
88 | <enum>Horizontal</enum> | ||
89 | </property> | ||
90 | <property stdset="1"> | ||
91 | <name>sizeType</name> | ||
92 | <enum>Expanding</enum> | ||
93 | </property> | ||
94 | <property> | ||
95 | <name>sizeHint</name> | ||
96 | <size> | ||
97 | <width>20</width> | ||
98 | <height>20</height> | ||
99 | </size> | ||
100 | </property> | ||
101 | </spacer> | ||
102 | </hbox> | ||
102 | </widget> | 103 | </widget> |
103 | <widget row="4" column="1" > | 104 | <widget> |
104 | <class>QSpinBox</class> | 105 | <class>QLayoutWidget</class> |
105 | <property stdset="1"> | 106 | <property stdset="1"> |
106 | <name>name</name> | 107 | <name>name</name> |
107 | <cstring>leaseTime</cstring> | 108 | <cstring>Layout9</cstring> |
108 | </property> | ||
109 | <property stdset="1"> | ||
110 | <name>suffix</name> | ||
111 | <string> hours</string> | ||
112 | </property> | ||
113 | <property stdset="1"> | ||
114 | <name>maxValue</name> | ||
115 | <number>336</number> | ||
116 | </property> | ||
117 | <property stdset="1"> | ||
118 | <name>minValue</name> | ||
119 | <number>1</number> | ||
120 | </property> | ||
121 | <property stdset="1"> | ||
122 | <name>value</name> | ||
123 | <number>24</number> | ||
124 | </property> | 109 | </property> |
110 | <hbox> | ||
111 | <property stdset="1"> | ||
112 | <name>margin</name> | ||
113 | <number>0</number> | ||
114 | </property> | ||
115 | <property stdset="1"> | ||
116 | <name>spacing</name> | ||
117 | <number>6</number> | ||
118 | </property> | ||
119 | <widget> | ||
120 | <class>QCheckBox</class> | ||
121 | <property stdset="1"> | ||
122 | <name>name</name> | ||
123 | <cstring>dhcpCheckBox</cstring> | ||
124 | </property> | ||
125 | <property stdset="1"> | ||
126 | <name>text</name> | ||
127 | <string>DHCP</string> | ||
128 | </property> | ||
129 | <property stdset="1"> | ||
130 | <name>checked</name> | ||
131 | <bool>true</bool> | ||
132 | </property> | ||
133 | </widget> | ||
134 | <widget> | ||
135 | <class>QLabel</class> | ||
136 | <property stdset="1"> | ||
137 | <name>name</name> | ||
138 | <cstring>leaseHoursLabel</cstring> | ||
139 | </property> | ||
140 | <property stdset="1"> | ||
141 | <name>text</name> | ||
142 | <string>Requested Lease</string> | ||
143 | </property> | ||
144 | </widget> | ||
145 | <widget> | ||
146 | <class>QSpinBox</class> | ||
147 | <property stdset="1"> | ||
148 | <name>name</name> | ||
149 | <cstring>leaseTime</cstring> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>suffix</name> | ||
153 | <string> hours</string> | ||
154 | </property> | ||
155 | <property stdset="1"> | ||
156 | <name>maxValue</name> | ||
157 | <number>336</number> | ||
158 | </property> | ||
159 | <property stdset="1"> | ||
160 | <name>minValue</name> | ||
161 | <number>1</number> | ||
162 | </property> | ||
163 | <property stdset="1"> | ||
164 | <name>value</name> | ||
165 | <number>24</number> | ||
166 | </property> | ||
167 | </widget> | ||
168 | </hbox> | ||
125 | </widget> | 169 | </widget> |
126 | <spacer row="6" column="1" > | 170 | <widget> |
127 | <property> | ||
128 | <name>name</name> | ||
129 | <cstring>Spacer9</cstring> | ||
130 | </property> | ||
131 | <property stdset="1"> | ||
132 | <name>orientation</name> | ||
133 | <enum>Vertical</enum> | ||
134 | </property> | ||
135 | <property stdset="1"> | ||
136 | <name>sizeType</name> | ||
137 | <enum>Expanding</enum> | ||
138 | </property> | ||
139 | <property> | ||
140 | <name>sizeHint</name> | ||
141 | <size> | ||
142 | <width>20</width> | ||
143 | <height>20</height> | ||
144 | </size> | ||
145 | </property> | ||
146 | </spacer> | ||
147 | <widget row="5" column="0" rowspan="1" colspan="2" > | ||
148 | <class>QGroupBox</class> | 171 | <class>QGroupBox</class> |
149 | <property stdset="1"> | 172 | <property stdset="1"> |
150 | <name>name</name> | 173 | <name>name</name> |
151 | <cstring>staticGroupBox</cstring> | 174 | <cstring>staticGroupBox</cstring> |
152 | </property> | 175 | </property> |
153 | <property stdset="1"> | 176 | <property stdset="1"> |
154 | <name>enabled</name> | 177 | <name>enabled</name> |
155 | <bool>false</bool> | 178 | <bool>false</bool> |
156 | </property> | 179 | </property> |
157 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>frameShape</name> | ||
182 | <enum>Box</enum> | ||
183 | </property> | ||
184 | <property stdset="1"> | ||
185 | <name>frameShadow</name> | ||
186 | <enum>Sunken</enum> | ||
187 | </property> | ||
188 | <property stdset="1"> | ||
158 | <name>title</name> | 189 | <name>title</name> |
159 | <string>Static Ip Configuration</string> | 190 | <string>Static Ip Configuration</string> |
160 | </property> | 191 | </property> |
161 | <grid> | 192 | <grid> |
162 | <property stdset="1"> | 193 | <property stdset="1"> |
163 | <name>margin</name> | 194 | <name>margin</name> |
164 | <number>11</number> | 195 | <number>11</number> |
165 | </property> | 196 | </property> |
166 | <property stdset="1"> | 197 | <property stdset="1"> |
167 | <name>spacing</name> | 198 | <name>spacing</name> |
168 | <number>6</number> | 199 | <number>6</number> |
169 | </property> | 200 | </property> |
170 | <widget row="3" column="1" > | 201 | <widget row="3" column="1" > |
171 | <class>QLineEdit</class> | 202 | <class>QLineEdit</class> |
172 | <property stdset="1"> | 203 | <property stdset="1"> |
173 | <name>name</name> | 204 | <name>name</name> |
174 | <cstring>firstDNSLineEdit</cstring> | 205 | <cstring>firstDNSLineEdit</cstring> |
175 | </property> | 206 | </property> |
176 | </widget> | 207 | </widget> |
177 | <widget row="1" column="0" > | 208 | <widget row="1" column="0" > |
178 | <class>QLabel</class> | 209 | <class>QLabel</class> |
179 | <property stdset="1"> | 210 | <property stdset="1"> |
180 | <name>name</name> | 211 | <name>name</name> |
181 | <cstring>TextLabel5</cstring> | 212 | <cstring>TextLabel5</cstring> |
182 | </property> | 213 | </property> |
183 | <property stdset="1"> | 214 | <property stdset="1"> |
184 | <name>text</name> | 215 | <name>text</name> |
185 | <string>Subnet Mask</string> | 216 | <string>Subnet Mask</string> |
186 | </property> | 217 | </property> |
187 | </widget> | 218 | </widget> |
188 | <widget row="2" column="1" > | 219 | <widget row="2" column="1" > |
189 | <class>QLineEdit</class> | 220 | <class>QLineEdit</class> |
190 | <property stdset="1"> | 221 | <property stdset="1"> |
191 | <name>name</name> | 222 | <name>name</name> |
192 | <cstring>gatewayEdit</cstring> | 223 | <cstring>gatewayEdit</cstring> |
193 | </property> | 224 | </property> |
194 | </widget> | 225 | </widget> |
195 | <widget row="1" column="1" > | 226 | <widget row="1" column="1" > |
196 | <class>QLineEdit</class> | 227 | <class>QLineEdit</class> |
197 | <property stdset="1"> | 228 | <property stdset="1"> |
198 | <name>name</name> | 229 | <name>name</name> |
199 | <cstring>subnetMaskEdit</cstring> | 230 | <cstring>subnetMaskEdit</cstring> |
200 | </property> | 231 | </property> |
201 | </widget> | 232 | </widget> |
202 | <widget row="0" column="1" > | 233 | <widget row="0" column="1" > |
203 | <class>QLineEdit</class> | 234 | <class>QLineEdit</class> |
204 | <property stdset="1"> | 235 | <property stdset="1"> |
205 | <name>name</name> | 236 | <name>name</name> |
206 | <cstring>ipAddressEdit</cstring> | 237 | <cstring>ipAddressEdit</cstring> |
207 | </property> | 238 | </property> |
208 | </widget> | 239 | </widget> |
209 | <widget row="3" column="0" > | 240 | <widget row="3" column="0" > |
210 | <class>QLabel</class> | 241 | <class>QLabel</class> |
211 | <property stdset="1"> | 242 | <property stdset="1"> |
212 | <name>name</name> | 243 | <name>name</name> |
213 | <cstring>TextLabel2</cstring> | 244 | <cstring>TextLabel2</cstring> |
214 | </property> | 245 | </property> |
215 | <property stdset="1"> | 246 | <property stdset="1"> |
216 | <name>text</name> | 247 | <name>text</name> |
217 | <string>First DNS</string> | 248 | <string>First DNS</string> |
218 | </property> | 249 | </property> |
219 | </widget> | 250 | </widget> |
220 | <widget row="4" column="1" > | 251 | <widget row="4" column="1" > |
221 | <class>QLineEdit</class> | 252 | <class>QLineEdit</class> |
222 | <property stdset="1"> | 253 | <property stdset="1"> |
223 | <name>name</name> | 254 | <name>name</name> |
224 | <cstring>secondDNSLineEdit</cstring> | 255 | <cstring>secondDNSLineEdit</cstring> |
225 | </property> | 256 | </property> |
226 | </widget> | 257 | </widget> |
227 | <widget row="0" column="0" > | 258 | <widget row="0" column="0" > |
228 | <class>QLabel</class> | 259 | <class>QLabel</class> |
229 | <property stdset="1"> | 260 | <property stdset="1"> |
230 | <name>name</name> | 261 | <name>name</name> |
231 | <cstring>TextLabel4</cstring> | 262 | <cstring>TextLabel4</cstring> |
232 | </property> | 263 | </property> |
233 | <property stdset="1"> | 264 | <property stdset="1"> |
234 | <name>text</name> | 265 | <name>text</name> |
235 | <string>IP Address</string> | 266 | <string>IP Address</string> |
236 | </property> | 267 | </property> |
237 | </widget> | 268 | </widget> |
238 | <widget row="2" column="0" > | 269 | <widget row="2" column="0" > |
239 | <class>QLabel</class> | 270 | <class>QLabel</class> |
240 | <property stdset="1"> | 271 | <property stdset="1"> |
241 | <name>name</name> | 272 | <name>name</name> |
242 | <cstring>TextLabel1_2</cstring> | 273 | <cstring>TextLabel1_2</cstring> |
243 | </property> | 274 | </property> |
244 | <property stdset="1"> | 275 | <property stdset="1"> |
245 | <name>text</name> | 276 | <name>text</name> |
246 | <string>Gateway</string> | 277 | <string>Gateway</string> |
247 | </property> | 278 | </property> |
248 | </widget> | 279 | </widget> |
249 | <widget row="4" column="0" > | 280 | <widget row="4" column="0" > |
250 | <class>QLabel</class> | 281 | <class>QLabel</class> |
251 | <property stdset="1"> | 282 | <property stdset="1"> |
252 | <name>name</name> | 283 | <name>name</name> |
253 | <cstring>TextLabel3</cstring> | 284 | <cstring>TextLabel3</cstring> |
254 | </property> | 285 | </property> |
255 | <property stdset="1"> | 286 | <property stdset="1"> |
256 | <name>text</name> | 287 | <name>text</name> |
257 | <string>Second DNS</string> | 288 | <string>Second DNS</string> |
258 | </property> | 289 | </property> |
259 | </widget> | 290 | </widget> |
260 | </grid> | 291 | </grid> |
261 | </widget> | 292 | </widget> |
262 | </grid> | 293 | <spacer> |
294 | <property> | ||
295 | <name>name</name> | ||
296 | <cstring>Spacer9</cstring> | ||
297 | </property> | ||
298 | <property stdset="1"> | ||
299 | <name>orientation</name> | ||
300 | <enum>Vertical</enum> | ||
301 | </property> | ||
302 | <property stdset="1"> | ||
303 | <name>sizeType</name> | ||
304 | <enum>Expanding</enum> | ||
305 | </property> | ||
306 | <property> | ||
307 | <name>sizeHint</name> | ||
308 | <size> | ||
309 | <width>20</width> | ||
310 | <height>20</height> | ||
311 | </size> | ||
312 | </property> | ||
313 | </spacer> | ||
314 | </vbox> | ||
263 | </widget> | 315 | </widget> |
264 | <connections> | 316 | <connections> |
265 | <connection> | 317 | <connection> |
266 | <sender>dhcpCheckBox</sender> | 318 | <sender>dhcpCheckBox</sender> |
267 | <signal>toggled(bool)</signal> | 319 | <signal>toggled(bool)</signal> |
268 | <receiver>leaseHoursLabel</receiver> | 320 | <receiver>leaseHoursLabel</receiver> |
269 | <slot>setEnabled(bool)</slot> | 321 | <slot>setEnabled(bool)</slot> |
270 | </connection> | 322 | </connection> |
271 | <connection> | 323 | <connection> |
272 | <sender>dhcpCheckBox</sender> | 324 | <sender>dhcpCheckBox</sender> |
273 | <signal>toggled(bool)</signal> | 325 | <signal>toggled(bool)</signal> |
274 | <receiver>leaseTime</receiver> | 326 | <receiver>leaseTime</receiver> |
275 | <slot>setEnabled(bool)</slot> | 327 | <slot>setEnabled(bool)</slot> |
276 | </connection> | 328 | </connection> |
277 | <connection> | 329 | <connection> |
278 | <sender>dhcpCheckBox</sender> | 330 | <sender>dhcpCheckBox</sender> |
279 | <signal>toggled(bool)</signal> | 331 | <signal>toggled(bool)</signal> |
280 | <receiver>staticGroupBox</receiver> | 332 | <receiver>staticGroupBox</receiver> |
281 | <slot>setDisabled(bool)</slot> | 333 | <slot>setDisabled(bool)</slot> |
282 | </connection> | 334 | </connection> |
283 | </connections> | 335 | </connections> |
284 | </UI> | 336 | </UI> |
diff --git a/noncore/net/networksetup/mainwindow.ui b/noncore/net/networksetup/mainwindow.ui index c1fa101..a3f7bb1 100644 --- a/noncore/net/networksetup/mainwindow.ui +++ b/noncore/net/networksetup/mainwindow.ui | |||
@@ -1,326 +1,358 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>MainWindow</class> | 2 | <class>MainWindow</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>MainWindow</cstring> | 7 | <cstring>MainWindow</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>218</width> | 14 | <width>217</width> |
15 | <height>289</height> | 15 | <height>289</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Network Setup</string> | 20 | <string>Network Setup</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QTabWidget</class> | 32 | <class>QTabWidget</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>tabWidget</cstring> | 35 | <cstring>tabWidget</cstring> |
36 | </property> | 36 | </property> |
37 | <property> | 37 | <property> |
38 | <name>layoutMargin</name> | 38 | <name>layoutMargin</name> |
39 | </property> | 39 | </property> |
40 | <widget> | 40 | <widget> |
41 | <class>QWidget</class> | 41 | <class>QWidget</class> |
42 | <property stdset="1"> | 42 | <property stdset="1"> |
43 | <name>name</name> | 43 | <name>name</name> |
44 | <cstring>Widget3</cstring> | 44 | <cstring>Widget3</cstring> |
45 | </property> | 45 | </property> |
46 | <attribute> | 46 | <attribute> |
47 | <name>title</name> | 47 | <name>title</name> |
48 | <string>Interfaces</string> | 48 | <string>Interfaces</string> |
49 | </attribute> | 49 | </attribute> |
50 | <vbox> | 50 | <vbox> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>margin</name> | 52 | <name>margin</name> |
53 | <number>0</number> | 53 | <number>0</number> |
54 | </property> | 54 | </property> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>spacing</name> | 56 | <name>spacing</name> |
57 | <number>6</number> | 57 | <number>6</number> |
58 | </property> | 58 | </property> |
59 | <widget> | 59 | <widget> |
60 | <class>QListView</class> | 60 | <class>QListView</class> |
61 | <column> | 61 | <column> |
62 | <property> | 62 | <property> |
63 | <name>text</name> | 63 | <name>text</name> |
64 | <string>i</string> | 64 | <string>i</string> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>clickable</name> | 67 | <name>clickable</name> |
68 | <bool>true</bool> | 68 | <bool>true</bool> |
69 | </property> | 69 | </property> |
70 | <property> | 70 | <property> |
71 | <name>resizeable</name> | 71 | <name>resizeable</name> |
72 | <bool>true</bool> | 72 | <bool>true</bool> |
73 | </property> | 73 | </property> |
74 | </column> | 74 | </column> |
75 | <column> | 75 | <column> |
76 | <property> | 76 | <property> |
77 | <name>text</name> | 77 | <name>text</name> |
78 | <string>t</string> | 78 | <string>t</string> |
79 | </property> | 79 | </property> |
80 | <property> | 80 | <property> |
81 | <name>clickable</name> | 81 | <name>clickable</name> |
82 | <bool>true</bool> | 82 | <bool>true</bool> |
83 | </property> | 83 | </property> |
84 | <property> | 84 | <property> |
85 | <name>resizeable</name> | 85 | <name>resizeable</name> |
86 | <bool>true</bool> | 86 | <bool>true</bool> |
87 | </property> | 87 | </property> |
88 | </column> | 88 | </column> |
89 | <column> | 89 | <column> |
90 | <property> | 90 | <property> |
91 | <name>text</name> | 91 | <name>text</name> |
92 | <string>Name</string> | 92 | <string>Name</string> |
93 | </property> | 93 | </property> |
94 | <property> | 94 | <property> |
95 | <name>clickable</name> | 95 | <name>clickable</name> |
96 | <bool>true</bool> | 96 | <bool>true</bool> |
97 | </property> | 97 | </property> |
98 | <property> | 98 | <property> |
99 | <name>resizeable</name> | 99 | <name>resizeable</name> |
100 | <bool>true</bool> | 100 | <bool>true</bool> |
101 | </property> | 101 | </property> |
102 | </column> | 102 | </column> |
103 | <property stdset="1"> | 103 | <property stdset="1"> |
104 | <name>name</name> | 104 | <name>name</name> |
105 | <cstring>serviceList</cstring> | 105 | <cstring>serviceList</cstring> |
106 | </property> | 106 | </property> |
107 | <property stdset="1"> | 107 | <property stdset="1"> |
108 | <name>allColumnsShowFocus</name> | 108 | <name>allColumnsShowFocus</name> |
109 | <bool>true</bool> | 109 | <bool>true</bool> |
110 | </property> | 110 | </property> |
111 | </widget> | 111 | </widget> |
112 | <widget> | 112 | <widget> |
113 | <class>QLayoutWidget</class> | 113 | <class>QLayoutWidget</class> |
114 | <property stdset="1"> | 114 | <property stdset="1"> |
115 | <name>name</name> | 115 | <name>name</name> |
116 | <cstring>Layout2</cstring> | 116 | <cstring>Layout2</cstring> |
117 | </property> | 117 | </property> |
118 | <property> | 118 | <property> |
119 | <name>layoutMargin</name> | 119 | <name>layoutMargin</name> |
120 | </property> | 120 | </property> |
121 | <grid> | 121 | <grid> |
122 | <property stdset="1"> | 122 | <property stdset="1"> |
123 | <name>margin</name> | 123 | <name>margin</name> |
124 | <number>5</number> | 124 | <number>5</number> |
125 | </property> | 125 | </property> |
126 | <property stdset="1"> | 126 | <property stdset="1"> |
127 | <name>spacing</name> | 127 | <name>spacing</name> |
128 | <number>6</number> | 128 | <number>6</number> |
129 | </property> | 129 | </property> |
130 | <widget row="1" column="0" > | 130 | <widget row="1" column="0" > |
131 | <class>QPushButton</class> | 131 | <class>QPushButton</class> |
132 | <property stdset="1"> | 132 | <property stdset="1"> |
133 | <name>name</name> | 133 | <name>name</name> |
134 | <cstring>addServiceButton</cstring> | 134 | <cstring>addServiceButton</cstring> |
135 | </property> | 135 | </property> |
136 | <property stdset="1"> | 136 | <property stdset="1"> |
137 | <name>text</name> | 137 | <name>text</name> |
138 | <string>&Add</string> | 138 | <string>&Add</string> |
139 | </property> | 139 | </property> |
140 | </widget> | 140 | </widget> |
141 | <widget row="0" column="0" > | 141 | <widget row="0" column="0" > |
142 | <class>QPushButton</class> | 142 | <class>QPushButton</class> |
143 | <property stdset="1"> | 143 | <property stdset="1"> |
144 | <name>name</name> | 144 | <name>name</name> |
145 | <cstring>informationServiceButton</cstring> | 145 | <cstring>informationServiceButton</cstring> |
146 | </property> | 146 | </property> |
147 | <property stdset="1"> | 147 | <property stdset="1"> |
148 | <name>text</name> | 148 | <name>text</name> |
149 | <string>&Information</string> | 149 | <string>&Information</string> |
150 | </property> | 150 | </property> |
151 | </widget> | 151 | </widget> |
152 | <widget row="0" column="1" > | 152 | <widget row="0" column="1" > |
153 | <class>QPushButton</class> | 153 | <class>QPushButton</class> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>name</name> | 155 | <name>name</name> |
156 | <cstring>configureServiceButton</cstring> | 156 | <cstring>configureServiceButton</cstring> |
157 | </property> | 157 | </property> |
158 | <property stdset="1"> | 158 | <property stdset="1"> |
159 | <name>text</name> | 159 | <name>text</name> |
160 | <string>&Configure</string> | 160 | <string>&Configure</string> |
161 | </property> | 161 | </property> |
162 | </widget> | 162 | </widget> |
163 | <widget row="1" column="1" > | 163 | <widget row="1" column="1" > |
164 | <class>QPushButton</class> | 164 | <class>QPushButton</class> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>name</name> | 166 | <name>name</name> |
167 | <cstring>removeServiceButton</cstring> | 167 | <cstring>removeServiceButton</cstring> |
168 | </property> | 168 | </property> |
169 | <property stdset="1"> | 169 | <property stdset="1"> |
170 | <name>text</name> | 170 | <name>text</name> |
171 | <string>&Remove</string> | 171 | <string>&Remove</string> |
172 | </property> | 172 | </property> |
173 | </widget> | 173 | </widget> |
174 | </grid> | 174 | </grid> |
175 | </widget> | 175 | </widget> |
176 | </vbox> | 176 | </vbox> |
177 | </widget> | 177 | </widget> |
178 | <widget> | 178 | <widget> |
179 | <class>QWidget</class> | 179 | <class>QWidget</class> |
180 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>name</name> | 181 | <name>name</name> |
182 | <cstring>tab</cstring> | 182 | <cstring>tab</cstring> |
183 | </property> | 183 | </property> |
184 | <attribute> | 184 | <attribute> |
185 | <name>title</name> | 185 | <name>title</name> |
186 | <string>Profiles</string> | 186 | <string>Profiles</string> |
187 | </attribute> | 187 | </attribute> |
188 | <grid> | 188 | <grid> |
189 | <property stdset="1"> | 189 | <property stdset="1"> |
190 | <name>margin</name> | 190 | <name>margin</name> |
191 | <number>11</number> | 191 | <number>11</number> |
192 | </property> | 192 | </property> |
193 | <property stdset="1"> | 193 | <property stdset="1"> |
194 | <name>spacing</name> | 194 | <name>spacing</name> |
195 | <number>6</number> | 195 | <number>6</number> |
196 | </property> | 196 | </property> |
197 | <widget row="0" column="0" rowspan="1" colspan="2" > | 197 | <widget row="1" column="0" rowspan="1" colspan="3" > |
198 | <class>Line</class> | ||
199 | <property stdset="1"> | ||
200 | <name>name</name> | ||
201 | <cstring>Line1</cstring> | ||
202 | </property> | ||
203 | <property stdset="1"> | ||
204 | <name>orientation</name> | ||
205 | <enum>Horizontal</enum> | ||
206 | </property> | ||
207 | </widget> | ||
208 | <widget row="0" column="0" > | ||
198 | <class>QLabel</class> | 209 | <class>QLabel</class> |
199 | <property stdset="1"> | 210 | <property stdset="1"> |
200 | <name>name</name> | 211 | <name>name</name> |
201 | <cstring>TextLabel1</cstring> | 212 | <cstring>TextLabel1</cstring> |
202 | </property> | 213 | </property> |
203 | <property stdset="1"> | 214 | <property stdset="1"> |
204 | <name>text</name> | 215 | <name>text</name> |
205 | <string>Current Profile</string> | 216 | <string>Current Profile</string> |
206 | </property> | 217 | </property> |
207 | </widget> | 218 | </widget> |
208 | <widget row="0" column="2" > | 219 | <widget row="0" column="1" > |
209 | <class>QLabel</class> | 220 | <class>QLabel</class> |
210 | <property stdset="1"> | 221 | <property stdset="1"> |
211 | <name>name</name> | 222 | <name>name</name> |
212 | <cstring>currentProfileLabel</cstring> | 223 | <cstring>currentProfileLabel</cstring> |
213 | </property> | 224 | </property> |
214 | <property stdset="1"> | 225 | <property stdset="1"> |
215 | <name>frameShape</name> | 226 | <name>frameShape</name> |
216 | <enum>Panel</enum> | 227 | <enum>Panel</enum> |
217 | </property> | 228 | </property> |
218 | <property stdset="1"> | 229 | <property stdset="1"> |
219 | <name>frameShadow</name> | 230 | <name>frameShadow</name> |
220 | <enum>Sunken</enum> | 231 | <enum>Sunken</enum> |
221 | </property> | 232 | </property> |
222 | <property stdset="1"> | 233 | <property stdset="1"> |
223 | <name>text</name> | 234 | <name>text</name> |
224 | <string>All</string> | 235 | <string>All</string> |
225 | </property> | 236 | </property> |
226 | </widget> | 237 | </widget> |
227 | <widget row="1" column="0" > | 238 | <spacer row="0" column="2" > |
228 | <class>QLabel</class> | 239 | <property> |
229 | <property stdset="1"> | ||
230 | <name>name</name> | 240 | <name>name</name> |
231 | <cstring>TextLabel1_2</cstring> | 241 | <cstring>Spacer2</cstring> |
232 | </property> | 242 | </property> |
233 | <property stdset="1"> | 243 | <property stdset="1"> |
234 | <name>text</name> | 244 | <name>orientation</name> |
235 | <string>Profiles</string> | 245 | <enum>Horizontal</enum> |
246 | </property> | ||
247 | <property stdset="1"> | ||
248 | <name>sizeType</name> | ||
249 | <enum>Expanding</enum> | ||
236 | </property> | 250 | </property> |
237 | </widget> | 251 | <property> |
238 | <spacer row="5" column="2" > | 252 | <name>sizeHint</name> |
253 | <size> | ||
254 | <width>20</width> | ||
255 | <height>20</height> | ||
256 | </size> | ||
257 | </property> | ||
258 | </spacer> | ||
259 | <spacer row="6" column="2" > | ||
239 | <property> | 260 | <property> |
240 | <name>name</name> | 261 | <name>name</name> |
241 | <cstring>Spacer16</cstring> | 262 | <cstring>Spacer16</cstring> |
242 | </property> | 263 | </property> |
243 | <property stdset="1"> | 264 | <property stdset="1"> |
244 | <name>orientation</name> | 265 | <name>orientation</name> |
245 | <enum>Vertical</enum> | 266 | <enum>Vertical</enum> |
246 | </property> | 267 | </property> |
247 | <property stdset="1"> | 268 | <property stdset="1"> |
248 | <name>sizeType</name> | 269 | <name>sizeType</name> |
249 | <enum>Expanding</enum> | 270 | <enum>Expanding</enum> |
250 | </property> | 271 | </property> |
251 | <property> | 272 | <property> |
252 | <name>sizeHint</name> | 273 | <name>sizeHint</name> |
253 | <size> | 274 | <size> |
254 | <width>20</width> | 275 | <width>20</width> |
255 | <height>20</height> | 276 | <height>20</height> |
256 | </size> | 277 | </size> |
257 | </property> | 278 | </property> |
258 | </spacer> | 279 | </spacer> |
259 | <widget row="2" column="0" rowspan="3" colspan="1" > | 280 | <widget row="5" column="2" > |
260 | <class>QListBox</class> | ||
261 | <property stdset="1"> | ||
262 | <name>name</name> | ||
263 | <cstring>profilesList</cstring> | ||
264 | </property> | ||
265 | </widget> | ||
266 | <widget row="4" column="1" rowspan="1" colspan="2" > | ||
267 | <class>QPushButton</class> | 281 | <class>QPushButton</class> |
268 | <property stdset="1"> | 282 | <property stdset="1"> |
269 | <name>name</name> | 283 | <name>name</name> |
270 | <cstring>PushButton7</cstring> | 284 | <cstring>PushButton7</cstring> |
271 | </property> | 285 | </property> |
272 | <property stdset="1"> | 286 | <property stdset="1"> |
273 | <name>text</name> | 287 | <name>text</name> |
274 | <string>&Set Current</string> | 288 | <string>&Set Current</string> |
275 | </property> | 289 | </property> |
276 | </widget> | 290 | </widget> |
277 | <widget row="3" column="1" rowspan="1" colspan="2" > | 291 | <widget row="4" column="2" > |
278 | <class>QPushButton</class> | 292 | <class>QPushButton</class> |
279 | <property stdset="1"> | 293 | <property stdset="1"> |
280 | <name>name</name> | 294 | <name>name</name> |
281 | <cstring>removeProfileButton</cstring> | 295 | <cstring>removeProfileButton</cstring> |
282 | </property> | 296 | </property> |
283 | <property stdset="1"> | 297 | <property stdset="1"> |
284 | <name>text</name> | 298 | <name>text</name> |
285 | <string>&Remove</string> | 299 | <string>&Remove</string> |
286 | </property> | 300 | </property> |
287 | </widget> | 301 | </widget> |
288 | <widget row="2" column="1" rowspan="1" colspan="2" > | 302 | <widget row="3" column="2" > |
289 | <class>QPushButton</class> | 303 | <class>QPushButton</class> |
290 | <property stdset="1"> | 304 | <property stdset="1"> |
291 | <name>name</name> | 305 | <name>name</name> |
292 | <cstring>newProfileButton</cstring> | 306 | <cstring>newProfileButton</cstring> |
293 | </property> | 307 | </property> |
294 | <property stdset="1"> | 308 | <property stdset="1"> |
295 | <name>text</name> | 309 | <name>text</name> |
296 | <string>&New</string> | 310 | <string>&New</string> |
297 | </property> | 311 | </property> |
298 | </widget> | 312 | </widget> |
313 | <widget row="2" column="0" > | ||
314 | <class>QLabel</class> | ||
315 | <property stdset="1"> | ||
316 | <name>name</name> | ||
317 | <cstring>TextLabel1_2</cstring> | ||
318 | </property> | ||
319 | <property stdset="1"> | ||
320 | <name>text</name> | ||
321 | <string>Profiles</string> | ||
322 | </property> | ||
323 | </widget> | ||
324 | <widget row="3" column="0" rowspan="3" colspan="2" > | ||
325 | <class>QListBox</class> | ||
326 | <property stdset="1"> | ||
327 | <name>name</name> | ||
328 | <cstring>profilesList</cstring> | ||
329 | </property> | ||
330 | </widget> | ||
299 | </grid> | 331 | </grid> |
300 | </widget> | 332 | </widget> |
301 | </widget> | 333 | </widget> |
302 | </vbox> | 334 | </vbox> |
303 | </widget> | 335 | </widget> |
304 | <customwidgets> | 336 | <customwidgets> |
305 | <customwidget> | 337 | <customwidget> |
306 | <class>QWidget</class> | 338 | <class>QWidget</class> |
307 | <header location="local">qwidget.h</header> | 339 | <header location="local">qwidget.h</header> |
308 | <sizehint> | 340 | <sizehint> |
309 | <width>100</width> | 341 | <width>100</width> |
310 | <height>100</height> | 342 | <height>100</height> |
311 | </sizehint> | 343 | </sizehint> |
312 | <container>0</container> | 344 | <container>0</container> |
313 | <sizepolicy> | 345 | <sizepolicy> |
314 | <hordata>7</hordata> | 346 | <hordata>7</hordata> |
315 | <verdata>7</verdata> | 347 | <verdata>7</verdata> |
316 | </sizepolicy> | 348 | </sizepolicy> |
317 | <pixmap>image0</pixmap> | 349 | <pixmap>image0</pixmap> |
318 | </customwidget> | 350 | </customwidget> |
319 | </customwidgets> | 351 | </customwidgets> |
320 | <images> | 352 | <images> |
321 | <image> | 353 | <image> |
322 | <name>image0</name> | 354 | <name>image0</name> |
323 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | 355 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> |
324 | </image> | 356 | </image> |
325 | </images> | 357 | </images> |
326 | </UI> | 358 | </UI> |
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 0f48a4b..89dac6f 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp | |||
@@ -1,363 +1,396 @@ | |||
1 | #include "mainwindowimp.h" | 1 | #include "mainwindowimp.h" |
2 | #include "addserviceimp.h" | 2 | #include "addserviceimp.h" |
3 | #include "interfaceinformationimp.h" | 3 | #include "interfaceinformationimp.h" |
4 | #include "interfacesetupimp.h" | 4 | #include "interfacesetupimp.h" |
5 | #include "kprocess.h" | 5 | #include "kprocess.h" |
6 | #include "module.h" | 6 | #include "module.h" |
7 | 7 | ||
8 | 8 | ||
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qtabwidget.h> | 10 | #include <qtabwidget.h> |
11 | #include <qlistbox.h> | 11 | #include <qlistbox.h> |
12 | #include <qlistview.h> | 12 | #include <qlistview.h> |
13 | #include <qheader.h> | 13 | #include <qheader.h> |
14 | #include <qlabel.h> | 14 | #include <qlabel.h> |
15 | 15 | ||
16 | #include <qmainwindow.h> | 16 | #include <qmainwindow.h> |
17 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #include <qpe/qlibrary.h> | 20 | #include <qpe/qlibrary.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | #include <qlist.h> | 23 | #include <qlist.h> |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <qfile.h> | 25 | #include <qfile.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | 27 | ||
28 | // For library loading. | 28 | // For library loading. |
29 | #include <dlfcn.h> | 29 | #include <dlfcn.h> |
30 | 30 | ||
31 | #define TEMP_ALL "/tmp/ifconfig-a" | 31 | #define TEMP_ALL "/tmp/ifconfig-a" |
32 | #define TEMP_UP "/tmp/ifconfig" | 32 | #define TEMP_UP "/tmp/ifconfig" |
33 | 33 | ||
34 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { | 34 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { |
35 | connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 35 | connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
36 | connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 36 | connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
37 | connect(informationServiceButton, SIGNAL(clicked()), this, SLOT(informationClicked())); | 37 | connect(informationServiceButton, SIGNAL(clicked()), this, SLOT(informationClicked())); |
38 | connect(configureServiceButton, SIGNAL(clicked()), this, SLOT(configureClicked())); | 38 | connect(configureServiceButton, SIGNAL(clicked()), this, SLOT(configureClicked())); |
39 | 39 | ||
40 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); | 40 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); |
41 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); | 41 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); |
42 | connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&))); | 42 | connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&))); |
43 | 43 | ||
44 | // Make sure we have a plugin directory to scan. | 44 | // Make sure we have a plugin directory to scan. |
45 | QString DirStr = QDir::homeDirPath() + "/.networksetup/" ; | 45 | QString DirStr = QDir::homeDirPath() + "/.networksetup/" ; |
46 | QDir pluginDir( DirStr ); | 46 | QDir pluginDir( DirStr ); |
47 | pluginDir.mkdir( DirStr ); | 47 | pluginDir.mkdir( DirStr ); |
48 | pluginDir.mkdir( ( DirStr + "plugins/" ) ); | 48 | pluginDir.mkdir( ( DirStr + "plugins/" ) ); |
49 | QString path = DirStr + "plugins"; | 49 | QString path = DirStr + "plugins"; |
50 | pluginDir.setPath(path); | 50 | pluginDir.setPath(path); |
51 | if(!pluginDir.exists()){ | 51 | if(!pluginDir.exists()){ |
52 | qDebug(QString("MainWindowImp: ERROR: %1 %2").arg(__FILE__).arg(__LINE__).latin1()); | 52 | qDebug(QString("MainWindowImp: ERROR: %1 %2").arg(__FILE__).arg(__LINE__).latin1()); |
53 | return; | 53 | return; |
54 | } | 54 | } |
55 | 55 | ||
56 | // Load any saved services. | 56 | // Load any saved services. |
57 | loadModules(path); | 57 | loadModules(path); |
58 | getInterfaceList(); | 58 | getInterfaceList(); |
59 | serviceList->header()->hide(); | 59 | serviceList->header()->hide(); |
60 | 60 | ||
61 | 61 | ||
62 | Config cfg("NetworkSetup"); | 62 | Config cfg("NetworkSetup"); |
63 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); | 63 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); |
64 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 64 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
65 | profilesList->insertItem((*it)); | 65 | profilesList->insertItem((*it)); |
66 | } | 66 | } |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Deconstructor. Unload libraries and save profile list. | 69 | * Deconstructor. Unload libraries and save profile list. |
70 | */ | 70 | */ |
71 | MainWindowImp::~MainWindowImp(){ | 71 | MainWindowImp::~MainWindowImp(){ |
72 | if(profiles.count() > 1){ | 72 | if(profiles.count() > 1){ |
73 | Config cfg("NetworkSetup"); | 73 | Config cfg("NetworkSetup"); |
74 | cfg.writeEntry("Profiles", profiles.join(" ")); | 74 | cfg.writeEntry("Profiles", profiles.join(" ")); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | void MainWindowImp::loadModules(QString path){ | 78 | void MainWindowImp::loadModules(QString path){ |
79 | qDebug(path.latin1()); | 79 | qDebug(path.latin1()); |
80 | QDir d; | 80 | QDir d; |
81 | d.setPath(path); | 81 | d.setPath(path); |
82 | if(!d.exists()){ | 82 | if(!d.exists()){ |
83 | qDebug("MainWindowImp:: Path doesn't exists"); | 83 | qDebug("MainWindowImp:: Path doesn't exists"); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 86 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
87 | const QFileInfoList *list = d.entryInfoList(); | 87 | const QFileInfoList *list = d.entryInfoList(); |
88 | QFileInfoListIterator it( *list ); | 88 | QFileInfoListIterator it( *list ); |
89 | QFileInfo *fi; | 89 | QFileInfo *fi; |
90 | while ( (fi=it.current()) ) { | 90 | while ( (fi=it.current()) ) { |
91 | if(fi->fileName().contains(".so")){ | 91 | if(fi->fileName().contains(".so")){ |
92 | qDebug("Found"); | 92 | qDebug("Found"); |
93 | Module *foo = loadPlugin(path + "/" + fi->fileName()); | 93 | Module *foo = loadPlugin(path + "/" + fi->fileName()); |
94 | } | 94 | } |
95 | ++it; | 95 | ++it; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Attempt to load a function and resolve a function. | 100 | * Attempt to load a function and resolve a function. |
101 | * @param pluginFileName - the name of the file in which to attempt to load | 101 | * @param pluginFileName - the name of the file in which to attempt to load |
102 | * @param resolveString - function pointer to resolve | 102 | * @param resolveString - function pointer to resolve |
103 | * @return pointer to the function with name resolveString or NULL | 103 | * @return pointer to the function with name resolveString or NULL |
104 | */ | 104 | */ |
105 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ | 105 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ |
106 | qDebug(pluginFileName.latin1()); | 106 | qDebug(pluginFileName.latin1()); |
107 | QLibrary *lib = new QLibrary(pluginFileName); | 107 | QLibrary *lib = new QLibrary(pluginFileName); |
108 | void *functionPointer = lib->resolve(resolveString); | 108 | void *functionPointer = lib->resolve(resolveString); |
109 | if( !functionPointer ){ | 109 | if( !functionPointer ){ |
110 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 110 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); |
111 | delete lib; | 111 | delete lib; |
112 | return NULL; | 112 | return NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | // Try to get an object. | 115 | // Try to get an object. |
116 | Module *object = ((Module* (*)()) functionPointer)(); | 116 | Module *object = ((Module* (*)()) functionPointer)(); |
117 | if(object == NULL){ | 117 | if(object == NULL){ |
118 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 118 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
119 | delete lib; | 119 | delete lib; |
120 | return NULL; | 120 | return NULL; |
121 | } | 121 | } |
122 | 122 | ||
123 | // Store for reference | 123 | // Store for reference |
124 | libraries.insert(object, lib); | 124 | libraries.insert(object, lib); |
125 | return object; | 125 | return object; |
126 | } | 126 | } |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 129 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
130 | * load the plugin and append it to the list | 130 | * load the plugin and append it to the list |
131 | */ | 131 | */ |
132 | void MainWindowImp::addClicked(){ | 132 | void MainWindowImp::addClicked(){ |
133 | // Now that we have a list of all of the protocals, list them. | 133 | // Now that we have a list of all of the protocals, list them. |
134 | { | 134 | { |
135 | QMessageBox::information(this, "No Modules", "Nothing to add.", "Ok"); | 135 | QMessageBox::information(this, "No Modules", "Nothing to add.", "Ok"); |
136 | return; | 136 | return; |
137 | } | 137 | } |
138 | AddServiceImp service(this, "AddService", true); | 138 | AddServiceImp service(this, "AddService", true); |
139 | service.showMaximized(); | 139 | service.showMaximized(); |
140 | service.exec(); | 140 | service.exec(); |
141 | } | 141 | } |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Prompt the user to see if they really want to do this. | 144 | * Prompt the user to see if they really want to do this. |
145 | * If they do then remove from the list and unload. | 145 | * If they do then remove from the list and unload. |
146 | */ | 146 | */ |
147 | void MainWindowImp::removeClicked(){ | 147 | void MainWindowImp::removeClicked(){ |
148 | QListViewItem *item = serviceList->currentItem(); | 148 | QListViewItem *item = serviceList->currentItem(); |
149 | if(item == NULL) { | 149 | if(item == NULL) { |
150 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 150 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
151 | return; | 151 | return; |
152 | } | 152 | } |
153 | 153 | ||
154 | if(modules.find(interfaceItems[item]) == modules.end()){ | 154 | if((interfaceItems[item])->getModuleOwner() == NULL){ |
155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); | 155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); |
156 | } | 156 | } |
157 | else{ | 157 | else{ |
158 | // Try to remove. | 158 | // Try to remove. |
159 | } | 159 | } |
160 | 160 | ||
161 | } | 161 | } |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * See if there is a configuration for the selected protocal. | 164 | * See if there is a configuration for the selected protocal. |
165 | * Prompt with errors. | 165 | * Prompt with errors. |
166 | */ | 166 | */ |
167 | void MainWindowImp::configureClicked(){ | 167 | void MainWindowImp::configureClicked(){ |
168 | QListViewItem *item = serviceList->currentItem(); | 168 | QListViewItem *item = serviceList->currentItem(); |
169 | if(item == NULL){ | 169 | if(item == NULL){ |
170 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 170 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | 173 | ||
174 | if(modules.find(interfaceItems[item]) == modules.end()){ | 174 | if((interfaceItems[item])->getModuleOwner() == NULL){ |
175 | InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); | 175 | InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); |
176 | conf->showMaximized(); | 176 | conf->showMaximized(); |
177 | conf->show(); | 177 | conf->show(); |
178 | } | 178 | } |
179 | else{ | 179 | else{ |
180 | InterfaceSetupImp *conf = new InterfaceSetupImp(this, "InterfaceConfiguration"); | 180 | QTabWidget *t = NULL; |
181 | conf->show(); | 181 | QWidget *conf = (interfaceItems[item])->getModuleOwner()->configure(&t); |
182 | if(conf != NULL){ | ||
183 | qDebug("Conf found"); | ||
184 | if(t != NULL){ | ||
185 | qDebug("Adding Interface"); | ||
186 | InterfaceSetupImp *i = new InterfaceSetupImp(t, "TCPIPInformation", interfaceItems[item], true); | ||
187 | t->insertTab(i, "TCP/IP"); | ||
188 | } | ||
189 | conf->showMaximized(); | ||
190 | conf->show(); | ||
191 | } | ||
192 | else{ | ||
193 | InterfaceSetupImp *i = new InterfaceSetupImp(0, "TCPIPInformation", interfaceItems[item], true); | ||
194 | i->showMaximized(); | ||
195 | i->show(); | ||
196 | } | ||
182 | } | 197 | } |
183 | } | 198 | } |
184 | 199 | ||
185 | /** | 200 | /** |
186 | * Pull up the information about the selected interface | 201 | * Pull up the information about the selected interface |
187 | * Report an error | 202 | * Report an error |
188 | */ | 203 | */ |
189 | void MainWindowImp::informationClicked(){ | 204 | void MainWindowImp::informationClicked(){ |
190 | QListViewItem *item = serviceList->currentItem(); | 205 | QListViewItem *item = serviceList->currentItem(); |
191 | if(item == NULL){ | 206 | if(item == NULL){ |
192 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 207 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
193 | return; | 208 | return; |
194 | } | 209 | } |
195 | 210 | ||
196 | if(modules.find(interfaceItems[item]) == modules.end()){ | 211 | if( (interfaceItems[item])->getModuleOwner() == NULL){ |
197 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); | 212 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); |
198 | i->showMaximized(); | 213 | i->showMaximized(); |
199 | i->show(); | 214 | i->show(); |
200 | } | 215 | } |
201 | else{ | 216 | else{ |
202 | QTabWidget *t = new QTabWidget(this, "InterfaceInformationTAB"); | 217 | QTabWidget *t = NULL; |
203 | InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true); | 218 | QWidget *conf = (interfaceItems[item])->getModuleOwner()->information(&t); |
204 | t->insertTab(i, "TCP/IP"); | 219 | if(conf != NULL){ |
205 | t->show(); | 220 | if(t){ |
221 | qDebug("Adding Interface"); | ||
222 | InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true); | ||
223 | t->insertTab(i, "TCP/IP"); | ||
224 | } | ||
225 | conf->showMaximized(); | ||
226 | conf->show(); | ||
227 | } | ||
228 | else{ | ||
229 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true); | ||
230 | i->showMaximized(); | ||
231 | i->show(); | ||
232 | } | ||
206 | } | 233 | } |
207 | } | 234 | } |
208 | 235 | ||
209 | /** | 236 | /** |
210 | * Aquire the list of active interfaces from ifconfig | 237 | * Aquire the list of active interfaces from ifconfig |
211 | * Call ifconfig and ifconfig -a | 238 | * Call ifconfig and ifconfig -a |
212 | */ | 239 | */ |
213 | void MainWindowImp::getInterfaceList(){ | 240 | void MainWindowImp::getInterfaceList(){ |
214 | KShellProcess *processAll = new KShellProcess(); | 241 | KShellProcess *processAll = new KShellProcess(); |
215 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; | 242 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; |
216 | connect(processAll, SIGNAL(processExited(KProcess *)), | 243 | connect(processAll, SIGNAL(processExited(KProcess *)), |
217 | this, SLOT(jobDone(KProcess *))); | 244 | this, SLOT(jobDone(KProcess *))); |
218 | threads.insert(processAll, TEMP_ALL); | 245 | threads.insert(processAll, TEMP_ALL); |
219 | processAll->start(KShellProcess::NotifyOnExit); | 246 | processAll->start(KShellProcess::NotifyOnExit); |
220 | 247 | ||
221 | KShellProcess *process = new KShellProcess(); | 248 | KShellProcess *process = new KShellProcess(); |
222 | *process << "/sbin/ifconfig" << " > " TEMP_UP; | 249 | *process << "/sbin/ifconfig" << " > " TEMP_UP; |
223 | connect(process, SIGNAL(processExited(KProcess *)), | 250 | connect(process, SIGNAL(processExited(KProcess *)), |
224 | this, SLOT(jobDone(KProcess *))); | 251 | this, SLOT(jobDone(KProcess *))); |
225 | threads.insert(process, TEMP_UP); | 252 | threads.insert(process, TEMP_UP); |
226 | process->start(KShellProcess::NotifyOnExit); | 253 | process->start(KShellProcess::NotifyOnExit); |
227 | } | 254 | } |
228 | 255 | ||
229 | void MainWindowImp::jobDone(KProcess *process){ | 256 | void MainWindowImp::jobDone(KProcess *process){ |
230 | QString fileName = threads[process]; | 257 | QString fileName = threads[process]; |
231 | threads.remove(process); | 258 | threads.remove(process); |
232 | delete process; | 259 | delete process; |
233 | 260 | ||
234 | QFile file(fileName); | 261 | QFile file(fileName); |
235 | if (!file.open(IO_ReadOnly)){ | 262 | if (!file.open(IO_ReadOnly)){ |
236 | qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1()); | 263 | qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1()); |
237 | return; | 264 | return; |
238 | } | 265 | } |
239 | 266 | ||
240 | QTextStream stream( &file ); | 267 | QTextStream stream( &file ); |
241 | QString line; | 268 | QString line; |
242 | while ( !stream.eof() ) { | 269 | while ( !stream.eof() ) { |
243 | line = stream.readLine(); | 270 | line = stream.readLine(); |
244 | int space = line.find(" "); | 271 | int space = line.find(" "); |
245 | if(space > 1){ | 272 | if(space > 1){ |
246 | // We have found an interface | 273 | // We have found an interface |
247 | QString interfaceName = line.mid(0, space); | 274 | QString interfaceName = line.mid(0, space); |
248 | Interface *i; | 275 | Interface *i; |
249 | // See if we already have it | 276 | // See if we already have it |
250 | if(interfaceNames.find(interfaceName) == interfaceNames.end()){ | 277 | if(interfaceNames.find(interfaceName) == interfaceNames.end()){ |
251 | if(fileName == TEMP_ALL) | 278 | if(fileName == TEMP_ALL) |
252 | i = new Interface(interfaceName, false); | 279 | i = new Interface(interfaceName, false); |
253 | else | 280 | else |
254 | i = new Interface(interfaceName, true); | 281 | i = new Interface(interfaceName, true); |
255 | } | 282 | } |
256 | else{ | 283 | else{ |
257 | i = interfaceNames[interfaceName]; | 284 | i = interfaceNames[interfaceName]; |
258 | if(fileName != TEMP_ALL) | 285 | if(fileName != TEMP_ALL) |
259 | i->setStatus(true); | 286 | i->setStatus(true); |
260 | } | 287 | } |
261 | 288 | ||
262 | i->setAttached(true); | 289 | i->setAttached(true); |
263 | i->setInterfaceName(interfaceName); | 290 | i->setInterfaceName(interfaceName); |
264 | 291 | ||
265 | QString hardName = "Ethernet"; | 292 | QString hardName = "Ethernet"; |
266 | int hardwareName = line.find("Link encap:"); | 293 | int hardwareName = line.find("Link encap:"); |
267 | int macAddress = line.find("HWaddr"); | 294 | int macAddress = line.find("HWaddr"); |
268 | if(macAddress == -1) | 295 | if(macAddress == -1) |
269 | macAddress = line.length(); | 296 | macAddress = line.length(); |
270 | if(hardwareName != -1) | 297 | if(hardwareName != -1) |
271 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); | 298 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); |
272 | // We have found an interface | 299 | // We have found an interface |
273 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); | 300 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); |
274 | interfaceNames.insert(i->getInterfaceName(), i); | 301 | interfaceNames.insert(i->getInterfaceName(), i); |
275 | updateInterface(i); | 302 | updateInterface(i); |
276 | } | 303 | } |
277 | } | 304 | } |
278 | file.close(); | 305 | file.close(); |
279 | QFile::remove(fileName); | 306 | QFile::remove(fileName); |
280 | } | 307 | } |
281 | 308 | ||
282 | void MainWindowImp::updateInterface(Interface *i){ | 309 | void MainWindowImp::updateInterface(Interface *i){ |
283 | QListViewItem *item = NULL; | 310 | QListViewItem *item = NULL; |
284 | 311 | ||
285 | // See if we already have it | 312 | // See if we already have it |
286 | if(items.find(i) == items.end()){ | 313 | if(items.find(i) == items.end()){ |
287 | item = new QListViewItem(serviceList, "", "", ""); | 314 | item = new QListViewItem(serviceList, "", "", ""); |
288 | // See if you can't find a module owner for this interface | 315 | // See if you can't find a module owner for this interface |
289 | //EmployeeMap::Iterator it; | 316 | QMap<Module*, QLibrary*>::Iterator it; |
290 | //for( it = map.begin(); it != map.end(); ++it ) | 317 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
291 | // printf( "%s, %s earns %d\n", it.key().latin1(), it.data().name().latin1(), it.data().salary() ); | 318 | if(it.key()->isOwner(i)) |
292 | 319 | i->setModuleOwner(it.key()); | |
320 | } | ||
321 | |||
293 | items.insert(i, item); | 322 | items.insert(i, item); |
294 | interfaceItems.insert(item, i); | 323 | interfaceItems.insert(item, i); |
295 | } | 324 | } |
296 | else | 325 | else |
297 | item = items[i]; | 326 | item = items[i]; |
298 | 327 | ||
299 | QString statusImage = "down"; | 328 | QString statusImage = "down"; |
300 | if(i->getStatus()) | 329 | if(i->getStatus()) |
301 | statusImage = "up"; | 330 | statusImage = "up"; |
302 | QPixmap status = (Resource::loadPixmap(statusImage)); | 331 | QPixmap status = (Resource::loadPixmap(statusImage)); |
303 | item->setPixmap(0, status); | 332 | item->setPixmap(0, status); |
304 | 333 | ||
305 | QString typeName = "lan"; | 334 | QString typeName = "lan"; |
306 | if(i->getHardwareName().contains("Local Loopback")) | 335 | if(i->getHardwareName().contains("Local Loopback")) |
307 | typeName = "lo"; | 336 | typeName = "lo"; |
308 | if(i->getInterfaceName().contains("irda")) | 337 | if(i->getInterfaceName().contains("irda")) |
309 | typeName = "irda"; | 338 | typeName = "irda"; |
310 | if(i->getInterfaceName().contains("wlan")) | 339 | if(i->getInterfaceName().contains("wlan")) |
311 | typeName = "wlan"; | 340 | typeName = "wlan"; |
341 | // Actually try to use the Module | ||
342 | if(i->getModuleOwner() != NULL){ | ||
343 | typeName = i->getModuleOwner()->getPixmapName(i); | ||
344 | } | ||
312 | QPixmap type = (Resource::loadPixmap(typeName)); | 345 | QPixmap type = (Resource::loadPixmap(typeName)); |
313 | item->setPixmap(1, type); | 346 | item->setPixmap(1, type); |
314 | 347 | ||
315 | item->setText(2, i->getHardwareName()); | 348 | item->setText(2, i->getHardwareName()); |
316 | 349 | ||
317 | } | 350 | } |
318 | 351 | ||
319 | /** | 352 | /** |
320 | * Adds a new profile to the list of profiles. | 353 | * Adds a new profile to the list of profiles. |
321 | * Don't add profiles that already exists. | 354 | * Don't add profiles that already exists. |
322 | * Appends to the combo and QStringList | 355 | * Appends to the combo and QStringList |
323 | */ | 356 | */ |
324 | void MainWindowImp::addProfile(){ | 357 | void MainWindowImp::addProfile(){ |
325 | QString newProfileName = "New"; | 358 | QString newProfileName = "New"; |
326 | if(profiles.grep(newProfileName).count() > 0){ | 359 | if(profiles.grep(newProfileName).count() > 0){ |
327 | QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok"); | 360 | QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok"); |
328 | return; | 361 | return; |
329 | } | 362 | } |
330 | profiles.append(newProfileName); | 363 | profiles.append(newProfileName); |
331 | profilesList->insertItem(newProfileName); | 364 | profilesList->insertItem(newProfileName); |
332 | 365 | ||
333 | } | 366 | } |
334 | 367 | ||
335 | /** | 368 | /** |
336 | * Removes the currently selected profile in the combo. | 369 | * Removes the currently selected profile in the combo. |
337 | * Doesn't delete if there are less then 2 profiles. | 370 | * Doesn't delete if there are less then 2 profiles. |
338 | */ | 371 | */ |
339 | void MainWindowImp::removeProfile(){ | 372 | void MainWindowImp::removeProfile(){ |
340 | if(profilesList->count() <= 1){ | 373 | if(profilesList->count() <= 1){ |
341 | QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok"); | 374 | QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok"); |
342 | return; | 375 | return; |
343 | } | 376 | } |
344 | QString profileToRemove = profilesList->currentText(); | 377 | QString profileToRemove = profilesList->currentText(); |
345 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ | 378 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ |
346 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); | 379 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); |
347 | profilesList->clear(); | 380 | profilesList->clear(); |
348 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 381 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
349 | profilesList->insertItem((*it)); | 382 | profilesList->insertItem((*it)); |
350 | } | 383 | } |
351 | 384 | ||
352 | } | 385 | } |
353 | 386 | ||
354 | /** | 387 | /** |
355 | * A new profile has been selected, change. | 388 | * A new profile has been selected, change. |
356 | * @param newProfile the new profile. | 389 | * @param newProfile the new profile. |
357 | */ | 390 | */ |
358 | void MainWindowImp::changeProfile(const QString& newProfile){ | 391 | void MainWindowImp::changeProfile(const QString& newProfile){ |
359 | currentProfileLabel->setText(newProfile); | 392 | currentProfileLabel->setText(newProfile); |
360 | } | 393 | } |
361 | 394 | ||
362 | // mainwindowimp.cpp | 395 | // mainwindowimp.cpp |
363 | 396 | ||
diff --git a/noncore/net/networksetup/mainwindowimp.h b/noncore/net/networksetup/mainwindowimp.h index 8e300bf..19ebaf2 100644 --- a/noncore/net/networksetup/mainwindowimp.h +++ b/noncore/net/networksetup/mainwindowimp.h | |||
@@ -1,57 +1,56 @@ | |||
1 | #ifndef MAINWINOWIMP_H | 1 | #ifndef MAINWINOWIMP_H |
2 | #define MAINWINOWIMP_H | 2 | #define MAINWINOWIMP_H |
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | 7 | ||
8 | class Module; | 8 | class Module; |
9 | class Interface; | 9 | class Interface; |
10 | class QLibrary; | 10 | class QLibrary; |
11 | class KProcess; | 11 | class KProcess; |
12 | 12 | ||
13 | class MainWindowImp : public MainWindow { | 13 | class MainWindowImp : public MainWindow { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | MainWindowImp(QWidget *parent=0, const char *name=0); | 17 | MainWindowImp(QWidget *parent=0, const char *name=0); |
18 | ~MainWindowImp(); | 18 | ~MainWindowImp(); |
19 | 19 | ||
20 | private slots: | 20 | private slots: |
21 | void addClicked(); | 21 | void addClicked(); |
22 | void removeClicked(); | 22 | void removeClicked(); |
23 | void configureClicked(); | 23 | void configureClicked(); |
24 | void informationClicked(); | 24 | void informationClicked(); |
25 | 25 | ||
26 | void jobDone(KProcess *process); | 26 | void jobDone(KProcess *process); |
27 | void getInterfaceList(); | 27 | void getInterfaceList(); |
28 | 28 | ||
29 | void addProfile(); | 29 | void addProfile(); |
30 | void removeProfile(); | 30 | void removeProfile(); |
31 | void changeProfile(const QString&); | 31 | void changeProfile(const QString&); |
32 | 32 | ||
33 | void updateInterface(Interface *i); | 33 | void updateInterface(Interface *i); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | void loadModules(QString path); | 36 | void loadModules(QString path); |
37 | 37 | ||
38 | Module* loadPlugin(QString pluginFileName, | 38 | Module* loadPlugin(QString pluginFileName, |
39 | QString resolveString = "create_plugin"); | 39 | QString resolveString = "create_plugin"); |
40 | 40 | ||
41 | // For our local list of names | 41 | // For our local list of names |
42 | QMap<QString, Interface*> interfaceNames; | 42 | QMap<QString, Interface*> interfaceNames; |
43 | 43 | ||
44 | QMap<Module*, QLibrary*> libraries; | 44 | QMap<Module*, QLibrary*> libraries; |
45 | QMap<Interface*, Module*> modules; | ||
46 | QMap<Interface*, QListViewItem*> items; | 45 | QMap<Interface*, QListViewItem*> items; |
47 | QMap<QListViewItem*, Interface*> interfaceItems; | 46 | QMap<QListViewItem*, Interface*> interfaceItems; |
48 | 47 | ||
49 | QMap<KProcess*, QString> threads; | 48 | QMap<KProcess*, QString> threads; |
50 | QStringList profiles; | 49 | QStringList profiles; |
51 | 50 | ||
52 | }; | 51 | }; |
53 | 52 | ||
54 | #endif | 53 | #endif |
55 | 54 | ||
56 | // mainwindowimp.h | 55 | // mainwindowimp.h |
57 | 56 | ||
diff --git a/noncore/net/networksetup/module.h b/noncore/net/networksetup/module.h index 13fd523..c1e9488 100644 --- a/noncore/net/networksetup/module.h +++ b/noncore/net/networksetup/module.h | |||
@@ -1,33 +1,34 @@ | |||
1 | #ifndef NETCONF_MODULE_H | 1 | #ifndef NETCONF_MODULE_H |
2 | #define NETCONF_MODULE_H | 2 | #define NETCONF_MODULE_H |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include "interface.h" | 7 | #include "interface.h" |
8 | 8 | ||
9 | class QWidget; | 9 | class QWidget; |
10 | class QTabWidget; | ||
10 | 11 | ||
11 | class Module : QObject{ | 12 | class Module : QObject{ |
12 | 13 | ||
13 | signals: | 14 | signals: |
14 | void updateInterface(Interface *i); | 15 | void updateInterface(Interface *i); |
15 | 16 | ||
16 | public: | 17 | public: |
17 | Module(){}; | 18 | Module(){}; |
18 | 19 | ||
19 | virtual bool isOwner(Interface *){ return false; }; | 20 | virtual bool isOwner(Interface *){ return false; }; |
20 | virtual QWidget *configure(){ return NULL; } ; | 21 | virtual QWidget *configure(QTabWidget **tabWidget){ return NULL; } ; |
21 | virtual QWidget *information(){ return NULL; }; | 22 | virtual QWidget *information(QTabWidget **tabWidget){ return NULL; }; |
22 | virtual QList<Interface> getInterfaces() = 0; | 23 | virtual QList<Interface> getInterfaces() = 0; |
23 | virtual QMap<QString, QString> possibleNewInterfaces() = 0; | 24 | virtual QMap<QString, QString> possibleNewInterfaces() = 0; |
24 | virtual Interface *addNewInterface(QString name) = 0; | 25 | virtual Interface *addNewInterface(QString name) = 0; |
25 | virtual bool remove(Interface* i) = 0; | 26 | virtual bool remove(Interface* i) = 0; |
26 | 27 | virtual QString getPixmapName(Interface* i) = 0; | |
27 | 28 | ||
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |
31 | 32 | ||
32 | // module.h | 33 | // module.h |
33 | 34 | ||
diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro index a01b050..0d48790 100644 --- a/noncore/net/networksetup/networksetup.pro +++ b/noncore/net/networksetup/networksetup.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on debug | 2 | #CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | 3 | CONFIG = qt warn_on release |
4 | HEADERS = mainwindowimp.h addserviceimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h | 4 | HEADERS = mainwindowimp.h addserviceimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h |
5 | SOURCES = main.cpp mainwindowimp.cpp addserviceimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp | 5 | SOURCES = main.cpp mainwindowimp.cpp addserviceimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp |
6 | #INCLUDEPATH+= $(QPEDIR)/include | 6 | #INCLUDEPATH+= $(QPEDIR)/include |
7 | #DEPENDPATH+= $(QPEDIR)/include | 7 | #DEPENDPATH+= $(QPEDIR)/include |
8 | LIBS += -lqpe | 8 | LIBS += -lqpe |
9 | INTERFACES= mainwindow.ui addservice.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui | 9 | INTERFACES= mainwindow.ui addservice.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui |
10 | TARGET = networksetup | 10 | TARGET = networksetup |
diff --git a/noncore/settings/networksettings/interface.cpp b/noncore/settings/networksettings/interface.cpp index f6eed00..5b21364 100644 --- a/noncore/settings/networksettings/interface.cpp +++ b/noncore/settings/networksettings/interface.cpp | |||
@@ -1,205 +1,205 @@ | |||
1 | #include "interface.h" | 1 | #include "interface.h" |
2 | #include <qdatetime.h> | 2 | #include <qdatetime.h> |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <qfileinfo.h> | 4 | #include <qfileinfo.h> |
5 | #include <qtextstream.h> | 5 | #include <qtextstream.h> |
6 | 6 | ||
7 | #define IFCONFIG "/sbin/ifconfig" | 7 | #define IFCONFIG "/sbin/ifconfig" |
8 | #define HDCP_INFO_DIR "/etc/dhcpc" | 8 | #define HDCP_INFO_DIR "/etc/dhcpc" |
9 | 9 | ||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
12 | 12 | ||
13 | Interface::Interface(QString name, bool newSatus): status(newSatus), attached(false), interfaceName(name), hardareName("Unknown"), moduleOwner("Default"), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){ | 13 | Interface::Interface(QString name, bool newSatus): status(newSatus), attached(false), interfaceName(name), hardareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){ |
14 | refresh(); | 14 | refresh(); |
15 | } | 15 | } |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Try to start the interface. | 18 | * Try to start the interface. |
19 | * @return bool true if successfull. | 19 | * @return bool true if successfull. |
20 | */ | 20 | */ |
21 | bool Interface::start(){ | 21 | bool Interface::start(){ |
22 | // check to see if we are already running. | 22 | // check to see if we are already running. |
23 | if(status) | 23 | if(status) |
24 | return false; | 24 | return false; |
25 | 25 | ||
26 | int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1()); | 26 | int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1()); |
27 | if(ret != 0) | 27 | if(ret != 0) |
28 | return false; | 28 | return false; |
29 | 29 | ||
30 | status = true; | 30 | status = true; |
31 | refresh(); | 31 | refresh(); |
32 | return true; | 32 | return true; |
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Try to stop the interface. | 36 | * Try to stop the interface. |
37 | * @return bool true if successfull. | 37 | * @return bool true if successfull. |
38 | */ | 38 | */ |
39 | bool Interface::stop(){ | 39 | bool Interface::stop(){ |
40 | // check to see if we are already stopped. | 40 | // check to see if we are already stopped. |
41 | if(status == false) | 41 | if(status == false) |
42 | return false; | 42 | return false; |
43 | 43 | ||
44 | int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1()); | 44 | int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1()); |
45 | if(ret != 0) | 45 | if(ret != 0) |
46 | return false; | 46 | return false; |
47 | 47 | ||
48 | status = true; | 48 | status = true; |
49 | refresh(); | 49 | refresh(); |
50 | return true; | 50 | return true; |
51 | } | 51 | } |
52 | /** | 52 | /** |
53 | * Try to restart the interface. | 53 | * Try to restart the interface. |
54 | * @return bool true if successfull. | 54 | * @return bool true if successfull. |
55 | */ | 55 | */ |
56 | bool Interface::restart(){ | 56 | bool Interface::restart(){ |
57 | return (stop() && start()); | 57 | return (stop() && start()); |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Try to refresh the information about the interface. | 61 | * Try to refresh the information about the interface. |
62 | * First call ifconfig, then check the dhcp-info file | 62 | * First call ifconfig, then check the dhcp-info file |
63 | * @return bool true if successfull. | 63 | * @return bool true if successfull. |
64 | */ | 64 | */ |
65 | bool Interface::refresh(){ | 65 | bool Interface::refresh(){ |
66 | // See if we are up. | 66 | // See if we are up. |
67 | if(status == false){ | 67 | if(status == false){ |
68 | macAddress = ""; | 68 | macAddress = ""; |
69 | ip = "0.0.0.0"; | 69 | ip = "0.0.0.0"; |
70 | subnetMask = "0.0.0.0"; | 70 | subnetMask = "0.0.0.0"; |
71 | broadcast = ""; | 71 | broadcast = ""; |
72 | dhcp = false; | 72 | dhcp = false; |
73 | dhcpServerIp = ""; | 73 | dhcpServerIp = ""; |
74 | leaseObtained = ""; | 74 | leaseObtained = ""; |
75 | leaseExpires = ""; | 75 | leaseExpires = ""; |
76 | return true; | 76 | return true; |
77 | } | 77 | } |
78 | 78 | ||
79 | QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName); | 79 | QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName); |
80 | int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1()); | 80 | int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1()); |
81 | if(ret != 0){ | 81 | if(ret != 0){ |
82 | qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); | 82 | qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); |
83 | return false; | 83 | return false; |
84 | } | 84 | } |
85 | 85 | ||
86 | QFile file(fileName); | 86 | QFile file(fileName); |
87 | if (!file.open(IO_ReadOnly)){ | 87 | if (!file.open(IO_ReadOnly)){ |
88 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); | 88 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); |
89 | return false; | 89 | return false; |
90 | } | 90 | } |
91 | 91 | ||
92 | // Set to the defaults | 92 | // Set to the defaults |
93 | macAddress = ""; | 93 | macAddress = ""; |
94 | ip = "0.0.0.0"; | 94 | ip = "0.0.0.0"; |
95 | subnetMask = "0.0.0.0"; | 95 | subnetMask = "0.0.0.0"; |
96 | broadcast = ""; | 96 | broadcast = ""; |
97 | 97 | ||
98 | QTextStream stream( &file ); | 98 | QTextStream stream( &file ); |
99 | QString line; | 99 | QString line; |
100 | while ( !stream.eof() ) { | 100 | while ( !stream.eof() ) { |
101 | line = stream.readLine(); | 101 | line = stream.readLine(); |
102 | if(line.contains("HWaddr")){ | 102 | if(line.contains("HWaddr")){ |
103 | int mac = line.find("HWaddr"); | 103 | int mac = line.find("HWaddr"); |
104 | macAddress = line.mid(mac+7, line.length()); | 104 | macAddress = line.mid(mac+7, line.length()); |
105 | } | 105 | } |
106 | if(line.contains("inet addr")){ | 106 | if(line.contains("inet addr")){ |
107 | int ipl = line.find("inet addr"); | 107 | int ipl = line.find("inet addr"); |
108 | int space = line.find(" ", ipl+10); | 108 | int space = line.find(" ", ipl+10); |
109 | ip = line.mid(ipl+10, space-ipl-10); | 109 | ip = line.mid(ipl+10, space-ipl-10); |
110 | } | 110 | } |
111 | if(line.contains("Mask")){ | 111 | if(line.contains("Mask")){ |
112 | int mask = line.find("Mask"); | 112 | int mask = line.find("Mask"); |
113 | subnetMask = line.mid(mask+5, line.length()); | 113 | subnetMask = line.mid(mask+5, line.length()); |
114 | } | 114 | } |
115 | if(line.contains("Bcast")){ | 115 | if(line.contains("Bcast")){ |
116 | int mask = line.find("Bcast"); | 116 | int mask = line.find("Bcast"); |
117 | int space = line.find(" ", mask+6); | 117 | int space = line.find(" ", mask+6); |
118 | broadcast = line.mid(mask+6, space-mask-6); | 118 | broadcast = line.mid(mask+6, space-mask-6); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | file.close(); | 121 | file.close(); |
122 | QFile::remove(fileName); | 122 | QFile::remove(fileName); |
123 | 123 | ||
124 | // DHCP TESTING | 124 | // DHCP TESTING |
125 | // reset DHCP info | 125 | // reset DHCP info |
126 | dhcpServerIp = ""; | 126 | dhcpServerIp = ""; |
127 | leaseObtained = ""; | 127 | leaseObtained = ""; |
128 | leaseExpires = ""; | 128 | leaseExpires = ""; |
129 | dhcp = false; | 129 | dhcp = false; |
130 | 130 | ||
131 | // See if we have | 131 | // See if we have |
132 | QString dhcpFile(QString(HDCP_INFO_DIR "/dhcpcd-%1.info").arg(interfaceName)); | 132 | QString dhcpFile(QString(HDCP_INFO_DIR "/dhcpcd-%1.info").arg(interfaceName)); |
133 | // If there is no DHCP information then exit now with no errors. | 133 | // If there is no DHCP information then exit now with no errors. |
134 | if(!QFile::exists(dhcpFile)){ | 134 | if(!QFile::exists(dhcpFile)){ |
135 | return true; | 135 | return true; |
136 | } | 136 | } |
137 | 137 | ||
138 | file.setName(dhcpFile); | 138 | file.setName(dhcpFile); |
139 | if (!file.open(IO_ReadOnly)){ | 139 | if (!file.open(IO_ReadOnly)){ |
140 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); | 140 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); |
141 | return false; | 141 | return false; |
142 | } | 142 | } |
143 | 143 | ||
144 | // leaseTime and renewalTime and used if pid and deamon exe can be accessed. | 144 | // leaseTime and renewalTime and used if pid and deamon exe can be accessed. |
145 | int leaseTime = 0; | 145 | int leaseTime = 0; |
146 | int renewalTime = 0; | 146 | int renewalTime = 0; |
147 | 147 | ||
148 | stream.setDevice( &file ); | 148 | stream.setDevice( &file ); |
149 | while ( !stream.eof() ) { | 149 | while ( !stream.eof() ) { |
150 | line = stream.readLine(); | 150 | line = stream.readLine(); |
151 | if(line.contains("DHCPSID=")) | 151 | if(line.contains("DHCPSID=")) |
152 | dhcpServerIp = line.mid(8, line.length()); | 152 | dhcpServerIp = line.mid(8, line.length()); |
153 | if(line.contains("LEASETIME=")) | 153 | if(line.contains("LEASETIME=")) |
154 | leaseTime = line.mid(10, line.length()).toInt(); | 154 | leaseTime = line.mid(10, line.length()).toInt(); |
155 | if(line.contains("RENEWALTIME=")) | 155 | if(line.contains("RENEWALTIME=")) |
156 | renewalTime = line.mid(12, line.length()).toInt(); | 156 | renewalTime = line.mid(12, line.length()).toInt(); |
157 | } | 157 | } |
158 | file.close(); | 158 | file.close(); |
159 | //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); | 159 | //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); |
160 | //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); | 160 | //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); |
161 | 161 | ||
162 | // Get the pid of the deamond | 162 | // Get the pid of the deamond |
163 | dhcpFile = (QString(HDCP_INFO_DIR "/dhcpcd-%1.pid").arg(interfaceName)); | 163 | dhcpFile = (QString(HDCP_INFO_DIR "/dhcpcd-%1.pid").arg(interfaceName)); |
164 | file.setName(dhcpFile); | 164 | file.setName(dhcpFile); |
165 | if (!file.open(IO_ReadOnly)){ | 165 | if (!file.open(IO_ReadOnly)){ |
166 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); | 166 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); |
167 | return false; | 167 | return false; |
168 | } | 168 | } |
169 | 169 | ||
170 | int pid = -1; | 170 | int pid = -1; |
171 | stream.setDevice( &file ); | 171 | stream.setDevice( &file ); |
172 | while ( !stream.eof() ) { | 172 | while ( !stream.eof() ) { |
173 | line = stream.readLine(); | 173 | line = stream.readLine(); |
174 | pid = line.toInt(); | 174 | pid = line.toInt(); |
175 | } | 175 | } |
176 | file.close(); | 176 | file.close(); |
177 | 177 | ||
178 | if( pid == -1){ | 178 | if( pid == -1){ |
179 | qDebug("Interface: Could not get pid of dhcpc deamon."); | 179 | qDebug("Interface: Could not get pid of dhcpc deamon."); |
180 | return false; | 180 | return false; |
181 | } | 181 | } |
182 | 182 | ||
183 | // Get the start running time of the deamon | 183 | // Get the start running time of the deamon |
184 | fileName = (QString("/proc/%1/stat").arg(pid)); | 184 | fileName = (QString("/proc/%1/stat").arg(pid)); |
185 | file.setName(fileName); | 185 | file.setName(fileName); |
186 | stream.setDevice( &file ); | 186 | stream.setDevice( &file ); |
187 | if (!file.open(IO_ReadOnly)){ | 187 | if (!file.open(IO_ReadOnly)){ |
188 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); | 188 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); |
189 | return false; | 189 | return false; |
190 | } | 190 | } |
191 | while ( !stream.eof() ) { | 191 | while ( !stream.eof() ) { |
192 | line = stream.readLine(); | 192 | line = stream.readLine(); |
193 | } | 193 | } |
194 | file.close(); | 194 | file.close(); |
195 | long time = 0; | 195 | long time = 0; |
196 | // Grab the start time | 196 | // Grab the start time |
197 | // pid com state ppid pgrp session tty_nr tpgid flags | 197 | // pid com state ppid pgrp session tty_nr tpgid flags |
198 | sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " | 198 | sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " |
199 | // minflt cminflt majflt cmajflt utime stime cutime cstime priority | 199 | // minflt cminflt majflt cmajflt utime stime cutime cstime priority |
200 | "%*u %*u %*u %*u %*u %*u %*d %*d %*d " | 200 | "%*u %*u %*u %*u %*u %*u %*d %*d %*d " |
201 | // nice 0 itrealvalue starttime | 201 | // nice 0 itrealvalue starttime |
202 | "%*d %*d %*d %lu", (long*) &time); | 202 | "%*d %*d %*d %lu", (long*) &time); |
203 | time = time/100; | 203 | time = time/100; |
204 | 204 | ||
205 | QDateTime datetime(QDateTime::currentDateTime()); | 205 | QDateTime datetime(QDateTime::currentDateTime()); |
diff --git a/noncore/settings/networksettings/interface.h b/noncore/settings/networksettings/interface.h index 1ad71eb..5dc95a4 100644 --- a/noncore/settings/networksettings/interface.h +++ b/noncore/settings/networksettings/interface.h | |||
@@ -1,65 +1,66 @@ | |||
1 | #ifndef INTERFACE_H | 1 | #ifndef INTERFACE_H |
2 | #define INTERFACE_H | 2 | #define INTERFACE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | class Module; | ||
6 | class Interface { | 7 | class Interface { |
7 | 8 | ||
8 | public: | 9 | public: |
9 | Interface(QString name = "unknown", bool status = false); | 10 | Interface(QString name = "unknown", bool status = false); |
10 | virtual ~Interface(){}; | 11 | virtual ~Interface(){}; |
11 | 12 | ||
12 | virtual bool getStatus(){ return status; }; | 13 | virtual bool getStatus(){ return status; }; |
13 | virtual void setStatus(bool newSatus){ status = newSatus; refresh(); }; | 14 | virtual void setStatus(bool newSatus){ status = newSatus; refresh(); }; |
14 | 15 | ||
15 | virtual bool isAttached(){ return attached; }; | 16 | virtual bool isAttached(){ return attached; }; |
16 | virtual void setAttached(bool isAttached=false){ attached = isAttached; }; | 17 | virtual void setAttached(bool isAttached=false){ attached = isAttached; }; |
17 | 18 | ||
18 | virtual QString getInterfaceName(){ return interfaceName; }; | 19 | virtual QString getInterfaceName(){ return interfaceName; }; |
19 | virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; }; | 20 | virtual void setInterfaceName(QString name="unknown"){ interfaceName = name; }; |
20 | 21 | ||
21 | virtual QString getHardwareName(){ return hardareName; }; | 22 | virtual QString getHardwareName(){ return hardareName; }; |
22 | virtual void setHardwareName(QString name="Unknown"){ hardareName = name; }; | 23 | virtual void setHardwareName(QString name="Unknown"){ hardareName = name; }; |
23 | 24 | ||
24 | virtual QString getModuleOwner(){ return moduleOwner; }; | 25 | virtual Module* getModuleOwner(){ return moduleOwner; }; |
25 | virtual void setModuleOwner(QString owner="Default"){ moduleOwner = owner; }; | 26 | virtual void setModuleOwner(Module *owner=NULL){ moduleOwner = owner; }; |
26 | 27 | ||
27 | // inet information. | 28 | // inet information. |
28 | QString getMacAddress(){ return macAddress; }; | 29 | QString getMacAddress(){ return macAddress; }; |
29 | QString getIp(){ return ip; }; | 30 | QString getIp(){ return ip; }; |
30 | QString getSubnetMask(){ return subnetMask; }; | 31 | QString getSubnetMask(){ return subnetMask; }; |
31 | QString getBroadcast(){ return broadcast; }; | 32 | QString getBroadcast(){ return broadcast; }; |
32 | bool isDhcp(){ return dhcp; }; | 33 | bool isDhcp(){ return dhcp; }; |
33 | QString getDhcpServerIp(){ return dhcpServerIp; }; | 34 | QString getDhcpServerIp(){ return dhcpServerIp; }; |
34 | QString getLeaseObtained(){ return leaseObtained; }; | 35 | QString getLeaseObtained(){ return leaseObtained; }; |
35 | QString getLeaseExpires(){ return leaseExpires; }; | 36 | QString getLeaseExpires(){ return leaseExpires; }; |
36 | 37 | ||
37 | bool refresh(); | 38 | bool refresh(); |
38 | bool start(); | 39 | bool start(); |
39 | bool stop(); | 40 | bool stop(); |
40 | bool restart(); | 41 | bool restart(); |
41 | 42 | ||
42 | private: | 43 | private: |
43 | // Interface information | 44 | // Interface information |
44 | bool status; | 45 | bool status; |
45 | bool attached; | 46 | bool attached; |
46 | QString interfaceName; | 47 | QString interfaceName; |
47 | QString hardareName; | 48 | QString hardareName; |
48 | QString moduleOwner; | 49 | Module *moduleOwner; |
49 | 50 | ||
50 | // Network information | 51 | // Network information |
51 | QString macAddress; | 52 | QString macAddress; |
52 | QString ip; | 53 | QString ip; |
53 | QString broadcast; | 54 | QString broadcast; |
54 | QString subnetMask; | 55 | QString subnetMask; |
55 | bool dhcp; | 56 | bool dhcp; |
56 | QString dhcpServerIp; | 57 | QString dhcpServerIp; |
57 | QString leaseObtained; | 58 | QString leaseObtained; |
58 | QString leaseExpires; | 59 | QString leaseExpires; |
59 | 60 | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | #endif | 63 | #endif |
63 | 64 | ||
64 | // interface.h | 65 | // interface.h |
65 | 66 | ||
diff --git a/noncore/settings/networksettings/interfacesetup.ui b/noncore/settings/networksettings/interfacesetup.ui index ff9810e..d367608 100644 --- a/noncore/settings/networksettings/interfacesetup.ui +++ b/noncore/settings/networksettings/interfacesetup.ui | |||
@@ -1,284 +1,336 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>InterfaceSetup</class> | 2 | <class>InterfaceSetup</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>InterfaceSetup</cstring> | 7 | <cstring>InterfaceSetup</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>177</width> | 14 | <width>271</width> |
15 | <height>320</height> | 15 | <height>280</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Interface Configuration</string> | 20 | <string>Interface Configuration</string> |
21 | </property> | 21 | </property> |
22 | <grid> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>11</number> | 25 | <number>11</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget row="1" column="0" rowspan="1" colspan="2" > | 31 | <widget> |
32 | <class>Line</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>Line1</cstring> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>orientation</name> | ||
39 | <enum>Horizontal</enum> | ||
40 | </property> | ||
41 | </widget> | ||
42 | <widget row="0" column="0" rowspan="1" colspan="2" > | ||
43 | <class>QCheckBox</class> | 32 | <class>QCheckBox</class> |
44 | <property stdset="1"> | 33 | <property stdset="1"> |
45 | <name>name</name> | 34 | <name>name</name> |
46 | <cstring>autoStart</cstring> | 35 | <cstring>autoStart</cstring> |
47 | </property> | 36 | </property> |
48 | <property stdset="1"> | 37 | <property stdset="1"> |
49 | <name>text</name> | 38 | <name>text</name> |
50 | <string>Automaticly bring up</string> | 39 | <string>Automaticly bring up</string> |
51 | </property> | 40 | </property> |
52 | </widget> | 41 | </widget> |
53 | <widget row="2" column="1" > | 42 | <widget> |
54 | <class>QComboBox</class> | 43 | <class>QLayoutWidget</class> |
55 | <item> | ||
56 | <property> | ||
57 | <name>text</name> | ||
58 | <string>All</string> | ||
59 | </property> | ||
60 | </item> | ||
61 | <property stdset="1"> | 44 | <property stdset="1"> |
62 | <name>name</name> | 45 | <name>name</name> |
63 | <cstring>profileCombo</cstring> | 46 | <cstring>Layout8</cstring> |
64 | </property> | ||
65 | </widget> | ||
66 | <widget row="4" column="0" > | ||
67 | <class>QLabel</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>leaseHoursLabel</cstring> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>text</name> | ||
74 | <string>Requested Lease</string> | ||
75 | </property> | ||
76 | </widget> | ||
77 | <widget row="3" column="0" rowspan="1" colspan="2" > | ||
78 | <class>QCheckBox</class> | ||
79 | <property stdset="1"> | ||
80 | <name>name</name> | ||
81 | <cstring>dhcpCheckBox</cstring> | ||
82 | </property> | ||
83 | <property stdset="1"> | ||
84 | <name>text</name> | ||
85 | <string>DHCP</string> | ||
86 | </property> | ||
87 | <property stdset="1"> | ||
88 | <name>checked</name> | ||
89 | <bool>true</bool> | ||
90 | </property> | ||
91 | </widget> | ||
92 | <widget row="2" column="0" > | ||
93 | <class>QLabel</class> | ||
94 | <property stdset="1"> | ||
95 | <name>name</name> | ||
96 | <cstring>TextLabel1</cstring> | ||
97 | </property> | ||
98 | <property stdset="1"> | ||
99 | <name>text</name> | ||
100 | <string>Profile:</string> | ||
101 | </property> | 47 | </property> |
48 | <hbox> | ||
49 | <property stdset="1"> | ||
50 | <name>margin</name> | ||
51 | <number>0</number> | ||
52 | </property> | ||
53 | <property stdset="1"> | ||
54 | <name>spacing</name> | ||
55 | <number>6</number> | ||
56 | </property> | ||
57 | <widget> | ||
58 | <class>QLabel</class> | ||
59 | <property stdset="1"> | ||
60 | <name>name</name> | ||
61 | <cstring>TextLabel1</cstring> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>text</name> | ||
65 | <string>Profile</string> | ||
66 | </property> | ||
67 | </widget> | ||
68 | <widget> | ||
69 | <class>QComboBox</class> | ||
70 | <item> | ||
71 | <property> | ||
72 | <name>text</name> | ||
73 | <string>All</string> | ||
74 | </property> | ||
75 | </item> | ||
76 | <property stdset="1"> | ||
77 | <name>name</name> | ||
78 | <cstring>profileCombo</cstring> | ||
79 | </property> | ||
80 | </widget> | ||
81 | <spacer> | ||
82 | <property> | ||
83 | <name>name</name> | ||
84 | <cstring>Spacer20</cstring> | ||
85 | </property> | ||
86 | <property stdset="1"> | ||
87 | <name>orientation</name> | ||
88 | <enum>Horizontal</enum> | ||
89 | </property> | ||
90 | <property stdset="1"> | ||
91 | <name>sizeType</name> | ||
92 | <enum>Expanding</enum> | ||
93 | </property> | ||
94 | <property> | ||
95 | <name>sizeHint</name> | ||
96 | <size> | ||
97 | <width>20</width> | ||
98 | <height>20</height> | ||
99 | </size> | ||
100 | </property> | ||
101 | </spacer> | ||
102 | </hbox> | ||
102 | </widget> | 103 | </widget> |
103 | <widget row="4" column="1" > | 104 | <widget> |
104 | <class>QSpinBox</class> | 105 | <class>QLayoutWidget</class> |
105 | <property stdset="1"> | 106 | <property stdset="1"> |
106 | <name>name</name> | 107 | <name>name</name> |
107 | <cstring>leaseTime</cstring> | 108 | <cstring>Layout9</cstring> |
108 | </property> | ||
109 | <property stdset="1"> | ||
110 | <name>suffix</name> | ||
111 | <string> hours</string> | ||
112 | </property> | ||
113 | <property stdset="1"> | ||
114 | <name>maxValue</name> | ||
115 | <number>336</number> | ||
116 | </property> | ||
117 | <property stdset="1"> | ||
118 | <name>minValue</name> | ||
119 | <number>1</number> | ||
120 | </property> | ||
121 | <property stdset="1"> | ||
122 | <name>value</name> | ||
123 | <number>24</number> | ||
124 | </property> | 109 | </property> |
110 | <hbox> | ||
111 | <property stdset="1"> | ||
112 | <name>margin</name> | ||
113 | <number>0</number> | ||
114 | </property> | ||
115 | <property stdset="1"> | ||
116 | <name>spacing</name> | ||
117 | <number>6</number> | ||
118 | </property> | ||
119 | <widget> | ||
120 | <class>QCheckBox</class> | ||
121 | <property stdset="1"> | ||
122 | <name>name</name> | ||
123 | <cstring>dhcpCheckBox</cstring> | ||
124 | </property> | ||
125 | <property stdset="1"> | ||
126 | <name>text</name> | ||
127 | <string>DHCP</string> | ||
128 | </property> | ||
129 | <property stdset="1"> | ||
130 | <name>checked</name> | ||
131 | <bool>true</bool> | ||
132 | </property> | ||
133 | </widget> | ||
134 | <widget> | ||
135 | <class>QLabel</class> | ||
136 | <property stdset="1"> | ||
137 | <name>name</name> | ||
138 | <cstring>leaseHoursLabel</cstring> | ||
139 | </property> | ||
140 | <property stdset="1"> | ||
141 | <name>text</name> | ||
142 | <string>Requested Lease</string> | ||
143 | </property> | ||
144 | </widget> | ||
145 | <widget> | ||
146 | <class>QSpinBox</class> | ||
147 | <property stdset="1"> | ||
148 | <name>name</name> | ||
149 | <cstring>leaseTime</cstring> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>suffix</name> | ||
153 | <string> hours</string> | ||
154 | </property> | ||
155 | <property stdset="1"> | ||
156 | <name>maxValue</name> | ||
157 | <number>336</number> | ||
158 | </property> | ||
159 | <property stdset="1"> | ||
160 | <name>minValue</name> | ||
161 | <number>1</number> | ||
162 | </property> | ||
163 | <property stdset="1"> | ||
164 | <name>value</name> | ||
165 | <number>24</number> | ||
166 | </property> | ||
167 | </widget> | ||
168 | </hbox> | ||
125 | </widget> | 169 | </widget> |
126 | <spacer row="6" column="1" > | 170 | <widget> |
127 | <property> | ||
128 | <name>name</name> | ||
129 | <cstring>Spacer9</cstring> | ||
130 | </property> | ||
131 | <property stdset="1"> | ||
132 | <name>orientation</name> | ||
133 | <enum>Vertical</enum> | ||
134 | </property> | ||
135 | <property stdset="1"> | ||
136 | <name>sizeType</name> | ||
137 | <enum>Expanding</enum> | ||
138 | </property> | ||
139 | <property> | ||
140 | <name>sizeHint</name> | ||
141 | <size> | ||
142 | <width>20</width> | ||
143 | <height>20</height> | ||
144 | </size> | ||
145 | </property> | ||
146 | </spacer> | ||
147 | <widget row="5" column="0" rowspan="1" colspan="2" > | ||
148 | <class>QGroupBox</class> | 171 | <class>QGroupBox</class> |
149 | <property stdset="1"> | 172 | <property stdset="1"> |
150 | <name>name</name> | 173 | <name>name</name> |
151 | <cstring>staticGroupBox</cstring> | 174 | <cstring>staticGroupBox</cstring> |
152 | </property> | 175 | </property> |
153 | <property stdset="1"> | 176 | <property stdset="1"> |
154 | <name>enabled</name> | 177 | <name>enabled</name> |
155 | <bool>false</bool> | 178 | <bool>false</bool> |
156 | </property> | 179 | </property> |
157 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>frameShape</name> | ||
182 | <enum>Box</enum> | ||
183 | </property> | ||
184 | <property stdset="1"> | ||
185 | <name>frameShadow</name> | ||
186 | <enum>Sunken</enum> | ||
187 | </property> | ||
188 | <property stdset="1"> | ||
158 | <name>title</name> | 189 | <name>title</name> |
159 | <string>Static Ip Configuration</string> | 190 | <string>Static Ip Configuration</string> |
160 | </property> | 191 | </property> |
161 | <grid> | 192 | <grid> |
162 | <property stdset="1"> | 193 | <property stdset="1"> |
163 | <name>margin</name> | 194 | <name>margin</name> |
164 | <number>11</number> | 195 | <number>11</number> |
165 | </property> | 196 | </property> |
166 | <property stdset="1"> | 197 | <property stdset="1"> |
167 | <name>spacing</name> | 198 | <name>spacing</name> |
168 | <number>6</number> | 199 | <number>6</number> |
169 | </property> | 200 | </property> |
170 | <widget row="3" column="1" > | 201 | <widget row="3" column="1" > |
171 | <class>QLineEdit</class> | 202 | <class>QLineEdit</class> |
172 | <property stdset="1"> | 203 | <property stdset="1"> |
173 | <name>name</name> | 204 | <name>name</name> |
174 | <cstring>firstDNSLineEdit</cstring> | 205 | <cstring>firstDNSLineEdit</cstring> |
175 | </property> | 206 | </property> |
176 | </widget> | 207 | </widget> |
177 | <widget row="1" column="0" > | 208 | <widget row="1" column="0" > |
178 | <class>QLabel</class> | 209 | <class>QLabel</class> |
179 | <property stdset="1"> | 210 | <property stdset="1"> |
180 | <name>name</name> | 211 | <name>name</name> |
181 | <cstring>TextLabel5</cstring> | 212 | <cstring>TextLabel5</cstring> |
182 | </property> | 213 | </property> |
183 | <property stdset="1"> | 214 | <property stdset="1"> |
184 | <name>text</name> | 215 | <name>text</name> |
185 | <string>Subnet Mask</string> | 216 | <string>Subnet Mask</string> |
186 | </property> | 217 | </property> |
187 | </widget> | 218 | </widget> |
188 | <widget row="2" column="1" > | 219 | <widget row="2" column="1" > |
189 | <class>QLineEdit</class> | 220 | <class>QLineEdit</class> |
190 | <property stdset="1"> | 221 | <property stdset="1"> |
191 | <name>name</name> | 222 | <name>name</name> |
192 | <cstring>gatewayEdit</cstring> | 223 | <cstring>gatewayEdit</cstring> |
193 | </property> | 224 | </property> |
194 | </widget> | 225 | </widget> |
195 | <widget row="1" column="1" > | 226 | <widget row="1" column="1" > |
196 | <class>QLineEdit</class> | 227 | <class>QLineEdit</class> |
197 | <property stdset="1"> | 228 | <property stdset="1"> |
198 | <name>name</name> | 229 | <name>name</name> |
199 | <cstring>subnetMaskEdit</cstring> | 230 | <cstring>subnetMaskEdit</cstring> |
200 | </property> | 231 | </property> |
201 | </widget> | 232 | </widget> |
202 | <widget row="0" column="1" > | 233 | <widget row="0" column="1" > |
203 | <class>QLineEdit</class> | 234 | <class>QLineEdit</class> |
204 | <property stdset="1"> | 235 | <property stdset="1"> |
205 | <name>name</name> | 236 | <name>name</name> |
206 | <cstring>ipAddressEdit</cstring> | 237 | <cstring>ipAddressEdit</cstring> |
207 | </property> | 238 | </property> |
208 | </widget> | 239 | </widget> |
209 | <widget row="3" column="0" > | 240 | <widget row="3" column="0" > |
210 | <class>QLabel</class> | 241 | <class>QLabel</class> |
211 | <property stdset="1"> | 242 | <property stdset="1"> |
212 | <name>name</name> | 243 | <name>name</name> |
213 | <cstring>TextLabel2</cstring> | 244 | <cstring>TextLabel2</cstring> |
214 | </property> | 245 | </property> |
215 | <property stdset="1"> | 246 | <property stdset="1"> |
216 | <name>text</name> | 247 | <name>text</name> |
217 | <string>First DNS</string> | 248 | <string>First DNS</string> |
218 | </property> | 249 | </property> |
219 | </widget> | 250 | </widget> |
220 | <widget row="4" column="1" > | 251 | <widget row="4" column="1" > |
221 | <class>QLineEdit</class> | 252 | <class>QLineEdit</class> |
222 | <property stdset="1"> | 253 | <property stdset="1"> |
223 | <name>name</name> | 254 | <name>name</name> |
224 | <cstring>secondDNSLineEdit</cstring> | 255 | <cstring>secondDNSLineEdit</cstring> |
225 | </property> | 256 | </property> |
226 | </widget> | 257 | </widget> |
227 | <widget row="0" column="0" > | 258 | <widget row="0" column="0" > |
228 | <class>QLabel</class> | 259 | <class>QLabel</class> |
229 | <property stdset="1"> | 260 | <property stdset="1"> |
230 | <name>name</name> | 261 | <name>name</name> |
231 | <cstring>TextLabel4</cstring> | 262 | <cstring>TextLabel4</cstring> |
232 | </property> | 263 | </property> |
233 | <property stdset="1"> | 264 | <property stdset="1"> |
234 | <name>text</name> | 265 | <name>text</name> |
235 | <string>IP Address</string> | 266 | <string>IP Address</string> |
236 | </property> | 267 | </property> |
237 | </widget> | 268 | </widget> |
238 | <widget row="2" column="0" > | 269 | <widget row="2" column="0" > |
239 | <class>QLabel</class> | 270 | <class>QLabel</class> |
240 | <property stdset="1"> | 271 | <property stdset="1"> |
241 | <name>name</name> | 272 | <name>name</name> |
242 | <cstring>TextLabel1_2</cstring> | 273 | <cstring>TextLabel1_2</cstring> |
243 | </property> | 274 | </property> |
244 | <property stdset="1"> | 275 | <property stdset="1"> |
245 | <name>text</name> | 276 | <name>text</name> |
246 | <string>Gateway</string> | 277 | <string>Gateway</string> |
247 | </property> | 278 | </property> |
248 | </widget> | 279 | </widget> |
249 | <widget row="4" column="0" > | 280 | <widget row="4" column="0" > |
250 | <class>QLabel</class> | 281 | <class>QLabel</class> |
251 | <property stdset="1"> | 282 | <property stdset="1"> |
252 | <name>name</name> | 283 | <name>name</name> |
253 | <cstring>TextLabel3</cstring> | 284 | <cstring>TextLabel3</cstring> |
254 | </property> | 285 | </property> |
255 | <property stdset="1"> | 286 | <property stdset="1"> |
256 | <name>text</name> | 287 | <name>text</name> |
257 | <string>Second DNS</string> | 288 | <string>Second DNS</string> |
258 | </property> | 289 | </property> |
259 | </widget> | 290 | </widget> |
260 | </grid> | 291 | </grid> |
261 | </widget> | 292 | </widget> |
262 | </grid> | 293 | <spacer> |
294 | <property> | ||
295 | <name>name</name> | ||
296 | <cstring>Spacer9</cstring> | ||
297 | </property> | ||
298 | <property stdset="1"> | ||
299 | <name>orientation</name> | ||
300 | <enum>Vertical</enum> | ||
301 | </property> | ||
302 | <property stdset="1"> | ||
303 | <name>sizeType</name> | ||
304 | <enum>Expanding</enum> | ||
305 | </property> | ||
306 | <property> | ||
307 | <name>sizeHint</name> | ||
308 | <size> | ||
309 | <width>20</width> | ||
310 | <height>20</height> | ||
311 | </size> | ||
312 | </property> | ||
313 | </spacer> | ||
314 | </vbox> | ||
263 | </widget> | 315 | </widget> |
264 | <connections> | 316 | <connections> |
265 | <connection> | 317 | <connection> |
266 | <sender>dhcpCheckBox</sender> | 318 | <sender>dhcpCheckBox</sender> |
267 | <signal>toggled(bool)</signal> | 319 | <signal>toggled(bool)</signal> |
268 | <receiver>leaseHoursLabel</receiver> | 320 | <receiver>leaseHoursLabel</receiver> |
269 | <slot>setEnabled(bool)</slot> | 321 | <slot>setEnabled(bool)</slot> |
270 | </connection> | 322 | </connection> |
271 | <connection> | 323 | <connection> |
272 | <sender>dhcpCheckBox</sender> | 324 | <sender>dhcpCheckBox</sender> |
273 | <signal>toggled(bool)</signal> | 325 | <signal>toggled(bool)</signal> |
274 | <receiver>leaseTime</receiver> | 326 | <receiver>leaseTime</receiver> |
275 | <slot>setEnabled(bool)</slot> | 327 | <slot>setEnabled(bool)</slot> |
276 | </connection> | 328 | </connection> |
277 | <connection> | 329 | <connection> |
278 | <sender>dhcpCheckBox</sender> | 330 | <sender>dhcpCheckBox</sender> |
279 | <signal>toggled(bool)</signal> | 331 | <signal>toggled(bool)</signal> |
280 | <receiver>staticGroupBox</receiver> | 332 | <receiver>staticGroupBox</receiver> |
281 | <slot>setDisabled(bool)</slot> | 333 | <slot>setDisabled(bool)</slot> |
282 | </connection> | 334 | </connection> |
283 | </connections> | 335 | </connections> |
284 | </UI> | 336 | </UI> |
diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui index c1fa101..a3f7bb1 100644 --- a/noncore/settings/networksettings/mainwindow.ui +++ b/noncore/settings/networksettings/mainwindow.ui | |||
@@ -1,326 +1,358 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>MainWindow</class> | 2 | <class>MainWindow</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>MainWindow</cstring> | 7 | <cstring>MainWindow</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>218</width> | 14 | <width>217</width> |
15 | <height>289</height> | 15 | <height>289</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Network Setup</string> | 20 | <string>Network Setup</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QTabWidget</class> | 32 | <class>QTabWidget</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>tabWidget</cstring> | 35 | <cstring>tabWidget</cstring> |
36 | </property> | 36 | </property> |
37 | <property> | 37 | <property> |
38 | <name>layoutMargin</name> | 38 | <name>layoutMargin</name> |
39 | </property> | 39 | </property> |
40 | <widget> | 40 | <widget> |
41 | <class>QWidget</class> | 41 | <class>QWidget</class> |
42 | <property stdset="1"> | 42 | <property stdset="1"> |
43 | <name>name</name> | 43 | <name>name</name> |
44 | <cstring>Widget3</cstring> | 44 | <cstring>Widget3</cstring> |
45 | </property> | 45 | </property> |
46 | <attribute> | 46 | <attribute> |
47 | <name>title</name> | 47 | <name>title</name> |
48 | <string>Interfaces</string> | 48 | <string>Interfaces</string> |
49 | </attribute> | 49 | </attribute> |
50 | <vbox> | 50 | <vbox> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>margin</name> | 52 | <name>margin</name> |
53 | <number>0</number> | 53 | <number>0</number> |
54 | </property> | 54 | </property> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>spacing</name> | 56 | <name>spacing</name> |
57 | <number>6</number> | 57 | <number>6</number> |
58 | </property> | 58 | </property> |
59 | <widget> | 59 | <widget> |
60 | <class>QListView</class> | 60 | <class>QListView</class> |
61 | <column> | 61 | <column> |
62 | <property> | 62 | <property> |
63 | <name>text</name> | 63 | <name>text</name> |
64 | <string>i</string> | 64 | <string>i</string> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>clickable</name> | 67 | <name>clickable</name> |
68 | <bool>true</bool> | 68 | <bool>true</bool> |
69 | </property> | 69 | </property> |
70 | <property> | 70 | <property> |
71 | <name>resizeable</name> | 71 | <name>resizeable</name> |
72 | <bool>true</bool> | 72 | <bool>true</bool> |
73 | </property> | 73 | </property> |
74 | </column> | 74 | </column> |
75 | <column> | 75 | <column> |
76 | <property> | 76 | <property> |
77 | <name>text</name> | 77 | <name>text</name> |
78 | <string>t</string> | 78 | <string>t</string> |
79 | </property> | 79 | </property> |
80 | <property> | 80 | <property> |
81 | <name>clickable</name> | 81 | <name>clickable</name> |
82 | <bool>true</bool> | 82 | <bool>true</bool> |
83 | </property> | 83 | </property> |
84 | <property> | 84 | <property> |
85 | <name>resizeable</name> | 85 | <name>resizeable</name> |
86 | <bool>true</bool> | 86 | <bool>true</bool> |
87 | </property> | 87 | </property> |
88 | </column> | 88 | </column> |
89 | <column> | 89 | <column> |
90 | <property> | 90 | <property> |
91 | <name>text</name> | 91 | <name>text</name> |
92 | <string>Name</string> | 92 | <string>Name</string> |
93 | </property> | 93 | </property> |
94 | <property> | 94 | <property> |
95 | <name>clickable</name> | 95 | <name>clickable</name> |
96 | <bool>true</bool> | 96 | <bool>true</bool> |
97 | </property> | 97 | </property> |
98 | <property> | 98 | <property> |
99 | <name>resizeable</name> | 99 | <name>resizeable</name> |
100 | <bool>true</bool> | 100 | <bool>true</bool> |
101 | </property> | 101 | </property> |
102 | </column> | 102 | </column> |
103 | <property stdset="1"> | 103 | <property stdset="1"> |
104 | <name>name</name> | 104 | <name>name</name> |
105 | <cstring>serviceList</cstring> | 105 | <cstring>serviceList</cstring> |
106 | </property> | 106 | </property> |
107 | <property stdset="1"> | 107 | <property stdset="1"> |
108 | <name>allColumnsShowFocus</name> | 108 | <name>allColumnsShowFocus</name> |
109 | <bool>true</bool> | 109 | <bool>true</bool> |
110 | </property> | 110 | </property> |
111 | </widget> | 111 | </widget> |
112 | <widget> | 112 | <widget> |
113 | <class>QLayoutWidget</class> | 113 | <class>QLayoutWidget</class> |
114 | <property stdset="1"> | 114 | <property stdset="1"> |
115 | <name>name</name> | 115 | <name>name</name> |
116 | <cstring>Layout2</cstring> | 116 | <cstring>Layout2</cstring> |
117 | </property> | 117 | </property> |
118 | <property> | 118 | <property> |
119 | <name>layoutMargin</name> | 119 | <name>layoutMargin</name> |
120 | </property> | 120 | </property> |
121 | <grid> | 121 | <grid> |
122 | <property stdset="1"> | 122 | <property stdset="1"> |
123 | <name>margin</name> | 123 | <name>margin</name> |
124 | <number>5</number> | 124 | <number>5</number> |
125 | </property> | 125 | </property> |
126 | <property stdset="1"> | 126 | <property stdset="1"> |
127 | <name>spacing</name> | 127 | <name>spacing</name> |
128 | <number>6</number> | 128 | <number>6</number> |
129 | </property> | 129 | </property> |
130 | <widget row="1" column="0" > | 130 | <widget row="1" column="0" > |
131 | <class>QPushButton</class> | 131 | <class>QPushButton</class> |
132 | <property stdset="1"> | 132 | <property stdset="1"> |
133 | <name>name</name> | 133 | <name>name</name> |
134 | <cstring>addServiceButton</cstring> | 134 | <cstring>addServiceButton</cstring> |
135 | </property> | 135 | </property> |
136 | <property stdset="1"> | 136 | <property stdset="1"> |
137 | <name>text</name> | 137 | <name>text</name> |
138 | <string>&Add</string> | 138 | <string>&Add</string> |
139 | </property> | 139 | </property> |
140 | </widget> | 140 | </widget> |
141 | <widget row="0" column="0" > | 141 | <widget row="0" column="0" > |
142 | <class>QPushButton</class> | 142 | <class>QPushButton</class> |
143 | <property stdset="1"> | 143 | <property stdset="1"> |
144 | <name>name</name> | 144 | <name>name</name> |
145 | <cstring>informationServiceButton</cstring> | 145 | <cstring>informationServiceButton</cstring> |
146 | </property> | 146 | </property> |
147 | <property stdset="1"> | 147 | <property stdset="1"> |
148 | <name>text</name> | 148 | <name>text</name> |
149 | <string>&Information</string> | 149 | <string>&Information</string> |
150 | </property> | 150 | </property> |
151 | </widget> | 151 | </widget> |
152 | <widget row="0" column="1" > | 152 | <widget row="0" column="1" > |
153 | <class>QPushButton</class> | 153 | <class>QPushButton</class> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>name</name> | 155 | <name>name</name> |
156 | <cstring>configureServiceButton</cstring> | 156 | <cstring>configureServiceButton</cstring> |
157 | </property> | 157 | </property> |
158 | <property stdset="1"> | 158 | <property stdset="1"> |
159 | <name>text</name> | 159 | <name>text</name> |
160 | <string>&Configure</string> | 160 | <string>&Configure</string> |
161 | </property> | 161 | </property> |
162 | </widget> | 162 | </widget> |
163 | <widget row="1" column="1" > | 163 | <widget row="1" column="1" > |
164 | <class>QPushButton</class> | 164 | <class>QPushButton</class> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>name</name> | 166 | <name>name</name> |
167 | <cstring>removeServiceButton</cstring> | 167 | <cstring>removeServiceButton</cstring> |
168 | </property> | 168 | </property> |
169 | <property stdset="1"> | 169 | <property stdset="1"> |
170 | <name>text</name> | 170 | <name>text</name> |
171 | <string>&Remove</string> | 171 | <string>&Remove</string> |
172 | </property> | 172 | </property> |
173 | </widget> | 173 | </widget> |
174 | </grid> | 174 | </grid> |
175 | </widget> | 175 | </widget> |
176 | </vbox> | 176 | </vbox> |
177 | </widget> | 177 | </widget> |
178 | <widget> | 178 | <widget> |
179 | <class>QWidget</class> | 179 | <class>QWidget</class> |
180 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>name</name> | 181 | <name>name</name> |
182 | <cstring>tab</cstring> | 182 | <cstring>tab</cstring> |
183 | </property> | 183 | </property> |
184 | <attribute> | 184 | <attribute> |
185 | <name>title</name> | 185 | <name>title</name> |
186 | <string>Profiles</string> | 186 | <string>Profiles</string> |
187 | </attribute> | 187 | </attribute> |
188 | <grid> | 188 | <grid> |
189 | <property stdset="1"> | 189 | <property stdset="1"> |
190 | <name>margin</name> | 190 | <name>margin</name> |
191 | <number>11</number> | 191 | <number>11</number> |
192 | </property> | 192 | </property> |
193 | <property stdset="1"> | 193 | <property stdset="1"> |
194 | <name>spacing</name> | 194 | <name>spacing</name> |
195 | <number>6</number> | 195 | <number>6</number> |
196 | </property> | 196 | </property> |
197 | <widget row="0" column="0" rowspan="1" colspan="2" > | 197 | <widget row="1" column="0" rowspan="1" colspan="3" > |
198 | <class>Line</class> | ||
199 | <property stdset="1"> | ||
200 | <name>name</name> | ||
201 | <cstring>Line1</cstring> | ||
202 | </property> | ||
203 | <property stdset="1"> | ||
204 | <name>orientation</name> | ||
205 | <enum>Horizontal</enum> | ||
206 | </property> | ||
207 | </widget> | ||
208 | <widget row="0" column="0" > | ||
198 | <class>QLabel</class> | 209 | <class>QLabel</class> |
199 | <property stdset="1"> | 210 | <property stdset="1"> |
200 | <name>name</name> | 211 | <name>name</name> |
201 | <cstring>TextLabel1</cstring> | 212 | <cstring>TextLabel1</cstring> |
202 | </property> | 213 | </property> |
203 | <property stdset="1"> | 214 | <property stdset="1"> |
204 | <name>text</name> | 215 | <name>text</name> |
205 | <string>Current Profile</string> | 216 | <string>Current Profile</string> |
206 | </property> | 217 | </property> |
207 | </widget> | 218 | </widget> |
208 | <widget row="0" column="2" > | 219 | <widget row="0" column="1" > |
209 | <class>QLabel</class> | 220 | <class>QLabel</class> |
210 | <property stdset="1"> | 221 | <property stdset="1"> |
211 | <name>name</name> | 222 | <name>name</name> |
212 | <cstring>currentProfileLabel</cstring> | 223 | <cstring>currentProfileLabel</cstring> |
213 | </property> | 224 | </property> |
214 | <property stdset="1"> | 225 | <property stdset="1"> |
215 | <name>frameShape</name> | 226 | <name>frameShape</name> |
216 | <enum>Panel</enum> | 227 | <enum>Panel</enum> |
217 | </property> | 228 | </property> |
218 | <property stdset="1"> | 229 | <property stdset="1"> |
219 | <name>frameShadow</name> | 230 | <name>frameShadow</name> |
220 | <enum>Sunken</enum> | 231 | <enum>Sunken</enum> |
221 | </property> | 232 | </property> |
222 | <property stdset="1"> | 233 | <property stdset="1"> |
223 | <name>text</name> | 234 | <name>text</name> |
224 | <string>All</string> | 235 | <string>All</string> |
225 | </property> | 236 | </property> |
226 | </widget> | 237 | </widget> |
227 | <widget row="1" column="0" > | 238 | <spacer row="0" column="2" > |
228 | <class>QLabel</class> | 239 | <property> |
229 | <property stdset="1"> | ||
230 | <name>name</name> | 240 | <name>name</name> |
231 | <cstring>TextLabel1_2</cstring> | 241 | <cstring>Spacer2</cstring> |
232 | </property> | 242 | </property> |
233 | <property stdset="1"> | 243 | <property stdset="1"> |
234 | <name>text</name> | 244 | <name>orientation</name> |
235 | <string>Profiles</string> | 245 | <enum>Horizontal</enum> |
246 | </property> | ||
247 | <property stdset="1"> | ||
248 | <name>sizeType</name> | ||
249 | <enum>Expanding</enum> | ||
236 | </property> | 250 | </property> |
237 | </widget> | 251 | <property> |
238 | <spacer row="5" column="2" > | 252 | <name>sizeHint</name> |
253 | <size> | ||
254 | <width>20</width> | ||
255 | <height>20</height> | ||
256 | </size> | ||
257 | </property> | ||
258 | </spacer> | ||
259 | <spacer row="6" column="2" > | ||
239 | <property> | 260 | <property> |
240 | <name>name</name> | 261 | <name>name</name> |
241 | <cstring>Spacer16</cstring> | 262 | <cstring>Spacer16</cstring> |
242 | </property> | 263 | </property> |
243 | <property stdset="1"> | 264 | <property stdset="1"> |
244 | <name>orientation</name> | 265 | <name>orientation</name> |
245 | <enum>Vertical</enum> | 266 | <enum>Vertical</enum> |
246 | </property> | 267 | </property> |
247 | <property stdset="1"> | 268 | <property stdset="1"> |
248 | <name>sizeType</name> | 269 | <name>sizeType</name> |
249 | <enum>Expanding</enum> | 270 | <enum>Expanding</enum> |
250 | </property> | 271 | </property> |
251 | <property> | 272 | <property> |
252 | <name>sizeHint</name> | 273 | <name>sizeHint</name> |
253 | <size> | 274 | <size> |
254 | <width>20</width> | 275 | <width>20</width> |
255 | <height>20</height> | 276 | <height>20</height> |
256 | </size> | 277 | </size> |
257 | </property> | 278 | </property> |
258 | </spacer> | 279 | </spacer> |
259 | <widget row="2" column="0" rowspan="3" colspan="1" > | 280 | <widget row="5" column="2" > |
260 | <class>QListBox</class> | ||
261 | <property stdset="1"> | ||
262 | <name>name</name> | ||
263 | <cstring>profilesList</cstring> | ||
264 | </property> | ||
265 | </widget> | ||
266 | <widget row="4" column="1" rowspan="1" colspan="2" > | ||
267 | <class>QPushButton</class> | 281 | <class>QPushButton</class> |
268 | <property stdset="1"> | 282 | <property stdset="1"> |
269 | <name>name</name> | 283 | <name>name</name> |
270 | <cstring>PushButton7</cstring> | 284 | <cstring>PushButton7</cstring> |
271 | </property> | 285 | </property> |
272 | <property stdset="1"> | 286 | <property stdset="1"> |
273 | <name>text</name> | 287 | <name>text</name> |
274 | <string>&Set Current</string> | 288 | <string>&Set Current</string> |
275 | </property> | 289 | </property> |
276 | </widget> | 290 | </widget> |
277 | <widget row="3" column="1" rowspan="1" colspan="2" > | 291 | <widget row="4" column="2" > |
278 | <class>QPushButton</class> | 292 | <class>QPushButton</class> |
279 | <property stdset="1"> | 293 | <property stdset="1"> |
280 | <name>name</name> | 294 | <name>name</name> |
281 | <cstring>removeProfileButton</cstring> | 295 | <cstring>removeProfileButton</cstring> |
282 | </property> | 296 | </property> |
283 | <property stdset="1"> | 297 | <property stdset="1"> |
284 | <name>text</name> | 298 | <name>text</name> |
285 | <string>&Remove</string> | 299 | <string>&Remove</string> |
286 | </property> | 300 | </property> |
287 | </widget> | 301 | </widget> |
288 | <widget row="2" column="1" rowspan="1" colspan="2" > | 302 | <widget row="3" column="2" > |
289 | <class>QPushButton</class> | 303 | <class>QPushButton</class> |
290 | <property stdset="1"> | 304 | <property stdset="1"> |
291 | <name>name</name> | 305 | <name>name</name> |
292 | <cstring>newProfileButton</cstring> | 306 | <cstring>newProfileButton</cstring> |
293 | </property> | 307 | </property> |
294 | <property stdset="1"> | 308 | <property stdset="1"> |
295 | <name>text</name> | 309 | <name>text</name> |
296 | <string>&New</string> | 310 | <string>&New</string> |
297 | </property> | 311 | </property> |
298 | </widget> | 312 | </widget> |
313 | <widget row="2" column="0" > | ||
314 | <class>QLabel</class> | ||
315 | <property stdset="1"> | ||
316 | <name>name</name> | ||
317 | <cstring>TextLabel1_2</cstring> | ||
318 | </property> | ||
319 | <property stdset="1"> | ||
320 | <name>text</name> | ||
321 | <string>Profiles</string> | ||
322 | </property> | ||
323 | </widget> | ||
324 | <widget row="3" column="0" rowspan="3" colspan="2" > | ||
325 | <class>QListBox</class> | ||
326 | <property stdset="1"> | ||
327 | <name>name</name> | ||
328 | <cstring>profilesList</cstring> | ||
329 | </property> | ||
330 | </widget> | ||
299 | </grid> | 331 | </grid> |
300 | </widget> | 332 | </widget> |
301 | </widget> | 333 | </widget> |
302 | </vbox> | 334 | </vbox> |
303 | </widget> | 335 | </widget> |
304 | <customwidgets> | 336 | <customwidgets> |
305 | <customwidget> | 337 | <customwidget> |
306 | <class>QWidget</class> | 338 | <class>QWidget</class> |
307 | <header location="local">qwidget.h</header> | 339 | <header location="local">qwidget.h</header> |
308 | <sizehint> | 340 | <sizehint> |
309 | <width>100</width> | 341 | <width>100</width> |
310 | <height>100</height> | 342 | <height>100</height> |
311 | </sizehint> | 343 | </sizehint> |
312 | <container>0</container> | 344 | <container>0</container> |
313 | <sizepolicy> | 345 | <sizepolicy> |
314 | <hordata>7</hordata> | 346 | <hordata>7</hordata> |
315 | <verdata>7</verdata> | 347 | <verdata>7</verdata> |
316 | </sizepolicy> | 348 | </sizepolicy> |
317 | <pixmap>image0</pixmap> | 349 | <pixmap>image0</pixmap> |
318 | </customwidget> | 350 | </customwidget> |
319 | </customwidgets> | 351 | </customwidgets> |
320 | <images> | 352 | <images> |
321 | <image> | 353 | <image> |
322 | <name>image0</name> | 354 | <name>image0</name> |
323 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | 355 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> |
324 | </image> | 356 | </image> |
325 | </images> | 357 | </images> |
326 | </UI> | 358 | </UI> |
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 0f48a4b..89dac6f 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -1,363 +1,396 @@ | |||
1 | #include "mainwindowimp.h" | 1 | #include "mainwindowimp.h" |
2 | #include "addserviceimp.h" | 2 | #include "addserviceimp.h" |
3 | #include "interfaceinformationimp.h" | 3 | #include "interfaceinformationimp.h" |
4 | #include "interfacesetupimp.h" | 4 | #include "interfacesetupimp.h" |
5 | #include "kprocess.h" | 5 | #include "kprocess.h" |
6 | #include "module.h" | 6 | #include "module.h" |
7 | 7 | ||
8 | 8 | ||
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qtabwidget.h> | 10 | #include <qtabwidget.h> |
11 | #include <qlistbox.h> | 11 | #include <qlistbox.h> |
12 | #include <qlistview.h> | 12 | #include <qlistview.h> |
13 | #include <qheader.h> | 13 | #include <qheader.h> |
14 | #include <qlabel.h> | 14 | #include <qlabel.h> |
15 | 15 | ||
16 | #include <qmainwindow.h> | 16 | #include <qmainwindow.h> |
17 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #include <qpe/qlibrary.h> | 20 | #include <qpe/qlibrary.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | #include <qlist.h> | 23 | #include <qlist.h> |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <qfile.h> | 25 | #include <qfile.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | 27 | ||
28 | // For library loading. | 28 | // For library loading. |
29 | #include <dlfcn.h> | 29 | #include <dlfcn.h> |
30 | 30 | ||
31 | #define TEMP_ALL "/tmp/ifconfig-a" | 31 | #define TEMP_ALL "/tmp/ifconfig-a" |
32 | #define TEMP_UP "/tmp/ifconfig" | 32 | #define TEMP_UP "/tmp/ifconfig" |
33 | 33 | ||
34 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { | 34 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true) { |
35 | connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 35 | connect(addServiceButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
36 | connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 36 | connect(removeServiceButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
37 | connect(informationServiceButton, SIGNAL(clicked()), this, SLOT(informationClicked())); | 37 | connect(informationServiceButton, SIGNAL(clicked()), this, SLOT(informationClicked())); |
38 | connect(configureServiceButton, SIGNAL(clicked()), this, SLOT(configureClicked())); | 38 | connect(configureServiceButton, SIGNAL(clicked()), this, SLOT(configureClicked())); |
39 | 39 | ||
40 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); | 40 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); |
41 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); | 41 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); |
42 | connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&))); | 42 | connect(profilesList, SIGNAL(highlighted(const QString&)), this, SLOT(changeProfile(const QString&))); |
43 | 43 | ||
44 | // Make sure we have a plugin directory to scan. | 44 | // Make sure we have a plugin directory to scan. |
45 | QString DirStr = QDir::homeDirPath() + "/.networksetup/" ; | 45 | QString DirStr = QDir::homeDirPath() + "/.networksetup/" ; |
46 | QDir pluginDir( DirStr ); | 46 | QDir pluginDir( DirStr ); |
47 | pluginDir.mkdir( DirStr ); | 47 | pluginDir.mkdir( DirStr ); |
48 | pluginDir.mkdir( ( DirStr + "plugins/" ) ); | 48 | pluginDir.mkdir( ( DirStr + "plugins/" ) ); |
49 | QString path = DirStr + "plugins"; | 49 | QString path = DirStr + "plugins"; |
50 | pluginDir.setPath(path); | 50 | pluginDir.setPath(path); |
51 | if(!pluginDir.exists()){ | 51 | if(!pluginDir.exists()){ |
52 | qDebug(QString("MainWindowImp: ERROR: %1 %2").arg(__FILE__).arg(__LINE__).latin1()); | 52 | qDebug(QString("MainWindowImp: ERROR: %1 %2").arg(__FILE__).arg(__LINE__).latin1()); |
53 | return; | 53 | return; |
54 | } | 54 | } |
55 | 55 | ||
56 | // Load any saved services. | 56 | // Load any saved services. |
57 | loadModules(path); | 57 | loadModules(path); |
58 | getInterfaceList(); | 58 | getInterfaceList(); |
59 | serviceList->header()->hide(); | 59 | serviceList->header()->hide(); |
60 | 60 | ||
61 | 61 | ||
62 | Config cfg("NetworkSetup"); | 62 | Config cfg("NetworkSetup"); |
63 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); | 63 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); |
64 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 64 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
65 | profilesList->insertItem((*it)); | 65 | profilesList->insertItem((*it)); |
66 | } | 66 | } |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Deconstructor. Unload libraries and save profile list. | 69 | * Deconstructor. Unload libraries and save profile list. |
70 | */ | 70 | */ |
71 | MainWindowImp::~MainWindowImp(){ | 71 | MainWindowImp::~MainWindowImp(){ |
72 | if(profiles.count() > 1){ | 72 | if(profiles.count() > 1){ |
73 | Config cfg("NetworkSetup"); | 73 | Config cfg("NetworkSetup"); |
74 | cfg.writeEntry("Profiles", profiles.join(" ")); | 74 | cfg.writeEntry("Profiles", profiles.join(" ")); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | void MainWindowImp::loadModules(QString path){ | 78 | void MainWindowImp::loadModules(QString path){ |
79 | qDebug(path.latin1()); | 79 | qDebug(path.latin1()); |
80 | QDir d; | 80 | QDir d; |
81 | d.setPath(path); | 81 | d.setPath(path); |
82 | if(!d.exists()){ | 82 | if(!d.exists()){ |
83 | qDebug("MainWindowImp:: Path doesn't exists"); | 83 | qDebug("MainWindowImp:: Path doesn't exists"); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 86 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
87 | const QFileInfoList *list = d.entryInfoList(); | 87 | const QFileInfoList *list = d.entryInfoList(); |
88 | QFileInfoListIterator it( *list ); | 88 | QFileInfoListIterator it( *list ); |
89 | QFileInfo *fi; | 89 | QFileInfo *fi; |
90 | while ( (fi=it.current()) ) { | 90 | while ( (fi=it.current()) ) { |
91 | if(fi->fileName().contains(".so")){ | 91 | if(fi->fileName().contains(".so")){ |
92 | qDebug("Found"); | 92 | qDebug("Found"); |
93 | Module *foo = loadPlugin(path + "/" + fi->fileName()); | 93 | Module *foo = loadPlugin(path + "/" + fi->fileName()); |
94 | } | 94 | } |
95 | ++it; | 95 | ++it; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Attempt to load a function and resolve a function. | 100 | * Attempt to load a function and resolve a function. |
101 | * @param pluginFileName - the name of the file in which to attempt to load | 101 | * @param pluginFileName - the name of the file in which to attempt to load |
102 | * @param resolveString - function pointer to resolve | 102 | * @param resolveString - function pointer to resolve |
103 | * @return pointer to the function with name resolveString or NULL | 103 | * @return pointer to the function with name resolveString or NULL |
104 | */ | 104 | */ |
105 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ | 105 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ |
106 | qDebug(pluginFileName.latin1()); | 106 | qDebug(pluginFileName.latin1()); |
107 | QLibrary *lib = new QLibrary(pluginFileName); | 107 | QLibrary *lib = new QLibrary(pluginFileName); |
108 | void *functionPointer = lib->resolve(resolveString); | 108 | void *functionPointer = lib->resolve(resolveString); |
109 | if( !functionPointer ){ | 109 | if( !functionPointer ){ |
110 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 110 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); |
111 | delete lib; | 111 | delete lib; |
112 | return NULL; | 112 | return NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | // Try to get an object. | 115 | // Try to get an object. |
116 | Module *object = ((Module* (*)()) functionPointer)(); | 116 | Module *object = ((Module* (*)()) functionPointer)(); |
117 | if(object == NULL){ | 117 | if(object == NULL){ |
118 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 118 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
119 | delete lib; | 119 | delete lib; |
120 | return NULL; | 120 | return NULL; |
121 | } | 121 | } |
122 | 122 | ||
123 | // Store for reference | 123 | // Store for reference |
124 | libraries.insert(object, lib); | 124 | libraries.insert(object, lib); |
125 | return object; | 125 | return object; |
126 | } | 126 | } |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 129 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
130 | * load the plugin and append it to the list | 130 | * load the plugin and append it to the list |
131 | */ | 131 | */ |
132 | void MainWindowImp::addClicked(){ | 132 | void MainWindowImp::addClicked(){ |
133 | // Now that we have a list of all of the protocals, list them. | 133 | // Now that we have a list of all of the protocals, list them. |
134 | { | 134 | { |
135 | QMessageBox::information(this, "No Modules", "Nothing to add.", "Ok"); | 135 | QMessageBox::information(this, "No Modules", "Nothing to add.", "Ok"); |
136 | return; | 136 | return; |
137 | } | 137 | } |
138 | AddServiceImp service(this, "AddService", true); | 138 | AddServiceImp service(this, "AddService", true); |
139 | service.showMaximized(); | 139 | service.showMaximized(); |
140 | service.exec(); | 140 | service.exec(); |
141 | } | 141 | } |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Prompt the user to see if they really want to do this. | 144 | * Prompt the user to see if they really want to do this. |
145 | * If they do then remove from the list and unload. | 145 | * If they do then remove from the list and unload. |
146 | */ | 146 | */ |
147 | void MainWindowImp::removeClicked(){ | 147 | void MainWindowImp::removeClicked(){ |
148 | QListViewItem *item = serviceList->currentItem(); | 148 | QListViewItem *item = serviceList->currentItem(); |
149 | if(item == NULL) { | 149 | if(item == NULL) { |
150 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 150 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
151 | return; | 151 | return; |
152 | } | 152 | } |
153 | 153 | ||
154 | if(modules.find(interfaceItems[item]) == modules.end()){ | 154 | if((interfaceItems[item])->getModuleOwner() == NULL){ |
155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); | 155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); |
156 | } | 156 | } |
157 | else{ | 157 | else{ |
158 | // Try to remove. | 158 | // Try to remove. |
159 | } | 159 | } |
160 | 160 | ||
161 | } | 161 | } |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * See if there is a configuration for the selected protocal. | 164 | * See if there is a configuration for the selected protocal. |
165 | * Prompt with errors. | 165 | * Prompt with errors. |
166 | */ | 166 | */ |
167 | void MainWindowImp::configureClicked(){ | 167 | void MainWindowImp::configureClicked(){ |
168 | QListViewItem *item = serviceList->currentItem(); | 168 | QListViewItem *item = serviceList->currentItem(); |
169 | if(item == NULL){ | 169 | if(item == NULL){ |
170 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 170 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | 173 | ||
174 | if(modules.find(interfaceItems[item]) == modules.end()){ | 174 | if((interfaceItems[item])->getModuleOwner() == NULL){ |
175 | InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); | 175 | InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); |
176 | conf->showMaximized(); | 176 | conf->showMaximized(); |
177 | conf->show(); | 177 | conf->show(); |
178 | } | 178 | } |
179 | else{ | 179 | else{ |
180 | InterfaceSetupImp *conf = new InterfaceSetupImp(this, "InterfaceConfiguration"); | 180 | QTabWidget *t = NULL; |
181 | conf->show(); | 181 | QWidget *conf = (interfaceItems[item])->getModuleOwner()->configure(&t); |
182 | if(conf != NULL){ | ||
183 | qDebug("Conf found"); | ||
184 | if(t != NULL){ | ||
185 | qDebug("Adding Interface"); | ||
186 | InterfaceSetupImp *i = new InterfaceSetupImp(t, "TCPIPInformation", interfaceItems[item], true); | ||
187 | t->insertTab(i, "TCP/IP"); | ||
188 | } | ||
189 | conf->showMaximized(); | ||
190 | conf->show(); | ||
191 | } | ||
192 | else{ | ||
193 | InterfaceSetupImp *i = new InterfaceSetupImp(0, "TCPIPInformation", interfaceItems[item], true); | ||
194 | i->showMaximized(); | ||
195 | i->show(); | ||
196 | } | ||
182 | } | 197 | } |
183 | } | 198 | } |
184 | 199 | ||
185 | /** | 200 | /** |
186 | * Pull up the information about the selected interface | 201 | * Pull up the information about the selected interface |
187 | * Report an error | 202 | * Report an error |
188 | */ | 203 | */ |
189 | void MainWindowImp::informationClicked(){ | 204 | void MainWindowImp::informationClicked(){ |
190 | QListViewItem *item = serviceList->currentItem(); | 205 | QListViewItem *item = serviceList->currentItem(); |
191 | if(item == NULL){ | 206 | if(item == NULL){ |
192 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 207 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
193 | return; | 208 | return; |
194 | } | 209 | } |
195 | 210 | ||
196 | if(modules.find(interfaceItems[item]) == modules.end()){ | 211 | if( (interfaceItems[item])->getModuleOwner() == NULL){ |
197 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); | 212 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); |
198 | i->showMaximized(); | 213 | i->showMaximized(); |
199 | i->show(); | 214 | i->show(); |
200 | } | 215 | } |
201 | else{ | 216 | else{ |
202 | QTabWidget *t = new QTabWidget(this, "InterfaceInformationTAB"); | 217 | QTabWidget *t = NULL; |
203 | InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true); | 218 | QWidget *conf = (interfaceItems[item])->getModuleOwner()->information(&t); |
204 | t->insertTab(i, "TCP/IP"); | 219 | if(conf != NULL){ |
205 | t->show(); | 220 | if(t){ |
221 | qDebug("Adding Interface"); | ||
222 | InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true); | ||
223 | t->insertTab(i, "TCP/IP"); | ||
224 | } | ||
225 | conf->showMaximized(); | ||
226 | conf->show(); | ||
227 | } | ||
228 | else{ | ||
229 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true); | ||
230 | i->showMaximized(); | ||
231 | i->show(); | ||
232 | } | ||
206 | } | 233 | } |
207 | } | 234 | } |
208 | 235 | ||
209 | /** | 236 | /** |
210 | * Aquire the list of active interfaces from ifconfig | 237 | * Aquire the list of active interfaces from ifconfig |
211 | * Call ifconfig and ifconfig -a | 238 | * Call ifconfig and ifconfig -a |
212 | */ | 239 | */ |
213 | void MainWindowImp::getInterfaceList(){ | 240 | void MainWindowImp::getInterfaceList(){ |
214 | KShellProcess *processAll = new KShellProcess(); | 241 | KShellProcess *processAll = new KShellProcess(); |
215 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; | 242 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; |
216 | connect(processAll, SIGNAL(processExited(KProcess *)), | 243 | connect(processAll, SIGNAL(processExited(KProcess *)), |
217 | this, SLOT(jobDone(KProcess *))); | 244 | this, SLOT(jobDone(KProcess *))); |
218 | threads.insert(processAll, TEMP_ALL); | 245 | threads.insert(processAll, TEMP_ALL); |
219 | processAll->start(KShellProcess::NotifyOnExit); | 246 | processAll->start(KShellProcess::NotifyOnExit); |
220 | 247 | ||
221 | KShellProcess *process = new KShellProcess(); | 248 | KShellProcess *process = new KShellProcess(); |
222 | *process << "/sbin/ifconfig" << " > " TEMP_UP; | 249 | *process << "/sbin/ifconfig" << " > " TEMP_UP; |
223 | connect(process, SIGNAL(processExited(KProcess *)), | 250 | connect(process, SIGNAL(processExited(KProcess *)), |
224 | this, SLOT(jobDone(KProcess *))); | 251 | this, SLOT(jobDone(KProcess *))); |
225 | threads.insert(process, TEMP_UP); | 252 | threads.insert(process, TEMP_UP); |
226 | process->start(KShellProcess::NotifyOnExit); | 253 | process->start(KShellProcess::NotifyOnExit); |
227 | } | 254 | } |
228 | 255 | ||
229 | void MainWindowImp::jobDone(KProcess *process){ | 256 | void MainWindowImp::jobDone(KProcess *process){ |
230 | QString fileName = threads[process]; | 257 | QString fileName = threads[process]; |
231 | threads.remove(process); | 258 | threads.remove(process); |
232 | delete process; | 259 | delete process; |
233 | 260 | ||
234 | QFile file(fileName); | 261 | QFile file(fileName); |
235 | if (!file.open(IO_ReadOnly)){ | 262 | if (!file.open(IO_ReadOnly)){ |
236 | qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1()); | 263 | qDebug(QString("MainWindowImp: Can't open file: %1").arg(fileName).latin1()); |
237 | return; | 264 | return; |
238 | } | 265 | } |
239 | 266 | ||
240 | QTextStream stream( &file ); | 267 | QTextStream stream( &file ); |
241 | QString line; | 268 | QString line; |
242 | while ( !stream.eof() ) { | 269 | while ( !stream.eof() ) { |
243 | line = stream.readLine(); | 270 | line = stream.readLine(); |
244 | int space = line.find(" "); | 271 | int space = line.find(" "); |
245 | if(space > 1){ | 272 | if(space > 1){ |
246 | // We have found an interface | 273 | // We have found an interface |
247 | QString interfaceName = line.mid(0, space); | 274 | QString interfaceName = line.mid(0, space); |
248 | Interface *i; | 275 | Interface *i; |
249 | // See if we already have it | 276 | // See if we already have it |
250 | if(interfaceNames.find(interfaceName) == interfaceNames.end()){ | 277 | if(interfaceNames.find(interfaceName) == interfaceNames.end()){ |
251 | if(fileName == TEMP_ALL) | 278 | if(fileName == TEMP_ALL) |
252 | i = new Interface(interfaceName, false); | 279 | i = new Interface(interfaceName, false); |
253 | else | 280 | else |
254 | i = new Interface(interfaceName, true); | 281 | i = new Interface(interfaceName, true); |
255 | } | 282 | } |
256 | else{ | 283 | else{ |
257 | i = interfaceNames[interfaceName]; | 284 | i = interfaceNames[interfaceName]; |
258 | if(fileName != TEMP_ALL) | 285 | if(fileName != TEMP_ALL) |
259 | i->setStatus(true); | 286 | i->setStatus(true); |
260 | } | 287 | } |
261 | 288 | ||
262 | i->setAttached(true); | 289 | i->setAttached(true); |
263 | i->setInterfaceName(interfaceName); | 290 | i->setInterfaceName(interfaceName); |
264 | 291 | ||
265 | QString hardName = "Ethernet"; | 292 | QString hardName = "Ethernet"; |
266 | int hardwareName = line.find("Link encap:"); | 293 | int hardwareName = line.find("Link encap:"); |
267 | int macAddress = line.find("HWaddr"); | 294 | int macAddress = line.find("HWaddr"); |
268 | if(macAddress == -1) | 295 | if(macAddress == -1) |
269 | macAddress = line.length(); | 296 | macAddress = line.length(); |
270 | if(hardwareName != -1) | 297 | if(hardwareName != -1) |
271 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); | 298 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); |
272 | // We have found an interface | 299 | // We have found an interface |
273 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); | 300 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); |
274 | interfaceNames.insert(i->getInterfaceName(), i); | 301 | interfaceNames.insert(i->getInterfaceName(), i); |
275 | updateInterface(i); | 302 | updateInterface(i); |
276 | } | 303 | } |
277 | } | 304 | } |
278 | file.close(); | 305 | file.close(); |
279 | QFile::remove(fileName); | 306 | QFile::remove(fileName); |
280 | } | 307 | } |
281 | 308 | ||
282 | void MainWindowImp::updateInterface(Interface *i){ | 309 | void MainWindowImp::updateInterface(Interface *i){ |
283 | QListViewItem *item = NULL; | 310 | QListViewItem *item = NULL; |
284 | 311 | ||
285 | // See if we already have it | 312 | // See if we already have it |
286 | if(items.find(i) == items.end()){ | 313 | if(items.find(i) == items.end()){ |
287 | item = new QListViewItem(serviceList, "", "", ""); | 314 | item = new QListViewItem(serviceList, "", "", ""); |
288 | // See if you can't find a module owner for this interface | 315 | // See if you can't find a module owner for this interface |
289 | //EmployeeMap::Iterator it; | 316 | QMap<Module*, QLibrary*>::Iterator it; |
290 | //for( it = map.begin(); it != map.end(); ++it ) | 317 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
291 | // printf( "%s, %s earns %d\n", it.key().latin1(), it.data().name().latin1(), it.data().salary() ); | 318 | if(it.key()->isOwner(i)) |
292 | 319 | i->setModuleOwner(it.key()); | |
320 | } | ||
321 | |||
293 | items.insert(i, item); | 322 | items.insert(i, item); |
294 | interfaceItems.insert(item, i); | 323 | interfaceItems.insert(item, i); |
295 | } | 324 | } |
296 | else | 325 | else |
297 | item = items[i]; | 326 | item = items[i]; |
298 | 327 | ||
299 | QString statusImage = "down"; | 328 | QString statusImage = "down"; |
300 | if(i->getStatus()) | 329 | if(i->getStatus()) |
301 | statusImage = "up"; | 330 | statusImage = "up"; |
302 | QPixmap status = (Resource::loadPixmap(statusImage)); | 331 | QPixmap status = (Resource::loadPixmap(statusImage)); |
303 | item->setPixmap(0, status); | 332 | item->setPixmap(0, status); |
304 | 333 | ||
305 | QString typeName = "lan"; | 334 | QString typeName = "lan"; |
306 | if(i->getHardwareName().contains("Local Loopback")) | 335 | if(i->getHardwareName().contains("Local Loopback")) |
307 | typeName = "lo"; | 336 | typeName = "lo"; |
308 | if(i->getInterfaceName().contains("irda")) | 337 | if(i->getInterfaceName().contains("irda")) |
309 | typeName = "irda"; | 338 | typeName = "irda"; |
310 | if(i->getInterfaceName().contains("wlan")) | 339 | if(i->getInterfaceName().contains("wlan")) |
311 | typeName = "wlan"; | 340 | typeName = "wlan"; |
341 | // Actually try to use the Module | ||
342 | if(i->getModuleOwner() != NULL){ | ||
343 | typeName = i->getModuleOwner()->getPixmapName(i); | ||
344 | } | ||
312 | QPixmap type = (Resource::loadPixmap(typeName)); | 345 | QPixmap type = (Resource::loadPixmap(typeName)); |
313 | item->setPixmap(1, type); | 346 | item->setPixmap(1, type); |
314 | 347 | ||
315 | item->setText(2, i->getHardwareName()); | 348 | item->setText(2, i->getHardwareName()); |
316 | 349 | ||
317 | } | 350 | } |
318 | 351 | ||
319 | /** | 352 | /** |
320 | * Adds a new profile to the list of profiles. | 353 | * Adds a new profile to the list of profiles. |
321 | * Don't add profiles that already exists. | 354 | * Don't add profiles that already exists. |
322 | * Appends to the combo and QStringList | 355 | * Appends to the combo and QStringList |
323 | */ | 356 | */ |
324 | void MainWindowImp::addProfile(){ | 357 | void MainWindowImp::addProfile(){ |
325 | QString newProfileName = "New"; | 358 | QString newProfileName = "New"; |
326 | if(profiles.grep(newProfileName).count() > 0){ | 359 | if(profiles.grep(newProfileName).count() > 0){ |
327 | QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok"); | 360 | QMessageBox::information(this, "Can't Add.","Profile already exists.", "Ok"); |
328 | return; | 361 | return; |
329 | } | 362 | } |
330 | profiles.append(newProfileName); | 363 | profiles.append(newProfileName); |
331 | profilesList->insertItem(newProfileName); | 364 | profilesList->insertItem(newProfileName); |
332 | 365 | ||
333 | } | 366 | } |
334 | 367 | ||
335 | /** | 368 | /** |
336 | * Removes the currently selected profile in the combo. | 369 | * Removes the currently selected profile in the combo. |
337 | * Doesn't delete if there are less then 2 profiles. | 370 | * Doesn't delete if there are less then 2 profiles. |
338 | */ | 371 | */ |
339 | void MainWindowImp::removeProfile(){ | 372 | void MainWindowImp::removeProfile(){ |
340 | if(profilesList->count() <= 1){ | 373 | if(profilesList->count() <= 1){ |
341 | QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok"); | 374 | QMessageBox::information(this, "Can't remove anything.","Need One Profile.", "Ok"); |
342 | return; | 375 | return; |
343 | } | 376 | } |
344 | QString profileToRemove = profilesList->currentText(); | 377 | QString profileToRemove = profilesList->currentText(); |
345 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ | 378 | if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ |
346 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); | 379 | profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); |
347 | profilesList->clear(); | 380 | profilesList->clear(); |
348 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 381 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
349 | profilesList->insertItem((*it)); | 382 | profilesList->insertItem((*it)); |
350 | } | 383 | } |
351 | 384 | ||
352 | } | 385 | } |
353 | 386 | ||
354 | /** | 387 | /** |
355 | * A new profile has been selected, change. | 388 | * A new profile has been selected, change. |
356 | * @param newProfile the new profile. | 389 | * @param newProfile the new profile. |
357 | */ | 390 | */ |
358 | void MainWindowImp::changeProfile(const QString& newProfile){ | 391 | void MainWindowImp::changeProfile(const QString& newProfile){ |
359 | currentProfileLabel->setText(newProfile); | 392 | currentProfileLabel->setText(newProfile); |
360 | } | 393 | } |
361 | 394 | ||
362 | // mainwindowimp.cpp | 395 | // mainwindowimp.cpp |
363 | 396 | ||
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h index 8e300bf..19ebaf2 100644 --- a/noncore/settings/networksettings/mainwindowimp.h +++ b/noncore/settings/networksettings/mainwindowimp.h | |||
@@ -1,57 +1,56 @@ | |||
1 | #ifndef MAINWINOWIMP_H | 1 | #ifndef MAINWINOWIMP_H |
2 | #define MAINWINOWIMP_H | 2 | #define MAINWINOWIMP_H |
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | 7 | ||
8 | class Module; | 8 | class Module; |
9 | class Interface; | 9 | class Interface; |
10 | class QLibrary; | 10 | class QLibrary; |
11 | class KProcess; | 11 | class KProcess; |
12 | 12 | ||
13 | class MainWindowImp : public MainWindow { | 13 | class MainWindowImp : public MainWindow { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | MainWindowImp(QWidget *parent=0, const char *name=0); | 17 | MainWindowImp(QWidget *parent=0, const char *name=0); |
18 | ~MainWindowImp(); | 18 | ~MainWindowImp(); |
19 | 19 | ||
20 | private slots: | 20 | private slots: |
21 | void addClicked(); | 21 | void addClicked(); |
22 | void removeClicked(); | 22 | void removeClicked(); |
23 | void configureClicked(); | 23 | void configureClicked(); |
24 | void informationClicked(); | 24 | void informationClicked(); |
25 | 25 | ||
26 | void jobDone(KProcess *process); | 26 | void jobDone(KProcess *process); |
27 | void getInterfaceList(); | 27 | void getInterfaceList(); |
28 | 28 | ||
29 | void addProfile(); | 29 | void addProfile(); |
30 | void removeProfile(); | 30 | void removeProfile(); |
31 | void changeProfile(const QString&); | 31 | void changeProfile(const QString&); |
32 | 32 | ||
33 | void updateInterface(Interface *i); | 33 | void updateInterface(Interface *i); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | void loadModules(QString path); | 36 | void loadModules(QString path); |
37 | 37 | ||
38 | Module* loadPlugin(QString pluginFileName, | 38 | Module* loadPlugin(QString pluginFileName, |
39 | QString resolveString = "create_plugin"); | 39 | QString resolveString = "create_plugin"); |
40 | 40 | ||
41 | // For our local list of names | 41 | // For our local list of names |
42 | QMap<QString, Interface*> interfaceNames; | 42 | QMap<QString, Interface*> interfaceNames; |
43 | 43 | ||
44 | QMap<Module*, QLibrary*> libraries; | 44 | QMap<Module*, QLibrary*> libraries; |
45 | QMap<Interface*, Module*> modules; | ||
46 | QMap<Interface*, QListViewItem*> items; | 45 | QMap<Interface*, QListViewItem*> items; |
47 | QMap<QListViewItem*, Interface*> interfaceItems; | 46 | QMap<QListViewItem*, Interface*> interfaceItems; |
48 | 47 | ||
49 | QMap<KProcess*, QString> threads; | 48 | QMap<KProcess*, QString> threads; |
50 | QStringList profiles; | 49 | QStringList profiles; |
51 | 50 | ||
52 | }; | 51 | }; |
53 | 52 | ||
54 | #endif | 53 | #endif |
55 | 54 | ||
56 | // mainwindowimp.h | 55 | // mainwindowimp.h |
57 | 56 | ||
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h index 13fd523..c1e9488 100644 --- a/noncore/settings/networksettings/module.h +++ b/noncore/settings/networksettings/module.h | |||
@@ -1,33 +1,34 @@ | |||
1 | #ifndef NETCONF_MODULE_H | 1 | #ifndef NETCONF_MODULE_H |
2 | #define NETCONF_MODULE_H | 2 | #define NETCONF_MODULE_H |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include "interface.h" | 7 | #include "interface.h" |
8 | 8 | ||
9 | class QWidget; | 9 | class QWidget; |
10 | class QTabWidget; | ||
10 | 11 | ||
11 | class Module : QObject{ | 12 | class Module : QObject{ |
12 | 13 | ||
13 | signals: | 14 | signals: |
14 | void updateInterface(Interface *i); | 15 | void updateInterface(Interface *i); |
15 | 16 | ||
16 | public: | 17 | public: |
17 | Module(){}; | 18 | Module(){}; |
18 | 19 | ||
19 | virtual bool isOwner(Interface *){ return false; }; | 20 | virtual bool isOwner(Interface *){ return false; }; |
20 | virtual QWidget *configure(){ return NULL; } ; | 21 | virtual QWidget *configure(QTabWidget **tabWidget){ return NULL; } ; |
21 | virtual QWidget *information(){ return NULL; }; | 22 | virtual QWidget *information(QTabWidget **tabWidget){ return NULL; }; |
22 | virtual QList<Interface> getInterfaces() = 0; | 23 | virtual QList<Interface> getInterfaces() = 0; |
23 | virtual QMap<QString, QString> possibleNewInterfaces() = 0; | 24 | virtual QMap<QString, QString> possibleNewInterfaces() = 0; |
24 | virtual Interface *addNewInterface(QString name) = 0; | 25 | virtual Interface *addNewInterface(QString name) = 0; |
25 | virtual bool remove(Interface* i) = 0; | 26 | virtual bool remove(Interface* i) = 0; |
26 | 27 | virtual QString getPixmapName(Interface* i) = 0; | |
27 | 28 | ||
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |
31 | 32 | ||
32 | // module.h | 33 | // module.h |
33 | 34 | ||
diff --git a/noncore/settings/networksettings/networksetup.pro b/noncore/settings/networksettings/networksetup.pro index a01b050..0d48790 100644 --- a/noncore/settings/networksettings/networksetup.pro +++ b/noncore/settings/networksettings/networksetup.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on debug | 2 | #CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | 3 | CONFIG = qt warn_on release |
4 | HEADERS = mainwindowimp.h addserviceimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h | 4 | HEADERS = mainwindowimp.h addserviceimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h |
5 | SOURCES = main.cpp mainwindowimp.cpp addserviceimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp | 5 | SOURCES = main.cpp mainwindowimp.cpp addserviceimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp |
6 | #INCLUDEPATH+= $(QPEDIR)/include | 6 | #INCLUDEPATH+= $(QPEDIR)/include |
7 | #DEPENDPATH+= $(QPEDIR)/include | 7 | #DEPENDPATH+= $(QPEDIR)/include |
8 | LIBS += -lqpe | 8 | LIBS += -lqpe |
9 | INTERFACES= mainwindow.ui addservice.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui | 9 | INTERFACES= mainwindow.ui addservice.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui |
10 | TARGET = networksetup | 10 | TARGET = networksetup |