2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +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

@@ -79,7 +79,7 @@ void Session::startExport() {
_exportPanel->closed(
) | rpl::start_with_next([=] {
clearExport();
stopExport();
}, _export->lifetime());
}
@@ -88,7 +88,26 @@ rpl::producer<Export::View::PanelController*> Session::currentExportView(
return _exportViewChanges.events_starting_with(_exportPanel.get());
}
void Session::clearExport() {
bool Session::exportInProgress() const {
return _export != nullptr;
}
void Session::stopExportWithConfirmation(FnMut<void()> callback) {
if (!_exportPanel) {
callback();
return;
}
auto closeAndCall = [=, callback = std::move(callback)]() mutable {
auto saved = std::move(callback);
stopExport();
if (saved) {
saved();
}
};
_exportPanel->stopWithConfirmation(std::move(closeAndCall));
}
void Session::stopExport() {
if (_exportPanel) {
_exportPanel = nullptr;
_exportViewChanges.fire(nullptr);