diff options
author | Tomás Touceda <chiiph@leap.se> | 2014-06-27 11:50:46 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2014-06-27 11:50:46 -0300 |
commit | f8a8d2b7baed0889f83d85e6bd2b25412b16f229 (patch) | |
tree | e80cf726a622d8c1093dd3e432fa9b0e407af87c /src/leap | |
parent | 3087f7c79e9e7584558d93a2ce7162867d6555db (diff) | |
parent | 9689c961743c3ccecd54c8010ce5e2e5cf1ec940 (diff) |
Merge remote-tracking branch 'refs/remotes/kali/disable-eip' into develop
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/bitmask/gui/eip_status.py | 9 | ||||
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 34 | ||||
-rw-r--r-- | src/leap/bitmask/platform_init/initializers.py | 16 |
3 files changed, 51 insertions, 8 deletions
diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py index 8b9f2d44..bd569343 100644 --- a/src/leap/bitmask/gui/eip_status.py +++ b/src/leap/bitmask/gui/eip_status.py @@ -88,6 +88,8 @@ class EIPStatusWidget(QtGui.QWidget): self.is_restart = False self.is_cold_start = True + self.missing_helpers = False + # Action for the systray self._eip_disabled_action = QtGui.QAction( "{0} is {1}".format(self._service_name, self.tr("disabled")), self) @@ -298,7 +300,12 @@ class EIPStatusWidget(QtGui.QWidget): # probably the best thing would be to make a conditional # transition there, but that's more involved. self.eip_button.hide() - msg = self.tr("You must login to use {0}".format(self._service_name)) + if self.missing_helpers: + msg = self.tr( + "<font color=red>Disabled: missing helper files</font>") + else: + msg = self.tr( + "You must login to use {0}".format(self._service_name)) self.eip_label.setText(msg) self._eip_status_menu.setTitle("{0} is {1}".format( self._service_name, self.tr("disabled"))) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 9e0e78bc..53a7d95a 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -41,6 +41,7 @@ from leap.bitmask.gui import twisted_main from leap.bitmask.platform_init import IS_WIN, IS_MAC, IS_LINUX from leap.bitmask.platform_init.initializers import init_platform +from leap.bitmask.platform_init.initializers import init_signals from leap.bitmask.backend import leapbackend @@ -146,6 +147,9 @@ class MainWindow(QtGui.QMainWindow): self._settings, self._backend) self._eip_status = EIPStatusWidget(self, self._eip_conductor) + init_signals.eip_missing_helpers.connect( + self._disable_eip_missing_helpers) + self.ui.eipLayout.addWidget(self._eip_status) self._eip_conductor.add_eip_widget(self._eip_status) @@ -663,6 +667,16 @@ class MainWindow(QtGui.QMainWindow): self._eip_status.set_eip_status(self.tr("Disabled")) @QtCore.Slot() + def _disable_eip_missing_helpers(self): + """ + TRIGGERS: + init_signals.missing_helpers + + Set the missing_helpers flag, so we can disable EIP. + """ + self._eip_status.missing_helpers = True + + @QtCore.Slot() def _show_eip_preferences(self): """ TRIGGERS: @@ -1509,7 +1523,13 @@ class MainWindow(QtGui.QMainWindow): else: should_start = self._provides_eip_and_enabled() - if should_start and not self._already_started_eip: + missing_helpers = self._eip_status.missing_helpers + already_started = self._already_started_eip + can_start = (should_start + and not already_started + and not missing_helpers) + + if can_start: if self._eip_status.is_cold_start: self._backend.tear_fw_down() # XXX this should be handled by the state machine. @@ -1529,12 +1549,16 @@ class MainWindow(QtGui.QMainWindow): else: if not self._already_started_eip: if EIP_SERVICE in self._enabled_services: - self._eip_status.set_eip_status( - self.tr("Not supported"), - error=True) + if missing_helpers: + msg = self.tr( + "Disabled: missing helper files") + else: + msg = self.tr("Not supported"), + self._eip_status.set_eip_status(msg, error=True) else: + msg = self.tr("Disabled") self._eip_status.disable_eip_start() - self._eip_status.set_eip_status(self.tr("Disabled")) + self._eip_status.set_eip_status(msg) # eip will not start, so we start soledad anyway self._maybe_run_soledad_setup_checks() diff --git a/src/leap/bitmask/platform_init/initializers.py b/src/leap/bitmask/platform_init/initializers.py index 8dae21bf..384e1ec1 100644 --- a/src/leap/bitmask/platform_init/initializers.py +++ b/src/leap/bitmask/platform_init/initializers.py @@ -45,6 +45,16 @@ __all__ = ["init_platform"] _system = platform.system() +class InitSignals(QtCore.QObject): + """ + Signal container to communicate initialization events to differnt widgets. + """ + eip_missing_helpers = QtCore.Signal() + + +init_signals = InitSignals() + + def init_platform(): """ Return the right initializer for the platform we are running in, or @@ -86,8 +96,9 @@ def get_missing_helpers_dialog(): """ WE_NEED_POWERS = ("To better protect your privacy, " "Bitmask needs administrative privileges " - "to install helper files. " - "Do you want to proceed?") + "to install helper files. Encrypted " + "Internet cannot work without those files. " + "Do you want to install them now?") msg = QtGui.QMessageBox() msg.setWindowTitle(msg.tr("Missing helper files")) msg.setText(msg.tr(WE_NEED_POWERS)) @@ -147,6 +158,7 @@ def check_missing(): elif ret == QtGui.QMessageBox.No: logger.debug("Not installing missing scripts, " "user decided to ignore our warning.") + init_signals.eip_missing_helpers.emit() elif ret == QtGui.QMessageBox.Rejected: logger.debug( |