[Improvement] Mention user from context menu
This commit is contained in:
parent
da586b36a6
commit
493531bf69
10 changed files with 40 additions and 0 deletions
BIN
Telegram/Resources/icons/menu/mention.png
Normal file
BIN
Telegram/Resources/icons/menu/mention.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
Telegram/Resources/icons/menu/mention@2x.png
Normal file
BIN
Telegram/Resources/icons/menu/mention@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3 KiB |
BIN
Telegram/Resources/icons/menu/mention@3x.png
Normal file
BIN
Telegram/Resources/icons/menu/mention@3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
|
|
@ -147,6 +147,7 @@
|
||||||
"ktg_forward_subtitle_uncaptioned": "uncaptioned",
|
"ktg_forward_subtitle_uncaptioned": "uncaptioned",
|
||||||
"ktg_forward_subtitle_group_all_media": "as albums",
|
"ktg_forward_subtitle_group_all_media": "as albums",
|
||||||
"ktg_forward_subtitle_separate_messages": "one by one",
|
"ktg_forward_subtitle_separate_messages": "one by one",
|
||||||
|
"ktg_profile_mention_user": "Mention user",
|
||||||
"ktg_filters_exclude_not_owned": "Not owned",
|
"ktg_filters_exclude_not_owned": "Not owned",
|
||||||
"ktg_filters_exclude_not_admin": "Not administrated",
|
"ktg_filters_exclude_not_admin": "Not administrated",
|
||||||
"ktg_filters_exclude_owned": "Owned",
|
"ktg_filters_exclude_owned": "Owned",
|
||||||
|
|
|
||||||
|
|
@ -1614,6 +1614,14 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
||||||
: Dialogs::Key(),
|
: Dialogs::Key(),
|
||||||
user);
|
user);
|
||||||
}), &st::menuIconSearch);
|
}), &st::menuIconSearch);
|
||||||
|
if (const auto openedPeer = mainwidget->peer()) {
|
||||||
|
if (Data::CanSendTexts(openedPeer) && participant->isUser()) {
|
||||||
|
result->addAction(
|
||||||
|
ktr("ktg_profile_mention_user"),
|
||||||
|
crl::guard(this, [=] { mainwidget->mentionUser(user); }),
|
||||||
|
&st::menuIconMention);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_role == Role::Kicked) {
|
if (_role == Role::Kicked) {
|
||||||
|
|
|
||||||
|
|
@ -7101,6 +7101,25 @@ bool HistoryWidget::sendExistingPhoto(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryWidget::mentionUser(PeerData *peer) {
|
||||||
|
if (!peer || !peer->isUser()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto user = peer->asUser();
|
||||||
|
QString replacement, entityTag;
|
||||||
|
if (user->username.isEmpty()) {
|
||||||
|
replacement = user->firstName;
|
||||||
|
if (replacement.isEmpty()) {
|
||||||
|
replacement = user->name;
|
||||||
|
}
|
||||||
|
entityTag = PrepareMentionTag(user);
|
||||||
|
} else {
|
||||||
|
replacement = '@' + user->username;
|
||||||
|
}
|
||||||
|
_field->insertTag(replacement, entityTag);
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryWidget::showInfoTooltip(
|
void HistoryWidget::showInfoTooltip(
|
||||||
const TextWithEntities &text,
|
const TextWithEntities &text,
|
||||||
Fn<void()> hiddenCallback) {
|
Fn<void()> hiddenCallback) {
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,8 @@ public:
|
||||||
not_null<PhotoData*> photo,
|
not_null<PhotoData*> photo,
|
||||||
Api::SendOptions options);
|
Api::SendOptions options);
|
||||||
|
|
||||||
|
void mentionUser(PeerData *peer);
|
||||||
|
|
||||||
void showInfoTooltip(
|
void showInfoTooltip(
|
||||||
const TextWithEntities &text,
|
const TextWithEntities &text,
|
||||||
Fn<void()> hiddenCallback);
|
Fn<void()> hiddenCallback);
|
||||||
|
|
|
||||||
|
|
@ -2701,6 +2701,13 @@ int MainWidget::backgroundFromY() const {
|
||||||
void MainWidget::searchInChat(Dialogs::Key chat) {
|
void MainWidget::searchInChat(Dialogs::Key chat) {
|
||||||
searchMessages(QString(), chat);
|
searchMessages(QString(), chat);
|
||||||
}
|
}
|
||||||
|
void MainWidget::mentionUser(PeerData *peer) {
|
||||||
|
if (!_history->peer() || !_history->peer()->canWrite()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_history->mentionUser(peer);
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWidget::contentOverlapped(const QRect &globalRect) {
|
bool MainWidget::contentOverlapped(const QRect &globalRect) {
|
||||||
return _history->contentOverlapped(globalRect)
|
return _history->contentOverlapped(globalRect)
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,8 @@ public:
|
||||||
|
|
||||||
void searchInChat(Dialogs::Key chat);
|
void searchInChat(Dialogs::Key chat);
|
||||||
|
|
||||||
|
void mentionUser(PeerData *peer);
|
||||||
|
|
||||||
void showChooseReportMessages(
|
void showChooseReportMessages(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::ReportReason reason,
|
Ui::ReportReason reason,
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ menuIconPersonal: icon {{ "menu/personal", menuIconColor }};
|
||||||
menuIconPorn: icon {{ "menu/porn", menuIconColor }};
|
menuIconPorn: icon {{ "menu/porn", menuIconColor }};
|
||||||
menuIconViolence: icon {{ "menu/violence", menuIconColor }};
|
menuIconViolence: icon {{ "menu/violence", menuIconColor }};
|
||||||
menuIconHide: icon {{ "menu/hide", menuIconColor }};
|
menuIconHide: icon {{ "menu/hide", menuIconColor }};
|
||||||
|
menuIconMention: icon {{ "menu/mention", menuSubmenuArrowFg }};
|
||||||
menuIconMuteFor: icon {{ "menu/mute_for", menuIconColor }};
|
menuIconMuteFor: icon {{ "menu/mute_for", menuIconColor }};
|
||||||
menuIconSilent: icon {{ "menu/silent", menuIconColor }};
|
menuIconSilent: icon {{ "menu/silent", menuIconColor }};
|
||||||
menuIconCustomize: icon {{ "menu/customize", menuIconColor }};
|
menuIconCustomize: icon {{ "menu/customize", menuIconColor }};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue