MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / ShowDropMediaBox

Function ShowDropMediaBox

Telegram/SourceFiles/window/window_peer_menu.cpp:3645–3683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3643}
3644
3645base::weak_qptr<Ui::BoxContent> ShowDropMediaBox(
3646 not_null<Window::SessionNavigation*> navigation,
3647 std::shared_ptr<QMimeData> data,
3648 not_null<Data::Forum*> forum,
3649 FnMut<void()> &&successCallback) {
3650 const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
3651 auto chosen = [
3652 data = std::move(data),
3653 callback = std::move(successCallback),
3654 weak,
3655 navigation
3656 ](not_null<Data::Thread*> thread) mutable {
3657 const auto content = navigation->parentController()->content();
3658 if (!content->filesOrForwardDrop(thread, data.get(), true)) {
3659 return;
3660 } else if (const auto strong = *weak) {
3661 strong->closeBox();
3662 }
3663 if (callback) {
3664 callback();
3665 }
3666 };
3667 auto initBox = [=](not_null<PeerListBox*> box) {
3668 box->addButton(tr::lng_cancel(), [=] {
3669 box->closeBox();
3670 });
3671
3672 forum->destroyed(
3673 ) | rpl::on_next([=] {
3674 box->closeBox();
3675 }, box->lifetime());
3676 };
3677 *weak = navigation->parentController()->show(Box<PeerListBox>(
3678 std::make_unique<ChooseTopicBoxController>(
3679 forum,
3680 std::move(chosen)),
3681 std::move(initBox)));
3682 return weak->get();
3683}
3684
3685base::weak_qptr<Ui::BoxContent> ShowDropMediaBox(
3686 not_null<Window::SessionNavigation*> navigation,

Callers 1

filesOrForwardDropMethod · 0.85

Calls 7

filesOrForwardDropMethod · 0.80
contentMethod · 0.45
parentControllerMethod · 0.45
getMethod · 0.45
addButtonMethod · 0.45
destroyedMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected