diff options
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/baseapp/eip.py | 3 | ||||
-rw-r--r-- | src/leap/baseapp/systray.py | 26 | ||||
-rw-r--r-- | src/leap/eip/config.py | 1 | ||||
-rw-r--r-- | src/leap/eip/openvpnconnection.py | 7 |
4 files changed, 19 insertions, 18 deletions
diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 6d6b79cb..98ff7142 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -216,12 +216,12 @@ class EIPConductorAppMixin(object): if self.debugmode: self.startStopButton.setText('&Disconnect') self.eip_service_started = True + self.toggleEIPAct() # XXX decouple! (timer is init by icons class). # we could bring Timer Init to this Mixin # or to its own Mixin. self.timer.start(constants.TIMER_MILLISECONDS) - return if self.eip_service_started is True: @@ -229,5 +229,6 @@ class EIPConductorAppMixin(object): if self.debugmode: self.startStopButton.setText('&Connect') self.eip_service_started = False + self.toggleEIPAct() self.timer.stop() return diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index f98bfa76..39a23f49 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -5,16 +5,12 @@ from PyQt4 import QtGui from leap import __branding as BRANDING from leap import __version__ as VERSION + from leap.gui import mainwindow_rc logger = logging.getLogger(__name__) -class PseudoAction(QtGui.QAction): - def isSeparator(self): - return True - - class StatusAwareTrayIconMixin(object): """ a mix of several functions needed @@ -86,10 +82,7 @@ class StatusAwareTrayIconMixin(object): """ self.trayIconMenu = QtGui.QMenu(self) - self.trayIconMenu.addAction(self.statusAct) self.trayIconMenu.addAction(self.connAct) - #self.trayIconMenu.addAction(self.dis_connectAction) - #self.trayIconMenu.addSeparator() #self.trayIconMenu.addAction(self.minimizeAction) #self.trayIconMenu.addAction(self.maximizeAction) #self.trayIconMenu.addAction(self.restoreAction) @@ -113,13 +106,7 @@ class StatusAwareTrayIconMixin(object): creates actions to be binded to tray icon """ # XXX change action name on (dis)connect - statusAct = PseudoAction( - "Encryption OFF", self) # , - statusAct.setSeparator(True) - self.statusAct = statusAct - self.statusAct.isSeparator = lambda: True - #triggered=self.bad) - self.connAct = QtGui.QAction(" turn &on", self, + self.connAct = QtGui.QAction("Encryption ON turn &off", self, triggered=lambda: self.start_or_stopVPN()) self.detailsAct = QtGui.QAction("&Details...", @@ -138,6 +125,15 @@ class StatusAwareTrayIconMixin(object): self.quitAction = QtGui.QAction("&Quit", self, triggered=self.cleanupAndQuit) + def toggleEIPAct(self): + # this is too simple by now. + # XXX We need to get the REAL info for Encryption state. + # (now is ON as soon as vpn launched) + if self.eip_service_started is True: + self.connAct.setText('Encryption ON turn o&ff') + else: + self.connAct.setText('Encryption OFF turn &on') + def detailsWin(self): visible = self.isVisible() if visible: diff --git a/src/leap/eip/config.py b/src/leap/eip/config.py index 44922310..e5fcd164 100644 --- a/src/leap/eip/config.py +++ b/src/leap/eip/config.py @@ -112,7 +112,6 @@ def build_ovpn_options(daemon=False, socket_path=None, **kwargs): # remote opts.append('--remote') gw = get_eip_gateway() - #gw = "springbokvpn.org" logger.debug('setting eip gateway to %s', gw) opts.append(str(gw)) opts.append('1194') diff --git a/src/leap/eip/openvpnconnection.py b/src/leap/eip/openvpnconnection.py index 92ae9de9..e32d584c 100644 --- a/src/leap/eip/openvpnconnection.py +++ b/src/leap/eip/openvpnconnection.py @@ -163,8 +163,13 @@ to be triggered for each one of them. """ terminates child subprocess """ + # XXX we should send a quit process using management + # interface. if self.subp: - self.subp.terminate() + try: + self.subp.terminate() + except OSError: + logger.error('cannot terminate subprocess!') # # management methods |