summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-04-10 16:59:07 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-04-10 17:16:01 -0300
commit65bbc9ac87092053a8079d4d7d88cac4df5fbc36 (patch)
tree403dfe583f7462865948861b254105f5cd69f6ab
parentc3a21a28ba3b3a8200959ec67b0447c982448941 (diff)
Add flag to start the app hidden in the tray.
Closes #4990.
-rw-r--r--changes/feature-4990_start-hidden-flag1
-rw-r--r--src/leap/bitmask/app.py4
-rw-r--r--src/leap/bitmask/gui/mainwindow.py21
-rw-r--r--src/leap/bitmask/util/leap_argparse.py3
4 files changed, 24 insertions, 5 deletions
diff --git a/changes/feature-4990_start-hidden-flag b/changes/feature-4990_start-hidden-flag
new file mode 100644
index 00000000..807fe8fe
--- /dev/null
+++ b/changes/feature-4990_start-hidden-flag
@@ -0,0 +1 @@
+- Add flag to allow the user to start the app hidden in the tray. Closes #4990.
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py
index 02e27123..ca1226de 100644
--- a/src/leap/bitmask/app.py
+++ b/src/leap/bitmask/app.py
@@ -201,6 +201,7 @@ def main():
logfile = opts.log_file
mail_logfile = opts.mail_log_file
openvpn_verb = opts.openvpn_verb
+ start_hidden = opts.start_hidden
#############################################################
# Given how paths and bundling works, we need to delay the imports
@@ -307,7 +308,8 @@ def main():
window = MainWindow(
lambda: twisted_main.quit(app),
openvpn_verb=openvpn_verb,
- bypass_checks=bypass_checks)
+ bypass_checks=bypass_checks,
+ start_hidden=start_hidden)
sigint_window = partial(sigint_handler, window, logger=logger)
signal.signal(signal.SIGINT, sigint_window)
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 5abfaa67..0cc6104b 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -124,7 +124,8 @@ class MainWindow(QtGui.QMainWindow):
def __init__(self, quit_callback,
openvpn_verb=1,
- bypass_checks=False):
+ bypass_checks=False,
+ start_hidden=False):
"""
Constructor for the client main window
@@ -136,6 +137,9 @@ class MainWindow(QtGui.QMainWindow):
first round of checks for CA
certificates at bootstrap
:type bypass_checks: bool
+ :param start_hidden: Set to true if the app should not show the window
+ but just the tray.
+ :type start_hidden: bool
"""
QtGui.QMainWindow.__init__(self)
@@ -342,6 +346,7 @@ class MainWindow(QtGui.QMainWindow):
self._logger_window = None
self._bypass_checks = bypass_checks
+ self._start_hidden = start_hidden
# We initialize Soledad and Keymanager instances as
# transparent proxies, so we can pass the reference freely
@@ -666,9 +671,11 @@ class MainWindow(QtGui.QMainWindow):
providers = self._settings.get_configured_providers()
self._login_widget.set_providers(providers)
self._show_systray()
- self.show()
- if IS_MAC:
- self.raise_()
+
+ if not self._start_hidden:
+ self.show()
+ if IS_MAC:
+ self.raise_()
self._hide_unsupported_services()
@@ -787,6 +794,12 @@ class MainWindow(QtGui.QMainWindow):
self._mail_status.set_systray(self._systray)
self._eip_status.set_systray(self._systray)
+ hello = lambda: self._systray.showMessage(
+ self.tr('Hello!'),
+ self.tr('Bitmask has started in the tray.'))
+ # we wait for the systray to be ready
+ reactor.callLater(1, hello)
+
def _tray_activated(self, reason=None):
"""
SLOT
diff --git a/src/leap/bitmask/util/leap_argparse.py b/src/leap/bitmask/util/leap_argparse.py
index 88267ff8..8aacc85d 100644
--- a/src/leap/bitmask/util/leap_argparse.py
+++ b/src/leap/bitmask/util/leap_argparse.py
@@ -59,6 +59,9 @@ def build_parser():
action="store_false", dest="api_version_check",
help='Skip the api version compatibility check with '
'the provider.')
+ parser.add_argument('-H', '--start-hidden', default=False,
+ action="store_true", dest="start_hidden",
+ help='Starts the application just in the taskbar.')
# openvpn options
parser.add_argument('--openvpn-verbosity', nargs='?',