- // session resume
- QtUi *gui = new QtUi();
- Client::init(gui);
- // init gui only after the event loop has started
- // QTimer::singleShot(0, gui, SLOT(init()));
- gui->init();
- resumeSessionIfPossible();
+ Client::init(new QtUi());
+
+ // Init UI only after the event loop has started
+ // TODO Qt5: Make this a lambda
+ QTimer::singleShot(0, this, SLOT(initUi()));
+
+ Quassel::registerQuitHandler([]() {
+ QtUi::mainWindow()->quit();
+ });
+
+