summaryrefslogtreecommitdiff
path: root/noncore/net/networksetup/interfacesetupimp.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/networksetup/interfacesetupimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/networksetup/interfacesetupimp.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/noncore/net/networksetup/interfacesetupimp.cpp b/noncore/net/networksetup/interfacesetupimp.cpp
index 951aeee..c16d821 100644
--- a/noncore/net/networksetup/interfacesetupimp.cpp
+++ b/noncore/net/networksetup/interfacesetupimp.cpp
@@ -24,3 +24,2 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac
interfaces = new Interfaces();
- changeProfile(profileCombo->currentText());
bool error = false;
@@ -32,3 +31,2 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac
}
- connect(profileCombo, SIGNAL(highlighted(const QString &)), this, SLOT(changeProfile(const QString &)));
}
@@ -92,22 +90,9 @@ bool InterfaceSetupImp::saveSettings(){
*/
-void InterfaceSetupImp::changeProfile(const QString &profile){
- QString newInterfaceName;
- if(profile.lower() == "all")
- newInterfaceName = interface->getInterfaceName();
- else
- newInterfaceName = interface->getInterfaceName() + "_" + profile;
- if(newInterfaceName == currentInterfaceName)
- return;
- else{
- saveSettings();
- currentInterfaceName = newInterfaceName;
- }
- bool error = interfaces->setInterface(currentInterfaceName);
+void InterfaceSetupImp::setProfile(const QString &profile){
+ QString newInterfaceName = interface->getInterfaceName() + profile;
// See if we have to make a interface.
- if(error){
- qDebug("InterfaceSetupImp: Adding a new interface from profile change.");
- interfaces->addInterface(currentInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
- error = interfaces->setInterface(currentInterfaceName);
- if(error){
+ if(!interfaces->setInterface(newInterfaceName)){
+ interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
+ if(!interfaces->setInterface(newInterfaceName)){
qDebug("InterfaceSetupImp: Added interface, but still can't set.");
@@ -115,5 +100,16 @@ void InterfaceSetupImp::changeProfile(const QString &profile){
}
+ // Add making for this new interface if need too
+ if(profile != ""){
+ if(!interfaces->setMapping(interface->getInterfaceName())){
+ interfaces->addMapping(interface->getInterfaceName());
+ if(!interfaces->setMapping(interface->getInterfaceName())){
+ qDebug("InterfaceSetupImp: Added Mapping, but still can't set.");
+ return;
+ }
+ }
+ interfaces->setScript("getprofile.sh");
+ interfaces->setMap("map", newInterfaceName);
+ }
}
- //qDebug( currentInterfaceName.latin1() );
// We must have a valid interface to get this far so read some settings.
@@ -121,2 +117,3 @@ void InterfaceSetupImp::changeProfile(const QString &profile){
// DHCP
+ bool error = false;
if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP)