summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/interfaces') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp2
-rw-r--r--noncore/settings/networksettings/interfaces/interface.h2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceadvanced.ui2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformation.ui233
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp14
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.h2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp54
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp4
8 files changed, 191 insertions, 122 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index cc45525..69b55d1 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -126,25 +126,25 @@ bool Interface::refresh(){
126 ip = "0.0.0.0"; 126 ip = "0.0.0.0";
127 subnetMask = "0.0.0.0"; 127 subnetMask = "0.0.0.0";
128 broadcast = ""; 128 broadcast = "";
129 dhcp = false; 129 dhcp = false;
130 dhcpServerIp = ""; 130 dhcpServerIp = "";
131 leaseObtained = ""; 131 leaseObtained = "";
132 leaseExpires = ""; 132 leaseExpires = "";
133 emit(updateInterface(this)); 133 emit(updateInterface(this));
134 return true; 134 return true;
135 } 135 }
136 136
137 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); 137 QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
138 int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); 138 int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
139 if(ret != 0){ 139 if(ret != 0){
140 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); 140 qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
141 return false; 141 return false;
142 } 142 }
143 143
144 QFile file(fileName); 144 QFile file(fileName);
145 if (!file.open(IO_ReadOnly)){ 145 if (!file.open(IO_ReadOnly)){
146 qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); 146 qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
147 return false; 147 return false;
148 } 148 }
149 149
150 // Set to the defaults 150 // Set to the defaults
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h
index 7e98deb..ec82851 100644
--- a/noncore/settings/networksettings/interfaces/interface.h
+++ b/noncore/settings/networksettings/interfaces/interface.h
@@ -38,25 +38,25 @@ public:
38 QString getBroadcast() const { return broadcast; }; 38 QString getBroadcast() const { return broadcast; };
39 bool isDhcp() const { return dhcp; }; 39 bool isDhcp() const { return dhcp; };
40 QString getDhcpServerIp() const { return dhcpServerIp; }; 40 QString getDhcpServerIp() const { return dhcpServerIp; };
41 QString getLeaseObtained() const { return leaseObtained; }; 41 QString getLeaseObtained() const { return leaseObtained; };
42 QString getLeaseExpires() const { return leaseExpires; }; 42 QString getLeaseExpires() const { return leaseExpires; };
43 43
44 public slots: 44 public slots:
45 virtual bool refresh(); 45 virtual bool refresh();
46 virtual void start(); 46 virtual void start();
47 virtual void stop(); 47 virtual void stop();
48 virtual void restart(); 48 virtual void restart();
49 49
50private: 50protected:
51 // Interface information 51 // Interface information
52 QString hardwareName; 52 QString hardwareName;
53 Module *moduleOwner; 53 Module *moduleOwner;
54 bool status; 54 bool status;
55 bool attached; 55 bool attached;
56 56
57 // Network information 57 // Network information
58 bool dhcp; 58 bool dhcp;
59 QString dhcpServerIp; 59 QString dhcpServerIp;
60 QString leaseObtained; 60 QString leaseObtained;
61 QString leaseExpires; 61 QString leaseExpires;
62 62
diff --git a/noncore/settings/networksettings/interfaces/interfaceadvanced.ui b/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
index 2e106cb..12dbb1d 100644
--- a/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
+++ b/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
@@ -9,25 +9,25 @@
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>214</width> 14 <width>214</width>
15 <height>290</height> 15 <height>290</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>maximumSize</name> 19 <name>maximumSize</name>
20 <size> 20 <size>
21 <width>240</width> 21 <width>32767</width>
22 <height>32767</height> 22 <height>32767</height>
23 </size> 23 </size>
24 </property> 24 </property>
25 <property stdset="1"> 25 <property stdset="1">
26 <name>caption</name> 26 <name>caption</name>
27 <string>Advanced Interface Information</string> 27 <string>Advanced Interface Information</string>
28 </property> 28 </property>
29 <grid> 29 <grid>
30 <property stdset="1"> 30 <property stdset="1">
31 <name>margin</name> 31 <name>margin</name>
32 <number>11</number> 32 <number>11</number>
33 </property> 33 </property>
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformation.ui b/noncore/settings/networksettings/interfaces/interfaceinformation.ui
index 763ad90..207200e 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformation.ui
+++ b/noncore/settings/networksettings/interfaces/interfaceinformation.ui
@@ -3,262 +3,258 @@
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>InterfaceInformation</cstring> 7 <cstring>InterfaceInformation</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>219</width> 14 <width>219</width>
15 <height>255</height> 15 <height>323</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 Information</string> 20 <string>Interface Information</string>
21 </property> 21 </property>
22 <grid> 22 <property>
23 <property stdset="1"> 23 <name>layoutMargin</name>
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property> 24 </property>
31 <widget row="4" column="0" rowspan="1" colspan="2" > 25 <property>
32 <class>QLayoutWidget</class> 26 <name>layoutSpacing</name>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>Layout1</cstring>
36 </property> 27 </property>
37 <grid> 28 <vbox>
38 <property stdset="1"> 29 <property stdset="1">
39 <name>margin</name> 30 <name>margin</name>
40 <number>0</number> 31 <number>4</number>
41 </property> 32 </property>
42 <property stdset="1"> 33 <property stdset="1">
43 <name>spacing</name> 34 <name>spacing</name>
44 <number>6</number> 35 <number>3</number>
45 </property> 36 </property>
46 <widget row="1" column="0" > 37 <widget>
47 <class>QPushButton</class> 38 <class>QLabel</class>
48 <property stdset="1">
49 <name>name</name>
50 <cstring>refreshButton</cstring>
51 </property>
52 <property stdset="1">
53 <name>text</name>
54 <string>&amp;Refresh</string>
55 </property>
56 </widget>
57 <widget row="0" column="1" >
58 <class>QPushButton</class>
59 <property stdset="1"> 39 <property stdset="1">
60 <name>name</name> 40 <name>name</name>
61 <cstring>stopButton</cstring> 41 <cstring>TextLabel22</cstring>
62 </property> 42 </property>
63 <property stdset="1"> 43 <property stdset="1">
64 <name>text</name> 44 <name>text</name>
65 <string>S&amp;top</string> 45 <string>IP Address</string>
66 </property> 46 </property>
67 </widget> 47 </widget>
68 <widget row="1" column="1" > 48 <widget>
69 <class>QPushButton</class> 49 <class>QLabel</class>
70 <property stdset="1"> 50 <property stdset="1">
71 <name>name</name> 51 <name>name</name>
72 <cstring>restartButton</cstring> 52 <cstring>ipAddressLabel</cstring>
73 </property> 53 </property>
74 <property stdset="1"> 54 <property stdset="1">
75 <name>text</name> 55 <name>frameShape</name>
76 <string>R&amp;estart</string> 56 <enum>Panel</enum>
77 </property> 57 </property>
78 </widget>
79 <widget row="0" column="0" >
80 <class>QPushButton</class>
81 <property stdset="1"> 58 <property stdset="1">
82 <name>name</name> 59 <name>frameShadow</name>
83 <cstring>startButton</cstring> 60 <enum>Sunken</enum>
84 </property> 61 </property>
85 <property stdset="1"> 62 <property stdset="1">
86 <name>text</name> 63 <name>text</name>
87 <string>&amp;Start</string> 64 <string>0.0.0.0</string>
88 </property> 65 </property>
89 </widget> 66 </widget>
90 </grid> 67 <widget>
91 </widget>
92 <widget row="0" column="0" >
93 <class>Line</class> 68 <class>Line</class>
94 <property stdset="1"> 69 <property stdset="1">
95 <name>name</name> 70 <name>name</name>
96 <cstring>Line1</cstring> 71 <cstring>Line1</cstring>
97 </property> 72 </property>
98 <property stdset="1"> 73 <property stdset="1">
99 <name>orientation</name> 74 <name>orientation</name>
100 <enum>Horizontal</enum> 75 <enum>Horizontal</enum>
101 </property> 76 </property>
102 </widget> 77 </widget>
103 <widget row="0" column="0" > 78 <widget>
104 <class>QLabel</class> 79 <class>QLabel</class>
105 <property stdset="1"> 80 <property stdset="1">
106 <name>name</name> 81 <name>name</name>
107 <cstring>TextLabel22</cstring> 82 <cstring>TextLabel23</cstring>
108 </property> 83 </property>
109 <property stdset="1"> 84 <property stdset="1">
110 <name>text</name> 85 <name>text</name>
111 <string>IP Address</string> 86 <string>Subnet Mask</string>
112 </property> 87 </property>
113 </widget> 88 </widget>
114 <widget row="1" column="0" > 89 <widget>
115 <class>QLabel</class> 90 <class>QLabel</class>
116 <property stdset="1"> 91 <property stdset="1">
117 <name>name</name> 92 <name>name</name>
118 <cstring>TextLabel23</cstring> 93 <cstring>subnetMaskLabel</cstring>
119 </property> 94 </property>
120 <property stdset="1"> 95 <property stdset="1">
121 <name>text</name> 96 <name>frameShape</name>
122 <string>Subnet Mask</string> 97 <enum>Panel</enum>
123 </property> 98 </property>
124 </widget>
125 <widget row="2" column="0" >
126 <class>QLabel</class>
127 <property stdset="1"> 99 <property stdset="1">
128 <name>name</name> 100 <name>frameShadow</name>
129 <cstring>TextLabel21</cstring> 101 <enum>Sunken</enum>
130 </property> 102 </property>
131 <property stdset="1"> 103 <property stdset="1">
132 <name>text</name> 104 <name>text</name>
133 <string>MAC Address</string> 105 <string>0.0.0.0</string>
134 </property> 106 </property>
135 </widget> 107 </widget>
136 <widget row="3" column="0" > 108 <widget>
137 <class>QLabel</class> 109 <class>QLabel</class>
138 <property stdset="1"> 110 <property stdset="1">
139 <name>name</name> 111 <name>name</name>
140 <cstring>TextLabel24</cstring> 112 <cstring>macAddressLabel</cstring>
141 </property> 113 </property>
142 <property stdset="1"> 114 <property stdset="1">
143 <name>frameShape</name> 115 <name>frameShape</name>
144 <enum>MShape</enum> 116 <enum>Panel</enum>
145 </property> 117 </property>
146 <property stdset="1"> 118 <property stdset="1">
147 <name>frameShadow</name> 119 <name>frameShadow</name>
148 <enum>MShadow</enum> 120 <enum>Sunken</enum>
149 </property> 121 </property>
150 <property stdset="1"> 122 <property stdset="1">
151 <name>text</name> 123 <name>text</name>
152 <string>Broadcast</string> 124 <string>00:00:00:00:00:00</string>
153 </property> 125 </property>
154 </widget> 126 </widget>
155 <widget row="1" column="1" > 127 <widget>
156 <class>QLabel</class> 128 <class>QLabel</class>
157 <property stdset="1"> 129 <property stdset="1">
158 <name>name</name> 130 <name>name</name>
159 <cstring>subnetMaskLabel</cstring> 131 <cstring>TextLabel21</cstring>
132 </property>
133 <property stdset="1">
134 <name>text</name>
135 <string>MAC Address</string>
136 </property>
137 </widget>
138 <widget>
139 <class>QLabel</class>
140 <property stdset="1">
141 <name>name</name>
142 <cstring>broadcastLabel</cstring>
160 </property> 143 </property>
161 <property stdset="1"> 144 <property stdset="1">
162 <name>frameShape</name> 145 <name>frameShape</name>
163 <enum>Panel</enum> 146 <enum>Panel</enum>
164 </property> 147 </property>
165 <property stdset="1"> 148 <property stdset="1">
166 <name>frameShadow</name> 149 <name>frameShadow</name>
167 <enum>Sunken</enum> 150 <enum>Sunken</enum>
168 </property> 151 </property>
169 <property stdset="1"> 152 <property stdset="1">
170 <name>text</name> 153 <name>text</name>
171 <string>0.0.0.0</string> 154 <string></string>
172 </property> 155 </property>
173 </widget> 156 </widget>
174 <widget row="2" column="1" > 157 <widget>
175 <class>QLabel</class> 158 <class>QLabel</class>
176 <property stdset="1"> 159 <property stdset="1">
177 <name>name</name> 160 <name>name</name>
178 <cstring>macAddressLabel</cstring> 161 <cstring>TextLabel24</cstring>
179 </property> 162 </property>
180 <property stdset="1"> 163 <property stdset="1">
181 <name>frameShape</name> 164 <name>frameShape</name>
182 <enum>Panel</enum> 165 <enum>MShape</enum>
183 </property> 166 </property>
184 <property stdset="1"> 167 <property stdset="1">
185 <name>frameShadow</name> 168 <name>frameShadow</name>
186 <enum>Sunken</enum> 169 <enum>MShadow</enum>
187 </property> 170 </property>
188 <property stdset="1"> 171 <property stdset="1">
189 <name>text</name> 172 <name>text</name>
190 <string>00:00:00:00:00:00</string> 173 <string>Broadcast</string>
191 </property> 174 </property>
192 </widget> 175 </widget>
193 <widget row="3" column="1" > 176 <widget>
194 <class>QLabel</class> 177 <class>QLayoutWidget</class>
195 <property stdset="1"> 178 <property stdset="1">
196 <name>name</name> 179 <name>name</name>
197 <cstring>broadcastLabel</cstring> 180 <cstring>Layout1</cstring>
198 </property> 181 </property>
182 <grid>
199 <property stdset="1"> 183 <property stdset="1">
200 <name>frameShape</name> 184 <name>margin</name>
201 <enum>Panel</enum> 185 <number>0</number>
202 </property> 186 </property>
203 <property stdset="1"> 187 <property stdset="1">
204 <name>frameShadow</name> 188 <name>spacing</name>
205 <enum>Sunken</enum> 189 <number>6</number>
190 </property>
191 <widget row="1" column="0" >
192 <class>QPushButton</class>
193 <property stdset="1">
194 <name>name</name>
195 <cstring>refreshButton</cstring>
206 </property> 196 </property>
207 <property stdset="1"> 197 <property stdset="1">
208 <name>text</name> 198 <name>text</name>
209 <string></string> 199 <string>&amp;Refresh</string>
210 </property> 200 </property>
211 </widget> 201 </widget>
212 <widget row="0" column="1" > 202 <widget row="0" column="1" >
213 <class>QLabel</class> 203 <class>QPushButton</class>
214 <property stdset="1"> 204 <property stdset="1">
215 <name>name</name> 205 <name>name</name>
216 <cstring>ipAddressLabel</cstring> 206 <cstring>stopButton</cstring>
217 </property> 207 </property>
218 <property stdset="1"> 208 <property stdset="1">
219 <name>frameShape</name> 209 <name>text</name>
220 <enum>Panel</enum> 210 <string>S&amp;top</string>
221 </property> 211 </property>
212 </widget>
213 <widget row="1" column="1" >
214 <class>QPushButton</class>
222 <property stdset="1"> 215 <property stdset="1">
223 <name>frameShadow</name> 216 <name>name</name>
224 <enum>Sunken</enum> 217 <cstring>restartButton</cstring>
225 </property> 218 </property>
226 <property stdset="1"> 219 <property stdset="1">
227 <name>text</name> 220 <name>text</name>
228 <string>0.0.0.0</string> 221 <string>R&amp;estart</string>
229 </property> 222 </property>
230 </widget> 223 </widget>
231 <spacer row="7" column="1" > 224 <widget row="0" column="0" >
232 <property> 225 <class>QPushButton</class>
226 <property stdset="1">
233 <name>name</name> 227 <name>name</name>
234 <cstring>Spacer18</cstring> 228 <cstring>startButton</cstring>
235 </property> 229 </property>
236 <property stdset="1"> 230 <property stdset="1">
237 <name>orientation</name> 231 <name>text</name>
238 <enum>Vertical</enum> 232 <string>&amp;Start</string>
239 </property> 233 </property>
234 </widget>
235 </grid>
236 </widget>
237 <widget>
238 <class>Line</class>
240 <property stdset="1"> 239 <property stdset="1">
241 <name>sizeType</name> 240 <name>name</name>
242 <enum>Expanding</enum> 241 <cstring>Line5</cstring>
243 </property> 242 </property>
244 <property> 243 <property stdset="1">
245 <name>sizeHint</name> 244 <name>orientation</name>
246 <size> 245 <enum>Horizontal</enum>
247 <width>20</width>
248 <height>20</height>
249 </size>
250 </property> 246 </property>
251 </spacer> 247 </widget>
252 <widget row="6" column="0" rowspan="1" colspan="2" > 248 <widget>
253 <class>QLayoutWidget</class> 249 <class>QLayoutWidget</class>
254 <property stdset="1"> 250 <property stdset="1">
255 <name>name</name> 251 <name>name</name>
256 <cstring>Layout2</cstring> 252 <cstring>Layout2</cstring>
257 </property> 253 </property>
258 <hbox> 254 <hbox>
259 <property stdset="1"> 255 <property stdset="1">
260 <name>margin</name> 256 <name>margin</name>
261 <number>0</number> 257 <number>0</number>
262 </property> 258 </property>
263 <property stdset="1"> 259 <property stdset="1">
264 <name>spacing</name> 260 <name>spacing</name>
@@ -289,33 +285,54 @@
289 <class>QPushButton</class> 285 <class>QPushButton</class>
290 <property stdset="1"> 286 <property stdset="1">
291 <name>name</name> 287 <name>name</name>
292 <cstring>advancedButton</cstring> 288 <cstring>advancedButton</cstring>
293 </property> 289 </property>
294 <property stdset="1"> 290 <property stdset="1">
295 <name>text</name> 291 <name>text</name>
296 <string>&amp;View Advanced Information</string> 292 <string>&amp;View Advanced Information</string>
297 </property> 293 </property>
298 </widget> 294 </widget>
299 </hbox> 295 </hbox>
300 </widget> 296 </widget>
301 <widget row="5" column="0" rowspan="1" colspan="2" > 297 <spacer>
302 <class>Line</class> 298 <property>
303 <property stdset="1">
304 <name>name</name> 299 <name>name</name>
305 <cstring>Line5</cstring> 300 <cstring>Spacer18</cstring>
306 </property> 301 </property>
307 <property stdset="1"> 302 <property stdset="1">
308 <name>orientation</name> 303 <name>orientation</name>
309 <enum>Horizontal</enum> 304 <enum>Vertical</enum>
305 </property>
306 <property stdset="1">
307 <name>sizeType</name>
308 <enum>Expanding</enum>
309 </property>
310 <property>
311 <name>sizeHint</name>
312 <size>
313 <width>20</width>
314 <height>20</height>
315 </size>
316 </property>
317 </spacer>
318 <widget>
319 <class>QCheckBox</class>
320 <property stdset="1">
321 <name>name</name>
322 <cstring>CheckBoxSilent</cstring>
323 </property>
324 <property stdset="1">
325 <name>text</name>
326 <string>be &amp;silent</string>
310 </property> 327 </property>
311 </widget> 328 </widget>
312 </grid> 329 </vbox>
313</widget> 330</widget>
314<tabstops> 331<tabstops>
315 <tabstop>startButton</tabstop> 332 <tabstop>startButton</tabstop>
316 <tabstop>stopButton</tabstop> 333 <tabstop>stopButton</tabstop>
317 <tabstop>refreshButton</tabstop> 334 <tabstop>refreshButton</tabstop>
318 <tabstop>restartButton</tabstop> 335 <tabstop>restartButton</tabstop>
319 <tabstop>advancedButton</tabstop> 336 <tabstop>advancedButton</tabstop>
320</tabstops> 337</tabstops>
321</UI> 338</UI>
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index e00dcce..37c3a91 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1,38 +1,51 @@
1#include "interfaceinformationimp.h" 1#include "interfaceinformationimp.h"
2#include "interfaceadvanced.h" 2#include "interfaceadvanced.h"
3 3
4#include <qcheckbox.h>
4#include <qpushbutton.h> 5#include <qpushbutton.h>
5#include <qlabel.h> 6#include <qlabel.h>
6#include <qgroupbox.h> 7#include <qgroupbox.h>
7#include <qmessagebox.h> 8#include <qmessagebox.h>
8 9
10#include <qpe/config.h>
11
9#ifdef QWS 12#ifdef QWS
10#else 13#else
11 #define showMaximized show 14 #define showMaximized show
12#endif 15#endif
13 16
14/** 17/**
15 * Constructor for the InterfaceInformationImp class. This class pretty much 18 * Constructor for the InterfaceInformationImp class. This class pretty much
16 * just display's information about the interface that is passed to it. 19 * just display's information about the interface that is passed to it.
17 */ 20 */
18InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ 21InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){
19 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 22 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
20 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); 23 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
21 updateInterface(interface); 24 updateInterface(interface);
22 connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); 25 connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
23 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); 26 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
24 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); 27 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
25 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); 28 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
26 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); 29 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
30 Config cfg("networksettings", Config::User);
31 cfg.setGroup("interface");
32 CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
33}
34
35InterfaceInformationImp::~InterfaceInformationImp()
36{
37 Config cfg("networksettings", Config::User);
38 cfg.setGroup("interface");
39 cfg.writeEntry("silent", CheckBoxSilent->isChecked() );
27} 40}
28 41
29/** 42/**
30 * Update the interface information and buttons. 43 * Update the interface information and buttons.
31 * @param Intarface *i the interface to update (should be the one we already 44 * @param Intarface *i the interface to update (should be the one we already
32 * know about). 45 * know about).
33 */ 46 */
34void InterfaceInformationImp::updateInterface(Interface *){ 47void InterfaceInformationImp::updateInterface(Interface *){
35 if(interface->getStatus()){ 48 if(interface->getStatus()){
36 startButton->setEnabled(false); 49 startButton->setEnabled(false);
37 stopButton->setEnabled(true); 50 stopButton->setEnabled(true);
38 restartButton->setEnabled(true); 51 restartButton->setEnabled(true);
@@ -63,17 +76,18 @@ void InterfaceInformationImp::advanced(){
63 a->leaseObtainedLabel->setText(interface->getLeaseObtained()); 76 a->leaseObtainedLabel->setText(interface->getLeaseObtained());
64 a->leaseExpiresLabel->setText(interface->getLeaseExpires()); 77 a->leaseExpiresLabel->setText(interface->getLeaseExpires());
65 a->dhcpInformation->setEnabled(interface->isDhcp()); 78 a->dhcpInformation->setEnabled(interface->isDhcp());
66 a->showMaximized(); 79 a->showMaximized();
67} 80}
68 81
69/** 82/**
70 * Messages from the interface if start/stop went as planned. 83 * Messages from the interface if start/stop went as planned.
71 * Purly for user feedback. 84 * Purly for user feedback.
72 * @param message the message to display. 85 * @param message the message to display.
73 */ 86 */
74void InterfaceInformationImp::showMessage(const QString &message){ 87void InterfaceInformationImp::showMessage(const QString &message){
88 if (CheckBoxSilent->isChecked()) return;
75 QMessageBox::information(this, "Message", message, QMessageBox::Ok); 89 QMessageBox::information(this, "Message", message, QMessageBox::Ok);
76} 90}
77 91
78// infoimp.cpp 92// infoimp.cpp
79 93
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.h b/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
index 65cdfe0..9c93d1d 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
@@ -1,25 +1,25 @@
1#ifndef INTERFACEINFORMATIONIMP_H 1#ifndef INTERFACEINFORMATIONIMP_H
2#define INTERFACEINFORMATIONIMP_H 2#define INTERFACEINFORMATIONIMP_H
3 3
4#include "interfaceinformation.h" 4#include "interfaceinformation.h"
5#include "interface.h" 5#include "interface.h"
6 6
7class InterfaceInformationImp : public InterfaceInformation { 7class InterfaceInformationImp : public InterfaceInformation {
8 8
9Q_OBJECT 9Q_OBJECT
10 10
11public: 11public:
12 InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0); 12 InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0);
13 ~InterfaceInformationImp(){}; 13 ~InterfaceInformationImp();
14 14
15private slots: 15private slots:
16 void advanced(); 16 void advanced();
17 void updateInterface(Interface *i); 17 void updateInterface(Interface *i);
18 void showMessage(const QString &message); 18 void showMessage(const QString &message);
19 19
20private: 20private:
21 Interface *interface; 21 Interface *interface;
22 22
23}; 23};
24 24
25#endif 25#endif
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index 71d0cf5..436e449 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -1,14 +1,15 @@
1#include "interfaces.h" 1#include "interfaces.h"
2 2
3#include <qcheckbox.h>
3#include <qfile.h> 4#include <qfile.h>
4#include <qtextstream.h> 5#include <qtextstream.h>
5#include <qregexp.h> 6#include <qregexp.h>
6 7
7// The three stanza's 8// The three stanza's
8#define AUTO "auto" 9#define AUTO "auto"
9#define IFACE "iface" 10#define IFACE "iface"
10#define MAPPING "mapping" 11#define MAPPING "mapping"
11 12
12/** 13/**
13 * Constructor. Reads in the interfaces file and then split the file up by 14 * Constructor. Reads in the interfaces file and then split the file up by
14 * the \n for interfaces variable. 15 * the \n for interfaces variable.
@@ -142,39 +143,41 @@ bool Interfaces::isInterfaceSet() const {
142} 143}
143 144
144/** 145/**
145 * Add a new interface of with the settings - family and method 146 * Add a new interface of with the settings - family and method
146 * @param interface the name of the interface to set. All whitespace is 147 * @param interface the name of the interface to set. All whitespace is
147 * removed from the interface name. 148 * removed from the interface name.
148 * @param family the family of this interface inet or inet, ipx or inet6 149 * @param family the family of this interface inet or inet, ipx or inet6
149 * Must of one of the families defined in interfaces.h 150 * Must of one of the families defined in interfaces.h
150 * @param method for the family. see interfaces man page for family methods. 151 * @param method for the family. see interfaces man page for family methods.
151 * @return true if successfull. 152 * @return true if successfull.
152 */ 153 */
153bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ 154bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
155 qDebug("Interfaces::addInterface(%s)",interface.latin1());
154 if(0 == acceptedFamily.contains(family)) 156 if(0 == acceptedFamily.contains(family))
155 return false; 157 return false;
156 QString newInterface = interface.simplifyWhiteSpace(); 158 QString newInterface = interface.simplifyWhiteSpace();
157 newInterface = newInterface.replace(QRegExp(" "), ""); 159 newInterface = newInterface.replace(QRegExp(" "), "");
158 interfaces.append(""); 160 interfaces.append("");
159 interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method)); 161 interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method));
160 return true; 162 return true;
161} 163}
162 164
163/** 165/**
164 * Copies interface with name interface to name newInterface 166 * Copies interface with name interface to name newInterface
165 * @param newInterface name of the new interface. 167 * @param newInterface name of the new interface.
166 * @return bool true if successfull 168 * @return bool true if successfull
167 */ 169 */
168bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ 170bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
171 qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1());
169 if(!setInterface(interface)) 172 if(!setInterface(interface))
170 return false; 173 return false;
171 174
172 // Store the old interface and bump past the stanza line. 175 // Store the old interface and bump past the stanza line.
173 QStringList::Iterator it = currentIface; 176 QStringList::Iterator it = currentIface;
174 it++; 177 it++;
175 178
176 // Add the new interface 179 // Add the new interface
177 bool error; 180 bool error;
178 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); 181 addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error));
179 if(!setInterface(newInterface)) 182 if(!setInterface(newInterface))
180 return false; 183 return false;
@@ -263,30 +266,34 @@ QString Interfaces::getInterfaceMethod(bool &error){
263 line = line.mid(family.length()+1, line.length()); 266 line = line.mid(family.length()+1, line.length());
264 line = line.simplifyWhiteSpace(); 267 line = line.simplifyWhiteSpace();
265 error = false; 268 error = false;
266 return line; 269 return line;
267} 270}
268 271
269/** 272/**
270 * Sets the interface name to newName. 273 * Sets the interface name to newName.
271 * @param newName the new name of the interface. All whitespace is removed. 274 * @param newName the new name of the interface. All whitespace is removed.
272 * @return bool true if successfull. 275 * @return bool true if successfull.
273 */ 276 */
274bool Interfaces::setInterfaceName(const QString &newName){ 277bool Interfaces::setInterfaceName(const QString &newName){
278 qDebug("setInterfaceName %s", newName.latin1());
275 if(currentIface == interfaces.end()) 279 if(currentIface == interfaces.end())
276 return false; 280 return false;
277 QString name = newName.simplifyWhiteSpace(); 281 QString name = newName.simplifyWhiteSpace();
278 name = name.replace(QRegExp(" "), ""); 282 name = name.replace(QRegExp(" "), "");
279 bool returnValue = false; 283 bool returnValue = false;
280 (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); 284 QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
285 qDebug("setting %s",tmp.latin1());
286
287 (*currentIface) = tmp;
281 return !returnValue; 288 return !returnValue;
282} 289}
283 290
284/** 291/**
285 * Sets the interface family to newName. 292 * Sets the interface family to newName.
286 * @param newName the new name of the interface. Must be one of the families 293 * @param newName the new name of the interface. Must be one of the families
287 * defined in the interfaces.h file. 294 * defined in the interfaces.h file.
288 * @return bool true if successfull. 295 * @return bool true if successfull.
289 */ 296 */
290bool Interfaces::setInterfaceFamily(const QString &newName){ 297bool Interfaces::setInterfaceFamily(const QString &newName){
291 if(currentIface == interfaces.end()) 298 if(currentIface == interfaces.end())
292 return false; 299 return false;
@@ -318,30 +325,36 @@ bool Interfaces::setInterfaceMethod(const QString &newName){
318 * address 192.168.1.1 325 * address 192.168.1.1
319 * @param option the options to get the value. 326 * @param option the options to get the value.
320 * @param error set to true if any error occurs, false otherwise. 327 * @param error set to true if any error occurs, false otherwise.
321 * @return QString the options value. QString::null if error == true 328 * @return QString the options value. QString::null if error == true
322 */ 329 */
323QString Interfaces::getInterfaceOption(const QString &option, bool &error){ 330QString Interfaces::getInterfaceOption(const QString &option, bool &error){
324 return getOption(currentIface, option, error); 331 return getOption(currentIface, option, error);
325} 332}
326 333
327/** 334/**
328 * Set a value for an option in the currently selected interface. If option 335 * Set a value for an option in the currently selected interface. If option
329 * doesn't exist then it is added along with the value. 336 * doesn't exist then it is added along with the value.
337 * If value isEmpty() then we will remove the option
338 *
330 * @param option the options to set the value. 339 * @param option the options to set the value.
331 * @param value the value that option should be set to. 340 * @param value the value that option should be set to.
332 * @param error set to true if any error occurs, false otherwise. 341 * @param error set to true if any error occurs, false otherwise.
333 * @return QString the options value. QString::null if error == true 342 * @return QString the options value. QString::null if error == true
334 */ 343 */
335bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ 344bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
345 if( value.stripWhiteSpace().isEmpty() )
346 return removeInterfaceOption( option );
347
348 qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1());
336 return setOption(currentIface, option, value); 349 return setOption(currentIface, option, value);
337} 350}
338 351
339/** 352/**
340 * Removes a value for an option in the currently selected interface. 353 * Removes a value for an option in the currently selected interface.
341 * @param option the options to set the value. 354 * @param option the options to set the value.
342 * @param error set to true if any error occurs, false otherwise. 355 * @param error set to true if any error occurs, false otherwise.
343 * @return QString the options value. QString::null if error == true 356 * @return QString the options value. QString::null if error == true
344 */ 357 */
345bool Interfaces::removeInterfaceOption(const QString &option){ 358bool Interfaces::removeInterfaceOption(const QString &option){
346 return removeOption(currentIface, option); 359 return removeOption(currentIface, option);
347} 360}
@@ -483,48 +496,67 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
483 return found; 496 return found;
484} 497}
485 498
486/** 499/**
487 * Sets a value of an option in a stanza 500 * Sets a value of an option in a stanza
488 * @param start the start of the stanza 501 * @param start the start of the stanza
489 * @param option the option to use when setting value. 502 * @param option the option to use when setting value.
490 * @return bool true if successfull, false otherwise. 503 * @return bool true if successfull, false otherwise.
491 */ 504 */
492bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ 505bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
493 if(start == interfaces.end()) 506 if(start == interfaces.end())
494 return false; 507 return false;
495 508 qDebug("setting option");
496 bool found = false; 509 bool found = false;
510 bool replaced = false;
511 QStringList::Iterator insertAt = NULL;
497 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 512 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
498 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 513 qDebug(" Interfaces::setOption got line >%s<",(*it).latin1());
499 if(!found && value != ""){ 514 // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line
500 // Got to the end of the stanza without finding it, so append it. 515 // but since it works with an empty interfaces file I (tille) will not do anything more
501 interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); 516 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){
502 } 517 if (found) break;
518// && it != start){
519// if(!found && value != ""){
520// // Got to the end of the stanza without finding it, so append it.
521// qDebug(" Got to the end of the stanza without finding it, so append it.");
522// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
523// }
524 qDebug("found 1");
525// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value));
503 found = true; 526 found = true;
504 break; 527 insertAt = it;
528
505 } 529 }
506 if((*it).contains(option) && it != start && (*it).at(0) != '#'){ 530 if((*it).contains(option) && it != start && (*it).at(0) != '#'){
507 // Found it in stanza so replace it. 531 // Found it in stanza so replace it.
532 qDebug("found 2");
508 if(found) 533 if(found)
509 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 534 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
510 found = true; 535 found = true;
536 replaced = true;
511 (*it) = QString("\t%1 %2").arg(option).arg(value); 537 (*it) = QString("\t%1 %2").arg(option).arg(value);
512 } 538 }
513 } 539 }
514 if(!found){ 540 if(!found){
541 qDebug("! found insert anyway");
515 QStringList::Iterator p = start; 542 QStringList::Iterator p = start;
516 interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value)); 543 interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
517 found = true; 544 found = true;
518 } 545 }
546
547 if(found && !replaced){
548 qDebug("found iface but not the option so insert it here...");
549 interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value));
550 }
519 return found; 551 return found;
520} 552}
521 553
522/** 554/**
523 * Removes a stanza and all of its options 555 * Removes a stanza and all of its options
524 * @param stanza the stanza to remove 556 * @param stanza the stanza to remove
525 * @return bool true if successfull. 557 * @return bool true if successfull.
526 */ 558 */
527bool Interfaces::removeStanza(QStringList::Iterator &stanza){ 559bool Interfaces::removeStanza(QStringList::Iterator &stanza){
528 if(stanza == interfaces.end()) 560 if(stanza == interfaces.end())
529 return false; 561 return false;
530 (*stanza) = ""; 562 (*stanza) = "";
@@ -543,25 +575,26 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
543 575
544 bool found = false; 576 bool found = false;
545 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 577 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
546 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 578 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
547 // got to the end without finding it 579 // got to the end without finding it
548 break; 580 break;
549 } 581 }
550 if((*it).contains(option) && it != start && (*it).at(0) != '#'){ 582 if((*it).contains(option) && it != start && (*it).at(0) != '#'){
551 // Found it in stanza so replace it. 583 // Found it in stanza so replace it.
552 if(found) 584 if(found)
553 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 585 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
554 found = true; 586 found = true;
555 (*it) = ""; 587 it = interfaces.remove( it ); // we really want to remove the line
588 --it; // we do ++it later in the head of the for loop
556 } 589 }
557 } 590 }
558 return found; 591 return found;
559} 592}
560 593
561/** 594/**
562 * Removes a option in a stanza 595 * Removes a option in a stanza
563 * @param start the start of the stanza 596 * @param start the start of the stanza
564 * @param option the option to use when setting value. 597 * @param option the option to use when setting value.
565 * @return bool true if successfull, false otherwise. 598 * @return bool true if successfull, false otherwise.
566 */ 599 */
567bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){ 600bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){
@@ -570,25 +603,26 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
570 603
571 bool found = false; 604 bool found = false;
572 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 605 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
573 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 606 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
574 // got to the end without finding it 607 // got to the end without finding it
575 break; 608 break;
576 } 609 }
577 if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){ 610 if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){
578 // Found it in stanza so replace it. 611 // Found it in stanza so replace it.
579 if(found) 612 if(found)
580 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 613 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
581 found = true; 614 found = true;
582 (*it) = ""; 615 it = interfaces.remove( it ); // we really want to remove the line
616 --it; // we do ++it later in the head of the for loop
583 } 617 }
584 } 618 }
585 return found; 619 return found;
586} 620}
587 621
588/** 622/**
589 * Removes all options in a stanza 623 * Removes all options in a stanza
590 * @param start the start of the stanza 624 * @param start the start of the stanza
591 * @return bool true if successfull, false otherwise. 625 * @return bool true if successfull, false otherwise.
592 */ 626 */
593bool Interfaces::removeAllOptions(const QStringList::Iterator &start){ 627bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
594 if(start == interfaces.end()) 628 if(start == interfaces.end())
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index b40d101..e844d8a 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -35,24 +35,25 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac
35InterfaceSetupImp::~InterfaceSetupImp(){ 35InterfaceSetupImp::~InterfaceSetupImp(){
36 if(delInterfaces) { 36 if(delInterfaces) {
37 delete interfaces; 37 delete interfaces;
38 } 38 }
39} 39}
40 40
41/** 41/**
42 * Save the current settings, then write out the interfaces file and close. 42 * Save the current settings, then write out the interfaces file and close.
43 */ 43 */
44bool InterfaceSetupImp::saveChanges(){ 44bool InterfaceSetupImp::saveChanges(){
45 bool error; 45 bool error;
46 QString iface = interfaces->getInterfaceName(error); 46 QString iface = interfaces->getInterfaceName(error);
47 qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() );
47 if(!saveSettings()) 48 if(!saveSettings())
48 return false; 49 return false;
49 50
50 interfaces->write(); 51 interfaces->write();
51 52
52 if (interface->getStatus()) { 53 if (interface->getStatus()) {
53 QString ifup; 54 QString ifup;
54 ifup += "ifdown "; 55 ifup += "ifdown ";
55 ifup += iface; 56 ifup += iface;
56 ifup += "; ifup "; 57 ifup += "; ifup ";
57 ifup += iface; 58 ifup += iface;
58 ifup += ";"; 59 ifup += ";";
@@ -108,24 +109,27 @@ bool InterfaceSetupImp::saveSettings(){
108 interfaces->removeInterfaceOption("gateway"); 109 interfaces->removeInterfaceOption("gateway");
109 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a "); 110 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
110 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r "); 111 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r ");
111 } else{ 112 } else{
112 interfaces->setInterfaceMethod("static"); 113 interfaces->setInterfaceMethod("static");
113 interfaces->setInterfaceOption("address", ipAddressEdit->text()); 114 interfaces->setInterfaceOption("address", ipAddressEdit->text());
114 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); 115 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
115 interfaces->setInterfaceOption("gateway", gatewayEdit->text()); 116 interfaces->setInterfaceOption("gateway", gatewayEdit->text());
116 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ 117 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
117 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); 118 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
118 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); 119 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
119 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); 120 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
121 }else{
122 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
123 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r");
120 } 124 }
121 } 125 }
122 126
123 // IP Information 127 // IP Information
124 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 128 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
125 return true; 129 return true;
126} 130}
127 131
128/** 132/**
129 * The Profile has changed. 133 * The Profile has changed.
130 * @param QString profile the new profile. 134 * @param QString profile the new profile.
131 */ 135 */