diff options
-rw-r--r-- | changes/feature_hide_unused_services | 2 | ||||
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 28 | ||||
-rw-r--r-- | src/leap/bitmask/gui/ui/mainwindow.ui | 172 |
3 files changed, 128 insertions, 74 deletions
diff --git a/changes/feature_hide_unused_services b/changes/feature_hide_unused_services new file mode 100644 index 00000000..abcdeb6f --- /dev/null +++ b/changes/feature_hide_unused_services @@ -0,0 +1,2 @@ + - Hide the GUI for services that are not supported on the set of + configured providers. Closes #4170.
\ No newline at end of file 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 @@ <x>0</x> <y>0</y> <width>524</width> - <height>635</height> + <height>636</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -86,89 +86,101 @@ <number>0</number> </property> <item> - <widget class="QFrame" name="frame_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">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));}</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="leftMargin"> - <number>24</number> + <widget class="QWidget" name="eipWidget" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>0</number> </property> - <property name="rightMargin"> - <number>24</number> + <property name="margin"> + <number>0</number> </property> <item> - <widget class="QLabel" name="label_2"> - <property name="font"> - <font> - <pointsize>16</pointsize> - <weight>75</weight> - <bold>true</bold> - </font> + <widget class="QFrame" name="frame_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="styleSheet"> - <string notr="true">background-color: rgba(255, 255, 255, 0);</string> - </property> - <property name="text"> - <string>Encrypted Internet</string> + <string notr="true">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));}</string> </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="leftMargin"> + <number>24</number> + </property> + <property name="rightMargin"> + <number>24</number> + </property> + <item> + <widget class="QLabel" name="label_2"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="styleSheet"> + <string notr="true">background-color: rgba(255, 255, 255, 0);</string> + </property> + <property name="text"> + <string>Encrypted Internet</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnEIPPreferences"> + <property name="maximumSize"> + <size> + <width>48</width> + <height>20</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="../../../../../data/resources/mainwindow.qrc"> + <normaloff>:/images/black/32/gear.png</normaloff>:/images/black/32/gear.png</iconset> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>false</bool> + </property> + <property name="flat"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> </widget> </item> <item> - <widget class="QPushButton" name="btnEIPPreferences"> - <property name="maximumSize"> - <size> - <width>48</width> - <height>20</height> - </size> + <layout class="QVBoxLayout" name="eipLayout"> + <property name="leftMargin"> + <number>12</number> </property> - <property name="styleSheet"> - <string notr="true"/> + <property name="topMargin"> + <number>0</number> </property> - <property name="text"> - <string/> + <property name="rightMargin"> + <number>12</number> </property> - <property name="icon"> - <iconset resource="../../../../../data/resources/mainwindow.qrc"> - <normaloff>:/images/black/32/gear.png</normaloff>:/images/black/32/gear.png</iconset> - </property> - <property name="autoDefault"> - <bool>false</bool> + <property name="bottomMargin"> + <number>0</number> </property> - <property name="default"> - <bool>false</bool> - </property> - <property name="flat"> - <bool>false</bool> - </property> - </widget> + </layout> </item> </layout> </widget> </item> <item> - <layout class="QVBoxLayout" name="eipLayout"> - <property name="leftMargin"> - <number>12</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>12</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - </layout> - </item> - <item> <widget class="Line" name="line"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -253,14 +265,26 @@ background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb </widget> </item> <item> - <layout class="QVBoxLayout" name="mailLayout" stretch=""> - <property name="spacing"> - <number>-1</number> - </property> - <property name="margin"> - <number>12</number> - </property> - </layout> + <widget class="QWidget" name="mailWidget" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>0</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <layout class="QVBoxLayout" name="mailLayout"> + <property name="spacing"> + <number>-1</number> + </property> + <property name="margin"> + <number>12</number> + </property> + </layout> + </item> + </layout> + </widget> </item> <item> <spacer name="verticalSpacer"> |