diff options
-rw-r--r-- | changes/feature-4990_start-hidden-flag | 1 | ||||
-rw-r--r-- | changes/feature_hide-mainwindow-on-quit | 1 | ||||
-rw-r--r-- | pkg/requirements.pip | 6 | ||||
-rw-r--r-- | src/leap/bitmask/app.py | 4 | ||||
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 30 | ||||
-rw-r--r-- | src/leap/bitmask/util/leap_argparse.py | 3 |
6 files changed, 37 insertions, 8 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/changes/feature_hide-mainwindow-on-quit b/changes/feature_hide-mainwindow-on-quit new file mode 100644 index 00000000..abd1df7a --- /dev/null +++ b/changes/feature_hide-mainwindow-on-quit @@ -0,0 +1 @@ +- Hide the main window on quit as first thing and show a tooltip to inform that we are closing. diff --git a/pkg/requirements.pip b/pkg/requirements.pip index e35ed1c5..70427e63 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -22,9 +22,9 @@ python-daemon # this should not be needed for Windows. keyring zope.proxy -leap.common>=0.3.4 -leap.soledad.client>=0.4.2 -leap.keymanager>=0.3.6 +leap.common>=0.3.7 +leap.soledad.client>=0.5.0 +leap.keymanager>=0.3.8 leap.mail>=0.3.9 # Remove this when u1db fixes its dependency on oauth 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..9d0f9145 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 @@ -2041,6 +2054,15 @@ class MainWindow(QtGui.QMainWindow): # TODO separate the shutting down of services from the # UI stuff. + # first thing to do quitting, hide the mainwindow and show tooltip. + self.hide() + self._systray.showMessage( + self.tr('Quitting...'), + self.tr('The app is quitting, please wait.')) + + # explicitly process events to display tooltip immediately + QtCore.QCoreApplication.processEvents() + # Set this in case that the app is hidden QtGui.QApplication.setQuitOnLastWindowClosed(True) 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='?', |