[Improvement] Mention user from context menu
This commit is contained in:
parent
add67118de
commit
8b7371fa04
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 |
|
|
@ -180,6 +180,7 @@
|
|||
"ktg_forward_subtitle_uncaptioned": "uncaptioned",
|
||||
"ktg_forward_subtitle_group_all_media": "as albums",
|
||||
"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_admin": "Not administrated",
|
||||
"ktg_filters_exclude_owned": "Owned",
|
||||
|
|
|
|||
|
|
@ -1553,6 +1553,14 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
|||
: Dialogs::Key(),
|
||||
user);
|
||||
}), &st::menuIconSearch);
|
||||
if (const auto openedPeer = mainwidget->peer()) {
|
||||
if (openedPeer->canWrite() && participant->isUser()) {
|
||||
result->addAction(
|
||||
ktr("ktg_profile_mention_user"),
|
||||
crl::guard(this, [=] { mainwidget->mentionUser(user); }),
|
||||
&st::menuIconMention);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_role == Role::Kicked) {
|
||||
|
|
|
|||
|
|
@ -6591,6 +6591,25 @@ bool HistoryWidget::sendExistingPhoto(
|
|||
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(
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback) {
|
||||
|
|
|
|||
|
|
@ -269,6 +269,8 @@ public:
|
|||
not_null<PhotoData*> photo,
|
||||
Api::SendOptions options);
|
||||
|
||||
void mentionUser(PeerData *peer);
|
||||
|
||||
void showInfoTooltip(
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback);
|
||||
|
|
|
|||
|
|
@ -2621,6 +2621,13 @@ void MainWidget::searchInChat(Dialogs::Key chat) {
|
|||
_dialogs->setInnerFocus();
|
||||
}
|
||||
}
|
||||
void MainWidget::mentionUser(PeerData *peer) {
|
||||
if (!_history->peer() || !_history->peer()->canWrite()) {
|
||||
return;
|
||||
}
|
||||
|
||||
_history->mentionUser(peer);
|
||||
}
|
||||
|
||||
bool MainWidget::contentOverlapped(const QRect &globalRect) {
|
||||
return _history->contentOverlapped(globalRect)
|
||||
|
|
|
|||
|
|
@ -209,6 +209,8 @@ public:
|
|||
|
||||
void searchInChat(Dialogs::Key chat);
|
||||
|
||||
void mentionUser(PeerData *peer);
|
||||
|
||||
void showChooseReportMessages(
|
||||
not_null<PeerData*> peer,
|
||||
Ui::ReportReason reason,
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ menuIconRestore: icon {{ "menu/restore", menuSubmenuArrowFg }};
|
|||
menuIconSettings: icon {{ "menu/settings", menuSubmenuArrowFg }};
|
||||
menuIconSearch: icon {{ "menu/search", menuSubmenuArrowFg }};
|
||||
menuIconHide: icon {{ "menu/hide", menuSubmenuArrowFg }};
|
||||
menuIconMention: icon {{ "menu/mention", menuSubmenuArrowFg }};
|
||||
|
||||
mediaMenuIconStickers: icon {{ "menu/stickers", mediaviewMenuFg }};
|
||||
mediaMenuIconCancel: icon {{ "menu/cancel", mediaviewMenuFg }};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue