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

Moved ConfirmBox to Ui namespace.

This commit is contained in:
23rd
2021-10-19 01:28:08 +03:00
parent 6148edbc7d
commit 80461bd9fe
88 changed files with 352 additions and 285 deletions

View File

@@ -188,7 +188,7 @@ bool PinnedLimitReached(Dialogs::Key key, FilterId filterId) {
tr::now,
lt_count,
pinnedMax);
Ui::show(Box<InformBox>(errorText));
Ui::show(Box<Ui::InformBox>(errorText));
}
return true;
}
@@ -742,7 +742,7 @@ void PeerMenuDeleteContact(not_null<UserData*> user) {
user->session().api().applyUpdates(result);
}).send();
};
Ui::show(Box<ConfirmBox>(
Ui::show(Box<Ui::ConfirmBox>(
text,
tr::lng_box_delete(tr::now),
deleteSure));
@@ -754,7 +754,7 @@ void PeerMenuShareContactBox(
const auto weak = std::make_shared<QPointer<PeerListBox>>();
auto callback = [=](not_null<PeerData*> peer) {
if (!peer->canWrite()) {
Ui::show(Box<InformBox>(
Ui::show(Box<Ui::InformBox>(
tr::lng_forward_share_cant(tr::now)),
Ui::LayerOption::KeepOther);
return;
@@ -771,7 +771,7 @@ void PeerMenuShareContactBox(
auto recipient = peer->isUser()
? peer->name
: '\xAB' + peer->name + '\xBB';
Ui::show(Box<ConfirmBox>(
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_forward_share_contact(tr::now, lt_recipient, recipient),
tr::lng_forward_send(tr::now),
[peer, user, navigation] {
@@ -1072,7 +1072,7 @@ QPointer<Ui::RpWidget> ShowSendNowMessagesBox(
}
};
return Ui::show(
Box<ConfirmBox>(text, tr::lng_send_button(tr::now), std::move(done)),
Box<Ui::ConfirmBox>(text, tr::lng_send_button(tr::now), std::move(done)),
Ui::LayerOption::KeepOther).data();
}
@@ -1133,7 +1133,7 @@ void ToggleMessagePinned(
} else {
const auto peer = item->history()->peer;
const auto session = &peer->session();
Ui::show(Box<ConfirmBox>(tr::lng_pinned_unpin_sure(tr::now), tr::lng_pinned_unpin(tr::now), crl::guard(session, [=] {
const auto callback = crl::guard(session, [=] {
Ui::hideLayer();
session->api().request(MTPmessages_UpdatePinnedMessage(
MTP_flags(MTPmessages_UpdatePinnedMessage::Flag::f_unpin),
@@ -1142,7 +1142,11 @@ void ToggleMessagePinned(
)).done([=](const MTPUpdates &result) {
session->api().applyUpdates(result);
}).send();
})));
});
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_pinned_unpin_sure(tr::now),
tr::lng_pinned_unpin(tr::now),
callback));
}
}
@@ -1150,7 +1154,7 @@ void HidePinnedBar(
not_null<Window::SessionNavigation*> navigation,
not_null<PeerData*> peer,
Fn<void()> onHidden) {
Ui::show(Box<ConfirmBox>(tr::lng_pinned_hide_all_sure(tr::now), tr::lng_pinned_hide_all_hide(tr::now), crl::guard(navigation, [=] {
const auto callback = crl::guard(navigation, [=] {
Ui::hideLayer();
auto &session = peer->session();
const auto migrated = peer->migrateFrom();
@@ -1169,13 +1173,17 @@ void HidePinnedBar(
} else {
session.api().requestFullPeer(peer);
}
})));
});
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_pinned_hide_all_sure(tr::now),
tr::lng_pinned_hide_all_hide(tr::now),
callback));
}
void UnpinAllMessages(
not_null<Window::SessionNavigation*> navigation,
not_null<History*> history) {
Ui::show(Box<ConfirmBox>(tr::lng_pinned_unpin_all_sure(tr::now), tr::lng_pinned_unpin(tr::now), crl::guard(navigation, [=] {
const auto callback = crl::guard(navigation, [=] {
Ui::hideLayer();
const auto api = &history->session().api();
const auto sendRequest = [=](auto self) -> void {
@@ -1192,7 +1200,11 @@ void UnpinAllMessages(
}).send();
};
sendRequest(sendRequest);
})));
});
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_pinned_unpin_all_sure(tr::now),
tr::lng_pinned_unpin(tr::now),
callback));
}
void PeerMenuAddMuteAction(
@@ -1230,7 +1242,7 @@ void MenuAddMarkAsReadAllChatsAction(
MarkAsReadChatList(folder->chatsList());
}
};
Ui::show(Box<ConfirmBox>(
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_context_mark_read_all_sure(tr::now),
std::move(boxCallback)));
};
@@ -1253,7 +1265,7 @@ void MenuAddMarkAsReadChatListAction(
MarkAsReadChatList(list());
close();
};
Ui::show(Box<ConfirmBox>(
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_context_mark_read_sure(tr::now),
std::move(boxCallback)));
} else {