mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Moved showLogoutConfirmation from MainWindow to Window::Controller.
This commit is contained in:
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_updates.h"
|
||||
#include "core/application.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "export/export_manager.h"
|
||||
#include "platform/platform_window_title.h"
|
||||
#include "main/main_account.h"
|
||||
#include "main/main_domain.h"
|
||||
@@ -329,4 +330,33 @@ QPoint Controller::getPointForCallPanelCenter() const {
|
||||
: _widget.windowHandle()->screen()->geometry().center();
|
||||
}
|
||||
|
||||
void Controller::showLogoutConfirmation() {
|
||||
const auto account = Core::App().passcodeLocked()
|
||||
? nullptr
|
||||
: sessionController()
|
||||
? &sessionController()->session().account()
|
||||
: nullptr;
|
||||
const auto weak = base::make_weak(account);
|
||||
const auto callback = [=] {
|
||||
if (account && !weak) {
|
||||
return;
|
||||
}
|
||||
if (account
|
||||
&& account->sessionExists()
|
||||
&& Core::App().exportManager().inProgress(&account->session())) {
|
||||
Ui::hideLayer();
|
||||
Core::App().exportManager().stopWithConfirmation([=] {
|
||||
Core::App().logout(account);
|
||||
});
|
||||
} else {
|
||||
Core::App().logout(account);
|
||||
}
|
||||
};
|
||||
show(Box<ConfirmBox>(
|
||||
tr::lng_sure_logout(tr::now),
|
||||
tr::lng_settings_logout(tr::now),
|
||||
st::attentionBoxButton,
|
||||
callback));
|
||||
}
|
||||
|
||||
} // namespace Window
|
||||
|
@@ -46,6 +46,8 @@ public:
|
||||
void setupIntro();
|
||||
void setupMain();
|
||||
|
||||
void showLogoutConfirmation();
|
||||
|
||||
void showSettings();
|
||||
|
||||
[[nodiscard]] int verticalShadowTop() const;
|
||||
|
@@ -120,7 +120,7 @@ PasscodeLockWidget::PasscodeLockWidget(
|
||||
|
||||
_submit->setClickedCallback([=] { submit(); });
|
||||
_logout->setClickedCallback([=] {
|
||||
window->widget()->showLogoutConfirmation();
|
||||
window->showLogoutConfirmation();
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user