2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Bundle silent and scheduled to Api::SendOptions.

This commit is contained in:
John Preston
2019-08-12 13:11:34 +01:00
parent 0b08810d5a
commit caef7dde24
27 changed files with 413 additions and 349 deletions

View File

@@ -787,13 +787,25 @@ void MessageLinksParser::apply(
void SetupSendWithoutSound(
not_null<Ui::RpWidget*> button,
Fn<bool()> enabled,
Fn<void()> send) {
Fn<void()> send,
Fn<void()> schedule) {
if (!send && !schedule) {
return;
}
const auto menu = std::make_shared<base::unique_qptr<Ui::PopupMenu>>();
const auto showMenu = [=] {
*menu = base::make_unique_q<Ui::PopupMenu>(button);
if (send) {
(*menu)->addAction(tr::lng_send_silent_message(tr::now), send);
}
if (schedule) {
(*menu)->addAction(tr::lng_schedule_message(tr::now), schedule);
}
(*menu)->popup(QCursor::pos());
};
Core::InstallEventFilter(button, [=](not_null<QEvent*> e) {
if (e->type() == QEvent::ContextMenu && enabled()) {
*menu = base::make_unique_q<Ui::PopupMenu>(button);
(*menu)->addAction(tr::lng_send_silent_message(tr::now), send);
(*menu)->popup(QCursor::pos());
showMenu();
return true;
}
return false;

View File

@@ -109,4 +109,5 @@ private:
void SetupSendWithoutSound(
not_null<Ui::RpWidget*> button,
Fn<bool()> enabled,
Fn<void()> send);
Fn<void()> send,
Fn<void()> schedule);