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/systray.py | |
parent | cbd474e49e12e5fc0677dafe331b9c5ab3a2539a (diff) |
toggle connection on/off
Diffstat (limited to 'src/leap/baseapp/systray.py')
-rw-r--r-- | src/leap/baseapp/systray.py | 26 |
1 files changed, 11 insertions, 15 deletions
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: |