Show no results message in share box search.

This commit is contained in:
John Preston 2018-03-09 21:13:47 +03:00
parent 76cb5677b2
commit 33fe1b6389
1 changed files with 14 additions and 4 deletions

View File

@ -573,15 +573,23 @@ void ShareBox::Inner::paintEvent(QPaintEvent *e) {
++indexFrom; ++indexFrom;
} }
} else { } else {
// empty
p.setFont(st::noContactsFont); p.setFont(st::noContactsFont);
p.setPen(st::noContactsColor); p.setPen(st::noContactsColor);
p.drawText(
rect().marginsRemoved(st::boxPadding),
lang(lng_bot_no_chats),
style::al_center);
} }
} else { } else {
if (_filtered.isEmpty() && _byUsernameFiltered.empty()) { if (_filtered.isEmpty()
// empty && _byUsernameFiltered.empty()
&& !_searching) {
p.setFont(st::noContactsFont); p.setFont(st::noContactsFont);
p.setPen(st::noContactsColor); p.setPen(st::noContactsColor);
p.drawText(
rect().marginsRemoved(st::boxPadding),
lang(lng_bot_chats_not_found),
style::al_center);
} else { } else {
auto filteredSize = _filtered.size(); auto filteredSize = _filtered.size();
if (filteredSize) { if (filteredSize) {
@ -781,7 +789,9 @@ void ShareBox::Inner::peopleReceived(
const QVector<MTPPeer> &my, const QVector<MTPPeer> &my,
const QVector<MTPPeer> &people) { const QVector<MTPPeer> &people) {
_lastQuery = query.toLower().trimmed(); _lastQuery = query.toLower().trimmed();
if (_lastQuery.at(0) == '@') _lastQuery = _lastQuery.mid(1); if (_lastQuery.at(0) == '@') {
_lastQuery = _lastQuery.mid(1);
}
int32 already = _byUsernameFiltered.size(); int32 already = _byUsernameFiltered.size();
_byUsernameFiltered.reserve(already + my.size() + people.size()); _byUsernameFiltered.reserve(already + my.size() + people.size());
d_byUsernameFiltered.reserve(already + my.size() + people.size()); d_byUsernameFiltered.reserve(already + my.size() + people.size());