mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +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_send_games" = "Send games";
|
||||||
"ktg_admin_log_banned_use_inline" = "Use inline bots";
|
"ktg_admin_log_banned_use_inline" = "Use inline bots";
|
||||||
|
|
||||||
|
"ktg_forward_go_to_chat" = "Go to chat";
|
||||||
|
|
||||||
// Keys finished
|
// Keys finished
|
||||||
|
@@ -166,6 +166,9 @@
|
|||||||
"ktg_admin_log_banned_send_games": "Send games",
|
"ktg_admin_log_banned_send_games": "Send games",
|
||||||
"ktg_admin_log_banned_use_inline": "Use inline bots",
|
"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.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
}
|
}
|
||||||
|
@@ -174,6 +174,9 @@
|
|||||||
"ktg_admin_log_banned_send_games": "Wyślij gry",
|
"ktg_admin_log_banned_send_games": "Wyślij gry",
|
||||||
"ktg_admin_log_banned_use_inline": "Użyj bota liniowego (inline)",
|
"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.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
}
|
}
|
@@ -173,6 +173,9 @@
|
|||||||
"ktg_admin_log_banned_send_games": "Отправка игр",
|
"ktg_admin_log_banned_send_games": "Отправка игр",
|
||||||
"ktg_admin_log_banned_use_inline": "Отправка через ботов",
|
"ktg_admin_log_banned_use_inline": "Отправка через ботов",
|
||||||
|
|
||||||
|
// New strings
|
||||||
|
"ktg_forward_go_to_chat": "Перейти в чат",
|
||||||
|
|
||||||
// This string should always be last for better work with Git.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
}
|
}
|
||||||
|
@@ -166,6 +166,9 @@
|
|||||||
"ktg_admin_log_banned_send_games": "Oyunlar Gönder",
|
"ktg_admin_log_banned_send_games": "Oyunlar Gönder",
|
||||||
"ktg_admin_log_banned_use_inline": "İnline Bot'lar Kullan",
|
"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.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
}
|
}
|
||||||
|
@@ -173,6 +173,9 @@
|
|||||||
"ktg_admin_log_banned_send_games": "Надсилати ігри",
|
"ktg_admin_log_banned_send_games": "Надсилати ігри",
|
||||||
"ktg_admin_log_banned_use_inline": "Використання інлайн-ботів",
|
"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.
|
// This string should always be last for better work with Git.
|
||||||
"dummy_last_string": ""
|
"dummy_last_string": ""
|
||||||
}
|
}
|
@@ -157,12 +157,14 @@ ShareBox::ShareBox(
|
|||||||
not_null<Window::SessionNavigation*> navigation,
|
not_null<Window::SessionNavigation*> navigation,
|
||||||
CopyCallback &©Callback,
|
CopyCallback &©Callback,
|
||||||
SubmitCallback &&submitCallback,
|
SubmitCallback &&submitCallback,
|
||||||
FilterCallback &&filterCallback)
|
FilterCallback &&filterCallback,
|
||||||
|
GoToChatCallback &&goToChatCallback)
|
||||||
: _navigation(navigation)
|
: _navigation(navigation)
|
||||||
, _api(&_navigation->session().mtp())
|
, _api(&_navigation->session().mtp())
|
||||||
, _copyCallback(std::move(copyCallback))
|
, _copyCallback(std::move(copyCallback))
|
||||||
, _submitCallback(std::move(submitCallback))
|
, _submitCallback(std::move(submitCallback))
|
||||||
, _filterCallback(std::move(filterCallback))
|
, _filterCallback(std::move(filterCallback))
|
||||||
|
, _goToChatCallback(goToChatCallback ? std::move(goToChatCallback) : nullptr)
|
||||||
, _select(
|
, _select(
|
||||||
this,
|
this,
|
||||||
st::contactsMultiSelect,
|
st::contactsMultiSelect,
|
||||||
@@ -420,6 +422,11 @@ SendMenuType ShareBox::sendMenuType() const {
|
|||||||
void ShareBox::createButtons() {
|
void ShareBox::createButtons() {
|
||||||
clearButtons();
|
clearButtons();
|
||||||
if (_hasSelected) {
|
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(), [=] {
|
const auto send = addButton(tr::lng_share_confirm(), [=] {
|
||||||
submit({});
|
submit({});
|
||||||
});
|
});
|
||||||
@@ -489,14 +496,20 @@ void ShareBox::copyLink() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShareBox::goToChat(not_null<PeerData*> peer) {
|
||||||
|
if (_goToChatCallback) {
|
||||||
|
_goToChatCallback(peer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ShareBox::selectedChanged() {
|
void ShareBox::selectedChanged() {
|
||||||
auto hasSelected = _inner->hasSelected();
|
auto hasSelected = _inner->hasSelected();
|
||||||
if (_hasSelected != hasSelected) {
|
if (_hasSelected != hasSelected) {
|
||||||
_hasSelected = hasSelected;
|
_hasSelected = hasSelected;
|
||||||
createButtons();
|
|
||||||
_comment->toggle(_hasSelected, anim::type::normal);
|
_comment->toggle(_hasSelected, anim::type::normal);
|
||||||
_comment->resizeToWidth(st::boxWideWidth);
|
_comment->resizeToWidth(st::boxWideWidth);
|
||||||
}
|
}
|
||||||
|
createButtons();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,13 +57,15 @@ public:
|
|||||||
TextWithTags&&,
|
TextWithTags&&,
|
||||||
Api::SendOptions)>;
|
Api::SendOptions)>;
|
||||||
using FilterCallback = Fn<bool(PeerData*)>;
|
using FilterCallback = Fn<bool(PeerData*)>;
|
||||||
|
using GoToChatCallback = Fn<void(PeerData *peer)>;
|
||||||
|
|
||||||
ShareBox(
|
ShareBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
not_null<Window::SessionNavigation*> navigation,
|
not_null<Window::SessionNavigation*> navigation,
|
||||||
CopyCallback &©Callback,
|
CopyCallback &©Callback,
|
||||||
SubmitCallback &&submitCallback,
|
SubmitCallback &&submitCallback,
|
||||||
FilterCallback &&filterCallback);
|
FilterCallback &&filterCallback,
|
||||||
|
GoToChatCallback &&goToChatCallback = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
@@ -80,6 +82,7 @@ private:
|
|||||||
void submitSilent();
|
void submitSilent();
|
||||||
void submitScheduled();
|
void submitScheduled();
|
||||||
void copyLink();
|
void copyLink();
|
||||||
|
void goToChat(not_null<PeerData*> peer);
|
||||||
bool searchByUsername(bool useCache = false);
|
bool searchByUsername(bool useCache = false);
|
||||||
|
|
||||||
SendMenuType sendMenuType() const;
|
SendMenuType sendMenuType() const;
|
||||||
@@ -108,6 +111,7 @@ private:
|
|||||||
CopyCallback _copyCallback;
|
CopyCallback _copyCallback;
|
||||||
SubmitCallback _submitCallback;
|
SubmitCallback _submitCallback;
|
||||||
FilterCallback _filterCallback;
|
FilterCallback _filterCallback;
|
||||||
|
GoToChatCallback _goToChatCallback;
|
||||||
|
|
||||||
object_ptr<Ui::MultiSelect> _select;
|
object_ptr<Ui::MultiSelect> _select;
|
||||||
object_ptr<Ui::SlideWrap<Ui::InputField>> _comment;
|
object_ptr<Ui::SlideWrap<Ui::InputField>> _comment;
|
||||||
|
@@ -1169,11 +1169,15 @@ QPointer<Ui::RpWidget> ShowForwardMessagesBox(
|
|||||||
auto copyLinkCallback = canCopyLink
|
auto copyLinkCallback = canCopyLink
|
||||||
? Fn<void()>(std::move(copyCallback))
|
? Fn<void()>(std::move(copyCallback))
|
||||||
: Fn<void()>();
|
: Fn<void()>();
|
||||||
|
auto goToChatCallback = [navigation, data](PeerData *peer) {
|
||||||
|
navigation->parentController()->content()->setForwardDraft(peer->id, std::move(data->msgIds));
|
||||||
|
};
|
||||||
*weak = Ui::show(Box<ShareBox>(
|
*weak = Ui::show(Box<ShareBox>(
|
||||||
App::wnd()->sessionController(),
|
App::wnd()->sessionController(),
|
||||||
std::move(copyLinkCallback),
|
std::move(copyLinkCallback),
|
||||||
std::move(submitCallback),
|
std::move(submitCallback),
|
||||||
std::move(filterCallback)));
|
std::move(filterCallback),
|
||||||
|
std::move(goToChatCallback)));
|
||||||
return weak->data();
|
return weak->data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user