diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 332cc56e3..8b353c5c6 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2576,4 +2576,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ktg_admin_log_banned_send_games" = "Send games"; "ktg_admin_log_banned_use_inline" = "Use inline bots"; +"ktg_forward_go_to_chat" = "Go to chat"; + // Keys finished diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index b04b98426..858d1d059 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -166,6 +166,9 @@ "ktg_admin_log_banned_send_games": "Send games", "ktg_admin_log_banned_use_inline": "Use inline bots", + // New strings + "ktg_forward_go_to_chat": "Go to chat", + // This string should always be last for better work with Git. "dummy_last_string": "" } diff --git a/Telegram/Resources/langs/rewrites/pl.json b/Telegram/Resources/langs/rewrites/pl.json index 05abd1843..703911c1e 100644 --- a/Telegram/Resources/langs/rewrites/pl.json +++ b/Telegram/Resources/langs/rewrites/pl.json @@ -174,6 +174,9 @@ "ktg_admin_log_banned_send_games": "Wyślij gry", "ktg_admin_log_banned_use_inline": "Użyj bota liniowego (inline)", + // New strings + "ktg_forward_go_to_chat": "Go to chat", + // This string should always be last for better work with Git. "dummy_last_string": "" } \ No newline at end of file diff --git a/Telegram/Resources/langs/rewrites/ru.json b/Telegram/Resources/langs/rewrites/ru.json index e1e813540..166fef554 100644 --- a/Telegram/Resources/langs/rewrites/ru.json +++ b/Telegram/Resources/langs/rewrites/ru.json @@ -173,6 +173,9 @@ "ktg_admin_log_banned_send_games": "Отправка игр", "ktg_admin_log_banned_use_inline": "Отправка через ботов", + // New strings + "ktg_forward_go_to_chat": "Перейти в чат", + // This string should always be last for better work with Git. "dummy_last_string": "" } diff --git a/Telegram/Resources/langs/rewrites/tr.json b/Telegram/Resources/langs/rewrites/tr.json index 2cf933c0b..727af981f 100644 --- a/Telegram/Resources/langs/rewrites/tr.json +++ b/Telegram/Resources/langs/rewrites/tr.json @@ -166,6 +166,9 @@ "ktg_admin_log_banned_send_games": "Oyunlar Gönder", "ktg_admin_log_banned_use_inline": "İnline Bot'lar Kullan", + // New strings + "ktg_forward_go_to_chat": "Go to chat", + // This string should always be last for better work with Git. "dummy_last_string": "" } diff --git a/Telegram/Resources/langs/rewrites/uk.json b/Telegram/Resources/langs/rewrites/uk.json index 0d44f8bfd..74eec40b3 100644 --- a/Telegram/Resources/langs/rewrites/uk.json +++ b/Telegram/Resources/langs/rewrites/uk.json @@ -173,6 +173,9 @@ "ktg_admin_log_banned_send_games": "Надсилати ігри", "ktg_admin_log_banned_use_inline": "Використання інлайн-ботів", + // New strings + "ktg_forward_go_to_chat": "Go to chat", + // This string should always be last for better work with Git. "dummy_last_string": "" } \ No newline at end of file diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index 5e3e767ad..884a046b1 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -157,12 +157,14 @@ ShareBox::ShareBox( not_null navigation, CopyCallback &©Callback, SubmitCallback &&submitCallback, - FilterCallback &&filterCallback) + FilterCallback &&filterCallback, + GoToChatCallback &&goToChatCallback) : _navigation(navigation) , _api(&_navigation->session().mtp()) , _copyCallback(std::move(copyCallback)) , _submitCallback(std::move(submitCallback)) , _filterCallback(std::move(filterCallback)) +, _goToChatCallback(goToChatCallback ? std::move(goToChatCallback) : nullptr) , _select( this, st::contactsMultiSelect, @@ -420,6 +422,11 @@ SendMenuType ShareBox::sendMenuType() const { void ShareBox::createButtons() { clearButtons(); if (_hasSelected) { + if (_goToChatCallback && _inner->selected().size() == 1) { + const auto singleChat = _inner->selected().at(0); + addLeftButton(tr::ktg_forward_go_to_chat(), [=] { goToChat(singleChat); }); + } + const auto send = addButton(tr::lng_share_confirm(), [=] { submit({}); }); @@ -489,14 +496,20 @@ void ShareBox::copyLink() { } } +void ShareBox::goToChat(not_null peer) { + if (_goToChatCallback) { + _goToChatCallback(peer); + } +} + void ShareBox::selectedChanged() { auto hasSelected = _inner->hasSelected(); if (_hasSelected != hasSelected) { _hasSelected = hasSelected; - createButtons(); _comment->toggle(_hasSelected, anim::type::normal); _comment->resizeToWidth(st::boxWideWidth); } + createButtons(); update(); } diff --git a/Telegram/SourceFiles/boxes/share_box.h b/Telegram/SourceFiles/boxes/share_box.h index 605b68f63..aaca74abc 100644 --- a/Telegram/SourceFiles/boxes/share_box.h +++ b/Telegram/SourceFiles/boxes/share_box.h @@ -57,13 +57,15 @@ public: TextWithTags&&, Api::SendOptions)>; using FilterCallback = Fn; + using GoToChatCallback = Fn; ShareBox( QWidget*, not_null navigation, CopyCallback &©Callback, SubmitCallback &&submitCallback, - FilterCallback &&filterCallback); + FilterCallback &&filterCallback, + GoToChatCallback &&goToChatCallback = nullptr); protected: void prepare() override; @@ -80,6 +82,7 @@ private: void submitSilent(); void submitScheduled(); void copyLink(); + void goToChat(not_null peer); bool searchByUsername(bool useCache = false); SendMenuType sendMenuType() const; @@ -108,6 +111,7 @@ private: CopyCallback _copyCallback; SubmitCallback _submitCallback; FilterCallback _filterCallback; + GoToChatCallback _goToChatCallback; object_ptr _select; object_ptr> _comment; diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 2adb9669c..92cd5b1e9 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -1169,11 +1169,15 @@ QPointer ShowForwardMessagesBox( auto copyLinkCallback = canCopyLink ? Fn(std::move(copyCallback)) : Fn(); + auto goToChatCallback = [navigation, data](PeerData *peer) { + navigation->parentController()->content()->setForwardDraft(peer->id, std::move(data->msgIds)); + }; *weak = Ui::show(Box( App::wnd()->sessionController(), std::move(copyLinkCallback), std::move(submitCallback), - std::move(filterCallback))); + std::move(filterCallback), + std::move(goToChatCallback))); return weak->data(); }