author | benmeyer <benmeyer> | 2002-10-01 21:21:48 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-01 21:21:48 (UTC) |
commit | 1ed782f91c1af59e31c117809ca5d9150b8b6654 (patch) (unidiff) | |
tree | d29c3f84dee9a01649d246a625a71d38274dbaae | |
parent | 2987dafbdfa6602c5e165fe862546ea32f5fd3ca (diff) | |
download | opie-1ed782f91c1af59e31c117809ca5d9150b8b6654.zip opie-1ed782f91c1af59e31c117809ca5d9150b8b6654.tar.gz opie-1ed782f91c1af59e31c117809ca5d9150b8b6654.tar.bz2 |
Getting modules to work
-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,29 +1,29 @@ | |||
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 | ||
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,64 +1,65 @@ | |||
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 |
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,173 +1,204 @@ | |||
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> |
@@ -246,33 +277,54 @@ | |||
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> |
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,30 +1,30 @@ | |||
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> |
@@ -181,134 +181,166 @@ | |||
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> |
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 | |||
@@ -138,84 +138,111 @@ void MainWindowImp::addClicked(){ | |||
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(); |
@@ -273,55 +300,61 @@ void MainWindowImp::jobDone(KProcess *process){ | |||
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"); |
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 | |||
@@ -29,29 +29,28 @@ private slots: | |||
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,29 +1,29 @@ | |||
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 | ||
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,64 +1,65 @@ | |||
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 |
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,173 +1,204 @@ | |||
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> |
@@ -246,33 +277,54 @@ | |||
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> |
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,30 +1,30 @@ | |||
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> |
@@ -181,134 +181,166 @@ | |||
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> |
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 | |||
@@ -138,84 +138,111 @@ void MainWindowImp::addClicked(){ | |||
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(); |
@@ -273,55 +300,61 @@ void MainWindowImp::jobDone(KProcess *process){ | |||
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"); |
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 | |||
@@ -29,29 +29,28 @@ private slots: | |||
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 |