mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Disable effects for inline results sending.
This commit is contained in:
parent
26345208a9
commit
12eecec501
4 changed files with 26 additions and 7 deletions
|
@ -390,11 +390,20 @@ base::unique_qptr<Ui::PopupMenu> GifsListWidget::fillContextMenu(
|
||||||
const auto send = crl::guard(this, [=](Api::SendOptions options) {
|
const auto send = crl::guard(this, [=](Api::SendOptions options) {
|
||||||
selectInlineResult(selected, options, true);
|
selectInlineResult(selected, options, true);
|
||||||
});
|
});
|
||||||
|
const auto item = _mosaic.maybeItemAt(_selected);
|
||||||
|
const auto isInlineResult = !item->getPhoto()
|
||||||
|
&& !item->getDocument()
|
||||||
|
&& item->getResult();
|
||||||
const auto icons = &st().icons;
|
const auto icons = &st().icons;
|
||||||
|
auto copyDetails = details;
|
||||||
|
if (isInlineResult) {
|
||||||
|
// inline results don't have effects
|
||||||
|
copyDetails.effectAllowed = false;
|
||||||
|
}
|
||||||
SendMenu::FillSendMenu(
|
SendMenu::FillSendMenu(
|
||||||
menu,
|
menu,
|
||||||
_show,
|
_show,
|
||||||
details,
|
copyDetails,
|
||||||
SendMenu::DefaultCallback(_show, send),
|
SendMenu::DefaultCallback(_show, send),
|
||||||
icons);
|
icons);
|
||||||
|
|
||||||
|
|
|
@ -4211,7 +4211,7 @@ void HistoryWidget::sendScheduled(Api::SendOptions initialOptions) {
|
||||||
HistoryView::PrepareScheduleBox(
|
HistoryView::PrepareScheduleBox(
|
||||||
_list,
|
_list,
|
||||||
controller()->uiShow(),
|
controller()->uiShow(),
|
||||||
sendMenuDetails(),
|
sendButtonDefaultDetails(),
|
||||||
[=](Api::SendOptions options) { send(options); },
|
[=](Api::SendOptions options) { send(options); },
|
||||||
initialOptions));
|
initialOptions));
|
||||||
}
|
}
|
||||||
|
@ -4224,9 +4224,7 @@ SendMenu::Details HistoryWidget::sendMenuDetails() const {
|
||||||
: HistoryView::CanScheduleUntilOnline(_peer)
|
: HistoryView::CanScheduleUntilOnline(_peer)
|
||||||
? SendMenu::Type::ScheduledToUser
|
? SendMenu::Type::ScheduledToUser
|
||||||
: SendMenu::Type::Scheduled;
|
: SendMenu::Type::Scheduled;
|
||||||
const auto effectAllowed = _peer
|
const auto effectAllowed = _peer && _peer->isUser();
|
||||||
&& _peer->isUser()
|
|
||||||
&& (HasSendText(_field) || _previewDrawPreview);
|
|
||||||
return { .type = type, .effectAllowed = effectAllowed };
|
return { .type = type, .effectAllowed = effectAllowed };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4257,7 +4255,15 @@ SendMenu::Details HistoryWidget::sendButtonMenuDetails() const {
|
||||||
} else if (type != Type::Send) {
|
} else if (type != Type::Send) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return sendMenuDetails();
|
return sendButtonDefaultDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
SendMenu::Details HistoryWidget::sendButtonDefaultDetails() const {
|
||||||
|
auto result = sendMenuDetails();
|
||||||
|
if (!HasSendText(_field) && !_previewDrawPreview) {
|
||||||
|
result.effectAllowed = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::unblockUser() {
|
void HistoryWidget::unblockUser() {
|
||||||
|
|
|
@ -398,6 +398,7 @@ private:
|
||||||
void sendWithModifiers(Qt::KeyboardModifiers modifiers);
|
void sendWithModifiers(Qt::KeyboardModifiers modifiers);
|
||||||
void sendScheduled(Api::SendOptions initialOptions);
|
void sendScheduled(Api::SendOptions initialOptions);
|
||||||
[[nodiscard]] SendMenu::Details sendButtonMenuDetails() const;
|
[[nodiscard]] SendMenu::Details sendButtonMenuDetails() const;
|
||||||
|
[[nodiscsard]] SendMenu::Details sendButtonDefaultDetails() const;
|
||||||
void handlePendingHistoryUpdate();
|
void handlePendingHistoryUpdate();
|
||||||
void fullInfoUpdated();
|
void fullInfoUpdated();
|
||||||
void toggleTabbedSelectorMode();
|
void toggleTabbedSelectorMode();
|
||||||
|
|
|
@ -329,10 +329,13 @@ void Inner::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
if (_selected < 0 || _pressed >= 0) {
|
if (_selected < 0 || _pressed >= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto details = _sendMenuDetails
|
auto details = _sendMenuDetails
|
||||||
? _sendMenuDetails()
|
? _sendMenuDetails()
|
||||||
: SendMenu::Details();
|
: SendMenu::Details();
|
||||||
|
|
||||||
|
// inline results don't have effects
|
||||||
|
details.effectAllowed = false;
|
||||||
|
|
||||||
_menu = base::make_unique_q<Ui::PopupMenu>(
|
_menu = base::make_unique_q<Ui::PopupMenu>(
|
||||||
this,
|
this,
|
||||||
st::popupMenuWithIcons);
|
st::popupMenuWithIcons);
|
||||||
|
|
Loading…
Add table
Reference in a new issue