| 3643 | } |
| 3644 | |
| 3645 | base::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 | |
| 3685 | base::weak_qptr<Ui::BoxContent> ShowDropMediaBox( |
| 3686 | not_null<Window::SessionNavigation*> navigation, |
no test coverage detected