mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Detach ComposeControls from SessionController.
This commit is contained in:
@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_session.h"
|
||||
#include "main/session/session_show.h"
|
||||
#include "main/main_session.h"
|
||||
#include "api/api_invite_links.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
@@ -543,8 +544,7 @@ void LinksController::appendSlice(const InviteLinksSlice &slice) {
|
||||
|
||||
void LinksController::rowClicked(not_null<PeerListRow*> row) {
|
||||
delegate()->peerListShowBox(
|
||||
ShowInviteLinkBox(_peer, static_cast<Row*>(row.get())->data()),
|
||||
Ui::LayerOption::KeepOther);
|
||||
ShowInviteLinkBox(_peer, static_cast<Row*>(row.get())->data()));
|
||||
}
|
||||
|
||||
void LinksController::rowRightActionClicked(not_null<PeerListRow*> row) {
|
||||
@@ -579,33 +579,25 @@ base::unique_qptr<Ui::PopupMenu> LinksController::createRowContextMenu(
|
||||
st::popupMenuWithIcons);
|
||||
if (data.revoked) {
|
||||
result->addAction(tr::lng_group_invite_context_delete(tr::now), [=] {
|
||||
delegate()->peerListShowBox(
|
||||
DeleteLinkBox(_peer, _admin, link),
|
||||
Ui::LayerOption::KeepOther);
|
||||
delegate()->peerListShowBox(DeleteLinkBox(_peer, _admin, link));
|
||||
}, &st::menuIconDelete);
|
||||
} else {
|
||||
result->addAction(tr::lng_group_invite_context_copy(tr::now), [=] {
|
||||
CopyInviteLink(delegate()->peerListToastParent(), link);
|
||||
CopyInviteLink(delegate()->peerListUiShow(), link);
|
||||
}, &st::menuIconCopy);
|
||||
result->addAction(tr::lng_group_invite_context_share(tr::now), [=] {
|
||||
delegate()->peerListShowBox(
|
||||
ShareInviteLinkBox(_peer, link),
|
||||
Ui::LayerOption::KeepOther);
|
||||
ShareInviteLinkBox(_peer, link));
|
||||
}, &st::menuIconShare);
|
||||
result->addAction(tr::lng_group_invite_context_qr(tr::now), [=] {
|
||||
delegate()->peerListShowBox(
|
||||
InviteLinkQrBox(link, tr::lng_group_invite_qr_about()),
|
||||
Ui::LayerOption::KeepOther);
|
||||
InviteLinkQrBox(link, tr::lng_group_invite_qr_about()));
|
||||
}, &st::menuIconQrCode);
|
||||
result->addAction(tr::lng_group_invite_context_edit(tr::now), [=] {
|
||||
delegate()->peerListShowBox(
|
||||
EditLinkBox(_peer, data),
|
||||
Ui::LayerOption::KeepOther);
|
||||
delegate()->peerListShowBox(EditLinkBox(_peer, data));
|
||||
}, &st::menuIconEdit);
|
||||
result->addAction(tr::lng_group_invite_context_revoke(tr::now), [=] {
|
||||
delegate()->peerListShowBox(
|
||||
RevokeLinkBox(_peer, _admin, link),
|
||||
Ui::LayerOption::KeepOther);
|
||||
delegate()->peerListShowBox(RevokeLinkBox(_peer, _admin, link));
|
||||
}, &st::menuIconRemove);
|
||||
}
|
||||
return result;
|
||||
@@ -813,8 +805,7 @@ void AdminsController::loadMoreRows() {
|
||||
|
||||
void AdminsController::rowClicked(not_null<PeerListRow*> row) {
|
||||
delegate()->peerListShowBox(
|
||||
Box(ManageInviteLinksBox, _peer, row->peer()->asUser(), 0, 0),
|
||||
Ui::LayerOption::KeepOther);
|
||||
Box(ManageInviteLinksBox, _peer, row->peer()->asUser(), 0, 0));
|
||||
}
|
||||
|
||||
Main::Session &AdminsController::session() const {
|
||||
@@ -836,7 +827,7 @@ struct LinksList {
|
||||
};
|
||||
|
||||
LinksList AddLinksList(
|
||||
std::shared_ptr<Ui::BoxShow> show,
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<UserData*> admin,
|
||||
@@ -861,7 +852,7 @@ LinksList AddLinksList(
|
||||
}
|
||||
|
||||
not_null<Ui::RpWidget*> AddAdminsList(
|
||||
std::shared_ptr<Ui::BoxShow> show,
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<UserData*> admin) {
|
||||
@@ -889,7 +880,9 @@ void ManageInviteLinksBox(
|
||||
int revokedCount) {
|
||||
using namespace Settings;
|
||||
|
||||
const auto show = std::make_shared<Ui::BoxShow>(box);
|
||||
const auto show = Main::MakeSessionShow(
|
||||
box->uiShow(),
|
||||
&peer->session());
|
||||
|
||||
box->setTitle(tr::lng_group_invite_title());
|
||||
box->setWidth(st::boxWideWidth);
|
||||
@@ -925,8 +918,7 @@ void ManageInviteLinksBox(
|
||||
const auto add = AddCreateLinkButton(container);
|
||||
add->setClickedCallback([=] {
|
||||
show->showBox(
|
||||
EditLinkBox(peer, InviteLinkData{ .admin = admin }),
|
||||
Ui::LayerOption::KeepOther);
|
||||
EditLinkBox(peer, InviteLinkData{ .admin = admin }));
|
||||
});
|
||||
} else {
|
||||
otherHeader = container->add(object_ptr<Ui::SlideWrap<>>(
|
||||
@@ -1006,8 +998,8 @@ void ManageInviteLinksBox(
|
||||
top + st::inviteLinkRevokedTitlePadding.top(),
|
||||
outerWidth);
|
||||
}, deleteAll->lifetime());
|
||||
deleteAll->setClickedCallback([=, show = Ui::BoxShow(box)] {
|
||||
show.showBox(DeleteAllRevokedBox(peer, admin));
|
||||
deleteAll->setClickedCallback([=, show = box->uiShow()] {
|
||||
show->showBox(DeleteAllRevokedBox(peer, admin));
|
||||
});
|
||||
|
||||
rpl::combine(
|
||||
|
||||
Reference in New Issue
Block a user