-rw-r--r-- | noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | 18 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfaces/interfacesetupimp.h | 3 |
2 files changed, 9 insertions, 12 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 @@ -11,28 +11,26 @@ #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(){ @@ -59,13 +57,13 @@ bool InterfaceSetupImp::saveSettings(){ } 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"); diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.h b/noncore/settings/networksettings/interfaces/interfacesetupimp.h index c4ace77..172da6a 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.h +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.h @@ -8,13 +8,12 @@ class Interface; class InterfaceSetupImp : public InterfaceSetup { Q_OBJECT public: - InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i = 0, WFlags fl = 0); InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i = 0, Interfaces *j = 0, WFlags fl = 0); ~InterfaceSetupImp(); bool saveChanges(); public slots: void setProfile(const QString &profile); @@ -34,13 +33,13 @@ class InterfaceSetupImpDialog : public QDialog { Q_OBJECT public: InterfaceSetupImpDialog(QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = false, WFlags fl = 0) : QDialog(parent, name, modal, fl){ QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); setCaption("Interface Setup"); - interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); + interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i); InterfaceSetupLayout->addWidget( interfaceSetup ); }; void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; private: InterfaceSetupImp *interfaceSetup; |