mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Allow copying large-emoji message texts.
This commit is contained in:
parent
2a4d269eca
commit
813bbba8b7
5 changed files with 19 additions and 5 deletions
|
@ -2275,6 +2275,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
const auto canReport = item && item->suggestReport();
|
||||
const auto canBlockSender = item && item->history()->peer->isRepliesChat();
|
||||
const auto view = item ? item->mainView() : nullptr;
|
||||
const auto actionText = link
|
||||
? link->copyToClipboardContextItemText()
|
||||
: QString();
|
||||
|
||||
if (isUponSelected > 0) {
|
||||
if (!hasCopyRestrictionForSelected()) {
|
||||
|
@ -2335,7 +2338,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
}
|
||||
if (!item->isService()
|
||||
&& view
|
||||
&& !link
|
||||
&& actionText.isEmpty()
|
||||
&& !hasCopyRestriction(item)
|
||||
&& (view->hasVisibleText() || mediaHasTextForCopy)) {
|
||||
_menu->addAction(tr::lng_context_copy_text(tr::now), [=] {
|
||||
|
@ -2344,10 +2347,6 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto actionText = link
|
||||
? link->copyToClipboardContextItemText()
|
||||
: QString();
|
||||
if (!actionText.isEmpty()) {
|
||||
_menu->addAction(
|
||||
actionText,
|
||||
|
|
|
@ -35,6 +35,9 @@ public:
|
|||
bool alwaysShowOutTimestamp() override {
|
||||
return true;
|
||||
}
|
||||
bool hasTextForCopy() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
const not_null<Element*> _parent;
|
||||
|
|
|
@ -404,6 +404,10 @@ TextState UnwrappedMedia::textState(QPoint point, StateRequest request) const {
|
|||
return result;
|
||||
}
|
||||
|
||||
bool UnwrappedMedia::hasTextForCopy() const {
|
||||
return _content->hasTextForCopy();
|
||||
}
|
||||
|
||||
QRect UnwrappedMedia::contentRectForReactions() const {
|
||||
const auto inWebPage = (_parent->media() != this);
|
||||
if (inWebPage) {
|
||||
|
|
|
@ -60,6 +60,9 @@ public:
|
|||
[[nodiscard]] virtual bool alwaysShowOutTimestamp() {
|
||||
return false;
|
||||
}
|
||||
virtual bool hasTextForCopy() const {
|
||||
return false;
|
||||
}
|
||||
virtual ~Content() = default;
|
||||
};
|
||||
|
||||
|
@ -71,6 +74,8 @@ public:
|
|||
PointState pointState(QPoint point) const override;
|
||||
TextState textState(QPoint point, StateRequest request) const override;
|
||||
|
||||
bool hasTextForCopy() const override;
|
||||
|
||||
bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,9 @@ public:
|
|||
void unloadHeavyPart() override;
|
||||
|
||||
void refreshLink() override;
|
||||
bool hasTextForCopy() const {
|
||||
return isEmojiSticker();
|
||||
}
|
||||
|
||||
void setDiceIndex(const QString &emoji, int index);
|
||||
[[nodiscard]] bool atTheEnd() const {
|
||||
|
|
Loading…
Add table
Reference in a new issue