summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-01-07 19:06:49 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-01-09 14:27:42 -0300
commitf4a0747e216fb651628490f7849d2e4c9c6d8092 (patch)
tree622384d3b6c0845321735d1a3d172ce0dd414780
parentfc0663054c4f76c1103291c334bb60c0dff1280b (diff)
Warn the user on incompatible api error.
- Add a proper signal for the incompatible api error. - Warn the user of an incompatible api.
-rw-r--r--src/leap/bitmask/backend.py5
-rw-r--r--src/leap/bitmask/gui/mainwindow.py11
-rw-r--r--src/leap/bitmask/provider/providerbootstrapper.py3
3 files changed, 16 insertions, 3 deletions
diff --git a/src/leap/bitmask/backend.py b/src/leap/bitmask/backend.py
index 0dfc6b21..6b29d4b3 100644
--- a/src/leap/bitmask/backend.py
+++ b/src/leap/bitmask/backend.py
@@ -195,6 +195,7 @@ class Signaler(QtCore.QObject):
prov_problem_with_provider = QtCore.Signal(object)
prov_unsupported_client = QtCore.Signal(object)
+ prov_unsupported_api = QtCore.Signal(object)
# These will exist both in the backend and the front end.
# The frontend might choose to not "interpret" all the signals
@@ -208,6 +209,7 @@ class Signaler(QtCore.QObject):
PROV_CHECK_API_CERTIFICATE_KEY = "prov_check_api_certificate"
PROV_PROBLEM_WITH_PROVIDER_KEY = "prov_problem_with_provider"
PROV_UNSUPPORTED_CLIENT = "prov_unsupported_client"
+ PROV_UNSUPPORTED_API = "prov_unsupported_api"
def __init__(self):
"""
@@ -224,7 +226,8 @@ class Signaler(QtCore.QObject):
self.PROV_CHECK_CA_FINGERPRINT_KEY,
self.PROV_CHECK_API_CERTIFICATE_KEY,
self.PROV_PROBLEM_WITH_PROVIDER_KEY,
- self.PROV_UNSUPPORTED_CLIENT
+ self.PROV_UNSUPPORTED_CLIENT,
+ self.PROV_UNSUPPORTED_API
]
for sig in signals:
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 1bbce8d4..8c512ad2 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -374,6 +374,7 @@ class MainWindow(QtGui.QMainWindow):
sig.prov_problem_with_provider.connect(self._login_problem_provider)
sig.prov_unsupported_client.connect(self._needs_update)
+ sig.prov_unsupported_api.connect(self._incompatible_api)
def _backend_disconnect(self):
"""
@@ -859,6 +860,16 @@ class MainWindow(QtGui.QMainWindow):
"You can get the latest version from {0}").format(url)
QtGui.QMessageBox.warning(self, self.tr("Update Needed"), msg)
+ def _incompatible_api(self):
+ """
+ Display a warning dialog to inform the user that the provider has an
+ incompatible API.
+ """
+ msg = self.tr(
+ "This provider is not compatible with the client.<br><br>"
+ "Error: API version incompatible.")
+ QtGui.QMessageBox.warning(self, self.tr("Incompatible Provider"), msg)
+
def changeEvent(self, e):
"""
Reimplements the changeEvent method to minimize to tray
diff --git a/src/leap/bitmask/provider/providerbootstrapper.py b/src/leap/bitmask/provider/providerbootstrapper.py
index e00dd646..52ebacd2 100644
--- a/src/leap/bitmask/provider/providerbootstrapper.py
+++ b/src/leap/bitmask/provider/providerbootstrapper.py
@@ -227,8 +227,7 @@ class ProviderBootstrapper(AbstractBootstrapper):
'Found: {1}.').format(api_supported, api_version)
logger.error(error)
- self._signaler.signal(
- self._signaler.PROV_PROBLEM_WITH_PROVIDER_KEY)
+ self._signaler.signal(self._signaler.PROV_UNSUPPORTED_API)
raise UnsupportedProviderAPI(error)
def run_provider_select_checks(self, domain, download_if_needed=False):