Commit 85697bc5 authored by scuq's avatar scuq

fixed #30

parent e0829cb2
......@@ -73,6 +73,7 @@ int main(int argc, char *argv[])
qInstallMessageHandler(aicMessageOutput);
QApplication a(argc, argv);
qmMainWindow w;
QObject::connect(&a, SIGNAL(aboutToQuit()),&w,SLOT(slAboutToQuit()));
w.show();
return a.exec();
......
......@@ -304,10 +304,15 @@ accntviews.value()->setModel(fsModel);
void qmMainWindow::closeEvent(QCloseEvent *closeev)
{
this->m_mp->setSaveWindowStatePosition("main", saveGeometry(),saveState());
if (this->getCloseToTray() == true) {
//this->trayIcon->showMessage(appname+" closed to tray.","");
this->hide();
closeev->ignore();
if (this->isVisible()) {
this->hide();
closeev->ignore();
} else {
this->disconnectSessions();
closeev->accept();
}
} else {
this->disconnectSessions();
closeev->accept();
......@@ -356,6 +361,9 @@ void qmMainWindow::disconnectSessions()
QMapIterator<QString, ImSession*> sessions(this->iMSessions);
if (this->iMSessions.keys().size() <= 0) {
qApp->quit();
}
while (sessions.hasNext()) {
......@@ -368,9 +376,6 @@ void qmMainWindow::disconnectSessions()
}
}
bool qmMainWindow::getNetworkConnection() const
......@@ -755,4 +760,9 @@ void qmMainWindow::slOnLoggedOut(QString accountname)
}
}
void qmMainWindow::slAboutToQuit()
{
this->disconnectSessions();
}
......@@ -152,6 +152,8 @@ private slots:
void slOnLoggedOut(QString accountname);
void slAboutToQuit();
private:
......
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