- def ok(self):
- current = self["config"].getCurrent()
- if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...':
- if current[1].help_window.instance is not None:
- current[1].help_window.instance.hide()
- elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value:
- if current[1].help_window.instance is not None:
- current[1].help_window.instance.hide()
- self.session.openWithCallback(self.applyConfig, MessageBox, (_("Are you sure you want to activate this network configuration?\n\n") + self.oktext ) )
+ def keySaveConfirm(self, ret = False):
+ if (ret == True):
+ num_configured_if = len(iNetwork.getConfiguredAdapters())
+ if num_configured_if >= 1:
+ if num_configured_if == 1 and self.iface in iNetwork.getConfiguredAdapters():
+ self.applyConfig(True)
+ else:
+ self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("A second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True)
+ else:
+ self.applyConfig(True)
+ else:
+ self.keyCancel()
+
+ def secondIfaceFoundCB(self,data):
+ if data is False:
+ self.applyConfig(True)
+ else:
+ configuredInterfaces = iNetwork.getConfiguredAdapters()
+ for interface in configuredInterfaces:
+ if interface == self.iface:
+ continue
+ iNetwork.setAdapterAttribute(interface, "up", False)
+ iNetwork.deactivateInterface(interface)
+ self.applyConfig(True)