Commit d469a2c7 authored by Saul Ibarra's avatar Saul Ibarra

Don't close all windows when closing the main window

parent 09a20e40
...@@ -16,7 +16,7 @@ import cjson ...@@ -16,7 +16,7 @@ import cjson
sip.setapi('QString', 2) sip.setapi('QString', 2)
sip.setapi('QVariant', 2) sip.setapi('QVariant', 2)
from PyQt4.QtCore import Qt from PyQt4.QtCore import Qt, QEvent
from PyQt4.QtGui import QApplication from PyQt4.QtGui import QApplication
from application import log from application import log
...@@ -110,6 +110,10 @@ class Blink(QApplication): ...@@ -110,6 +110,10 @@ class Blink(QApplication):
self.main_window = MainWindow() self.main_window = MainWindow()
self.chat_window = ChatWindow() self.chat_window = ChatWindow()
self.main_window.__closed__ = True
self.chat_window.__closed__ = True
self.main_window.installEventFilter(self)
self.chat_window.installEventFilter(self)
self.main_window.addAction(self.chat_window.control_button.actions.main_window) self.main_window.addAction(self.chat_window.control_button.actions.main_window)
self.chat_window.addAction(self.main_window.quit_action) self.chat_window.addAction(self.main_window.quit_action)
...@@ -236,6 +240,19 @@ class Blink(QApplication): ...@@ -236,6 +240,19 @@ class Blink(QApplication):
settings.save() settings.save()
return certificate_path return certificate_path
def eventFilter(self, watched, event):
if watched in (self.main_window, self.chat_window):
if event.type() == QEvent.Show:
watched.__closed__ = False
elif event.type() == QEvent.Close:
watched.__closed__ = True
if self.main_window.__closed__ and self.chat_window.__closed__:
# close auxiliary windows
self.main_window.conference_dialog.close()
self.main_window.filetransfer_window.close()
self.main_window.preferences_window.close()
return False
def customEvent(self, event): def customEvent(self, event):
handler = getattr(self, '_EH_%s' % event.name, Null) handler = getattr(self, '_EH_%s' % event.name, Null)
handler(event) handler(event)
......
...@@ -233,11 +233,8 @@ class MainWindow(base_class, ui_class): ...@@ -233,11 +233,8 @@ class MainWindow(base_class, ui_class):
QSettings().setValue("main_window/geometry", self.saveGeometry()) QSettings().setValue("main_window/geometry", self.saveGeometry())
super(MainWindow, self).closeEvent(event) super(MainWindow, self).closeEvent(event)
self.about_panel.close() self.about_panel.close()
self.conference_dialog.close()
self.contact_editor_dialog.close() self.contact_editor_dialog.close()
self.google_contacts_dialog.close() self.google_contacts_dialog.close()
self.filetransfer_window.close()
self.preferences_window.close()
self.server_tools_window.close() self.server_tools_window.close()
for dialog in self.pending_watcher_dialogs[:]: for dialog in self.pending_watcher_dialogs[:]:
dialog.close() dialog.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment