author | kergoth <kergoth> | 2003-04-14 23:26:44 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-14 23:26:44 (UTC) |
commit | 9c0ba9922e12081ba87cce6583fe413ab5794cf6 (patch) (side-by-side diff) | |
tree | 274472a08b80971045ad54a49b126f7b19454483 /noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |
parent | 4c0ff8a1bdc4750ee36c713392d0842e9eb9eeb3 (diff) | |
download | opie-9c0ba9922e12081ba87cce6583fe413ab5794cf6.zip opie-9c0ba9922e12081ba87cce6583fe413ab5794cf6.tar.gz opie-9c0ba9922e12081ba87cce6583fe413ab5794cf6.tar.bz2 |
Correct the constructor, and ensure it does not remove all interface options, as that interferes with the new wireless module.
Diffstat (limited to 'noncore/settings/networksettings/interfaces/interfacesetupimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 2a5520d..fc65c5f 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp @@ -5,40 +5,38 @@ #include <qlineedit.h> #include <qspinbox.h> #include <qgroupbox.h> #include <qlabel.h> #include <qmessagebox.h> #define DNSSCRIPT "changedns" /** * Constuctor. Set up the connection. A profile must be set. */ -InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interfaces(j), interface(i), delInterfaces(false){ -} - -/** - * Constuctor. Set up the connection. A profile must be set. - */ -InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), delInterfaces(true){ - interfaces = new Interfaces; +InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){ + if (j == 0) { + delInterfaces = true; + interfaces = new Interfaces; + } } /** * Destructor */ InterfaceSetupImp::~InterfaceSetupImp(){ - if(delInterfaces) + if(delInterfaces) { delete interfaces; + } } /** * Save the current settings, then write out the interfaces file and close. */ bool InterfaceSetupImp::saveChanges(){ if(!saveSettings()) return false; interfaces->write(); return true; } @@ -53,25 +51,25 @@ bool InterfaceSetupImp::saveSettings(){ bool error = false; // Loopback case if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); return true; } if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); return false; } - interfaces->removeAllInterfaceOptions(); + //interfaces.removeAllInterfaceOptions(); // DHCP if(dhcpCheckBox->isChecked()) interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); else{ interfaces->setInterfaceMethod("static"); interfaces->setInterfaceOption("address", ipAddressEdit->text()); interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); interfaces->setInterfaceOption("gateway", gatewayEdit->text()); if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); |