mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 14:17:45 +00:00
Go to chat in forward
This commit is contained in:
@@ -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
|
||||
|
@@ -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": ""
|
||||
}
|
||||
|
@@ -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": ""
|
||||
}
|
@@ -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": ""
|
||||
}
|
||||
|
@@ -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": ""
|
||||
}
|
||||
|
@@ -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": ""
|
||||
}
|
@@ -157,12 +157,14 @@ ShareBox::ShareBox(
|
||||
not_null<Window::SessionNavigation*> 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<PeerData*> 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();
|
||||
}
|
||||
|
||||
|
@@ -57,13 +57,15 @@ public:
|
||||
TextWithTags&&,
|
||||
Api::SendOptions)>;
|
||||
using FilterCallback = Fn<bool(PeerData*)>;
|
||||
using GoToChatCallback = Fn<void(PeerData *peer)>;
|
||||
|
||||
ShareBox(
|
||||
QWidget*,
|
||||
not_null<Window::SessionNavigation*> 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<PeerData*> peer);
|
||||
bool searchByUsername(bool useCache = false);
|
||||
|
||||
SendMenuType sendMenuType() const;
|
||||
@@ -108,6 +111,7 @@ private:
|
||||
CopyCallback _copyCallback;
|
||||
SubmitCallback _submitCallback;
|
||||
FilterCallback _filterCallback;
|
||||
GoToChatCallback _goToChatCallback;
|
||||
|
||||
object_ptr<Ui::MultiSelect> _select;
|
||||
object_ptr<Ui::SlideWrap<Ui::InputField>> _comment;
|
||||
|
@@ -1169,11 +1169,15 @@ QPointer<Ui::RpWidget> ShowForwardMessagesBox(
|
||||
auto copyLinkCallback = canCopyLink
|
||||
? Fn<void()>(std::move(copyCallback))
|
||||
: Fn<void()>();
|
||||
auto goToChatCallback = [navigation, data](PeerData *peer) {
|
||||
navigation->parentController()->content()->setForwardDraft(peer->id, std::move(data->msgIds));
|
||||
};
|
||||
*weak = Ui::show(Box<ShareBox>(
|
||||
App::wnd()->sessionController(),
|
||||
std::move(copyLinkCallback),
|
||||
std::move(submitCallback),
|
||||
std::move(filterCallback)));
|
||||
std::move(filterCallback),
|
||||
std::move(goToChatCallback)));
|
||||
return weak->data();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user