mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-29 13:47:47 +00:00
[Improvement] Mention user from context menu
This commit is contained in:
parent
06e6f48559
commit
6d87dcb6a5
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.0 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 |
@ -133,6 +133,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",
|
||||
|
@ -1647,6 +1647,14 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
||||
: Dialogs::Key(),
|
||||
user);
|
||||
}), &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 (const auto by = _additional.restrictedBy(participant)) {
|
||||
|
@ -7642,6 +7642,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) {
|
||||
|
@ -277,6 +277,8 @@ public:
|
||||
not_null<PhotoData*> photo,
|
||||
Api::SendOptions options);
|
||||
|
||||
void mentionUser(PeerData *peer);
|
||||
|
||||
void showInfoTooltip(
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback);
|
||||
|
@ -2796,6 +2796,14 @@ int MainWidget::backgroundFromY() const {
|
||||
return -getMainSectionTop();
|
||||
}
|
||||
|
||||
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)
|
||||
|| _playerPlaylist->overlaps(globalRect);
|
||||
|
@ -202,6 +202,8 @@ public:
|
||||
|
||||
bool contentOverlapped(const QRect &globalRect);
|
||||
|
||||
void mentionUser(PeerData *peer);
|
||||
|
||||
void showChooseReportMessages(
|
||||
not_null<PeerData*> peer,
|
||||
Ui::ReportReason reason,
|
||||
|
@ -80,6 +80,7 @@ menuIconPersonal: icon {{ "menu/personal", menuIconColor }};
|
||||
menuIconPorn: icon {{ "menu/porn", menuIconColor }};
|
||||
menuIconViolence: icon {{ "menu/violence", menuIconColor }};
|
||||
menuIconHide: icon {{ "menu/hide", menuIconColor }};
|
||||
menuIconMention: icon {{ "menu/mention", menuSubmenuArrowFg }};
|
||||
menuIconMuteFor: icon {{ "menu/mute_for", menuIconColor }};
|
||||
menuIconSilent: icon {{ "menu/silent", menuIconColor }};
|
||||
menuIconCustomize: icon {{ "menu/customize", menuIconColor }};
|
||||
|
Loading…
x
Reference in New Issue
Block a user