summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug-3791_prevent-last-window-close-app1
-rw-r--r--src/leap/bitmask/gui/mainwindow.py12
2 files changed, 13 insertions, 0 deletions
diff --git a/changes/bug-3791_prevent-last-window-close-app b/changes/bug-3791_prevent-last-window-close-app
new file mode 100644
index 00000000..3eeee72a
--- /dev/null
+++ b/changes/bug-3791_prevent-last-window-close-app
@@ -0,0 +1 @@
+ o Prevent dialogs closing the app when it has been minimized to the tray. Closes #3791.
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