diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-30 13:05:29 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-30 13:05:29 -0300 |
commit | e1a318fdeb0947da940496c793eb2481bf775450 (patch) | |
tree | 58b22a6486710c743667b4a89f262a19c7e2e6e8 /src/leap/bitmask/gui/mainwindow.py | |
parent | 094e71f620416859fb63ab5674165984b8f12b50 (diff) | |
parent | 01447ca9d4867bbcafc6b4616b5ed62480883deb (diff) |
Merge remote-tracking branch 'chiiph/feature/hide_unused_services' into develop
Diffstat (limited to 'src/leap/bitmask/gui/mainwindow.py')
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index fa1a82f8..6af71e24 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -545,6 +545,8 @@ class MainWindow(QtGui.QMainWindow): if IS_MAC: self.raise_() + self._hide_unsupported_services() + if self._wizard: possible_username = self._wizard.get_username() possible_password = self._wizard.get_password() @@ -603,6 +605,30 @@ class MainWindow(QtGui.QMainWindow): saved_password.decode("utf8")) self._login() + def _hide_unsupported_services(self): + """ + Given a set of configured providers, it creates a set of + available services among all of them and displays the service + widgets of only those. + + This means, for example, that with just one provider with EIP + only, the mail widget won't be displayed. + """ + providers = self._settings.get_configured_providers() + + services = set() + + for prov in providers: + provider_config = ProviderConfig() + loaded = provider_config.load( + provider.get_provider_path(prov)) + if loaded: + for service in provider_config.get_services(): + services.add(service) + + self.ui.eipWidget.setVisible(self.OPENVPN_SERVICE in services) + self.ui.mailWidget.setVisible(self.MX_SERVICE in services) + # # systray # @@ -883,6 +909,8 @@ class MainWindow(QtGui.QMainWindow): username = self._login_widget.get_user() password = self._login_widget.get_password() + self._hide_unsupported_services() + if self._srp_auth is None: self._srp_auth = SRPAuth(self._provider_config) self._srp_auth.authentication_finished.connect( |