From b8f1cebeb66408c7e393e89f52b508b07f360560 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 26 Jan 2022 14:50:10 +0300 Subject: [PATCH] Support confirm-on-Quit on macOS. --- Telegram/SourceFiles/core/sandbox.cpp | 6 +++++- Telegram/SourceFiles/main/main_session.cpp | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index 556ed1886..403d9c6f8 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -261,7 +261,11 @@ void Sandbox::setupScreenScale() { Sandbox::~Sandbox() = default; bool Sandbox::event(QEvent *e) { - if (e->type() == QEvent::Close || e->type() == QEvent::Quit) { + if (e->type() == QEvent::Quit && !App::quitting()) { + App::quit(); + e->ignore(); + return false; + } else if (e->type() == QEvent::Close) { App::quit(); } return QApplication::event(e); diff --git a/Telegram/SourceFiles/main/main_session.cpp b/Telegram/SourceFiles/main/main_session.cpp index 10401054b..ae4658ef7 100644 --- a/Telegram/SourceFiles/main/main_session.cpp +++ b/Telegram/SourceFiles/main/main_session.cpp @@ -393,6 +393,7 @@ void Session::uploadsStopWithConfirmation(Fn done) { } }); window->show(std::move(box)); + window->activate(); } void Session::uploadsStop() {