From fa50a5962c3d0b05d59dbeae328f7476be4f1349 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 6 Mar 2022 16:27:04 +0300 Subject: [PATCH] Removed Window::SessionNavigation from ShareBox. --- .../boxes/peers/edit_peer_invite_link.cpp | 2 +- Telegram/SourceFiles/boxes/share_box.cpp | 14 ++++++++------ Telegram/SourceFiles/boxes/share_box.h | 5 ++--- Telegram/SourceFiles/history/history_message.cpp | 1 - 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 63b183979..cc9288535 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp @@ -1204,7 +1204,7 @@ object_ptr ShareInviteLinkBox( .copyCallback = std::move(copyCallback), .submitCallback = std::move(submitCallback), .filterCallback = [](auto peer) { return peer->canWrite(); }, - .navigation = App::wnd()->sessionController() }); + }); *box = Ui::MakeWeak(object.data()); return object; } diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index 2566edd14..c8e911308 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -197,6 +197,7 @@ private: ShareBox::ShareBox(QWidget*, Descriptor &&descriptor) : _descriptor(std::move(descriptor)) , _api(&_descriptor.session->mtp()) +, _show(std::make_shared(this)) , _select( this, (_descriptor.stMultiSelect @@ -255,19 +256,20 @@ void ShareBox::prepareCommentField() { field->setMarkdownReplacesEnabled(rpl::single(true)); if (_descriptor.initEditLink) { _descriptor.initEditLink(field); - } else if (_descriptor.navigation) { + } else if (_show->valid()) { field->setEditLinkCallback( DefaultEditLinkCallback( - std::make_shared(_descriptor.navigation), + _show, _descriptor.session, - field)); + field, + _descriptor.stComment)); } field->setSubmitSettings(Core::App().settings().sendSubmitWay()); if (_descriptor.initSpellchecker) { _descriptor.initSpellchecker(field); - } else if (_descriptor.navigation) { - InitSpellchecker(_descriptor.navigation->parentController(), field); + } else if (_show->valid()) { + InitSpellchecker(_show, _descriptor.session, field, true); } Ui::SendPendingMoveResizeEvents(_comment); if (_bottomWidget) { @@ -602,7 +604,7 @@ void ShareBox::submitSilent() { void ShareBox::submitScheduled() { const auto callback = [=](Api::SendOptions options) { submit(options); }; - Ui::show( + _show->showBox( HistoryView::PrepareScheduleBox( this, sendMenuType(), diff --git a/Telegram/SourceFiles/boxes/share_box.h b/Telegram/SourceFiles/boxes/share_box.h index b340ec5cb..89749ce5d 100644 --- a/Telegram/SourceFiles/boxes/share_box.h +++ b/Telegram/SourceFiles/boxes/share_box.h @@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #pragma once #include "boxes/abstract_box.h" -#include "base/observer.h" #include "base/timer.h" #include "history/view/history_view_schedule_box.h" #include "ui/chat/forward_options_box.h" @@ -28,7 +27,6 @@ enum class Type; namespace Window { class SessionController; -class SessionNavigation; } // namespace Window namespace Api { @@ -80,7 +78,6 @@ public: CopyCallback copyCallback; SubmitCallback submitCallback; FilterCallback filterCallback; - Window::SessionNavigation *navigation = nullptr; Fn)> initSpellchecker; Fn)> initEditLink; object_ptr bottomWidget = { nullptr }; @@ -139,6 +136,8 @@ private: Descriptor _descriptor; MTP::Sender _api; + std::shared_ptr _show; + object_ptr _select; object_ptr> _comment; object_ptr _bottomWidget; diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 6280ee91c..addd2519b 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -365,7 +365,6 @@ void FastShareMessage(not_null item) { .copyCallback = std::move(copyLinkCallback), .submitCallback = std::move(submitCallback), .filterCallback = std::move(filterCallback), - .navigation = App::wnd()->sessionController(), .forwardOptions = { .messagesCount = int(data->msgIds.size()), .show = !hasOnlyForcedForwardedInfo,