Show special phone number context number.

This commit is contained in:
John Preston 2024-11-04 14:52:42 +04:00
parent 7bf1f9bd71
commit f77fdc799d
3 changed files with 13 additions and 1 deletions

View file

@ -16,6 +16,7 @@ constexpr auto kDocumentLinkMediaProperty = 0x03;
constexpr auto kSendReactionEmojiProperty = 0x04;
constexpr auto kReactionsCountEmojiProperty = 0x05;
constexpr auto kDocumentFilenameTooltipProperty = 0x06;
constexpr auto kPhoneNumberLinkProperty = 0x07;
namespace Ui {
class Show;

View file

@ -291,6 +291,7 @@ PhoneClickHandler::PhoneClickHandler(
QString text)
: _session(session)
, _text(text) {
setProperty(kPhoneNumberLinkProperty, _text);
}
void PhoneClickHandler::onClick(ClickContext context) const {

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/stickers_emoji_pack.h"
#include "core/file_utilities.h"
#include "core/click_handler_types.h"
#include "core/phone_click_handler.h"
#include "history/history_item_helpers.h"
#include "history/view/controls/history_view_forward_panel.h"
#include "history/view/controls/history_view_draft_options.h"
@ -2200,6 +2201,10 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
&& Api::WhoReactedExists(leaderOrSelf, Api::WhoReactedList::All);
using namespace HistoryView::Reactions;
const auto clickedReaction = ReactionIdOfLink(link);
const auto linkPhoneNumber = link
? link->property(kPhoneNumberLinkProperty).toString()
: QString();
const auto session = &this->session();
_whoReactedMenuLifetime.destroy();
if (!clickedReaction.empty()
&& leaderOrSelf
@ -2214,9 +2219,14 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_whoReactedMenuLifetime);
e->accept();
return;
} else if (!linkPhoneNumber.isEmpty()) {
PhoneClickHandler(session, linkPhoneNumber).onClick(
prepareClickContext(
Qt::LeftButton,
_dragStateItem ? _dragStateItem->fullId() : FullMsgId()));
return;
}
_menu = base::make_unique_q<Ui::PopupMenu>(this, st::popupMenuWithIcons);
const auto session = &this->session();
const auto controller = _controller;
const auto addItemActions = [&](
HistoryItem *item,