[Improvement] Allow to send inline result preview
This commit is contained in:
parent
6f6ec5de89
commit
100b89161a
12 changed files with 187 additions and 42 deletions
|
|
@ -189,6 +189,10 @@
|
||||||
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
|
"ktg_filters_hide_all_chats_toast": "\"All Chats\" folder is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
|
"ktg_filters_hide_edit_toast": "Edit button is hidden.\nYou can enable it back in Kotatogram Settings.",
|
||||||
"ktg_settings_telegram_sites_autologin": "Auto-login on Telegram sites",
|
"ktg_settings_telegram_sites_autologin": "Auto-login on Telegram sites",
|
||||||
|
"ktg_send_preview": "Send preview",
|
||||||
|
"ktg_send_silent_preview": "Send preview silent",
|
||||||
|
"ktg_reminder_preview": "Remind with preview",
|
||||||
|
"ktg_schedule_preview": "Send preview scheduled",
|
||||||
"ktg_forward_sender_names_and_captions_removed": "Sender names and captions removed",
|
"ktg_forward_sender_names_and_captions_removed": "Sender names and captions removed",
|
||||||
"ktg_forward_remember_mode": "Remember forward mode",
|
"ktg_forward_remember_mode": "Remember forward mode",
|
||||||
"ktg_forward_mode": "Forward mode",
|
"ktg_forward_mode": "Forward mode",
|
||||||
|
|
|
||||||
|
|
@ -1179,7 +1179,20 @@ void HistoryWidget::initTabbedSelector() {
|
||||||
}
|
}
|
||||||
return (data.recipientOverride == _peer);
|
return (data.recipientOverride == _peer);
|
||||||
}) | rpl::start_with_next([=](Selector::InlineChosen data) {
|
}) | rpl::start_with_next([=](Selector::InlineChosen data) {
|
||||||
|
if (data.sendPreview) {
|
||||||
|
const auto request = data.result->openRequest();
|
||||||
|
if (const auto photo = request.photo()) {
|
||||||
|
sendExistingPhoto(photo, data.options);
|
||||||
|
} else if (const auto document = request.document()) {
|
||||||
|
sendExistingDocument(document, data.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
addRecentBot(data.bot);
|
||||||
|
clearFieldText();
|
||||||
|
saveCloudDraft();
|
||||||
|
} else {
|
||||||
sendInlineResult(data);
|
sendInlineResult(data);
|
||||||
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
selector->contextMenuRequested(
|
selector->contextMenuRequested(
|
||||||
|
|
@ -1567,6 +1580,17 @@ void HistoryWidget::applyInlineBotQuery(UserData *bot, const QString &query) {
|
||||||
} else if (const auto document = request.document()) {
|
} else if (const auto document = request.document()) {
|
||||||
controller()->openDocument(document, FullMsgId());
|
controller()->openDocument(document, FullMsgId());
|
||||||
}
|
}
|
||||||
|
} else if (result.sendPreview) {
|
||||||
|
const auto request = result.result->openRequest();
|
||||||
|
if (const auto photo = request.photo()) {
|
||||||
|
sendExistingPhoto(photo, result.options);
|
||||||
|
} else if (const auto document = request.document()) {
|
||||||
|
sendExistingDocument(document, result.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
addRecentBot(result.bot);
|
||||||
|
clearFieldText();
|
||||||
|
saveCloudDraft();
|
||||||
} else {
|
} else {
|
||||||
sendInlineResult(result);
|
sendInlineResult(result);
|
||||||
}
|
}
|
||||||
|
|
@ -6433,17 +6457,7 @@ void HistoryWidget::sendInlineResult(InlineBots::ResultSelected result) {
|
||||||
_saveDraftStart = crl::now();
|
_saveDraftStart = crl::now();
|
||||||
saveDraft();
|
saveDraft();
|
||||||
|
|
||||||
auto &bots = cRefRecentInlineBots();
|
addRecentBot(result.bot);
|
||||||
const auto index = bots.indexOf(result.bot);
|
|
||||||
if (index) {
|
|
||||||
if (index > 0) {
|
|
||||||
bots.removeAt(index);
|
|
||||||
} else if (bots.size() >= RecentInlineBotsLimit) {
|
|
||||||
bots.resize(RecentInlineBotsLimit - 1);
|
|
||||||
}
|
|
||||||
bots.push_front(result.bot);
|
|
||||||
session().local().writeRecentHashtagsAndBots();
|
|
||||||
}
|
|
||||||
|
|
||||||
hideSelectorControlsAnimated();
|
hideSelectorControlsAnimated();
|
||||||
|
|
||||||
|
|
@ -7623,6 +7637,20 @@ void HistoryWidget::messageDataReceived(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryWidget::addRecentBot(not_null<UserData*> bot) {
|
||||||
|
auto &bots = cRefRecentInlineBots();
|
||||||
|
const auto index = bots.indexOf(bot);
|
||||||
|
if (index) {
|
||||||
|
if (index > 0) {
|
||||||
|
bots.removeAt(index);
|
||||||
|
} else if (bots.size() >= RecentInlineBotsLimit) {
|
||||||
|
bots.resize(RecentInlineBotsLimit - 1);
|
||||||
|
}
|
||||||
|
bots.push_front(bot);
|
||||||
|
session().local().writeRecentHashtagsAndBots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateReplyEditText(not_null<HistoryItem*> item) {
|
void HistoryWidget::updateReplyEditText(not_null<HistoryItem*> item) {
|
||||||
const auto context = Core::MarkedTextContext{
|
const auto context = Core::MarkedTextContext{
|
||||||
.session = &session(),
|
.session = &session(),
|
||||||
|
|
|
||||||
|
|
@ -373,6 +373,8 @@ private:
|
||||||
void requestMessageData(MsgId msgId);
|
void requestMessageData(MsgId msgId);
|
||||||
void messageDataReceived(not_null<PeerData*> peer, MsgId msgId);
|
void messageDataReceived(not_null<PeerData*> peer, MsgId msgId);
|
||||||
|
|
||||||
|
void addRecentBot(not_null<UserData*> bot);
|
||||||
|
|
||||||
[[nodiscard]] Api::SendAction prepareSendAction(
|
[[nodiscard]] Api::SendAction prepareSendAction(
|
||||||
Api::SendOptions options) const;
|
Api::SendOptions options) const;
|
||||||
void send(Api::SendOptions options);
|
void send(Api::SendOptions options);
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "core/file_utilities.h"
|
#include "core/file_utilities.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
|
#include "data/data_document.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
|
|
@ -592,7 +593,20 @@ void RepliesWidget::setupComposeControls() {
|
||||||
controller()->sendingAnimation().appendSending(
|
controller()->sendingAnimation().appendSending(
|
||||||
chosen.messageSendingFrom);
|
chosen.messageSendingFrom);
|
||||||
const auto localId = chosen.messageSendingFrom.localId;
|
const auto localId = chosen.messageSendingFrom.localId;
|
||||||
|
if (chosen.sendPreview) {
|
||||||
|
const auto request = chosen.result->openRequest();
|
||||||
|
if (const auto photo = request.photo()) {
|
||||||
|
sendExistingPhoto(photo, chosen.options);
|
||||||
|
} else if (const auto document = request.document()) {
|
||||||
|
sendExistingDocument(document, chosen.options, localId);
|
||||||
|
}
|
||||||
|
|
||||||
|
addRecentBot(chosen.bot);
|
||||||
|
_composeControls->clear();
|
||||||
|
finishSending();
|
||||||
|
} else {
|
||||||
sendInlineResult(chosen.result, chosen.bot, chosen.options, localId);
|
sendInlineResult(chosen.result, chosen.bot, chosen.options, localId);
|
||||||
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_composeControls->scrollRequests(
|
_composeControls->scrollRequests(
|
||||||
|
|
@ -968,6 +982,20 @@ bool RepliesWidget::showSendingFilesError(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RepliesWidget::addRecentBot(not_null<UserData*> bot) {
|
||||||
|
auto &bots = cRefRecentInlineBots();
|
||||||
|
const auto index = bots.indexOf(bot);
|
||||||
|
if (index) {
|
||||||
|
if (index > 0) {
|
||||||
|
bots.removeAt(index);
|
||||||
|
} else if (bots.size() >= RecentInlineBotsLimit) {
|
||||||
|
bots.resize(RecentInlineBotsLimit - 1);
|
||||||
|
}
|
||||||
|
bots.push_front(bot);
|
||||||
|
bot->session().local().writeRecentHashtagsAndBots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Api::SendAction RepliesWidget::prepareSendAction(
|
Api::SendAction RepliesWidget::prepareSendAction(
|
||||||
Api::SendOptions options) const {
|
Api::SendOptions options) const {
|
||||||
auto result = Api::SendAction(_history, options);
|
auto result = Api::SendAction(_history, options);
|
||||||
|
|
@ -1182,10 +1210,17 @@ bool RepliesWidget::sendExistingDocument(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document->hasRemoteLocation()) {
|
||||||
Api::SendExistingDocument(
|
Api::SendExistingDocument(
|
||||||
Api::MessageToSend(prepareSendAction(options)),
|
Api::MessageToSend(prepareSendAction(options)),
|
||||||
document,
|
document,
|
||||||
localId);
|
localId);
|
||||||
|
} else {
|
||||||
|
Api::SendWebDocument(
|
||||||
|
Api::MessageToSend(prepareSendAction(options)),
|
||||||
|
document,
|
||||||
|
localId);
|
||||||
|
}
|
||||||
|
|
||||||
_composeControls->cancelReplyMessage();
|
_composeControls->cancelReplyMessage();
|
||||||
finishSending();
|
finishSending();
|
||||||
|
|
@ -1258,17 +1293,7 @@ void RepliesWidget::sendInlineResult(
|
||||||
//_saveDraftStart = crl::now();
|
//_saveDraftStart = crl::now();
|
||||||
//onDraftSave();
|
//onDraftSave();
|
||||||
|
|
||||||
auto &bots = cRefRecentInlineBots();
|
addRecentBot(bot);
|
||||||
const auto index = bots.indexOf(bot);
|
|
||||||
if (index) {
|
|
||||||
if (index > 0) {
|
|
||||||
bots.removeAt(index);
|
|
||||||
} else if (bots.size() >= RecentInlineBotsLimit) {
|
|
||||||
bots.resize(RecentInlineBotsLimit - 1);
|
|
||||||
}
|
|
||||||
bots.push_front(bot);
|
|
||||||
bot->session().local().writeRecentHashtagsAndBots();
|
|
||||||
}
|
|
||||||
finishSending();
|
finishSending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,8 @@ private:
|
||||||
void clearSelected();
|
void clearSelected();
|
||||||
void setPinnedVisibility(bool shown);
|
void setPinnedVisibility(bool shown);
|
||||||
|
|
||||||
|
void addRecentBot(not_null<UserData*> bot);
|
||||||
|
|
||||||
[[nodiscard]] Api::SendAction prepareSendAction(
|
[[nodiscard]] Api::SendAction prepareSendAction(
|
||||||
Api::SendOptions options) const;
|
Api::SendOptions options) const;
|
||||||
void send();
|
void send();
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,21 @@ void ScheduledWidget::setupComposeControls() {
|
||||||
|
|
||||||
_composeControls->inlineResultChosen(
|
_composeControls->inlineResultChosen(
|
||||||
) | rpl::start_with_next([=](Selector::InlineChosen chosen) {
|
) | rpl::start_with_next([=](Selector::InlineChosen chosen) {
|
||||||
|
if (chosen.sendPreview) {
|
||||||
|
const auto request = chosen.result->openRequest();
|
||||||
|
if (const auto photo = request.photo()) {
|
||||||
|
sendExistingPhoto(photo);
|
||||||
|
} else if (const auto document = request.document()) {
|
||||||
|
sendExistingDocument(document);
|
||||||
|
}
|
||||||
|
|
||||||
|
addRecentBot(chosen.bot);
|
||||||
|
_composeControls->clear();
|
||||||
|
_composeControls->hidePanelsAnimated();
|
||||||
|
_composeControls->focus();
|
||||||
|
} else {
|
||||||
sendInlineResult(chosen.result, chosen.bot);
|
sendInlineResult(chosen.result, chosen.bot);
|
||||||
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_composeControls->scrollRequests(
|
_composeControls->scrollRequests(
|
||||||
|
|
@ -578,6 +592,20 @@ bool ScheduledWidget::showSendingFilesError(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScheduledWidget::addRecentBot(not_null<UserData*> bot) {
|
||||||
|
auto &bots = cRefRecentInlineBots();
|
||||||
|
const auto index = bots.indexOf(bot);
|
||||||
|
if (index) {
|
||||||
|
if (index > 0) {
|
||||||
|
bots.removeAt(index);
|
||||||
|
} else if (bots.size() >= RecentInlineBotsLimit) {
|
||||||
|
bots.resize(RecentInlineBotsLimit - 1);
|
||||||
|
}
|
||||||
|
bots.push_front(bot);
|
||||||
|
bot->session().local().writeRecentHashtagsAndBots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Api::SendAction ScheduledWidget::prepareSendAction(
|
Api::SendAction ScheduledWidget::prepareSendAction(
|
||||||
Api::SendOptions options) const {
|
Api::SendOptions options) const {
|
||||||
auto result = Api::SendAction(_history, options);
|
auto result = Api::SendAction(_history, options);
|
||||||
|
|
@ -818,17 +846,7 @@ void ScheduledWidget::sendInlineResult(
|
||||||
//_saveDraftStart = crl::now();
|
//_saveDraftStart = crl::now();
|
||||||
//onDraftSave();
|
//onDraftSave();
|
||||||
|
|
||||||
auto &bots = cRefRecentInlineBots();
|
addRecentBot(bot);
|
||||||
const auto index = bots.indexOf(bot);
|
|
||||||
if (index) {
|
|
||||||
if (index > 0) {
|
|
||||||
bots.removeAt(index);
|
|
||||||
} else if (bots.size() >= RecentInlineBotsLimit) {
|
|
||||||
bots.resize(RecentInlineBotsLimit - 1);
|
|
||||||
}
|
|
||||||
bots.push_front(bot);
|
|
||||||
bot->session().local().writeRecentHashtagsAndBots();
|
|
||||||
}
|
|
||||||
|
|
||||||
_composeControls->hidePanelsAnimated();
|
_composeControls->hidePanelsAnimated();
|
||||||
_composeControls->focus();
|
_composeControls->focus();
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,8 @@ private:
|
||||||
void confirmDeleteSelected();
|
void confirmDeleteSelected();
|
||||||
void clearSelected();
|
void clearSelected();
|
||||||
|
|
||||||
|
void addRecentBot(not_null<UserData*> bot);
|
||||||
|
|
||||||
[[nodiscard]] Api::SendAction prepareSendAction(
|
[[nodiscard]] Api::SendAction prepareSendAction(
|
||||||
Api::SendOptions options) const;
|
Api::SendOptions options) const;
|
||||||
void send();
|
void send();
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ struct ResultSelected {
|
||||||
Ui::MessageSendingAnimationFrom messageSendingFrom;
|
Ui::MessageSendingAnimationFrom messageSendingFrom;
|
||||||
// Open in OverlayWidget;
|
// Open in OverlayWidget;
|
||||||
bool open = false;
|
bool open = false;
|
||||||
|
bool sendPreview = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace InlineBots
|
} // namespace InlineBots
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,8 @@ void Inner::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
void Inner::selectInlineResult(
|
void Inner::selectInlineResult(
|
||||||
int index,
|
int index,
|
||||||
Api::SendOptions options,
|
Api::SendOptions options,
|
||||||
bool open) {
|
bool open,
|
||||||
|
bool sendPreview) {
|
||||||
const auto item = _mosaic.maybeItemAt(index);
|
const auto item = _mosaic.maybeItemAt(index);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -300,6 +301,7 @@ void Inner::selectInlineResult(
|
||||||
.options = std::move(options),
|
.options = std::move(options),
|
||||||
.messageSendingFrom = messageSendingFrom(),
|
.messageSendingFrom = messageSendingFrom(),
|
||||||
.open = open,
|
.open = open,
|
||||||
|
.sendPreview = sendPreview,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -345,8 +347,23 @@ void Inner::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
SendMenu::DefaultSilentCallback(send),
|
SendMenu::DefaultSilentCallback(send),
|
||||||
SendMenu::DefaultScheduleCallback(this, type, send));
|
SendMenu::DefaultScheduleCallback(this, type, send));
|
||||||
|
|
||||||
|
const auto hideViaActions = [&] {
|
||||||
|
const auto sendPreview = [=, selected = _selected](Api::SendOptions options) {
|
||||||
|
selectInlineResult(selected, options, false, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
SendMenu::FillSendPreviewMenu(
|
||||||
|
_menu,
|
||||||
|
type,
|
||||||
|
[=] { sendPreview({}); },
|
||||||
|
SendMenu::DefaultSilentCallback(sendPreview),
|
||||||
|
SendMenu::DefaultScheduleCallback(this, type, sendPreview));
|
||||||
|
};
|
||||||
|
|
||||||
const auto item = _mosaic.itemAt(_selected);
|
const auto item = _mosaic.itemAt(_selected);
|
||||||
if (const auto previewDocument = item->getPreviewDocument()) {
|
if (const auto previewDocument = item->getPreviewDocument()) {
|
||||||
|
hideViaActions();
|
||||||
|
|
||||||
auto callback = [&](
|
auto callback = [&](
|
||||||
const QString &text,
|
const QString &text,
|
||||||
Fn<void()> &&done,
|
Fn<void()> &&done,
|
||||||
|
|
@ -357,6 +374,8 @@ void Inner::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
std::move(callback),
|
std::move(callback),
|
||||||
_controller,
|
_controller,
|
||||||
previewDocument);
|
previewDocument);
|
||||||
|
} else if (const auto previewPhoto = item->getPreviewPhoto()) {
|
||||||
|
hideViaActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_menu->empty()) {
|
if (!_menu->empty()) {
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,8 @@ private:
|
||||||
void selectInlineResult(
|
void selectInlineResult(
|
||||||
int index,
|
int index,
|
||||||
Api::SendOptions options,
|
Api::SendOptions options,
|
||||||
bool open);
|
bool open,
|
||||||
|
bool sendPreview = false);
|
||||||
|
|
||||||
not_null<Window::SessionController*> _controller;
|
not_null<Window::SessionController*> _controller;
|
||||||
const std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
|
const std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "menu/menu_send.h"
|
#include "menu/menu_send.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
#include "api/api_common.h"
|
#include "api/api_common.h"
|
||||||
#include "base/event_filter.h"
|
#include "base/event_filter.h"
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
|
|
@ -55,6 +56,7 @@ FillMenuResult FillSendMenu(
|
||||||
}
|
}
|
||||||
const auto now = type;
|
const auto now = type;
|
||||||
if (now == Type::Disabled
|
if (now == Type::Disabled
|
||||||
|
|| now == Type::PreviewOnly
|
||||||
|| (!silent && now == Type::SilentOnly)) {
|
|| (!silent && now == Type::SilentOnly)) {
|
||||||
return FillMenuResult::None;
|
return FillMenuResult::None;
|
||||||
}
|
}
|
||||||
|
|
@ -76,6 +78,38 @@ FillMenuResult FillSendMenu(
|
||||||
return FillMenuResult::Success;
|
return FillMenuResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FillMenuResult FillSendPreviewMenu(
|
||||||
|
not_null<Ui::PopupMenu*> menu,
|
||||||
|
Type type,
|
||||||
|
Fn<void()> defaultSend,
|
||||||
|
Fn<void()> silent,
|
||||||
|
Fn<void()> schedule) {
|
||||||
|
if (!defaultSend && !silent && !schedule) {
|
||||||
|
return FillMenuResult::None;
|
||||||
|
}
|
||||||
|
const auto now = type;
|
||||||
|
if (now == Type::Disabled) {
|
||||||
|
return FillMenuResult::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defaultSend) {
|
||||||
|
menu->addAction(ktr("ktg_send_preview"), defaultSend);
|
||||||
|
}
|
||||||
|
if (type != Type::PreviewOnly) {
|
||||||
|
if (silent && now != Type::Reminder) {
|
||||||
|
menu->addAction(ktr("ktg_send_silent_preview"), silent);
|
||||||
|
}
|
||||||
|
if (schedule && now != Type::SilentOnly) {
|
||||||
|
menu->addAction(
|
||||||
|
(now == Type::Reminder
|
||||||
|
? ktr("ktg_reminder_preview")
|
||||||
|
: ktr("ktg_schedule_preview")),
|
||||||
|
schedule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FillMenuResult::Success;
|
||||||
|
}
|
||||||
|
|
||||||
void SetupMenuAndShortcuts(
|
void SetupMenuAndShortcuts(
|
||||||
not_null<Ui::RpWidget*> button,
|
not_null<Ui::RpWidget*> button,
|
||||||
Fn<Type()> type,
|
Fn<Type()> type,
|
||||||
|
|
@ -111,6 +145,7 @@ void SetupMenuAndShortcuts(
|
||||||
|
|
||||||
const auto now = type();
|
const auto now = type();
|
||||||
if (now == Type::Disabled
|
if (now == Type::Disabled
|
||||||
|
|| now == Type::PreviewOnly
|
||||||
|| (!silent && now == Type::SilentOnly)) {
|
|| (!silent && now == Type::SilentOnly)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ enum class Type {
|
||||||
Scheduled,
|
Scheduled,
|
||||||
ScheduledToUser, // For "Send when online".
|
ScheduledToUser, // For "Send when online".
|
||||||
Reminder,
|
Reminder,
|
||||||
|
PreviewOnly,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class FillMenuResult {
|
enum class FillMenuResult {
|
||||||
|
|
@ -43,6 +44,13 @@ FillMenuResult FillSendMenu(
|
||||||
Fn<void()> silent,
|
Fn<void()> silent,
|
||||||
Fn<void()> schedule);
|
Fn<void()> schedule);
|
||||||
|
|
||||||
|
FillMenuResult FillSendPreviewMenu(
|
||||||
|
not_null<Ui::PopupMenu*> menu,
|
||||||
|
Type type,
|
||||||
|
Fn<void()> defaultSend,
|
||||||
|
Fn<void()> silent,
|
||||||
|
Fn<void()> schedule);
|
||||||
|
|
||||||
void SetupMenuAndShortcuts(
|
void SetupMenuAndShortcuts(
|
||||||
not_null<Ui::RpWidget*> button,
|
not_null<Ui::RpWidget*> button,
|
||||||
Fn<Type()> type,
|
Fn<Type()> type,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue