mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
fixed media_only dcs, added copy post link to clipboard, fixed signature display in gifs, 0.9.27 dev version
This commit is contained in:
@@ -879,7 +879,6 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
}
|
||||
}
|
||||
if (lnkPhoto) {
|
||||
_menu->addAction(lang(lng_context_open_image), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_save_image), this, SLOT(saveContextImage()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_image), this, SLOT(copyContextImage()))->setEnabled(true);
|
||||
} else {
|
||||
@@ -892,10 +891,12 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
if (lnkDocument && !lnkDocument->document()->already(true).isEmpty()) {
|
||||
_menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true);
|
||||
}
|
||||
_menu->addAction(lang(lnkIsVideo ? lng_context_open_video : (lnkIsAudio ? lng_context_open_audio : lng_context_open_file)), this, SLOT(openContextFile()))->setEnabled(true);
|
||||
_menu->addAction(lang(lnkIsVideo ? lng_context_save_video : (lnkIsAudio ? lng_context_save_audio : lng_context_save_file)), this, SLOT(saveContextFile()))->setEnabled(true);
|
||||
}
|
||||
}
|
||||
if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) {
|
||||
_menu->addAction(lang(lng_context_copy_post_link), _widget, SLOT(onCopyPostLink()));
|
||||
}
|
||||
if (isUponSelected > 1) {
|
||||
_menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected()));
|
||||
if (selectedForDelete == selectedForForward) {
|
||||
@@ -980,19 +981,18 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
|
||||
QLatin1String linktype = _contextMenuLnk ? _contextMenuLnk->type() : qstr("");
|
||||
if (linktype == qstr("TextLink") || linktype == qstr("LocationLink")) {
|
||||
_menu->addAction(lang(lng_context_open_link), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_link), this, SLOT(copyContextUrl()))->setEnabled(true);
|
||||
} else if (linktype == qstr("EmailLink")) {
|
||||
_menu->addAction(lang(lng_context_open_email), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_email), this, SLOT(copyContextUrl()))->setEnabled(true);
|
||||
} else if (linktype == qstr("MentionLink")) {
|
||||
_menu->addAction(lang(lng_context_open_mention), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_mention), this, SLOT(copyContextUrl()))->setEnabled(true);
|
||||
} else if (linktype == qstr("HashtagLink")) {
|
||||
_menu->addAction(lang(lng_context_open_hashtag), this, SLOT(openContextUrl()))->setEnabled(true);
|
||||
_menu->addAction(lang(lng_context_copy_hashtag), this, SLOT(copyContextUrl()))->setEnabled(true);
|
||||
} else {
|
||||
}
|
||||
if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) {
|
||||
_menu->addAction(lang(lng_context_copy_post_link), _widget, SLOT(onCopyPostLink()));
|
||||
}
|
||||
if (isUponSelected > 1) {
|
||||
_menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected()));
|
||||
if (selectedForDelete == selectedForForward) {
|
||||
@@ -1044,13 +1044,6 @@ void HistoryInner::copySelectedText() {
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryInner::openContextUrl() {
|
||||
HistoryItem *was = App::hoveredLinkItem();
|
||||
App::hoveredLinkItem(App::contextItem());
|
||||
_contextMenuLnk->onClick(Qt::LeftButton);
|
||||
App::hoveredLinkItem(was);
|
||||
}
|
||||
|
||||
void HistoryInner::copyContextUrl() {
|
||||
QString enc = _contextMenuLnk->encoded();
|
||||
if (!enc.isEmpty()) {
|
||||
@@ -1109,14 +1102,6 @@ void HistoryInner::showContextInFolder() {
|
||||
if (!already.isEmpty()) psShowInFolder(already);
|
||||
}
|
||||
|
||||
void HistoryInner::openContextFile() {
|
||||
HistoryItem *was = App::hoveredLinkItem();
|
||||
App::hoveredLinkItem(App::contextItem());
|
||||
DocumentLink *lnkDocument = dynamic_cast<DocumentLink*>(_contextMenuLnk.data());
|
||||
if (lnkDocument) DocumentOpenLink(lnkDocument->document()).onClick(Qt::LeftButton);
|
||||
App::hoveredLinkItem(was);
|
||||
}
|
||||
|
||||
void HistoryInner::saveContextFile() {
|
||||
if (DocumentLink *lnkDocument = dynamic_cast<DocumentLink*>(_contextMenuLnk.data())) {
|
||||
DocumentSaveLink::doSave(lnkDocument->document(), true);
|
||||
@@ -6952,6 +6937,13 @@ void HistoryWidget::onEditMessage() {
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::onCopyPostLink() {
|
||||
HistoryItem *to = App::contextItem();
|
||||
if (!to || !to->hasDirectLink()) return;
|
||||
|
||||
QApplication::clipboard()->setText(to->directLink());
|
||||
}
|
||||
|
||||
bool HistoryWidget::lastForceReplyReplied(const FullMsgId &replyTo) const {
|
||||
if (replyTo.msg > 0 && replyTo.channel != _channel) return false;
|
||||
return _keyboard.forceReply() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _keyboard.forMsgId().msg == (replyTo.msg < 0 ? replyToId() : replyTo.msg);
|
||||
|
Reference in New Issue
Block a user