Improve saved messages search results display.

This commit is contained in:
John Preston 2017-12-21 16:29:01 +04:00
parent 255dbf9405
commit ec515080b5
2 changed files with 9 additions and 6 deletions

View file

@ -1797,7 +1797,7 @@ void DialogsInner::searchInPeer(PeerData *peer, UserData *from) {
_cancelSearchInPeer->show();
if (_searchInPeer->isSelf()) {
_searchInSavedText.setText(
st::dialogsSearchFromStyle,
st::msgNameStyle,
lang(lng_saved_messages),
_textDlgOptions);
}

View file

@ -499,7 +499,7 @@ void RowPainter::paint(
auto item = row->item();
auto history = item->history();
auto cloudDraft = nullptr;
auto from = [&] {
const auto from = [&] {
if (auto searchPeer = row->searchInPeer()) {
if (searchPeer->isSelf()) {
return item->senderOriginal();
@ -509,7 +509,7 @@ void RowPainter::paint(
}
return (history->peer->migrateTo() ? history->peer->migrateTo() : history->peer);
}();
auto drawInDialogWay = [&] {
const auto drawInDialogWay = [&] {
if (auto searchPeer = row->searchInPeer()) {
if (!searchPeer->isChannel() || searchPeer->isMegagroup()) {
return HistoryItem::DrawInDialog::WithoutSender;
@ -517,7 +517,7 @@ void RowPainter::paint(
}
return HistoryItem::DrawInDialog::Normal;
}();
auto paintItemCallback = [&](int nameleft, int namewidth) {
const auto paintItemCallback = [&](int nameleft, int namewidth) {
auto lastWidth = namewidth;
auto texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip;
item->drawInDialog(
@ -529,11 +529,14 @@ void RowPainter::paint(
row->_cacheFor,
row->_cache);
};
auto paintCounterCallback = [] {};
const auto paintCounterCallback = [] {};
const auto showSavedMessages = history->peer->isSelf()
&& !row->searchInPeer();
const auto flags = (active ? Flag::Active : Flag(0))
| (selected ? Flag::Selected : Flag(0))
| (onlyBackground ? Flag::OnlyBackground : Flag(0))
| Flag::SearchResult;
| Flag::SearchResult
| (showSavedMessages ? Flag::SavedMessages : Flag(0));
paintRow(
p,
row,