Warn on quit if downloading files.

This commit is contained in:
John Preston
2022-03-09 15:30:22 +04:00
parent 6dd720b76e
commit 602e7a7164
5 changed files with 118 additions and 1 deletions
+15 -1
View File
@@ -661,6 +661,10 @@ void Application::logoutWithChecks(Main::Account *account) {
_exportManager->stopWithConfirmation(retry);
} else if (account->session().uploadsInProgress()) {
account->session().uploadsStopWithConfirmation(retry);
} else if (_downloadManager->loadingInProgress(&account->session())) {
_downloadManager->loadingStopWithConfirmation(
retry,
&account->session());
} else {
logout(account);
}
@@ -801,8 +805,18 @@ bool Application::uploadPreventsQuit() {
return false;
}
bool Application::downloadPreventsQuit() {
if (_downloadManager->loadingInProgress()) {
_downloadManager->loadingStopWithConfirmation([=] { Quit(); });
return true;
}
return false;
}
bool Application::preventsQuit(QuitReason reason) {
if (exportPreventsQuit() || uploadPreventsQuit()) {
if (exportPreventsQuit()
|| uploadPreventsQuit()
|| downloadPreventsQuit()) {
return true;
} else if (const auto window = activeWindow()) {
if (window->widget()->isActive()) {