From 01447ca9d4867bbcafc6b4616b5ed62480883deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Wed, 30 Oct 2013 12:48:35 -0300 Subject: Hide unsupported services by the configured providers --- src/leap/bitmask/gui/mainwindow.py | 28 ++++++ src/leap/bitmask/gui/ui/mainwindow.ui | 172 +++++++++++++++++++--------------- 2 files changed, 126 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index dddd53da..72dcf278 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().encode("utf8") password = self._login_widget.get_password().encode("utf8") + self._hide_unsupported_services() + if self._srp_auth is None: self._srp_auth = SRPAuth(self._provider_config) self._srp_auth.authentication_finished.connect( diff --git a/src/leap/bitmask/gui/ui/mainwindow.ui b/src/leap/bitmask/gui/ui/mainwindow.ui index 10c77057..badd291d 100644 --- a/src/leap/bitmask/gui/ui/mainwindow.ui +++ b/src/leap/bitmask/gui/ui/mainwindow.ui @@ -75,7 +75,7 @@ 0 0 524 - 635 + 636 @@ -86,88 +86,100 @@ 0 - - - - 0 - 0 - - - - QFrame{background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(160, 160, 160, 128), stop:1 rgba(255, 255, 255, 0));} - - - - 24 + + + + 0 - - 24 + + 0 - - - - 16 - 75 - true - + + + + 0 + 0 + - background-color: rgba(255, 255, 255, 0); - - - Encrypted Internet + QFrame{background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(160, 160, 160, 128), stop:1 rgba(255, 255, 255, 0));} + + + 24 + + + 24 + + + + + + 16 + 75 + true + + + + background-color: rgba(255, 255, 255, 0); + + + Encrypted Internet + + + + + + + + 48 + 20 + + + + + + + + + + + :/images/black/32/gear.png:/images/black/32/gear.png + + + false + + + false + + + false + + + + - - - - 48 - 20 - + + + 12 - - + + 0 - - + + 12 - - - :/images/black/32/gear.png:/images/black/32/gear.png - - - false + + 0 - - false - - - false - - + - - - - 12 - - - 0 - - - 12 - - - 0 - - - @@ -253,14 +265,26 @@ background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb - - - -1 - - - 12 - - + + + + 0 + + + 0 + + + + + -1 + + + 12 + + + + + -- cgit v1.2.3