diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index a1930194c..100bbaa9e 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -3200,7 +3200,7 @@ void ApiWrap::forwardMessages( messageFromId, messagePostAuthor, item, - action.topicRootId); // #TODO forum forward + action.topicRootId); _session->data().registerMessageRandomId(randomId, newId); if (!localIds) { localIds = std::make_shared>(); diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index 9e152f5cb..84d933635 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -497,20 +497,24 @@ void ChooseRecipientBoxController::rowClicked(not_null row) { (*weak)->closeBox(); } }; + const auto filter = [=](not_null topic) { + return guard && (!_filter || _filter(topic)); + }; auto owned = Box( std::make_unique( forum, - std::move(callback)), + std::move(callback), + filter), [=](not_null box) { - box->addButton(tr::lng_cancel(), [=] { - box->closeBox(); - }); + box->addButton(tr::lng_cancel(), [=] { + box->closeBox(); + }); - forum->destroyed( - ) | rpl::start_with_next([=] { - box->closeBox(); - }, box->lifetime()); - }); + forum->destroyed( + ) | rpl::start_with_next([=] { + box->closeBox(); + }, box->lifetime()); + }); *weak = owned.data(); delegate()->peerListShowBox(std::move(owned)); return; @@ -604,6 +608,49 @@ bool ChooseTopicSearchController::loadMoreRows() { return !_allLoaded; } +ChooseTopicBoxController::Row::Row(not_null topic) +: PeerListRow(topic->rootId().bare) +, _topic(topic) { +} + +QString ChooseTopicBoxController::Row::generateName() { + return _topic->title(); +} + +QString ChooseTopicBoxController::Row::generateShortName() { + return _topic->title(); +} + +auto ChooseTopicBoxController::Row::generatePaintUserpicCallback() +-> PaintRoundImageCallback { + return [=]( + Painter &p, + int x, + int y, + int outerWidth, + int size) { + auto view = std::shared_ptr(); + p.translate(x, y); + _topic->paintUserpic(p, view, { + .st = &st::forumTopicRow, + .now = crl::now(), + .width = outerWidth, + .paused = false, + }); + p.translate(-x, -y); + }; +} + +auto ChooseTopicBoxController::Row::generateNameFirstLetters() const +-> const base::flat_set & { + return _topic->chatListFirstLetters(); +} + +auto ChooseTopicBoxController::Row::generateNameWords() const +-> const base::flat_set & { + return _topic->chatListNameWords(); +} + ChooseTopicBoxController::ChooseTopicBoxController( not_null forum, FnMut)> callback, @@ -656,8 +703,10 @@ void ChooseTopicBoxController::refreshRows(bool initial) { const auto id = topic->rootId().bare; auto already = delegate()->peerListFindRow(id); if (initial || !already) { - delegate()->peerListAppendRow(createRow(topic)); - added = true; + if (auto created = createRow(topic)) { + delegate()->peerListAppendRow(std::move(created)); + added = true; + } } else if (already->isSearchResult()) { delegate()->peerListAppendFoundRow(already); added = true; @@ -681,49 +730,6 @@ std::unique_ptr ChooseTopicBoxController::createSearchRow( return nullptr; } -ChooseTopicBoxController::Row::Row(not_null topic) -: PeerListRow(topic->rootId().bare) -, _topic(topic) { -} - -QString ChooseTopicBoxController::Row::generateName() { - return _topic->title(); -} - -QString ChooseTopicBoxController::Row::generateShortName() { - return _topic->title(); -} - -auto ChooseTopicBoxController::Row::generatePaintUserpicCallback() --> PaintRoundImageCallback { - return [=]( - Painter &p, - int x, - int y, - int outerWidth, - int size) { - auto view = std::shared_ptr(); - p.translate(x, y); - _topic->paintUserpic(p, view, { - .st = &st::forumTopicRow, - .now = crl::now(), - .width = outerWidth, - .paused = false, - }); - p.translate(-x, -y); - }; -} - -auto ChooseTopicBoxController::Row::generateNameFirstLetters() const --> const base::flat_set & { - return _topic->chatListFirstLetters(); -} - -auto ChooseTopicBoxController::Row::generateNameWords() const --> const base::flat_set & { - return _topic->chatListNameWords(); -} - auto ChooseTopicBoxController::createRow(not_null topic) -> std::unique_ptr { const auto skip = _filter ? !_filter(topic) : !topic->canWrite(); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 20acec9ad..eb8819fde 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( auto object = Box(ShareBox::Descriptor{ .session = &peer->session(), .copyCallback = std::move(copyCallback), - .submitCallback = std::move(submitCallback), // #TODO forum forward + .submitCallback = std::move(submitCallback), // #TODO forum share .filterCallback = [](auto peer) { return peer->canWrite(); }, }); *box = Ui::MakeWeak(object.data()); diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index 10817279a..278e46c76 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -1292,7 +1292,7 @@ void FastShareMessage( } const auto error = [&] { - for (const auto peer : result) { // #TODO forum forward + for (const auto peer : result) { // #TODO forum share const auto error = GetErrorTextForSending( peer, { .forward = &items, .text = &comment }); @@ -1398,7 +1398,7 @@ void FastShareMessage( } }; auto filterCallback = [isGame](PeerData *peer) { - if (peer->canWrite()) { // #TODO forum forward + if (peer->canWrite()) { // #TODO forum share if (auto channel = peer->asChannel()) { return isGame ? (!channel->isBroadcast()) : true; } diff --git a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp index 40076019f..217ecf3f3 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp @@ -142,7 +142,7 @@ object_ptr ShareInviteLinkBox( } const auto error = [&] { - for (const auto peer : result) { // #TODO forum forward + for (const auto peer : result) { // #TODO forum share const auto error = GetErrorTextForSending( peer, { .text = &comment }); @@ -196,7 +196,7 @@ object_ptr ShareInviteLinkBox( showToast(tr::lng_share_done(tr::now)); }; auto filterCallback = [](PeerData *peer) { - return peer->canWrite(); // #TODO forum forward + return peer->canWrite(); // #TODO forum share }; const auto scheduleStyle = [&] { diff --git a/Telegram/SourceFiles/core/mime_type.cpp b/Telegram/SourceFiles/core/mime_type.cpp index 737e285f1..0f4bfc202 100644 --- a/Telegram/SourceFiles/core/mime_type.cpp +++ b/Telegram/SourceFiles/core/mime_type.cpp @@ -7,7 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "core/mime_type.h" +#include "core/utils.h" + #include +#include namespace Core { @@ -152,4 +155,19 @@ bool FileIsImage(const QString &name, const QString &mime) { return false; } +std::shared_ptr ShareMimeMediaData( + not_null original) { + auto result = std::make_shared(); + if (original->hasFormat(u"application/x-td-forward"_q)) { + result->setData(u"application/x-td-forward"_q, "1"); + } + if (original->hasImage()) { + result->setImageData(original->imageData()); + } + if (auto list = base::GetMimeUrls(original); !list.isEmpty()) { + result->setUrls(std::move(list)); + } + return result; +} + } // namespace Core diff --git a/Telegram/SourceFiles/core/mime_type.h b/Telegram/SourceFiles/core/mime_type.h index 7cf472e15..bb83de41c 100644 --- a/Telegram/SourceFiles/core/mime_type.h +++ b/Telegram/SourceFiles/core/mime_type.h @@ -12,6 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +class QMimeData; + namespace Core { class MimeType { @@ -47,4 +49,7 @@ private: [[nodiscard]] bool FileIsImage(const QString &name, const QString &mime); +[[nodiscard]] std::shared_ptr ShareMimeMediaData( + not_null original); + } // namespace Core diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index 86bc34b08..043a09199 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -449,8 +449,8 @@ editTopicMaxHeight: 408px; chooseTopicListItem: PeerListItem(defaultPeerListItem) { height: 44px; photoSize: 28px; - photoPosition: point(16px, 5px); - namePosition: point(71px, 11px); + photoPosition: point(8px, 5px); + namePosition: point(55px, 11px); nameStyle: TextStyle(defaultTextStyle) { font: font(14px semibold); linkFont: font(14px semibold); diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 1bf68782f..3bc21ef7e 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -1437,7 +1437,7 @@ ClickHandlerPtr goToMessageClickHandler( returnToId }; if (const auto item = peer->owner().message(peer, msgId)) { - controller->showMessage(item); + controller->showMessage(item, params); } else { controller->showPeerHistory(peer, params, msgId); } diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 3d3f5aae1..12f66f4b4 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -150,8 +150,6 @@ public: bool confirmSendingFiles(const QStringList &files); bool confirmSendingFiles(not_null data); - void sendFileConfirmed(const std::shared_ptr &file, - const std::optional &oldId = std::nullopt); void updateControlsVisibility(); void updateControlsGeometry(); diff --git a/Telegram/SourceFiles/history/view/history_view_corner_buttons.cpp b/Telegram/SourceFiles/history/view/history_view_corner_buttons.cpp index 22034dcf2..288e9d68c 100644 --- a/Telegram/SourceFiles/history/view/history_view_corner_buttons.cpp +++ b/Telegram/SourceFiles/history/view/history_view_corner_buttons.cpp @@ -341,7 +341,8 @@ void CornerButtons::finishAnimations() { Fn CornerButtons::doneJumpFrom( FullMsgId targetId, - FullMsgId originId) { + FullMsgId originId, + bool ignoreMessageNotFound) { return [=](bool found) { skipReplyReturn(targetId); if (originId) { @@ -351,7 +352,7 @@ Fn CornerButtons::doneJumpFrom( } } } - if (!found) { + if (!found && !ignoreMessageNotFound) { Ui::Toast::Show( _scroll.get(), tr::lng_message_not_found(tr::now)); diff --git a/Telegram/SourceFiles/history/view/history_view_corner_buttons.h b/Telegram/SourceFiles/history/view/history_view_corner_buttons.h index bab384fcd..7d61571f7 100644 --- a/Telegram/SourceFiles/history/view/history_view_corner_buttons.h +++ b/Telegram/SourceFiles/history/view/history_view_corner_buttons.h @@ -87,7 +87,8 @@ public: } [[nodiscard]] Fn doneJumpFrom( FullMsgId targetId, - FullMsgId originId); + FullMsgId originId, + bool ignoreMessageNotFound = false); private: bool eventFilter(QObject *o, QEvent *e) override; diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 9f94de35a..32d9e15f1 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -687,7 +687,7 @@ bool ListWidget::showAtPositionNow( } if (done) { const auto found = !position.fullId.peer - || !position.fullId.msg + || !IsServerMsgId(position.fullId.msg) || viewForItem(position.fullId); done(found); } diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index 45ace90bf..75e665777 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -1796,10 +1796,11 @@ void RepliesWidget::showAtPosition( anim::type animated) { _lastShownAt = position.fullId; controller()->setActiveChatEntry(activeChat()); + const auto ignore = (position.fullId.msg == _rootId); _inner->showAtPosition( position, animated, - _cornerButtons.doneJumpFrom(position.fullId, originItemId)); + _cornerButtons.doneJumpFrom(position.fullId, originItemId, ignore)); } void RepliesWidget::updateAdaptiveLayout() { @@ -1962,6 +1963,23 @@ Window::SectionActionResult RepliesWidget::sendBotCommand( return Window::SectionActionResult::Handle; } +bool RepliesWidget::confirmSendingFiles(const QStringList &files) { + return confirmSendingFiles(files, QString()); +} + +bool RepliesWidget::confirmSendingFiles(not_null data) { + return confirmSendingFiles(data, std::nullopt); +} + +bool RepliesWidget::confirmSendingFiles( + const QStringList &files, + const QString &insertTextOnCancel) { + const auto premium = controller()->session().user()->isPremium(); + return confirmSendingFiles( + Storage::PrepareMediaList(files, st::sendMediaPreviewSize, premium), + insertTextOnCancel); +} + void RepliesWidget::replyToMessage(FullMsgId itemId) { _composeControls->replyToMessage(itemId); refreshTopBarActiveChat(); diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.h b/Telegram/SourceFiles/history/view/history_view_replies_section.h index 10152586b..a0915f530 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.h +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.h @@ -104,6 +104,9 @@ public: Window::SectionActionResult sendBotCommand( Bot::SendCommandRequest request) override; + bool confirmSendingFiles(const QStringList &files) override; + bool confirmSendingFiles(not_null data) override; + void setInternalState( const QRect &geometry, not_null memento); @@ -261,12 +264,15 @@ private: QByteArray &&content, std::optional overrideSendImagesAsPhotos = std::nullopt, const QString &insertTextOnCancel = QString()); + bool confirmSendingFiles( + const QStringList &files, + const QString &insertTextOnCancel); bool confirmSendingFiles( Ui::PreparedList &&list, const QString &insertTextOnCancel = QString()); bool confirmSendingFiles( not_null data, - std::optional overrideSendImagesAsPhotos = std::nullopt, + std::optional overrideSendImagesAsPhotos, const QString &insertTextOnCancel = QString()); bool showSendingFilesError(const Ui::PreparedList &list) const; void sendingFilesConfirmed( diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 1fa3c06f4..6b105ba4b 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -92,6 +92,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/shortcuts.h" #include "core/application.h" #include "core/changelogs.h" +#include "core/mime_type.h" #include "base/unixtime.h" #include "calls/calls_call.h" #include "calls/calls_instance.h" @@ -323,7 +324,6 @@ MainWidget::MainWidget( Data::EntryUpdate::Flag::LocalDraftSet ) | rpl::start_with_next([=](const Data::EntryUpdate &update) { controller->showThread(update.entry->asThread(), ShowAtUnreadMsgId); - _history->applyDraft(); // #TODO forum drop controller->hideLayer(); }, lifetime()); @@ -574,7 +574,7 @@ bool MainWidget::shareUrl( bool MainWidget::inlineSwitchChosen( not_null thread, const QString &botAndQuery) const { - if (!thread->canWrite()) { // #TODO forum forward + if (!thread->canWrite()) { Ui::show(Ui::MakeInformBox(tr::lng_inline_switch_cant())); return false; } @@ -617,26 +617,33 @@ bool MainWidget::sendPaths(not_null thread) { ShowAtTheEndMsgId, Window::SectionShow::Way::ClearStack); } - // #TODO forum drop return (controller()->activeChatCurrent().thread() == thread) - && _history->confirmSendingFiles(cSendPaths()); + && (_mainSection + ? _mainSection->confirmSendingFiles(cSendPaths()) + : _history->confirmSendingFiles(cSendPaths())); } -void MainWidget::onFilesOrForwardDrop( +bool MainWidget::onFilesOrForwardDrop( not_null thread, - const QMimeData *data) { + not_null data) { + const auto history = thread->asHistory(); + if (const auto forum = history ? history->peer->forum() : nullptr) { + Window::ShowDropMediaBox( + _controller, + Core::ShareMimeMediaData(data), + forum); + if (_hider) { + _hider->startHide(); + clearHider(_hider); + } + return true; + } if (data->hasFormat(qsl("application/x-td-forward"))) { auto draft = Data::ForwardDraft{ .ids = session().data().takeMimeForwardIds(), }; - const auto history = thread->asHistory(); - if (const auto forum = history ? history->peer->forum() : nullptr) { - Window::ShowForwardMessagesBox( - _controller, - std::move(draft), - forum); - } else if (setForwardDraft(thread, std::move(draft))) { - return; + if (setForwardDraft(thread, std::move(draft))) { + return true; } // We've already released the mouse button, // so the forwarding is cancelled. @@ -644,17 +651,22 @@ void MainWidget::onFilesOrForwardDrop( _hider->startHide(); clearHider(_hider); } + return false; } else if (!thread->canWrite()) { Ui::show(Ui::MakeInformBox(tr::lng_forward_send_files_cant())); + return false; } else { controller()->showThread( thread, ShowAtTheEndMsgId, Window::SectionShow::Way::ClearStack); - if (thread->asHistory()) { - // #TODO forum drop - _history->confirmSendingFiles(data); + if (controller()->activeChatCurrent().thread() != thread) { + return false; } + (_mainSection + ? _mainSection->confirmSendingFiles(data) + : _history->confirmSendingFiles(data)); + return true; } } @@ -1264,7 +1276,10 @@ void MainWidget::chooseThread( if (selectingPeer()) { _hider->offerThread(thread); } else { - controller()->showThread(thread, showAtMsgId); + controller()->showThread( + thread, + showAtMsgId, + Window::SectionShow::Way::ClearStack); } } @@ -1522,6 +1537,31 @@ void MainWidget::ui_showPeerHistory( floatPlayerCheckVisibility(); } +void MainWidget::showMessage( + not_null item, + const SectionShow ¶ms) { + const auto peerId = item->history()->peer->id; + const auto itemId = item->id; + if (!v::is_null(params.origin)) { + if (_mainSection) { + if (_mainSection->showMessage(peerId, params, itemId)) { + return; + } + } else if (_history->peer() == item->history()->peer) { + ui_showPeerHistory(peerId, params, itemId); + return; + } + } + if (const auto topic = item->topic()) { + _controller->showTopic(topic, item->id, params); + } else { + _controller->showPeerHistory( + item->history(), + params, + item->id); + } +} + PeerData *MainWidget::peer() const { return _history->peer(); } @@ -2710,31 +2750,31 @@ bool MainWidget::contentOverlapped(const QRect &globalRect) { void MainWidget::activate() { if (_a_show.animating()) { return; - } else if (!_mainSection) { - if (_hider) { + } else if (!cSendPaths().isEmpty()) { + const auto interpret = qstr("interpret://"); + const auto path = cSendPaths()[0]; + if (path.startsWith(interpret)) { + cSetSendPaths(QStringList()); + const auto error = Support::InterpretSendPath( + _controller, + path.mid(interpret.size())); + if (!error.isEmpty()) { + Ui::show(Ui::MakeInformBox(error)); + } + } else { + showSendPathsLayer(); + } + } else if (_mainSection) { + _mainSection->setInnerFocus(); + } else if (_hider) { + Assert(_dialogs != nullptr); + _dialogs->setInnerFocus(); + } else if (!Ui::isLayerShown()) { + if (_history->peer()) { + _history->activate(); + } else { Assert(_dialogs != nullptr); _dialogs->setInnerFocus(); - } else if (!Ui::isLayerShown()) { - if (!cSendPaths().isEmpty()) { - const auto interpret = qstr("interpret://"); - const auto path = cSendPaths()[0]; - if (path.startsWith(interpret)) { - cSetSendPaths(QStringList()); - const auto error = Support::InterpretSendPath( - _controller, - path.mid(interpret.size())); - if (!error.isEmpty()) { - Ui::show(Ui::MakeInformBox(error)); - } - } else { - showSendPathsLayer(); - } - } else if (_history->peer()) { - _history->activate(); - } else { - Assert(_dialogs != nullptr); - _dialogs->setInnerFocus(); - } } } _controller->widget()->fixOrder(); diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index d2a5676a7..dc3b2c0a0 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -179,9 +179,9 @@ public: not_null thread, Data::ForwardDraft &&draft); bool sendPaths(not_null thread); - void onFilesOrForwardDrop( + bool onFilesOrForwardDrop( not_null thread, - const QMimeData *data); + not_null data); bool selectingPeer() const; void clearSelectingPeer(); @@ -222,6 +222,9 @@ public: PeerId peer, const SectionShow ¶ms, MsgId msgId); + void showMessage( + not_null item, + const SectionShow ¶ms); bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo); diff --git a/Telegram/SourceFiles/window/section_widget.h b/Telegram/SourceFiles/window/section_widget.h index 58579ec13..c9bff162f 100644 --- a/Telegram/SourceFiles/window/section_widget.h +++ b/Telegram/SourceFiles/window/section_widget.h @@ -151,6 +151,13 @@ public: return SectionActionResult::Ignore; } + virtual bool confirmSendingFiles(const QStringList &files) { + return false; + } + virtual bool confirmSendingFiles(not_null data) { + return false; + } + // Create a memento of that section to store it in the history stack. // This method may modify the section ("take" heavy items). virtual std::shared_ptr createMemento(); diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 6cce6d8c5..492303e11 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -1542,20 +1542,20 @@ QPointer ShowForwardMessagesBox( std::move(successCallback)); } -QPointer ShowForwardMessagesBox( +QPointer ShowDropMediaBox( not_null navigation, - Data::ForwardDraft &&draft, + std::shared_ptr data, not_null forum, FnMut &&successCallback) { const auto weak = std::make_shared>(); auto chosen = [ - draft = std::move(draft), + data = std::move(data), callback = std::move(successCallback), weak, navigation ](not_null topic) mutable { const auto content = navigation->parentController()->content(); - if (!content->setForwardDraft(topic, std::move(draft))) { + if (!content->onFilesOrForwardDrop(topic, data.get())) { return; } else if (const auto strong = *weak) { strong->closeBox(); diff --git a/Telegram/SourceFiles/window/window_peer_menu.h b/Telegram/SourceFiles/window/window_peer_menu.h index 8cdf7a238..08246c1c3 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.h +++ b/Telegram/SourceFiles/window/window_peer_menu.h @@ -122,9 +122,9 @@ QPointer ShowForwardMessagesBox( not_null navigation, MessageIdsList &&items, FnMut &&successCallback = nullptr); -QPointer ShowForwardMessagesBox( +QPointer ShowDropMediaBox( not_null navigation, - Data::ForwardDraft &&draft, + std::shared_ptr data, not_null forum, FnMut &&successCallback = nullptr); diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index a7e817cd3..03c69579e 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -1670,26 +1670,19 @@ void SessionController::showPeerHistory( } void SessionController::showMessage( - not_null item) { + not_null item, + const SectionShow ¶ms) { _window->invokeForSessionController( - &item->history()->peer->session().account(), + &item->history()->session().account(), item->history()->peer, [&](not_null controller) { if (item->isScheduled()) { controller->showSection( std::make_shared( item->history()), - SectionShow::Way::ClearStack); - } else if (const auto topic = item->topic()) { - controller->showTopic( - topic, - item->id, - SectionShow::Way::ClearStack); + params); } else { - controller->showPeerHistory( - item->history()->peer, - SectionShow::Way::ClearStack, - item->id); + controller->content()->showMessage(item, params); } }); } diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index f783dfe76..b860e987e 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -431,7 +431,9 @@ public: const SectionShow ¶ms = SectionShow::Way::ClearStack, MsgId msgId = ShowAtUnreadMsgId) override; - void showMessage(not_null item); + void showMessage( + not_null item, + const SectionShow ¶ms = SectionShow::Way::ClearStack); void cancelUploadLayer(not_null item); void showLayer( diff --git a/Telegram/cmake/td_ui.cmake b/Telegram/cmake/td_ui.cmake index 3bd8eadf9..13e473c4f 100644 --- a/Telegram/cmake/td_ui.cmake +++ b/Telegram/cmake/td_ui.cmake @@ -294,4 +294,5 @@ PRIVATE desktop-app::lib_webview desktop-app::lib_webrtc desktop-app::lib_stripe + desktop-app::external_kcoreaddons )