mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Confirm logout/quit if active call in progress
This commit is contained in:
parent
55783c6fe5
commit
7377215d28
1 changed files with 21 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QPluginLoader>
|
#include <QPluginLoader>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
#include "TrayIcon.h"
|
#include "TrayIcon.h"
|
||||||
#include "UserSettingsPage.h"
|
#include "UserSettingsPage.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "WebRTCSession.h"
|
||||||
#include "WelcomePage.h"
|
#include "WelcomePage.h"
|
||||||
#include "ui/LoadingIndicator.h"
|
#include "ui/LoadingIndicator.h"
|
||||||
#include "ui/OverlayModal.h"
|
#include "ui/OverlayModal.h"
|
||||||
|
@ -285,6 +287,14 @@ MainWindow::showChatPage()
|
||||||
void
|
void
|
||||||
MainWindow::closeEvent(QCloseEvent *event)
|
MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
|
if (WebRTCSession::instance().state() != WebRTCSession::State::DISCONNECTED) {
|
||||||
|
if (QMessageBox::question(this, "nheko", "A call is in progress. Quit?") !=
|
||||||
|
QMessageBox::Yes) {
|
||||||
|
event->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() &&
|
if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() &&
|
||||||
userSettings_->tray()) {
|
userSettings_->tray()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
@ -433,8 +443,17 @@ void
|
||||||
MainWindow::openLogoutDialog()
|
MainWindow::openLogoutDialog()
|
||||||
{
|
{
|
||||||
auto dialog = new dialogs::Logout(this);
|
auto dialog = new dialogs::Logout(this);
|
||||||
connect(
|
connect(dialog, &dialogs::Logout::loggingOut, this, [this]() {
|
||||||
dialog, &dialogs::Logout::loggingOut, this, [this]() { chat_page_->initiateLogout(); });
|
if (WebRTCSession::instance().state() != WebRTCSession::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);
|
showDialog(dialog);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue