Fix quitting

This commit is contained in:
Florian Bruhin 2014-01-20 13:50:33 +01:00
parent 7ed257467b
commit e73d06c252

View File

@ -12,6 +12,7 @@ from qutebrowser.utils.appdirs import AppDirs
class QuteBrowser(QApplication): class QuteBrowser(QApplication):
def __init__(self): def __init__(self):
super().__init__(sys.argv) super().__init__(sys.argv)
args = self.parseopts() args = self.parseopts()
self.initlog() self.initlog()
@ -22,6 +23,7 @@ class QuteBrowser(QApplication):
self.commandparser = cmdutils.CommandParser() self.commandparser = cmdutils.CommandParser()
self.keyparser = KeyParser(self.mainwindow) self.keyparser = KeyParser(self.mainwindow)
super().aboutToQuit.connect(self.config.save)
self.mainwindow.tabs.keypress.connect(self.keyparser.handle) self.mainwindow.tabs.keypress.connect(self.keyparser.handle)
self.keyparser.set_cmd_text.connect(self.mainwindow.status.cmd.set_cmd) self.keyparser.set_cmd_text.connect(self.mainwindow.status.cmd.set_cmd)
self.mainwindow.status.cmd.got_cmd.connect(self.commandparser.parse) self.mainwindow.status.cmd.got_cmd.connect(self.commandparser.parse)
@ -69,7 +71,7 @@ class QuteBrowser(QApplication):
handlers = { handlers = {
'open': self.mainwindow.tabs.openurl, 'open': self.mainwindow.tabs.openurl,
'tabopen': self.mainwindow.tabs.tabopen, 'tabopen': self.mainwindow.tabs.tabopen,
'quit': self.exit, 'quit': super().quit,
'tabclose': self.mainwindow.tabs.close_act, 'tabclose': self.mainwindow.tabs.close_act,
'tabprev': self.mainwindow.tabs.switch_prev, 'tabprev': self.mainwindow.tabs.switch_prev,
'tabnext': self.mainwindow.tabs.switch_next, 'tabnext': self.mainwindow.tabs.switch_next,
@ -107,8 +109,3 @@ class QuteBrowser(QApplication):
tab = self.mainwindow.tabs.currentWidget() tab = self.mainwindow.tabs.currentWidget()
tab.setUrl(QUrl('about:pyeval')) tab.setUrl(QUrl('about:pyeval'))
tab.setContent(out.encode('UTF-8'), 'text/plain') tab.setContent(out.encode('UTF-8'), 'text/plain')
def exit(self, status=0):
self.config.save()
QApplication.closeAllWindows()
# FIXME do this right