diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index bc53b906..0978fc25 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -35,7 +35,6 @@
#include "dialogs/CreateRoom.h"
#include "dialogs/JoinRoom.h"
#include "dialogs/LeaveRoom.h"
-#include "dialogs/Logout.h"
MainWindow *MainWindow::instance_ = nullptr;
@@ -372,24 +371,6 @@ MainWindow::showSolidOverlayModal(QWidget *content, QFlags<Qt::AlignmentFlag> fl
modal_->show();
}
-void
-MainWindow::openLogoutDialog()
-{
- auto dialog = new dialogs::Logout(this);
- connect(dialog, &dialogs::Logout::loggingOut, this, [this]() {
- if (WebRTCSession::instance().state() != webrtc::State::DISCONNECTED) {
- if (QMessageBox::question(this, "nheko", "A call is in progress. Log out?") !=
- QMessageBox::Yes) {
- return;
- }
- WebRTCSession::instance().end();
- }
- chat_page_->initiateLogout();
- });
-
- showDialog(dialog);
-}
-
bool
MainWindow::hasActiveDialogs() const
{
diff --git a/src/MainWindow.h b/src/MainWindow.h
index eff8fbe7..a3c3c767 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -64,7 +64,6 @@ public:
void openCreateRoomDialog(
std::function<void(const mtx::requests::CreateRoom &request)> callback);
void openJoinRoomDialog(std::function<void(const QString &room_id)> callback);
- void openLogoutDialog();
void hideOverlay();
void showSolidOverlayModal(QWidget *content, QFlags<Qt::AlignmentFlag> flags = Qt::AlignCenter);
diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp
index d6824996..1a20cbc2 100644
--- a/src/ui/NhekoGlobalObject.cpp
+++ b/src/ui/NhekoGlobalObject.cpp
@@ -13,6 +13,7 @@
#include "Logging.h"
#include "MainWindow.h"
#include "UserSettingsPage.h"
+#include "WebRTCSession.h"
#include "Utils.h"
Nheko::Nheko()
@@ -83,9 +84,9 @@ Nheko::showUserSettingsPage() const
}
void
-Nheko::openLogoutDialog() const
+Nheko::logout() const
{
- MainWindow::instance()->openLogoutDialog();
+ ChatPage::instance()->initiateLogout();
}
void
diff --git a/src/ui/NhekoGlobalObject.h b/src/ui/NhekoGlobalObject.h
index aa8435d1..64aad941 100644
--- a/src/ui/NhekoGlobalObject.h
+++ b/src/ui/NhekoGlobalObject.h
@@ -48,7 +48,7 @@ public:
Q_INVOKABLE void openLink(QString link) const;
Q_INVOKABLE void setStatusMessage(QString msg) const;
Q_INVOKABLE void showUserSettingsPage() const;
- Q_INVOKABLE void openLogoutDialog() const;
+ Q_INVOKABLE void logout() const;
Q_INVOKABLE void openCreateRoomDialog() const;
Q_INVOKABLE void openJoinRoomDialog() const;
Q_INVOKABLE void reparent(QWindow *win) const;
@@ -60,6 +60,8 @@ signals:
void colorsChanged();
void profileChanged();
+ void openLogoutDialog();
+
private:
QScopedPointer<UserProfile> currentUser_;
};
|