mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +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 canReport = item && item->suggestReport();
|
||||||
const auto canBlockSender = item && item->history()->peer->isRepliesChat();
|
const auto canBlockSender = item && item->history()->peer->isRepliesChat();
|
||||||
const auto view = item ? item->mainView() : nullptr;
|
const auto view = item ? item->mainView() : nullptr;
|
||||||
|
const auto actionText = link
|
||||||
|
? link->copyToClipboardContextItemText()
|
||||||
|
: QString();
|
||||||
|
|
||||||
if (isUponSelected > 0) {
|
if (isUponSelected > 0) {
|
||||||
if (!hasCopyRestrictionForSelected()) {
|
if (!hasCopyRestrictionForSelected()) {
|
||||||
|
@ -2335,7 +2338,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
}
|
}
|
||||||
if (!item->isService()
|
if (!item->isService()
|
||||||
&& view
|
&& view
|
||||||
&& !link
|
&& actionText.isEmpty()
|
||||||
&& !hasCopyRestriction(item)
|
&& !hasCopyRestriction(item)
|
||||||
&& (view->hasVisibleText() || mediaHasTextForCopy)) {
|
&& (view->hasVisibleText() || mediaHasTextForCopy)) {
|
||||||
_menu->addAction(tr::lng_context_copy_text(tr::now), [=] {
|
_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()) {
|
if (!actionText.isEmpty()) {
|
||||||
_menu->addAction(
|
_menu->addAction(
|
||||||
actionText,
|
actionText,
|
||||||
|
|
|
@ -35,6 +35,9 @@ public:
|
||||||
bool alwaysShowOutTimestamp() override {
|
bool alwaysShowOutTimestamp() override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
bool hasTextForCopy() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const not_null<Element*> _parent;
|
const not_null<Element*> _parent;
|
||||||
|
|
|
@ -404,6 +404,10 @@ TextState UnwrappedMedia::textState(QPoint point, StateRequest request) const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UnwrappedMedia::hasTextForCopy() const {
|
||||||
|
return _content->hasTextForCopy();
|
||||||
|
}
|
||||||
|
|
||||||
QRect UnwrappedMedia::contentRectForReactions() const {
|
QRect UnwrappedMedia::contentRectForReactions() const {
|
||||||
const auto inWebPage = (_parent->media() != this);
|
const auto inWebPage = (_parent->media() != this);
|
||||||
if (inWebPage) {
|
if (inWebPage) {
|
||||||
|
|
|
@ -60,6 +60,9 @@ public:
|
||||||
[[nodiscard]] virtual bool alwaysShowOutTimestamp() {
|
[[nodiscard]] virtual bool alwaysShowOutTimestamp() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
virtual bool hasTextForCopy() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
virtual ~Content() = default;
|
virtual ~Content() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,6 +74,8 @@ public:
|
||||||
PointState pointState(QPoint point) const override;
|
PointState pointState(QPoint point) const override;
|
||||||
TextState textState(QPoint point, StateRequest request) const override;
|
TextState textState(QPoint point, StateRequest request) const override;
|
||||||
|
|
||||||
|
bool hasTextForCopy() const override;
|
||||||
|
|
||||||
bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override {
|
bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,9 @@ public:
|
||||||
void unloadHeavyPart() override;
|
void unloadHeavyPart() override;
|
||||||
|
|
||||||
void refreshLink() override;
|
void refreshLink() override;
|
||||||
|
bool hasTextForCopy() const {
|
||||||
|
return isEmojiSticker();
|
||||||
|
}
|
||||||
|
|
||||||
void setDiceIndex(const QString &emoji, int index);
|
void setDiceIndex(const QString &emoji, int index);
|
||||||
[[nodiscard]] bool atTheEnd() const {
|
[[nodiscard]] bool atTheEnd() const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue