diff options
author | Kali Kaneko <kali@leap.se> | 2013-09-11 16:35:49 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-09-11 16:35:49 +0200 |
commit | f2024b6143cad13ed71c4e32293510c9b44e9a45 (patch) | |
tree | ee7d249ef5426532e82622f17ac2a8f865ef7837 /src/leap/bitmask/gui | |
parent | dd489b4785b2a534e7a1a70027b38bb42c2470c7 (diff) | |
parent | 8ccd37675068abb63887faed0e556306f442058f (diff) |
Merge remote-tracking branch 'ivan-github/bug/3791_prevent-last-window-close-app' into develop
Diffstat (limited to 'src/leap/bitmask/gui')
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 6141a3a2..2942d4c8 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -682,11 +682,18 @@ class MainWindow(QtGui.QMainWindow): Toggles the window visibility """ visible = self.isVisible() and self.isActiveWindow() + qApp = QtCore.QCoreApplication.instance() + if not visible: + qApp.setQuitOnLastWindowClosed(True) self.show() self.activateWindow() self.raise_() else: + # We set this in order to avoid dialogs shutting down the + # app on close, as they will be the only visible window. + # e.g.: PreferencesWindow, LoggerWindow + qApp.setQuitOnLastWindowClosed(False) self.hide() self._update_hideshow_menu() @@ -1611,6 +1618,11 @@ class MainWindow(QtGui.QMainWindow): """ # TODO separate the shutting down of services from the # UI stuff. + + # Set this in case that the app is hidden + qApp = QtCore.QCoreApplication.instance() + qApp.setQuitOnLastWindowClosed(True) + self._cleanup_and_quit() self._really_quit = True |