2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Version 0.9.44 copy text context menu item added to some messages.

This commit is contained in:
John Preston
2016-04-20 15:56:59 +03:00
parent 5caceefc2c
commit 7d272919aa
7 changed files with 44 additions and 22 deletions

View File

@@ -1037,7 +1037,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
}
if (item && !isUponSelected) {
if (HistoryMedia *media = (msg ? msg->getMedia() : 0)) {
bool mediaHasTextForCopy = false;
if (HistoryMedia *media = (msg ? msg->getMedia() : nullptr)) {
mediaHasTextForCopy = media->hasTextForCopy();
if (media->type() == MediaTypeWebPage && static_cast<HistoryWebPage*>(media)->attach()) {
media = static_cast<HistoryWebPage*>(media)->attach();
}
@@ -1065,8 +1067,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
}
}
QString contextMenuText = item->selectedText(FullSelection);
if (!contextMenuText.isEmpty() && msg && !msg->getMedia()) {
if (msg && (!msg->emptyText() || mediaHasTextForCopy)) {
_menu->addAction(lang(lng_context_copy_text), this, SLOT(copyContextText()))->setEnabled(true);
}
}