mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Removed Ui::show from window peer menu functions.
This commit is contained in:
@@ -208,6 +208,7 @@ void AddUnreadBadge(
|
||||
|
||||
[[nodiscard]] object_ptr<Ui::SettingsButton> MakeAccountButton(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> window,
|
||||
not_null<Main::Account*> account,
|
||||
Fn<void()> callback) {
|
||||
const auto active = (account == &Core::App().activeAccount());
|
||||
@@ -306,7 +307,7 @@ void AddUnreadBadge(
|
||||
state->menu = base::make_unique_q<Ui::PopupMenu>(
|
||||
raw,
|
||||
st::popupMenuWithIcons);
|
||||
MenuAddMarkAsReadAllChatsAction(&session->data(), addAction);
|
||||
MenuAddMarkAsReadAllChatsAction(window, addAction);
|
||||
state->menu->popup(QCursor::pos());
|
||||
return;
|
||||
}
|
||||
@@ -325,12 +326,14 @@ void AddUnreadBadge(
|
||||
close();
|
||||
Core::App().logoutWithChecks(&session->account());
|
||||
};
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
.text = tr::lng_sure_logout(),
|
||||
.confirmed = crl::guard(session, callback),
|
||||
.confirmText = tr::lng_settings_logout(),
|
||||
.confirmStyle = &st::attentionBoxButton,
|
||||
}));
|
||||
window->show(
|
||||
Ui::MakeConfirmBox({
|
||||
.text = tr::lng_sure_logout(),
|
||||
.confirmed = crl::guard(session, callback),
|
||||
.confirmText = tr::lng_settings_logout(),
|
||||
.confirmStyle = &st::attentionBoxButton,
|
||||
}),
|
||||
Ui::LayerOption::CloseOther);
|
||||
}, &st::menuIconLeave);
|
||||
state->menu->popup(QCursor::pos());
|
||||
}, raw->lifetime());
|
||||
@@ -725,6 +728,7 @@ void MainMenu::setupArchive() {
|
||||
&st::menuIconFromMainMenu);
|
||||
|
||||
MenuAddMarkAsReadChatListAction(
|
||||
controller,
|
||||
[f = folder()] { return f->chatsList(); },
|
||||
addAction);
|
||||
|
||||
@@ -861,7 +865,7 @@ void MainMenu::rebuildAccounts() {
|
||||
if (!account->sessionExists()) {
|
||||
button = nullptr;
|
||||
} else if (!button) {
|
||||
button.reset(inner->add(MakeAccountButton(inner, account, [=] {
|
||||
auto callback = [=] {
|
||||
if (_reordering) {
|
||||
return;
|
||||
}
|
||||
@@ -879,7 +883,12 @@ void MainMenu::rebuildAccounts() {
|
||||
st::defaultRippleAnimation.hideDuration,
|
||||
account,
|
||||
std::move(activate));
|
||||
})));
|
||||
};
|
||||
button.reset(inner->add(MakeAccountButton(
|
||||
inner,
|
||||
_controller,
|
||||
account,
|
||||
std::move(callback))));
|
||||
}
|
||||
}
|
||||
inner->resizeToWidth(_accounts->width());
|
||||
|
Reference in New Issue
Block a user