Skip to content

Commit

Permalink
Support forward multiple messages
Browse files Browse the repository at this point in the history
  • Loading branch information
c0re100 committed Jul 9, 2020
1 parent f65a35b commit 241db5e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2405,6 +2405,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_context_repeat_msg" = "Repeat This Message";
"lng_context_repeat_msg_no_fwd" = "Repeat This Message(!Forward)";
"lng_context_forward_msg_no_quote" = "Forward Message(W/O quote)";
"lng_context_forward_selected_no_quote" = "Forward Selected(W/O quote)";
"lng_message_id" = "Message ID: ";

"lng_admin_log_banned_send_stickers2" = "Send stickers";
Expand Down
10 changes: 10 additions & 0 deletions Telegram/SourceFiles/history/history_inner_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,11 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_widget->forwardSelected();
});
}
if (selectedState.count > 0 && selectedState.canForwardCount == selectedState.count) {
_menu->addAction(tr::lng_context_forward_selected_no_quote(tr::now), [=] {
_widget->forwardNoQuoteSelected();
});
}
if (selectedState.count > 0 && selectedState.canDeleteCount == selectedState.count) {
_menu->addAction(tr::lng_context_delete_selected(tr::now), [=] {
_widget->confirmDeleteSelected();
Expand Down Expand Up @@ -1806,6 +1811,11 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_widget->forwardSelected();
});
}
if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
_menu->addAction(tr::lng_context_forward_selected_no_quote(tr::now), [=] {
_widget->forwardNoQuoteSelected();
});
}
if (selectedState.count > 0 && selectedState.count == selectedState.canDeleteCount) {
_menu->addAction(tr::lng_context_delete_selected(tr::now), [=] {
_widget->confirmDeleteSelected();
Expand Down
12 changes: 12 additions & 0 deletions Telegram/SourceFiles/history/history_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6417,6 +6417,18 @@ void HistoryWidget::forwardSelected() {
});
}

void HistoryWidget::forwardNoQuoteSelected() {
if (!_list) {
return;
}
const auto weak = Ui::MakeWeak(this);
Window::ShowForwardNoQuoteMessagesBox(controller(), getSelectedItems(), [=] {
if (const auto strong = weak.data()) {
strong->clearSelected();
}
});
}

void HistoryWidget::confirmDeleteSelected() {
if (!_list) return;

Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/history/history_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class HistoryWidget final : public Window::AbstractSectionWidget {
QPixmap grabForShowAnimation(const Window::SectionSlideParams &params);

void forwardSelected();
void forwardNoQuoteSelected();
void confirmDeleteSelected();
void clearSelected();

Expand Down

0 comments on commit 241db5e

Please sign in to comment.