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

Method filesOrForwardDrop

Telegram/SourceFiles/mainwidget.cpp:666–729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666bool MainWidget::filesOrForwardDrop(
667 not_null<Data::Thread*> thread,
668 not_null<const QMimeData*> data,
669 bool forumResolved) {
670 if (!forumResolved) {
671 if (const auto forum = thread->asForum()) {
672 Window::ShowDropMediaBox(
673 _controller,
674 Core::ShareMimeMediaData(data),
675 forum);
676 if (_hider) {
677 _hider->startHide();
678 clearHider(_hider);
679 }
680 return true;
681 } else if (const auto history = thread->asHistory()
682 ; history && history->peer->monoforum()) {
683 Window::ShowDropMediaBox(
684 _controller,
685 Core::ShareMimeMediaData(data),
686 history->peer->monoforum());
687 if (_hider) {
688 _hider->startHide();
689 clearHider(_hider);
690 }
691 return true;
692 }
693 }
694 if (data->hasFormat(u"application/x-td-forward"_q)) {
695 auto draft = Data::ForwardDraft{
696 .ids = session().data().takeMimeForwardIds(),
697 };
698 if (setForwardDraft(thread, std::move(draft))) {
699 return true;
700 }
701 // We've already released the mouse button,
702 // so the forwarding is cancelled.
703 if (_hider) {
704 _hider->startHide();
705 clearHider(_hider);
706 }
707 return false;
708 } else if (!Data::CanSendAnyOf(thread, Data::FilesSendRestrictions())) {
709 _controller->showToast(
710 tr::lng_forward_send_files_cant(tr::now));
711 return false;
712 } else if (const auto error = Data::AnyFileRestrictionError(
713 thread->peer())) {
714 Data::ShowSendErrorToast(_controller, thread->peer(), error);
715 return false;
716 } else {
717 _controller->showThread(
718 thread,
719 ShowAtTheEndMsgId,
720 Window::SectionShow::Way::ClearStack);
721 if (_controller->activeChatCurrent().thread() != thread) {
722 return false;
723 }

Callers 3

prepareButtonMethod · 0.80
ShowDropMediaBoxFunction · 0.80
dropEventMethod · 0.80

Calls 15

ShowDropMediaBoxFunction · 0.85
ShareMimeMediaDataFunction · 0.85
CanSendAnyOfFunction · 0.85
FilesSendRestrictionsFunction · 0.85
AnyFileRestrictionErrorFunction · 0.85
ShowSendErrorToastFunction · 0.85
asForumMethod · 0.80
asHistoryMethod · 0.80
takeMimeForwardIdsMethod · 0.80
showThreadMethod · 0.80
activeChatCurrentMethod · 0.80
startHideMethod · 0.45

Tested by

no test coverage detected