diff options
author | kali <kali@leap.se> | 2012-09-20 04:39:50 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-09-20 04:39:50 +0900 |
commit | f2749fa3ff1df5875d3bc0b932a408031fee9874 (patch) | |
tree | da78596104a8cfe906f3a6f469d23157ac4803d7 /src/leap/baseapp | |
parent | cbd474e49e12e5fc0677dafe331b9c5ab3a2539a (diff) |
toggle connection on/off
Diffstat (limited to 'src/leap/baseapp')
-rw-r--r-- | src/leap/baseapp/eip.py | 3 | ||||
-rw-r--r-- | src/leap/baseapp/systray.py | 26 |
2 files changed, 13 insertions, 16 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: |