2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Confirm export stop on quit and logout.

This commit is contained in:
John Preston
2018-06-20 18:30:57 +01:00
parent 13e6b91ac7
commit 154e5660de
6 changed files with 74 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "data/data_document.h"
#include "data/data_session.h"
#include "dialogs/dialogs_layout.h"
#include "styles/style_dialogs.h"
#include "styles/style_window.h"
@@ -618,11 +619,22 @@ void MainWindow::onLogout() {
showFromTray();
}
const auto logout = [] {
Messenger::Instance().logOut();
};
const auto callback = [=] {
if (AuthSession::Exists() && Auth().data().exportInProgress()) {
Ui::hideLayer();
Auth().data().stopExportWithConfirmation(logout);
} else {
logout();
}
};
Ui::show(Box<ConfirmBox>(
lang(lng_sure_logout),
lang(lng_settings_logout),
st::attentionBoxButton,
[] { Messenger::Instance().logOut(); }));
callback));
}
void MainWindow::quitFromTray() {