author | benmeyer <benmeyer> | 2002-12-16 21:48:37 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-12-16 21:48:37 (UTC) |
commit | 9cb9007f211c22349e3183ba20bb7f817d811005 (patch) (unidiff) | |
tree | 71d929282b4edfff101ef208d6ab4d1512b20960 | |
parent | 05ee76167ad314aea710966e7c93b124da252a95 (diff) | |
download | opie-9cb9007f211c22349e3183ba20bb7f817d811005.zip opie-9cb9007f211c22349e3183ba20bb7f817d811005.tar.gz opie-9cb9007f211c22349e3183ba20bb7f817d811005.tar.bz2 |
Remove the lease time requst. Wasn't realy needed and was uneccessary
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 | |||
@@ -5,49 +5,49 @@ | |||
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()); |
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,134 +1,79 @@ | |||
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> |
@@ -260,51 +205,38 @@ | |||
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 | |||
@@ -29,53 +29,50 @@ bool InterfaceSetupImp::saveChanges(){ | |||
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; |
@@ -101,45 +98,39 @@ void InterfaceSetupImp::setProfile(const QString &profile){ | |||
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 | |||
@@ -5,49 +5,49 @@ | |||
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()); |
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,134 +1,79 @@ | |||
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> |
@@ -260,51 +205,38 @@ | |||
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 | |||
@@ -29,53 +29,50 @@ bool InterfaceSetupImp::saveChanges(){ | |||
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; |
@@ -101,45 +98,39 @@ void InterfaceSetupImp::setProfile(const QString &profile){ | |||
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 | ||