diff options
-rw-r--r-- | changes/bug-4117_select-current-logged-in-provider-in-preferences-window | 2 | ||||
-rw-r--r-- | src/leap/bitmask/gui/preferenceswindow.py | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/changes/bug-4117_select-current-logged-in-provider-in-preferences-window b/changes/bug-4117_select-current-logged-in-provider-in-preferences-window new file mode 100644 index 00000000..46a031e0 --- /dev/null +++ b/changes/bug-4117_select-current-logged-in-provider-in-preferences-window @@ -0,0 +1,2 @@ + - Select the current logged in provider in the preferences window. Closes + #4117. diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index 86fe9433..acb39b07 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -77,10 +77,11 @@ class PreferencesWindow(QtGui.QDialog): pw_enabled = False # check if the user is logged in - if srp_auth is not None and srp_auth.get_session_id() is not None: + if srp_auth is not None and srp_auth.get_token() is not None: # check if provider has 'mx' ... + domain = provider_config.get_domain() + self._select_provider_by_name(domain) if provider_config.provides_mx(): - domain = provider_config.get_domain() enabled_services = self._settings.get_enabled_services(domain) mx_name = get_service_display_name('mx') @@ -253,6 +254,16 @@ class PreferencesWindow(QtGui.QDialog): for provider in self._settings.get_configured_providers(): self.ui.cbProvidersServices.addItem(provider) + def _select_provider_by_name(self, name): + """ + Given a provider name/domain, selects it in the combobox. + + :param name: name or domain for the provider + :type name: str + """ + provider_index = self.ui.cbProvidersServices.findText(name) + self.ui.cbProvidersServices.setCurrentIndex(provider_index) + def _service_selection_changed(self, service, state): """ SLOT |