6 files changed, 26 insertions, 180 deletions
diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp index cf3dba1..1fa5d38 100644 --- a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp +++ b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp | |||
@@ -1,76 +1,76 @@ | |||
1 | #include "interfaceinformationimp.h" | 1 | #include "interfaceinformationimp.h" |
2 | #include "interfaceadvanced.h" | 2 | #include "interfaceadvanced.h" |
3 | 3 | ||
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor for the InterfaceInformationImp class. This class pretty much | 10 | * Constructor for the InterfaceInformationImp class. This class pretty much |
11 | * just display's information about the interface that is passed to it. | 11 | * just display's information about the interface that is passed to it. |
12 | */ | 12 | */ |
13 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ | 13 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ |
14 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 14 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
15 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); | 15 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); |
16 | updateInterface(interface); | 16 | updateInterface(interface); |
17 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); | 17 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); |
18 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); | 18 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); |
19 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); | 19 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); |
20 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); | 20 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); |
21 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); | 21 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); |
22 | } | 22 | } |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Update the interface information and buttons. | 25 | * Update the interface information and buttons. |
26 | * @param Intarface *i the interface to update (should be the one we already | 26 | * @param Intarface *i the interface to update (should be the one we already |
27 | * know about). | 27 | * know about). |
28 | */ | 28 | */ |
29 | void InterfaceInformationImp::updateInterface(Interface *i){ | 29 | void InterfaceInformationImp::updateInterface(Interface *){ |
30 | if(interface->getStatus()){ | 30 | if(interface->getStatus()){ |
31 | startButton->setEnabled(false); | 31 | startButton->setEnabled(false); |
32 | stopButton->setEnabled(true); | 32 | stopButton->setEnabled(true); |
33 | restartButton->setEnabled(true); | 33 | restartButton->setEnabled(true); |
34 | } | 34 | } |
35 | else{ | 35 | else{ |
36 | startButton->setEnabled(true); | 36 | startButton->setEnabled(true); |
37 | stopButton->setEnabled(false); | 37 | stopButton->setEnabled(false); |
38 | restartButton->setEnabled(false); | 38 | restartButton->setEnabled(false); |
39 | } | 39 | } |
40 | macAddressLabel->setText(interface->getMacAddress()); | 40 | macAddressLabel->setText(interface->getMacAddress()); |
41 | ipAddressLabel->setText(interface->getIp()); | 41 | ipAddressLabel->setText(interface->getIp()); |
42 | subnetMaskLabel->setText(interface->getSubnetMask()); | 42 | subnetMaskLabel->setText(interface->getSubnetMask()); |
43 | broadcastLabel->setText(interface->getBroadcast()); | 43 | broadcastLabel->setText(interface->getBroadcast()); |
44 | } | 44 | } |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Create the advanced widget. Fill it with the current interface's information. | 47 | * Create the advanced widget. Fill it with the current interface's information. |
48 | * Display it. | 48 | * Display it. |
49 | */ | 49 | */ |
50 | void InterfaceInformationImp::advanced(){ | 50 | void InterfaceInformationImp::advanced(){ |
51 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); | 51 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); |
52 | a->interfaceName->setText(interface->getInterfaceName()); | 52 | a->interfaceName->setText(interface->getInterfaceName()); |
53 | a->macAddressLabel->setText(interface->getMacAddress()); | 53 | a->macAddressLabel->setText(interface->getMacAddress()); |
54 | a->ipAddressLabel->setText(interface->getIp()); | 54 | a->ipAddressLabel->setText(interface->getIp()); |
55 | a->subnetMaskLabel->setText(interface->getSubnetMask()); | 55 | a->subnetMaskLabel->setText(interface->getSubnetMask()); |
56 | a->broadcastLabel->setText(interface->getBroadcast()); | 56 | a->broadcastLabel->setText(interface->getBroadcast()); |
57 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); | 57 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); |
58 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); | 58 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); |
59 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); | 59 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); |
60 | a->dhcpInformation->setEnabled(interface->isDhcp()); | 60 | a->dhcpInformation->setEnabled(interface->isDhcp()); |
61 | 61 | ||
62 | a->showMaximized(); | 62 | a->showMaximized(); |
63 | a->show(); | 63 | a->show(); |
64 | } | 64 | } |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Messages from the interface if start/stop went as planned. | 67 | * Messages from the interface if start/stop went as planned. |
68 | * Purly for user feedback. | 68 | * Purly for user feedback. |
69 | * @param message the message to display. | 69 | * @param message the message to display. |
70 | */ | 70 | */ |
71 | void InterfaceInformationImp::showMessage(const QString &message){ | 71 | void InterfaceInformationImp::showMessage(const QString &message){ |
72 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); | 72 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); |
73 | } | 73 | } |
74 | 74 | ||
75 | // infoimp.cpp | 75 | // infoimp.cpp |
76 | 76 | ||
diff --git a/noncore/net/networksetup/interfaces/interfacesetup.ui b/noncore/net/networksetup/interfaces/interfacesetup.ui index df55d25..2b45d49 100644 --- a/noncore/net/networksetup/interfaces/interfacesetup.ui +++ b/noncore/net/networksetup/interfaces/interfacesetup.ui | |||
@@ -1,310 +1,242 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>InterfaceSetup</class> | 2 | <class>InterfaceSetup</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>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>290</width> | 14 | <width>286</width> |
15 | <height>280</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 | <vbox> | 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> | 31 | <widget> |
32 | <class>QCheckBox</class> | 32 | <class>QCheckBox</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>autoStart</cstring> | 35 | <cstring>autoStart</cstring> |
36 | </property> | 36 | </property> |
37 | <property stdset="1"> | 37 | <property stdset="1"> |
38 | <name>text</name> | 38 | <name>text</name> |
39 | <string>Automatically bring up</string> | 39 | <string>Automatically bring up</string> |
40 | </property> | 40 | </property> |
41 | </widget> | 41 | </widget> |
42 | <widget> | 42 | <widget> |
43 | <class>QLayoutWidget</class> | 43 | <class>QCheckBox</class> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>name</name> | 45 | <name>name</name> |
46 | <cstring>Layout9</cstring> | 46 | <cstring>dhcpCheckBox</cstring> |
47 | </property> | ||
48 | <property stdset="1"> | ||
49 | <name>text</name> | ||
50 | <string>DHCP</string> | ||
51 | </property> | ||
52 | <property stdset="1"> | ||
53 | <name>checked</name> | ||
54 | <bool>true</bool> | ||
47 | </property> | 55 | </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>QCheckBox</class> | ||
59 | <property stdset="1"> | ||
60 | <name>name</name> | ||
61 | <cstring>dhcpCheckBox</cstring> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>text</name> | ||
65 | <string>DHCP</string> | ||
66 | </property> | ||
67 | <property stdset="1"> | ||
68 | <name>checked</name> | ||
69 | <bool>true</bool> | ||
70 | </property> | ||
71 | </widget> | ||
72 | <widget> | ||
73 | <class>QLabel</class> | ||
74 | <property stdset="1"> | ||
75 | <name>name</name> | ||
76 | <cstring>leaseHoursLabel</cstring> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>text</name> | ||
80 | <string>Requested Lease</string> | ||
81 | </property> | ||
82 | </widget> | ||
83 | <widget> | ||
84 | <class>QSpinBox</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>leaseTime</cstring> | ||
88 | </property> | ||
89 | <property stdset="1"> | ||
90 | <name>suffix</name> | ||
91 | <string> hours</string> | ||
92 | </property> | ||
93 | <property stdset="1"> | ||
94 | <name>maxValue</name> | ||
95 | <number>87600</number> | ||
96 | </property> | ||
97 | <property stdset="1"> | ||
98 | <name>minValue</name> | ||
99 | <number>1</number> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>lineStep</name> | ||
103 | <number>24</number> | ||
104 | </property> | ||
105 | <property stdset="1"> | ||
106 | <name>value</name> | ||
107 | <number>168</number> | ||
108 | </property> | ||
109 | </widget> | ||
110 | </hbox> | ||
111 | </widget> | 56 | </widget> |
112 | <widget> | 57 | <widget> |
113 | <class>QGroupBox</class> | 58 | <class>QGroupBox</class> |
114 | <property stdset="1"> | 59 | <property stdset="1"> |
115 | <name>name</name> | 60 | <name>name</name> |
116 | <cstring>staticGroupBox</cstring> | 61 | <cstring>staticGroupBox</cstring> |
117 | </property> | 62 | </property> |
118 | <property stdset="1"> | 63 | <property stdset="1"> |
119 | <name>enabled</name> | 64 | <name>enabled</name> |
120 | <bool>false</bool> | 65 | <bool>false</bool> |
121 | </property> | 66 | </property> |
122 | <property stdset="1"> | 67 | <property stdset="1"> |
123 | <name>frameShape</name> | 68 | <name>frameShape</name> |
124 | <enum>Box</enum> | 69 | <enum>Box</enum> |
125 | </property> | 70 | </property> |
126 | <property stdset="1"> | 71 | <property stdset="1"> |
127 | <name>frameShadow</name> | 72 | <name>frameShadow</name> |
128 | <enum>Sunken</enum> | 73 | <enum>Sunken</enum> |
129 | </property> | 74 | </property> |
130 | <property stdset="1"> | 75 | <property stdset="1"> |
131 | <name>title</name> | 76 | <name>title</name> |
132 | <string>Static Ip Configuration</string> | 77 | <string>Static Ip Configuration</string> |
133 | </property> | 78 | </property> |
134 | <grid> | 79 | <grid> |
135 | <property stdset="1"> | 80 | <property stdset="1"> |
136 | <name>margin</name> | 81 | <name>margin</name> |
137 | <number>11</number> | 82 | <number>11</number> |
138 | </property> | 83 | </property> |
139 | <property stdset="1"> | 84 | <property stdset="1"> |
140 | <name>spacing</name> | 85 | <name>spacing</name> |
141 | <number>6</number> | 86 | <number>6</number> |
142 | </property> | 87 | </property> |
143 | <widget row="1" column="0" > | 88 | <widget row="1" column="0" > |
144 | <class>QLabel</class> | 89 | <class>QLabel</class> |
145 | <property stdset="1"> | 90 | <property stdset="1"> |
146 | <name>name</name> | 91 | <name>name</name> |
147 | <cstring>TextLabel5</cstring> | 92 | <cstring>TextLabel5</cstring> |
148 | </property> | 93 | </property> |
149 | <property stdset="1"> | 94 | <property stdset="1"> |
150 | <name>text</name> | 95 | <name>text</name> |
151 | <string>Subnet Mask</string> | 96 | <string>Subnet Mask</string> |
152 | </property> | 97 | </property> |
153 | </widget> | 98 | </widget> |
154 | <widget row="2" column="1" > | 99 | <widget row="2" column="1" > |
155 | <class>QLineEdit</class> | 100 | <class>QLineEdit</class> |
156 | <property stdset="1"> | 101 | <property stdset="1"> |
157 | <name>name</name> | 102 | <name>name</name> |
158 | <cstring>gatewayEdit</cstring> | 103 | <cstring>gatewayEdit</cstring> |
159 | </property> | 104 | </property> |
160 | </widget> | 105 | </widget> |
161 | <widget row="1" column="1" > | 106 | <widget row="1" column="1" > |
162 | <class>QLineEdit</class> | 107 | <class>QLineEdit</class> |
163 | <property stdset="1"> | 108 | <property stdset="1"> |
164 | <name>name</name> | 109 | <name>name</name> |
165 | <cstring>subnetMaskEdit</cstring> | 110 | <cstring>subnetMaskEdit</cstring> |
166 | </property> | 111 | </property> |
167 | </widget> | 112 | </widget> |
168 | <widget row="0" column="1" > | 113 | <widget row="0" column="1" > |
169 | <class>QLineEdit</class> | 114 | <class>QLineEdit</class> |
170 | <property stdset="1"> | 115 | <property stdset="1"> |
171 | <name>name</name> | 116 | <name>name</name> |
172 | <cstring>ipAddressEdit</cstring> | 117 | <cstring>ipAddressEdit</cstring> |
173 | </property> | 118 | </property> |
174 | </widget> | 119 | </widget> |
175 | <widget row="3" column="0" > | 120 | <widget row="3" column="0" > |
176 | <class>QLabel</class> | 121 | <class>QLabel</class> |
177 | <property stdset="1"> | 122 | <property stdset="1"> |
178 | <name>name</name> | 123 | <name>name</name> |
179 | <cstring>TextLabel2</cstring> | 124 | <cstring>TextLabel2</cstring> |
180 | </property> | 125 | </property> |
181 | <property stdset="1"> | 126 | <property stdset="1"> |
182 | <name>text</name> | 127 | <name>text</name> |
183 | <string>First DNS</string> | 128 | <string>First DNS</string> |
184 | </property> | 129 | </property> |
185 | </widget> | 130 | </widget> |
186 | <widget row="0" column="0" > | 131 | <widget row="0" column="0" > |
187 | <class>QLabel</class> | 132 | <class>QLabel</class> |
188 | <property stdset="1"> | 133 | <property stdset="1"> |
189 | <name>name</name> | 134 | <name>name</name> |
190 | <cstring>TextLabel4</cstring> | 135 | <cstring>TextLabel4</cstring> |
191 | </property> | 136 | </property> |
192 | <property stdset="1"> | 137 | <property stdset="1"> |
193 | <name>text</name> | 138 | <name>text</name> |
194 | <string>IP Address</string> | 139 | <string>IP Address</string> |
195 | </property> | 140 | </property> |
196 | </widget> | 141 | </widget> |
197 | <widget row="2" column="0" > | 142 | <widget row="2" column="0" > |
198 | <class>QLabel</class> | 143 | <class>QLabel</class> |
199 | <property stdset="1"> | 144 | <property stdset="1"> |
200 | <name>name</name> | 145 | <name>name</name> |
201 | <cstring>TextLabel1_2</cstring> | 146 | <cstring>TextLabel1_2</cstring> |
202 | </property> | 147 | </property> |
203 | <property stdset="1"> | 148 | <property stdset="1"> |
204 | <name>text</name> | 149 | <name>text</name> |
205 | <string>Gateway</string> | 150 | <string>Gateway</string> |
206 | </property> | 151 | </property> |
207 | </widget> | 152 | </widget> |
208 | <widget row="4" column="0" > | 153 | <widget row="4" column="0" > |
209 | <class>QLabel</class> | 154 | <class>QLabel</class> |
210 | <property stdset="1"> | 155 | <property stdset="1"> |
211 | <name>name</name> | 156 | <name>name</name> |
212 | <cstring>TextLabel3</cstring> | 157 | <cstring>TextLabel3</cstring> |
213 | </property> | 158 | </property> |
214 | <property stdset="1"> | 159 | <property stdset="1"> |
215 | <name>text</name> | 160 | <name>text</name> |
216 | <string>Second DNS</string> | 161 | <string>Second DNS</string> |
217 | </property> | 162 | </property> |
218 | </widget> | 163 | </widget> |
219 | <widget row="3" column="1" > | 164 | <widget row="3" column="1" > |
220 | <class>QLineEdit</class> | 165 | <class>QLineEdit</class> |
221 | <property stdset="1"> | 166 | <property stdset="1"> |
222 | <name>name</name> | 167 | <name>name</name> |
223 | <cstring>firstDNSLineEdit</cstring> | 168 | <cstring>firstDNSLineEdit</cstring> |
224 | </property> | 169 | </property> |
225 | </widget> | 170 | </widget> |
226 | <widget row="4" column="1" > | 171 | <widget row="4" column="1" > |
227 | <class>QLineEdit</class> | 172 | <class>QLineEdit</class> |
228 | <property stdset="1"> | 173 | <property stdset="1"> |
229 | <name>name</name> | 174 | <name>name</name> |
230 | <cstring>secondDNSLineEdit</cstring> | 175 | <cstring>secondDNSLineEdit</cstring> |
231 | </property> | 176 | </property> |
232 | </widget> | 177 | </widget> |
233 | </grid> | 178 | </grid> |
234 | </widget> | 179 | </widget> |
235 | <spacer> | 180 | <spacer> |
236 | <property> | 181 | <property> |
237 | <name>name</name> | 182 | <name>name</name> |
238 | <cstring>Spacer9</cstring> | 183 | <cstring>Spacer9</cstring> |
239 | </property> | 184 | </property> |
240 | <property stdset="1"> | 185 | <property stdset="1"> |
241 | <name>orientation</name> | 186 | <name>orientation</name> |
242 | <enum>Vertical</enum> | 187 | <enum>Vertical</enum> |
243 | </property> | 188 | </property> |
244 | <property stdset="1"> | 189 | <property stdset="1"> |
245 | <name>sizeType</name> | 190 | <name>sizeType</name> |
246 | <enum>Expanding</enum> | 191 | <enum>Expanding</enum> |
247 | </property> | 192 | </property> |
248 | <property> | 193 | <property> |
249 | <name>sizeHint</name> | 194 | <name>sizeHint</name> |
250 | <size> | 195 | <size> |
251 | <width>20</width> | 196 | <width>20</width> |
252 | <height>20</height> | 197 | <height>20</height> |
253 | </size> | 198 | </size> |
254 | </property> | 199 | </property> |
255 | </spacer> | 200 | </spacer> |
256 | </vbox> | 201 | </vbox> |
257 | </widget> | 202 | </widget> |
258 | <customwidgets> | 203 | <customwidgets> |
259 | <customwidget> | 204 | <customwidget> |
260 | <class>QWidget</class> | 205 | <class>QWidget</class> |
261 | <header location="local">qwidget.h</header> | 206 | <header location="local">qwidget.h</header> |
262 | <sizehint> | 207 | <sizehint> |
263 | <width>100</width> | 208 | <width>100</width> |
264 | <height>100</height> | 209 | <height>100</height> |
265 | </sizehint> | 210 | </sizehint> |
266 | <container>0</container> | 211 | <container>0</container> |
267 | <sizepolicy> | 212 | <sizepolicy> |
268 | <hordata>7</hordata> | 213 | <hordata>7</hordata> |
269 | <verdata>7</verdata> | 214 | <verdata>7</verdata> |
270 | </sizepolicy> | 215 | </sizepolicy> |
271 | <pixmap>image0</pixmap> | 216 | <pixmap>image0</pixmap> |
272 | </customwidget> | 217 | </customwidget> |
273 | </customwidgets> | 218 | </customwidgets> |
274 | <images> | 219 | <images> |
275 | <image> | 220 | <image> |
276 | <name>image0</name> | 221 | <name>image0</name> |
277 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | 222 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> |
278 | </image> | 223 | </image> |
279 | </images> | 224 | </images> |
280 | <connections> | 225 | <connections> |
281 | <connection> | 226 | <connection> |
282 | <sender>dhcpCheckBox</sender> | 227 | <sender>dhcpCheckBox</sender> |
283 | <signal>toggled(bool)</signal> | 228 | <signal>toggled(bool)</signal> |
284 | <receiver>leaseHoursLabel</receiver> | ||
285 | <slot>setEnabled(bool)</slot> | ||
286 | </connection> | ||
287 | <connection> | ||
288 | <sender>dhcpCheckBox</sender> | ||
289 | <signal>toggled(bool)</signal> | ||
290 | <receiver>leaseTime</receiver> | ||
291 | <slot>setEnabled(bool)</slot> | ||
292 | </connection> | ||
293 | <connection> | ||
294 | <sender>dhcpCheckBox</sender> | ||
295 | <signal>toggled(bool)</signal> | ||
296 | <receiver>staticGroupBox</receiver> | 229 | <receiver>staticGroupBox</receiver> |
297 | <slot>setDisabled(bool)</slot> | 230 | <slot>setDisabled(bool)</slot> |
298 | </connection> | 231 | </connection> |
299 | </connections> | 232 | </connections> |
300 | <tabstops> | 233 | <tabstops> |
301 | <tabstop>autoStart</tabstop> | 234 | <tabstop>autoStart</tabstop> |
302 | <tabstop>dhcpCheckBox</tabstop> | 235 | <tabstop>dhcpCheckBox</tabstop> |
303 | <tabstop>leaseTime</tabstop> | ||
304 | <tabstop>ipAddressEdit</tabstop> | 236 | <tabstop>ipAddressEdit</tabstop> |
305 | <tabstop>subnetMaskEdit</tabstop> | 237 | <tabstop>subnetMaskEdit</tabstop> |
306 | <tabstop>gatewayEdit</tabstop> | 238 | <tabstop>gatewayEdit</tabstop> |
307 | <tabstop>firstDNSLineEdit</tabstop> | 239 | <tabstop>firstDNSLineEdit</tabstop> |
308 | <tabstop>secondDNSLineEdit</tabstop> | 240 | <tabstop>secondDNSLineEdit</tabstop> |
309 | </tabstops> | 241 | </tabstops> |
310 | </UI> | 242 | </UI> |
diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp index 4818e37..56bbe93 100644 --- a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp +++ b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp | |||
@@ -1,145 +1,136 @@ | |||
1 | #include "interfacesetupimp.h" | 1 | #include "interfacesetupimp.h" |
2 | #include "interface.h" | 2 | #include "interface.h" |
3 | 3 | ||
4 | #include <qcheckbox.h> | 4 | #include <qcheckbox.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qspinbox.h> | 6 | #include <qspinbox.h> |
7 | #include <qgroupbox.h> | 7 | #include <qgroupbox.h> |
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | 9 | ||
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | 11 | ||
12 | #define DNSSCRIPT "changedns" | 12 | #define DNSSCRIPT "changedns" |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Constuctor. Set up the connection. A profile must be set. | 15 | * Constuctor. Set up the connection. A profile must be set. |
16 | */ | 16 | */ |
17 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i){ | 17 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i){ |
18 | } | 18 | } |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Save the current settings, then write out the interfaces file and close. | 21 | * Save the current settings, then write out the interfaces file and close. |
22 | */ | 22 | */ |
23 | bool InterfaceSetupImp::saveChanges(){ | 23 | bool InterfaceSetupImp::saveChanges(){ |
24 | if(!saveSettings()) | 24 | if(!saveSettings()) |
25 | return false; | 25 | return false; |
26 | interfaces.write(); | 26 | interfaces.write(); |
27 | return true; | 27 | return true; |
28 | } | 28 | } |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Save the settings for the current Interface. | 31 | * Save the settings for the current Interface. |
32 | * @return bool true if successfull, false otherwise | 32 | * @return bool true if successfull, false otherwise |
33 | */ | 33 | */ |
34 | bool InterfaceSetupImp::saveSettings(){ | 34 | bool InterfaceSetupImp::saveSettings(){ |
35 | // eh can't really do anything about it other then return. :-D | 35 | // eh can't really do anything about it other then return. :-D |
36 | if(!interfaces.isInterfaceSet()) | 36 | if(!interfaces.isInterfaceSet()) |
37 | return true; | 37 | return true; |
38 | 38 | ||
39 | bool error = false; | 39 | bool error = false; |
40 | // Loopback case | 40 | // Loopback case |
41 | if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 41 | if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
42 | interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 42 | interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
43 | return true; | 43 | return true; |
44 | } | 44 | } |
45 | 45 | ||
46 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ | 46 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ |
47 | QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); | 47 | QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); |
48 | return false; | 48 | return false; |
49 | } | 49 | } |
50 | interfaces.removeAllInterfaceOptions(); | 50 | interfaces.removeAllInterfaceOptions(); |
51 | 51 | ||
52 | // DHCP | 52 | // DHCP |
53 | if(dhcpCheckBox->isChecked()){ | 53 | if(dhcpCheckBox->isChecked()) |
54 | interfaces.setInterfaceMethod(INTERFACES_METHOD_DHCP); | 54 | interfaces.setInterfaceMethod(INTERFACES_METHOD_DHCP); |
55 | interfaces.setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); | ||
56 | interfaces.setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); | ||
57 | } | ||
58 | else{ | 55 | else{ |
59 | interfaces.setInterfaceMethod("static"); | 56 | interfaces.setInterfaceMethod("static"); |
60 | interfaces.setInterfaceOption("address", ipAddressEdit->text()); | 57 | interfaces.setInterfaceOption("address", ipAddressEdit->text()); |
61 | interfaces.setInterfaceOption("netmask", subnetMaskEdit->text()); | 58 | interfaces.setInterfaceOption("netmask", subnetMaskEdit->text()); |
62 | interfaces.setInterfaceOption("gateway", gatewayEdit->text()); | 59 | interfaces.setInterfaceOption("gateway", gatewayEdit->text()); |
63 | if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ | 60 | if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ |
64 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); | 61 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); |
65 | interfaces.setInterfaceOption("up "DNSSCRIPT" -a ", dns); | 62 | interfaces.setInterfaceOption("up "DNSSCRIPT" -a ", dns); |
66 | interfaces.setInterfaceOption("down "DNSSCRIPT" -r ", dns); | 63 | interfaces.setInterfaceOption("down "DNSSCRIPT" -r ", dns); |
67 | } | 64 | } |
68 | } | 65 | } |
69 | 66 | ||
70 | // IP Information | 67 | // IP Information |
71 | interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 68 | interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
72 | return true; | 69 | return true; |
73 | } | 70 | } |
74 | 71 | ||
75 | /** | 72 | /** |
76 | * The Profile has changed. | 73 | * The Profile has changed. |
77 | * @param QString profile the new profile. | 74 | * @param QString profile the new profile. |
78 | */ | 75 | */ |
79 | void InterfaceSetupImp::setProfile(const QString &profile){ | 76 | void InterfaceSetupImp::setProfile(const QString &profile){ |
80 | /* | 77 | /* |
81 | bool error = false; | 78 | bool error = false; |
82 | if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 79 | if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
83 | staticGroupBox->hide(); | 80 | staticGroupBox->hide(); |
84 | dhcpCheckBox->hide(); | 81 | dhcpCheckBox->hide(); |
85 | leaseTime->hide(); | 82 | leaseTime->hide(); |
86 | leaseHoursLabel->hide(); | 83 | leaseHoursLabel->hide(); |
87 | } | 84 | } |
88 | */ | 85 | */ |
89 | 86 | ||
90 | QString newInterfaceName = interface->getInterfaceName(); | 87 | QString newInterfaceName = interface->getInterfaceName(); |
91 | if(profile.length() > 0) | 88 | if(profile.length() > 0) |
92 | newInterfaceName += "_" + profile; | 89 | newInterfaceName += "_" + profile; |
93 | // See if we have to make a interface. | 90 | // See if we have to make a interface. |
94 | if(!interfaces.setInterface(newInterfaceName)){ | 91 | if(!interfaces.setInterface(newInterfaceName)){ |
95 | // Add making for this new interface if need too | 92 | // Add making for this new interface if need too |
96 | if(profile != ""){ | 93 | if(profile != ""){ |
97 | interfaces.copyInterface(interface->getInterfaceName(), newInterfaceName); | 94 | interfaces.copyInterface(interface->getInterfaceName(), newInterfaceName); |
98 | if(!interfaces.setMapping(interface->getInterfaceName())){ | 95 | if(!interfaces.setMapping(interface->getInterfaceName())){ |
99 | interfaces.addMapping(interface->getInterfaceName()); | 96 | interfaces.addMapping(interface->getInterfaceName()); |
100 | if(!interfaces.setMapping(interface->getInterfaceName())){ | 97 | if(!interfaces.setMapping(interface->getInterfaceName())){ |
101 | qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); | 98 | qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); |
102 | return; | 99 | return; |
103 | } | 100 | } |
104 | } | 101 | } |
105 | interfaces.setMap("map", newInterfaceName); | 102 | interfaces.setMap("map", newInterfaceName); |
106 | interfaces.setScript("getprofile.sh"); | 103 | interfaces.setScript("getprofile.sh"); |
107 | } | 104 | } |
108 | else{ | 105 | else{ |
109 | interfaces.addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); | 106 | interfaces.addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); |
110 | if(!interfaces.setInterface(newInterfaceName)){ | 107 | if(!interfaces.setInterface(newInterfaceName)){ |
111 | qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); | 108 | qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); |
112 | return; | 109 | return; |
113 | } | 110 | } |
114 | } | 111 | } |
115 | } | 112 | } |
116 | 113 | ||
117 | // We must have a valid interface to get this far so read some settings. | 114 | // We must have a valid interface to get this far so read some settings. |
118 | 115 | ||
119 | // DHCP | 116 | // DHCP |
120 | bool error = false; | 117 | bool error = false; |
121 | if(interfaces.getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) | 118 | if(interfaces.getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) |
122 | dhcpCheckBox->setChecked(true); | 119 | dhcpCheckBox->setChecked(true); |
123 | else | 120 | else |
124 | dhcpCheckBox->setChecked(false); | 121 | dhcpCheckBox->setChecked(false); |
125 | leaseTime->setValue(interfaces.getInterfaceOption("leasehours", error).toInt()); | ||
126 | if(error) | ||
127 | leaseTime->setValue(interfaces.getInterfaceOption("leasetime", error).toInt()/60/60); | ||
128 | if(error) | ||
129 | leaseTime->setValue(24); | ||
130 | 122 | ||
131 | // IP Information | 123 | // IP Information |
132 | autoStart->setChecked(interfaces.isAuto(interface->getInterfaceName())); | 124 | autoStart->setChecked(interfaces.isAuto(interface->getInterfaceName())); |
133 | QString dns = interfaces.getInterfaceOption("up "DNSSCRIPT" -a", error); | 125 | QString dns = interfaces.getInterfaceOption("up "DNSSCRIPT" -a", error); |
134 | if(dns.contains(" ")){ | 126 | if(dns.contains(" ")){ |
135 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); | 127 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); |
136 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); | 128 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); |
137 | } | 129 | } |
138 | ipAddressEdit->setText(interfaces.getInterfaceOption("address", error)); | 130 | ipAddressEdit->setText(interfaces.getInterfaceOption("address", error)); |
139 | subnetMaskEdit->setText(interfaces.getInterfaceOption("netmask", error)); | 131 | subnetMaskEdit->setText(interfaces.getInterfaceOption("netmask", error)); |
140 | gatewayEdit->setText(interfaces.getInterfaceOption("gateway", error)); | 132 | gatewayEdit->setText(interfaces.getInterfaceOption("gateway", error)); |
141 | |||
142 | } | 133 | } |
143 | 134 | ||
144 | // interfacesetup.cpp | 135 | // interfacesetup.cpp |
145 | 136 | ||
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp index cf3dba1..1fa5d38 100644 --- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp | |||
@@ -1,76 +1,76 @@ | |||
1 | #include "interfaceinformationimp.h" | 1 | #include "interfaceinformationimp.h" |
2 | #include "interfaceadvanced.h" | 2 | #include "interfaceadvanced.h" |
3 | 3 | ||
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor for the InterfaceInformationImp class. This class pretty much | 10 | * Constructor for the InterfaceInformationImp class. This class pretty much |
11 | * just display's information about the interface that is passed to it. | 11 | * just display's information about the interface that is passed to it. |
12 | */ | 12 | */ |
13 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ | 13 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ |
14 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 14 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
15 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); | 15 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); |
16 | updateInterface(interface); | 16 | updateInterface(interface); |
17 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); | 17 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); |
18 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); | 18 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); |
19 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); | 19 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); |
20 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); | 20 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); |
21 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); | 21 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); |
22 | } | 22 | } |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Update the interface information and buttons. | 25 | * Update the interface information and buttons. |
26 | * @param Intarface *i the interface to update (should be the one we already | 26 | * @param Intarface *i the interface to update (should be the one we already |
27 | * know about). | 27 | * know about). |
28 | */ | 28 | */ |
29 | void InterfaceInformationImp::updateInterface(Interface *i){ | 29 | void InterfaceInformationImp::updateInterface(Interface *){ |
30 | if(interface->getStatus()){ | 30 | if(interface->getStatus()){ |
31 | startButton->setEnabled(false); | 31 | startButton->setEnabled(false); |
32 | stopButton->setEnabled(true); | 32 | stopButton->setEnabled(true); |
33 | restartButton->setEnabled(true); | 33 | restartButton->setEnabled(true); |
34 | } | 34 | } |
35 | else{ | 35 | else{ |
36 | startButton->setEnabled(true); | 36 | startButton->setEnabled(true); |
37 | stopButton->setEnabled(false); | 37 | stopButton->setEnabled(false); |
38 | restartButton->setEnabled(false); | 38 | restartButton->setEnabled(false); |
39 | } | 39 | } |
40 | macAddressLabel->setText(interface->getMacAddress()); | 40 | macAddressLabel->setText(interface->getMacAddress()); |
41 | ipAddressLabel->setText(interface->getIp()); | 41 | ipAddressLabel->setText(interface->getIp()); |
42 | subnetMaskLabel->setText(interface->getSubnetMask()); | 42 | subnetMaskLabel->setText(interface->getSubnetMask()); |
43 | broadcastLabel->setText(interface->getBroadcast()); | 43 | broadcastLabel->setText(interface->getBroadcast()); |
44 | } | 44 | } |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Create the advanced widget. Fill it with the current interface's information. | 47 | * Create the advanced widget. Fill it with the current interface's information. |
48 | * Display it. | 48 | * Display it. |
49 | */ | 49 | */ |
50 | void InterfaceInformationImp::advanced(){ | 50 | void InterfaceInformationImp::advanced(){ |
51 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); | 51 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); |
52 | a->interfaceName->setText(interface->getInterfaceName()); | 52 | a->interfaceName->setText(interface->getInterfaceName()); |
53 | a->macAddressLabel->setText(interface->getMacAddress()); | 53 | a->macAddressLabel->setText(interface->getMacAddress()); |
54 | a->ipAddressLabel->setText(interface->getIp()); | 54 | a->ipAddressLabel->setText(interface->getIp()); |
55 | a->subnetMaskLabel->setText(interface->getSubnetMask()); | 55 | a->subnetMaskLabel->setText(interface->getSubnetMask()); |
56 | a->broadcastLabel->setText(interface->getBroadcast()); | 56 | a->broadcastLabel->setText(interface->getBroadcast()); |
57 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); | 57 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); |
58 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); | 58 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); |
59 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); | 59 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); |
60 | a->dhcpInformation->setEnabled(interface->isDhcp()); | 60 | a->dhcpInformation->setEnabled(interface->isDhcp()); |
61 | 61 | ||
62 | a->showMaximized(); | 62 | a->showMaximized(); |
63 | a->show(); | 63 | a->show(); |
64 | } | 64 | } |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Messages from the interface if start/stop went as planned. | 67 | * Messages from the interface if start/stop went as planned. |
68 | * Purly for user feedback. | 68 | * Purly for user feedback. |
69 | * @param message the message to display. | 69 | * @param message the message to display. |
70 | */ | 70 | */ |
71 | void InterfaceInformationImp::showMessage(const QString &message){ | 71 | void InterfaceInformationImp::showMessage(const QString &message){ |
72 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); | 72 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); |
73 | } | 73 | } |
74 | 74 | ||
75 | // infoimp.cpp | 75 | // infoimp.cpp |
76 | 76 | ||
diff --git a/noncore/settings/networksettings/interfaces/interfacesetup.ui b/noncore/settings/networksettings/interfaces/interfacesetup.ui index df55d25..2b45d49 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetup.ui +++ b/noncore/settings/networksettings/interfaces/interfacesetup.ui | |||
@@ -1,310 +1,242 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>InterfaceSetup</class> | 2 | <class>InterfaceSetup</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>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>290</width> | 14 | <width>286</width> |
15 | <height>280</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 | <vbox> | 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> | 31 | <widget> |
32 | <class>QCheckBox</class> | 32 | <class>QCheckBox</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>autoStart</cstring> | 35 | <cstring>autoStart</cstring> |
36 | </property> | 36 | </property> |
37 | <property stdset="1"> | 37 | <property stdset="1"> |
38 | <name>text</name> | 38 | <name>text</name> |
39 | <string>Automatically bring up</string> | 39 | <string>Automatically bring up</string> |
40 | </property> | 40 | </property> |
41 | </widget> | 41 | </widget> |
42 | <widget> | 42 | <widget> |
43 | <class>QLayoutWidget</class> | 43 | <class>QCheckBox</class> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>name</name> | 45 | <name>name</name> |
46 | <cstring>Layout9</cstring> | 46 | <cstring>dhcpCheckBox</cstring> |
47 | </property> | ||
48 | <property stdset="1"> | ||
49 | <name>text</name> | ||
50 | <string>DHCP</string> | ||
51 | </property> | ||
52 | <property stdset="1"> | ||
53 | <name>checked</name> | ||
54 | <bool>true</bool> | ||
47 | </property> | 55 | </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>QCheckBox</class> | ||
59 | <property stdset="1"> | ||
60 | <name>name</name> | ||
61 | <cstring>dhcpCheckBox</cstring> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>text</name> | ||
65 | <string>DHCP</string> | ||
66 | </property> | ||
67 | <property stdset="1"> | ||
68 | <name>checked</name> | ||
69 | <bool>true</bool> | ||
70 | </property> | ||
71 | </widget> | ||
72 | <widget> | ||
73 | <class>QLabel</class> | ||
74 | <property stdset="1"> | ||
75 | <name>name</name> | ||
76 | <cstring>leaseHoursLabel</cstring> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>text</name> | ||
80 | <string>Requested Lease</string> | ||
81 | </property> | ||
82 | </widget> | ||
83 | <widget> | ||
84 | <class>QSpinBox</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>leaseTime</cstring> | ||
88 | </property> | ||
89 | <property stdset="1"> | ||
90 | <name>suffix</name> | ||
91 | <string> hours</string> | ||
92 | </property> | ||
93 | <property stdset="1"> | ||
94 | <name>maxValue</name> | ||
95 | <number>87600</number> | ||
96 | </property> | ||
97 | <property stdset="1"> | ||
98 | <name>minValue</name> | ||
99 | <number>1</number> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>lineStep</name> | ||
103 | <number>24</number> | ||
104 | </property> | ||
105 | <property stdset="1"> | ||
106 | <name>value</name> | ||
107 | <number>168</number> | ||
108 | </property> | ||
109 | </widget> | ||
110 | </hbox> | ||
111 | </widget> | 56 | </widget> |
112 | <widget> | 57 | <widget> |
113 | <class>QGroupBox</class> | 58 | <class>QGroupBox</class> |
114 | <property stdset="1"> | 59 | <property stdset="1"> |
115 | <name>name</name> | 60 | <name>name</name> |
116 | <cstring>staticGroupBox</cstring> | 61 | <cstring>staticGroupBox</cstring> |
117 | </property> | 62 | </property> |
118 | <property stdset="1"> | 63 | <property stdset="1"> |
119 | <name>enabled</name> | 64 | <name>enabled</name> |
120 | <bool>false</bool> | 65 | <bool>false</bool> |
121 | </property> | 66 | </property> |
122 | <property stdset="1"> | 67 | <property stdset="1"> |
123 | <name>frameShape</name> | 68 | <name>frameShape</name> |
124 | <enum>Box</enum> | 69 | <enum>Box</enum> |
125 | </property> | 70 | </property> |
126 | <property stdset="1"> | 71 | <property stdset="1"> |
127 | <name>frameShadow</name> | 72 | <name>frameShadow</name> |
128 | <enum>Sunken</enum> | 73 | <enum>Sunken</enum> |
129 | </property> | 74 | </property> |
130 | <property stdset="1"> | 75 | <property stdset="1"> |
131 | <name>title</name> | 76 | <name>title</name> |
132 | <string>Static Ip Configuration</string> | 77 | <string>Static Ip Configuration</string> |
133 | </property> | 78 | </property> |
134 | <grid> | 79 | <grid> |
135 | <property stdset="1"> | 80 | <property stdset="1"> |
136 | <name>margin</name> | 81 | <name>margin</name> |
137 | <number>11</number> | 82 | <number>11</number> |
138 | </property> | 83 | </property> |
139 | <property stdset="1"> | 84 | <property stdset="1"> |
140 | <name>spacing</name> | 85 | <name>spacing</name> |
141 | <number>6</number> | 86 | <number>6</number> |
142 | </property> | 87 | </property> |
143 | <widget row="1" column="0" > | 88 | <widget row="1" column="0" > |
144 | <class>QLabel</class> | 89 | <class>QLabel</class> |
145 | <property stdset="1"> | 90 | <property stdset="1"> |
146 | <name>name</name> | 91 | <name>name</name> |
147 | <cstring>TextLabel5</cstring> | 92 | <cstring>TextLabel5</cstring> |
148 | </property> | 93 | </property> |
149 | <property stdset="1"> | 94 | <property stdset="1"> |
150 | <name>text</name> | 95 | <name>text</name> |
151 | <string>Subnet Mask</string> | 96 | <string>Subnet Mask</string> |
152 | </property> | 97 | </property> |
153 | </widget> | 98 | </widget> |
154 | <widget row="2" column="1" > | 99 | <widget row="2" column="1" > |
155 | <class>QLineEdit</class> | 100 | <class>QLineEdit</class> |
156 | <property stdset="1"> | 101 | <property stdset="1"> |
157 | <name>name</name> | 102 | <name>name</name> |
158 | <cstring>gatewayEdit</cstring> | 103 | <cstring>gatewayEdit</cstring> |
159 | </property> | 104 | </property> |
160 | </widget> | 105 | </widget> |
161 | <widget row="1" column="1" > | 106 | <widget row="1" column="1" > |
162 | <class>QLineEdit</class> | 107 | <class>QLineEdit</class> |
163 | <property stdset="1"> | 108 | <property stdset="1"> |
164 | <name>name</name> | 109 | <name>name</name> |
165 | <cstring>subnetMaskEdit</cstring> | 110 | <cstring>subnetMaskEdit</cstring> |
166 | </property> | 111 | </property> |
167 | </widget> | 112 | </widget> |
168 | <widget row="0" column="1" > | 113 | <widget row="0" column="1" > |
169 | <class>QLineEdit</class> | 114 | <class>QLineEdit</class> |
170 | <property stdset="1"> | 115 | <property stdset="1"> |
171 | <name>name</name> | 116 | <name>name</name> |
172 | <cstring>ipAddressEdit</cstring> | 117 | <cstring>ipAddressEdit</cstring> |
173 | </property> | 118 | </property> |
174 | </widget> | 119 | </widget> |
175 | <widget row="3" column="0" > | 120 | <widget row="3" column="0" > |
176 | <class>QLabel</class> | 121 | <class>QLabel</class> |
177 | <property stdset="1"> | 122 | <property stdset="1"> |
178 | <name>name</name> | 123 | <name>name</name> |
179 | <cstring>TextLabel2</cstring> | 124 | <cstring>TextLabel2</cstring> |
180 | </property> | 125 | </property> |
181 | <property stdset="1"> | 126 | <property stdset="1"> |
182 | <name>text</name> | 127 | <name>text</name> |
183 | <string>First DNS</string> | 128 | <string>First DNS</string> |
184 | </property> | 129 | </property> |
185 | </widget> | 130 | </widget> |
186 | <widget row="0" column="0" > | 131 | <widget row="0" column="0" > |
187 | <class>QLabel</class> | 132 | <class>QLabel</class> |
188 | <property stdset="1"> | 133 | <property stdset="1"> |
189 | <name>name</name> | 134 | <name>name</name> |
190 | <cstring>TextLabel4</cstring> | 135 | <cstring>TextLabel4</cstring> |
191 | </property> | 136 | </property> |
192 | <property stdset="1"> | 137 | <property stdset="1"> |
193 | <name>text</name> | 138 | <name>text</name> |
194 | <string>IP Address</string> | 139 | <string>IP Address</string> |
195 | </property> | 140 | </property> |
196 | </widget> | 141 | </widget> |
197 | <widget row="2" column="0" > | 142 | <widget row="2" column="0" > |
198 | <class>QLabel</class> | 143 | <class>QLabel</class> |
199 | <property stdset="1"> | 144 | <property stdset="1"> |
200 | <name>name</name> | 145 | <name>name</name> |
201 | <cstring>TextLabel1_2</cstring> | 146 | <cstring>TextLabel1_2</cstring> |
202 | </property> | 147 | </property> |
203 | <property stdset="1"> | 148 | <property stdset="1"> |
204 | <name>text</name> | 149 | <name>text</name> |
205 | <string>Gateway</string> | 150 | <string>Gateway</string> |
206 | </property> | 151 | </property> |
207 | </widget> | 152 | </widget> |
208 | <widget row="4" column="0" > | 153 | <widget row="4" column="0" > |
209 | <class>QLabel</class> | 154 | <class>QLabel</class> |
210 | <property stdset="1"> | 155 | <property stdset="1"> |
211 | <name>name</name> | 156 | <name>name</name> |
212 | <cstring>TextLabel3</cstring> | 157 | <cstring>TextLabel3</cstring> |
213 | </property> | 158 | </property> |
214 | <property stdset="1"> | 159 | <property stdset="1"> |
215 | <name>text</name> | 160 | <name>text</name> |
216 | <string>Second DNS</string> | 161 | <string>Second DNS</string> |
217 | </property> | 162 | </property> |
218 | </widget> | 163 | </widget> |
219 | <widget row="3" column="1" > | 164 | <widget row="3" column="1" > |
220 | <class>QLineEdit</class> | 165 | <class>QLineEdit</class> |
221 | <property stdset="1"> | 166 | <property stdset="1"> |
222 | <name>name</name> | 167 | <name>name</name> |
223 | <cstring>firstDNSLineEdit</cstring> | 168 | <cstring>firstDNSLineEdit</cstring> |
224 | </property> | 169 | </property> |
225 | </widget> | 170 | </widget> |
226 | <widget row="4" column="1" > | 171 | <widget row="4" column="1" > |
227 | <class>QLineEdit</class> | 172 | <class>QLineEdit</class> |
228 | <property stdset="1"> | 173 | <property stdset="1"> |
229 | <name>name</name> | 174 | <name>name</name> |
230 | <cstring>secondDNSLineEdit</cstring> | 175 | <cstring>secondDNSLineEdit</cstring> |
231 | </property> | 176 | </property> |
232 | </widget> | 177 | </widget> |
233 | </grid> | 178 | </grid> |
234 | </widget> | 179 | </widget> |
235 | <spacer> | 180 | <spacer> |
236 | <property> | 181 | <property> |
237 | <name>name</name> | 182 | <name>name</name> |
238 | <cstring>Spacer9</cstring> | 183 | <cstring>Spacer9</cstring> |
239 | </property> | 184 | </property> |
240 | <property stdset="1"> | 185 | <property stdset="1"> |
241 | <name>orientation</name> | 186 | <name>orientation</name> |
242 | <enum>Vertical</enum> | 187 | <enum>Vertical</enum> |
243 | </property> | 188 | </property> |
244 | <property stdset="1"> | 189 | <property stdset="1"> |
245 | <name>sizeType</name> | 190 | <name>sizeType</name> |
246 | <enum>Expanding</enum> | 191 | <enum>Expanding</enum> |
247 | </property> | 192 | </property> |
248 | <property> | 193 | <property> |
249 | <name>sizeHint</name> | 194 | <name>sizeHint</name> |
250 | <size> | 195 | <size> |
251 | <width>20</width> | 196 | <width>20</width> |
252 | <height>20</height> | 197 | <height>20</height> |
253 | </size> | 198 | </size> |
254 | </property> | 199 | </property> |
255 | </spacer> | 200 | </spacer> |
256 | </vbox> | 201 | </vbox> |
257 | </widget> | 202 | </widget> |
258 | <customwidgets> | 203 | <customwidgets> |
259 | <customwidget> | 204 | <customwidget> |
260 | <class>QWidget</class> | 205 | <class>QWidget</class> |
261 | <header location="local">qwidget.h</header> | 206 | <header location="local">qwidget.h</header> |
262 | <sizehint> | 207 | <sizehint> |
263 | <width>100</width> | 208 | <width>100</width> |
264 | <height>100</height> | 209 | <height>100</height> |
265 | </sizehint> | 210 | </sizehint> |
266 | <container>0</container> | 211 | <container>0</container> |
267 | <sizepolicy> | 212 | <sizepolicy> |
268 | <hordata>7</hordata> | 213 | <hordata>7</hordata> |
269 | <verdata>7</verdata> | 214 | <verdata>7</verdata> |
270 | </sizepolicy> | 215 | </sizepolicy> |
271 | <pixmap>image0</pixmap> | 216 | <pixmap>image0</pixmap> |
272 | </customwidget> | 217 | </customwidget> |
273 | </customwidgets> | 218 | </customwidgets> |
274 | <images> | 219 | <images> |
275 | <image> | 220 | <image> |
276 | <name>image0</name> | 221 | <name>image0</name> |
277 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | 222 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> |
278 | </image> | 223 | </image> |
279 | </images> | 224 | </images> |
280 | <connections> | 225 | <connections> |
281 | <connection> | 226 | <connection> |
282 | <sender>dhcpCheckBox</sender> | 227 | <sender>dhcpCheckBox</sender> |
283 | <signal>toggled(bool)</signal> | 228 | <signal>toggled(bool)</signal> |
284 | <receiver>leaseHoursLabel</receiver> | ||
285 | <slot>setEnabled(bool)</slot> | ||
286 | </connection> | ||
287 | <connection> | ||
288 | <sender>dhcpCheckBox</sender> | ||
289 | <signal>toggled(bool)</signal> | ||
290 | <receiver>leaseTime</receiver> | ||
291 | <slot>setEnabled(bool)</slot> | ||
292 | </connection> | ||
293 | <connection> | ||
294 | <sender>dhcpCheckBox</sender> | ||
295 | <signal>toggled(bool)</signal> | ||
296 | <receiver>staticGroupBox</receiver> | 229 | <receiver>staticGroupBox</receiver> |
297 | <slot>setDisabled(bool)</slot> | 230 | <slot>setDisabled(bool)</slot> |
298 | </connection> | 231 | </connection> |
299 | </connections> | 232 | </connections> |
300 | <tabstops> | 233 | <tabstops> |
301 | <tabstop>autoStart</tabstop> | 234 | <tabstop>autoStart</tabstop> |
302 | <tabstop>dhcpCheckBox</tabstop> | 235 | <tabstop>dhcpCheckBox</tabstop> |
303 | <tabstop>leaseTime</tabstop> | ||
304 | <tabstop>ipAddressEdit</tabstop> | 236 | <tabstop>ipAddressEdit</tabstop> |
305 | <tabstop>subnetMaskEdit</tabstop> | 237 | <tabstop>subnetMaskEdit</tabstop> |
306 | <tabstop>gatewayEdit</tabstop> | 238 | <tabstop>gatewayEdit</tabstop> |
307 | <tabstop>firstDNSLineEdit</tabstop> | 239 | <tabstop>firstDNSLineEdit</tabstop> |
308 | <tabstop>secondDNSLineEdit</tabstop> | 240 | <tabstop>secondDNSLineEdit</tabstop> |
309 | </tabstops> | 241 | </tabstops> |
310 | </UI> | 242 | </UI> |
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 4818e37..56bbe93 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |||
@@ -1,145 +1,136 @@ | |||
1 | #include "interfacesetupimp.h" | 1 | #include "interfacesetupimp.h" |
2 | #include "interface.h" | 2 | #include "interface.h" |
3 | 3 | ||
4 | #include <qcheckbox.h> | 4 | #include <qcheckbox.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qspinbox.h> | 6 | #include <qspinbox.h> |
7 | #include <qgroupbox.h> | 7 | #include <qgroupbox.h> |
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | 9 | ||
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | 11 | ||
12 | #define DNSSCRIPT "changedns" | 12 | #define DNSSCRIPT "changedns" |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Constuctor. Set up the connection. A profile must be set. | 15 | * Constuctor. Set up the connection. A profile must be set. |
16 | */ | 16 | */ |
17 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i){ | 17 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i){ |
18 | } | 18 | } |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Save the current settings, then write out the interfaces file and close. | 21 | * Save the current settings, then write out the interfaces file and close. |
22 | */ | 22 | */ |
23 | bool InterfaceSetupImp::saveChanges(){ | 23 | bool InterfaceSetupImp::saveChanges(){ |
24 | if(!saveSettings()) | 24 | if(!saveSettings()) |
25 | return false; | 25 | return false; |
26 | interfaces.write(); | 26 | interfaces.write(); |
27 | return true; | 27 | return true; |
28 | } | 28 | } |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Save the settings for the current Interface. | 31 | * Save the settings for the current Interface. |
32 | * @return bool true if successfull, false otherwise | 32 | * @return bool true if successfull, false otherwise |
33 | */ | 33 | */ |
34 | bool InterfaceSetupImp::saveSettings(){ | 34 | bool InterfaceSetupImp::saveSettings(){ |
35 | // eh can't really do anything about it other then return. :-D | 35 | // eh can't really do anything about it other then return. :-D |
36 | if(!interfaces.isInterfaceSet()) | 36 | if(!interfaces.isInterfaceSet()) |
37 | return true; | 37 | return true; |
38 | 38 | ||
39 | bool error = false; | 39 | bool error = false; |
40 | // Loopback case | 40 | // Loopback case |
41 | if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 41 | if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
42 | interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 42 | interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
43 | return true; | 43 | return true; |
44 | } | 44 | } |
45 | 45 | ||
46 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ | 46 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ |
47 | QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); | 47 | QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); |
48 | return false; | 48 | return false; |
49 | } | 49 | } |
50 | interfaces.removeAllInterfaceOptions(); | 50 | interfaces.removeAllInterfaceOptions(); |
51 | 51 | ||
52 | // DHCP | 52 | // DHCP |
53 | if(dhcpCheckBox->isChecked()){ | 53 | if(dhcpCheckBox->isChecked()) |
54 | interfaces.setInterfaceMethod(INTERFACES_METHOD_DHCP); | 54 | interfaces.setInterfaceMethod(INTERFACES_METHOD_DHCP); |
55 | interfaces.setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); | ||
56 | interfaces.setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); | ||
57 | } | ||
58 | else{ | 55 | else{ |
59 | interfaces.setInterfaceMethod("static"); | 56 | interfaces.setInterfaceMethod("static"); |
60 | interfaces.setInterfaceOption("address", ipAddressEdit->text()); | 57 | interfaces.setInterfaceOption("address", ipAddressEdit->text()); |
61 | interfaces.setInterfaceOption("netmask", subnetMaskEdit->text()); | 58 | interfaces.setInterfaceOption("netmask", subnetMaskEdit->text()); |
62 | interfaces.setInterfaceOption("gateway", gatewayEdit->text()); | 59 | interfaces.setInterfaceOption("gateway", gatewayEdit->text()); |
63 | if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ | 60 | if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ |
64 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); | 61 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); |
65 | interfaces.setInterfaceOption("up "DNSSCRIPT" -a ", dns); | 62 | interfaces.setInterfaceOption("up "DNSSCRIPT" -a ", dns); |
66 | interfaces.setInterfaceOption("down "DNSSCRIPT" -r ", dns); | 63 | interfaces.setInterfaceOption("down "DNSSCRIPT" -r ", dns); |
67 | } | 64 | } |
68 | } | 65 | } |
69 | 66 | ||
70 | // IP Information | 67 | // IP Information |
71 | interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 68 | interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
72 | return true; | 69 | return true; |
73 | } | 70 | } |
74 | 71 | ||
75 | /** | 72 | /** |
76 | * The Profile has changed. | 73 | * The Profile has changed. |
77 | * @param QString profile the new profile. | 74 | * @param QString profile the new profile. |
78 | */ | 75 | */ |
79 | void InterfaceSetupImp::setProfile(const QString &profile){ | 76 | void InterfaceSetupImp::setProfile(const QString &profile){ |
80 | /* | 77 | /* |
81 | bool error = false; | 78 | bool error = false; |
82 | if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 79 | if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
83 | staticGroupBox->hide(); | 80 | staticGroupBox->hide(); |
84 | dhcpCheckBox->hide(); | 81 | dhcpCheckBox->hide(); |
85 | leaseTime->hide(); | 82 | leaseTime->hide(); |
86 | leaseHoursLabel->hide(); | 83 | leaseHoursLabel->hide(); |
87 | } | 84 | } |
88 | */ | 85 | */ |
89 | 86 | ||
90 | QString newInterfaceName = interface->getInterfaceName(); | 87 | QString newInterfaceName = interface->getInterfaceName(); |
91 | if(profile.length() > 0) | 88 | if(profile.length() > 0) |
92 | newInterfaceName += "_" + profile; | 89 | newInterfaceName += "_" + profile; |
93 | // See if we have to make a interface. | 90 | // See if we have to make a interface. |
94 | if(!interfaces.setInterface(newInterfaceName)){ | 91 | if(!interfaces.setInterface(newInterfaceName)){ |
95 | // Add making for this new interface if need too | 92 | // Add making for this new interface if need too |
96 | if(profile != ""){ | 93 | if(profile != ""){ |
97 | interfaces.copyInterface(interface->getInterfaceName(), newInterfaceName); | 94 | interfaces.copyInterface(interface->getInterfaceName(), newInterfaceName); |
98 | if(!interfaces.setMapping(interface->getInterfaceName())){ | 95 | if(!interfaces.setMapping(interface->getInterfaceName())){ |
99 | interfaces.addMapping(interface->getInterfaceName()); | 96 | interfaces.addMapping(interface->getInterfaceName()); |
100 | if(!interfaces.setMapping(interface->getInterfaceName())){ | 97 | if(!interfaces.setMapping(interface->getInterfaceName())){ |
101 | qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); | 98 | qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); |
102 | return; | 99 | return; |
103 | } | 100 | } |
104 | } | 101 | } |
105 | interfaces.setMap("map", newInterfaceName); | 102 | interfaces.setMap("map", newInterfaceName); |
106 | interfaces.setScript("getprofile.sh"); | 103 | interfaces.setScript("getprofile.sh"); |
107 | } | 104 | } |
108 | else{ | 105 | else{ |
109 | interfaces.addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); | 106 | interfaces.addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); |
110 | if(!interfaces.setInterface(newInterfaceName)){ | 107 | if(!interfaces.setInterface(newInterfaceName)){ |
111 | qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); | 108 | qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); |
112 | return; | 109 | return; |
113 | } | 110 | } |
114 | } | 111 | } |
115 | } | 112 | } |
116 | 113 | ||
117 | // We must have a valid interface to get this far so read some settings. | 114 | // We must have a valid interface to get this far so read some settings. |
118 | 115 | ||
119 | // DHCP | 116 | // DHCP |
120 | bool error = false; | 117 | bool error = false; |
121 | if(interfaces.getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) | 118 | if(interfaces.getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) |
122 | dhcpCheckBox->setChecked(true); | 119 | dhcpCheckBox->setChecked(true); |
123 | else | 120 | else |
124 | dhcpCheckBox->setChecked(false); | 121 | dhcpCheckBox->setChecked(false); |
125 | leaseTime->setValue(interfaces.getInterfaceOption("leasehours", error).toInt()); | ||
126 | if(error) | ||
127 | leaseTime->setValue(interfaces.getInterfaceOption("leasetime", error).toInt()/60/60); | ||
128 | if(error) | ||
129 | leaseTime->setValue(24); | ||
130 | 122 | ||
131 | // IP Information | 123 | // IP Information |
132 | autoStart->setChecked(interfaces.isAuto(interface->getInterfaceName())); | 124 | autoStart->setChecked(interfaces.isAuto(interface->getInterfaceName())); |
133 | QString dns = interfaces.getInterfaceOption("up "DNSSCRIPT" -a", error); | 125 | QString dns = interfaces.getInterfaceOption("up "DNSSCRIPT" -a", error); |
134 | if(dns.contains(" ")){ | 126 | if(dns.contains(" ")){ |
135 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); | 127 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); |
136 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); | 128 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); |
137 | } | 129 | } |
138 | ipAddressEdit->setText(interfaces.getInterfaceOption("address", error)); | 130 | ipAddressEdit->setText(interfaces.getInterfaceOption("address", error)); |
139 | subnetMaskEdit->setText(interfaces.getInterfaceOption("netmask", error)); | 131 | subnetMaskEdit->setText(interfaces.getInterfaceOption("netmask", error)); |
140 | gatewayEdit->setText(interfaces.getInterfaceOption("gateway", error)); | 132 | gatewayEdit->setText(interfaces.getInterfaceOption("gateway", error)); |
141 | |||
142 | } | 133 | } |
143 | 134 | ||
144 | // interfacesetup.cpp | 135 | // interfacesetup.cpp |
145 | 136 | ||