diff --git a/qml/main.qml b/qml/main.qml index 66f3d4df9..dbdfdcdd1 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -251,6 +251,9 @@ Kirigami.ApplicationWindow { target: Controller function onInitiated() { + if (roomManager.hasOpenRoom) { + return; + } if (Controller.accountCount === 0) { pageStack.replace("qrc:/imports/NeoChat/Page/LoginPage.qml", {}); } else { diff --git a/src/controller.cpp b/src/controller.cpp index 57e922126..c15b0b1fc 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -282,6 +282,7 @@ void Controller::invokeLogin() Q_EMIT errorOccured(i18n("Login Failed"), error); logout(connection, true); } + Q_EMIT initiated(); }); connect(connection, &Connection::networkError, this, [=](const QString &error, const QString &, int, int) { Q_EMIT errorOccured("Network Error", error); @@ -289,7 +290,7 @@ void Controller::invokeLogin() connection->connectWithToken(account.userId(), accessToken, account.deviceId()); } } - if (m_connections.isEmpty()) { + if (accounts.isEmpty()) { Q_EMIT initiated(); } }