mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Don't suggest "Set As Quick" on already quick.
This commit is contained in:
parent
4d11ad45db
commit
9a451a1423
5 changed files with 28 additions and 14 deletions
|
@ -1852,7 +1852,10 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
const auto link = ClickHandler::getActive();
|
const auto link = ClickHandler::getActive();
|
||||||
if (link
|
if (link
|
||||||
&& !link->property(kSendReactionEmojiProperty).toString().isEmpty()
|
&& !link->property(kSendReactionEmojiProperty).toString().isEmpty()
|
||||||
&& _reactionsManager->showContextMenu(this, e)) {
|
&& _reactionsManager->showContextMenu(
|
||||||
|
this,
|
||||||
|
e,
|
||||||
|
session().data().reactions().favorite())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto selectedState = getSelectionState();
|
auto selectedState = getSelectionState();
|
||||||
|
|
|
@ -1126,10 +1126,8 @@ void ShowWhoReactedMenu(
|
||||||
const auto reactions = &controller->session().data().reactions();
|
const auto reactions = &controller->session().data().reactions();
|
||||||
const auto &list = reactions->list(
|
const auto &list = reactions->list(
|
||||||
Data::Reactions::Type::Active);
|
Data::Reactions::Type::Active);
|
||||||
const auto active = ranges::contains(
|
const auto activeNonQuick = (emoji != reactions->favorite())
|
||||||
list,
|
&& ranges::contains(list, emoji, &Data::Reaction::emoji);
|
||||||
emoji,
|
|
||||||
&Data::Reaction::emoji);
|
|
||||||
const auto filler = lifetime.make_state<Ui::WhoReactedListMenu>(
|
const auto filler = lifetime.make_state<Ui::WhoReactedListMenu>(
|
||||||
participantChosen,
|
participantChosen,
|
||||||
showAllChosen);
|
showAllChosen);
|
||||||
|
@ -1143,7 +1141,7 @@ void ShowWhoReactedMenu(
|
||||||
}) | rpl::start_with_next([=, &lifetime](Ui::WhoReadContent &&content) {
|
}) | rpl::start_with_next([=, &lifetime](Ui::WhoReadContent &&content) {
|
||||||
const auto creating = !*menu;
|
const auto creating = !*menu;
|
||||||
const auto refill = [=] {
|
const auto refill = [=] {
|
||||||
if (active) {
|
if (activeNonQuick) {
|
||||||
(*menu)->addAction(tr::lng_context_set_as_quick(tr::now), [=] {
|
(*menu)->addAction(tr::lng_context_set_as_quick(tr::now), [=] {
|
||||||
reactions->setFavorite(emoji);
|
reactions->setFavorite(emoji);
|
||||||
}, &st::menuIconFave);
|
}, &st::menuIconFave);
|
||||||
|
|
|
@ -2096,7 +2096,10 @@ void ListWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
const auto link = ClickHandler::getActive();
|
const auto link = ClickHandler::getActive();
|
||||||
if (link
|
if (link
|
||||||
&& !link->property(kSendReactionEmojiProperty).toString().isEmpty()
|
&& !link->property(kSendReactionEmojiProperty).toString().isEmpty()
|
||||||
&& _reactionsManager->showContextMenu(this, e)) {
|
&& _reactionsManager->showContextMenu(
|
||||||
|
this,
|
||||||
|
e,
|
||||||
|
session().data().reactions().favorite())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto overItem = _overItemExact
|
const auto overItem = _overItemExact
|
||||||
|
|
|
@ -1553,19 +1553,26 @@ void Manager::recordCurrentReactionEffect(FullMsgId itemId, QPoint origin) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Manager::showContextMenu(QWidget *parent, QContextMenuEvent *e) {
|
bool Manager::showContextMenu(
|
||||||
|
QWidget *parent,
|
||||||
|
QContextMenuEvent *e,
|
||||||
|
const QString &favorite) {
|
||||||
if (_icons.empty() || _selectedIcon < 0) {
|
if (_icons.empty() || _selectedIcon < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const auto lookupSelectedEmoji = [&] {
|
||||||
|
const auto i = ranges::find(_icons, true, &ReactionIcons::selected);
|
||||||
|
return (i != end(_icons)) ? (*i)->emoji : QString();
|
||||||
|
};
|
||||||
|
if (!favorite.isEmpty() && lookupSelectedEmoji() == favorite) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
_menu = base::make_unique_q<Ui::PopupMenu>(
|
_menu = base::make_unique_q<Ui::PopupMenu>(
|
||||||
parent,
|
parent,
|
||||||
st::popupMenuWithIcons);
|
st::popupMenuWithIcons);
|
||||||
const auto callback = [=] {
|
const auto callback = [=] {
|
||||||
for (const auto &icon : _icons) {
|
if (const auto emoji = lookupSelectedEmoji(); !emoji.isEmpty()) {
|
||||||
if (icon->selected) {
|
_faveRequests.fire_copy(emoji);
|
||||||
_faveRequests.fire_copy(icon->emoji);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_menu->addAction(
|
_menu->addAction(
|
||||||
|
|
|
@ -177,7 +177,10 @@ public:
|
||||||
-> not_null<Ui::ReactionEffectPainter*>;
|
-> not_null<Ui::ReactionEffectPainter*>;
|
||||||
void recordCurrentReactionEffect(FullMsgId itemId, QPoint origin);
|
void recordCurrentReactionEffect(FullMsgId itemId, QPoint origin);
|
||||||
|
|
||||||
bool showContextMenu(QWidget *parent, QContextMenuEvent *e);
|
bool showContextMenu(
|
||||||
|
QWidget *parent,
|
||||||
|
QContextMenuEvent *e,
|
||||||
|
const QString &favorite);
|
||||||
[[nodiscard]] rpl::producer<QString> faveRequests() const;
|
[[nodiscard]] rpl::producer<QString> faveRequests() const;
|
||||||
|
|
||||||
[[nodiscard]] rpl::lifetime &lifetime() {
|
[[nodiscard]] rpl::lifetime &lifetime() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue