[Improvement] Allow to search messages from user
This commit is contained in:
parent
35c9a61316
commit
bebf2d9f2f
8 changed files with 46 additions and 6 deletions
|
|
@ -104,6 +104,7 @@
|
||||||
"ktg_hide_pinned_message": "Hide",
|
"ktg_hide_pinned_message": "Hide",
|
||||||
"ktg_stickers_copy_title": "Copy name",
|
"ktg_stickers_copy_title": "Copy name",
|
||||||
"ktg_stickers_title_copied": "Sticker pack name copied to clipboard.",
|
"ktg_stickers_title_copied": "Sticker pack name copied to clipboard.",
|
||||||
|
"ktg_context_show_messages_from": "User messages",
|
||||||
"ktg_settings_userpic_rounding": "Profile pictures rounding",
|
"ktg_settings_userpic_rounding": "Profile pictures rounding",
|
||||||
"ktg_settings_userpic_rounding_none": "Square",
|
"ktg_settings_userpic_rounding_none": "Square",
|
||||||
"ktg_settings_userpic_rounding_small": "Small",
|
"ktg_settings_userpic_rounding_small": "Small",
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "boxes/peers/edit_participants_box.h"
|
#include "boxes/peers/edit_participants_box.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
#include "api/api_chat_participants.h"
|
#include "api/api_chat_participants.h"
|
||||||
#include "boxes/peer_list_controllers.h"
|
#include "boxes/peer_list_controllers.h"
|
||||||
#include "boxes/peers/edit_participant_box.h"
|
#include "boxes/peers/edit_participant_box.h"
|
||||||
|
|
@ -17,8 +18,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/add_contact_box.h"
|
#include "boxes/add_contact_box.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "mtproto/mtproto_config.h"
|
#include "mtproto/mtproto_config.h"
|
||||||
|
#include "facades.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "dialogs/dialogs_indexed_list.h"
|
#include "dialogs/dialogs_indexed_list.h"
|
||||||
#include "data/data_peer_values.h"
|
#include "data/data_peer_values.h"
|
||||||
|
|
@ -1545,6 +1548,20 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
||||||
? &st::menuIconProfile
|
? &st::menuIconProfile
|
||||||
: &st::menuIconInfo));
|
: &st::menuIconInfo));
|
||||||
}
|
}
|
||||||
|
if (const auto window = App::wnd()) {
|
||||||
|
if (const auto mainwidget = window->sessionContent()) {
|
||||||
|
result->addAction(
|
||||||
|
ktr("ktg_context_show_messages_from"),
|
||||||
|
crl::guard(this, [=] {
|
||||||
|
mainwidget->searchMessages(
|
||||||
|
" ",
|
||||||
|
(_peer && !_peer->isUser())
|
||||||
|
? _peer->owner().history(_peer).get()
|
||||||
|
: Dialogs::Key(),
|
||||||
|
user);
|
||||||
|
}), &st::menuIconSearch);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (_role == Role::Kicked) {
|
if (_role == Role::Kicked) {
|
||||||
if (_peer->isMegagroup()
|
if (_peer->isMegagroup()
|
||||||
&& _additional.canRestrictParticipant(participant)) {
|
&& _additional.canRestrictParticipant(participant)) {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "main/main_domain.h"
|
#include "main/main_domain.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
#include "main/main_account.h"
|
||||||
#include "main/main_session_settings.h"
|
#include "main/main_session_settings.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "base/event_filter.h"
|
#include "base/event_filter.h"
|
||||||
|
|
@ -1059,7 +1060,8 @@ void Widget::showMainMenu() {
|
||||||
|
|
||||||
void Widget::searchMessages(
|
void Widget::searchMessages(
|
||||||
const QString &query,
|
const QString &query,
|
||||||
Key inChat) {
|
Key inChat,
|
||||||
|
UserData *from) {
|
||||||
auto inChatChanged = [&] {
|
auto inChatChanged = [&] {
|
||||||
if (inChat == _searchInChat) {
|
if (inChat == _searchInChat) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1075,7 +1077,9 @@ void Widget::searchMessages(
|
||||||
cancelSearch();
|
cancelSearch();
|
||||||
setSearchInChat(inChat);
|
setSearchInChat(inChat);
|
||||||
}
|
}
|
||||||
|
if (!query.trimmed().isEmpty()) {
|
||||||
_filter->setText(query);
|
_filter->setText(query);
|
||||||
|
}
|
||||||
_filter->updatePlaceholder();
|
_filter->updatePlaceholder();
|
||||||
applyFilterUpdate(true);
|
applyFilterUpdate(true);
|
||||||
_searchTimer.cancel();
|
_searchTimer.cancel();
|
||||||
|
|
@ -1083,6 +1087,10 @@ void Widget::searchMessages(
|
||||||
|
|
||||||
session().local().saveRecentSearchHashtags(query);
|
session().local().saveRecentSearchHashtags(query);
|
||||||
}
|
}
|
||||||
|
if (inChat && from) {
|
||||||
|
setSearchInChat(inChat, from);
|
||||||
|
applyFilterUpdate(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::searchMore() {
|
void Widget::searchMore() {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public:
|
||||||
|
|
||||||
void scrollToEntry(const RowDescriptor &entry);
|
void scrollToEntry(const RowDescriptor &entry);
|
||||||
|
|
||||||
void searchMessages(const QString &query, Key inChat = {});
|
void searchMessages(const QString &query, Key inChat = {}, UserData *from = nullptr);
|
||||||
void searchMore();
|
void searchMore();
|
||||||
|
|
||||||
void updateForwardBar();
|
void updateForwardBar();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/history_inner_widget.h"
|
#include "history/history_inner_widget.h"
|
||||||
|
|
||||||
#include "kotato/kotato_settings.h"
|
#include "kotato/kotato_settings.h"
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
|
#include "mainwidget.h"
|
||||||
#include "core/file_utilities.h"
|
#include "core/file_utilities.h"
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
#include "core/click_handler_types.h"
|
#include "core/click_handler_types.h"
|
||||||
|
|
@ -2079,6 +2081,17 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
Window::ToggleMessagePinned(controller, pinItemId, !isPinned);
|
Window::ToggleMessagePinned(controller, pinItemId, !isPinned);
|
||||||
}), isPinned ? &st::menuIconUnpin : &st::menuIconPin);
|
}), isPinned ? &st::menuIconUnpin : &st::menuIconPin);
|
||||||
}
|
}
|
||||||
|
const auto peer = item->history()->peer;
|
||||||
|
if (peer->isChat() || peer->isMegagroup()) {
|
||||||
|
_menu->addAction(ktr("ktg_context_show_messages_from"), [=] {
|
||||||
|
controller->content()->searchMessages(
|
||||||
|
" ",
|
||||||
|
(peer && !peer->isUser())
|
||||||
|
? peer->owner().history(peer).get()
|
||||||
|
: Dialogs::Key(),
|
||||||
|
item->from()->asUser());
|
||||||
|
}, &st::menuIconSearch);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const auto addPhotoActions = [&](not_null<PhotoData*> photo, HistoryItem *item) {
|
const auto addPhotoActions = [&](not_null<PhotoData*> photo, HistoryItem *item) {
|
||||||
const auto media = photo->activeMediaView();
|
const auto media = photo->activeMediaView();
|
||||||
|
|
|
||||||
|
|
@ -790,12 +790,12 @@ void MainWidget::hideSingleUseKeyboard(PeerData *peer, MsgId replyTo) {
|
||||||
_history->hideSingleUseKeyboard(peer, replyTo);
|
_history->hideSingleUseKeyboard(peer, replyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
|
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat, UserData *from) {
|
||||||
// #TODO windows
|
// #TODO windows
|
||||||
if (!_dialogs) {
|
if (!_dialogs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_dialogs->searchMessages(query, inChat);
|
_dialogs->searchMessages(query, inChat, from);
|
||||||
if (isOneColumn()) {
|
if (isOneColumn()) {
|
||||||
Ui::showChatsList(&session());
|
Ui::showChatsList(&session());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ public:
|
||||||
void sendBotCommand(Bot::SendCommandRequest request);
|
void sendBotCommand(Bot::SendCommandRequest request);
|
||||||
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
||||||
|
|
||||||
void searchMessages(const QString &query, Dialogs::Key inChat);
|
void searchMessages(const QString &query, Dialogs::Key inChat, UserData *from = nullptr);
|
||||||
|
|
||||||
void setChatBackground(
|
void setChatBackground(
|
||||||
const Data::WallPaper &background,
|
const Data::WallPaper &background,
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ menuIconFake: icon {{ "menu/fake", menuIconColor }};
|
||||||
menuIconPersonal: icon {{ "menu/personal", menuIconColor }};
|
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 }};
|
||||||
|
menuIconSearch: icon {{ "menu/search", menuIconColor }};
|
||||||
menuIconHide: icon {{ "menu/hide", menuIconColor }};
|
menuIconHide: icon {{ "menu/hide", menuIconColor }};
|
||||||
menuIconMuteFor: icon {{ "menu/mute_for", menuIconColor }};
|
menuIconMuteFor: icon {{ "menu/mute_for", menuIconColor }};
|
||||||
menuIconSilent: icon {{ "menu/silent", menuIconColor }};
|
menuIconSilent: icon {{ "menu/silent", menuIconColor }};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue