| 1089 | } |
| 1090 | |
| 1091 | void PeerData::fillNames() { |
| 1092 | _nameWords.clear(); |
| 1093 | _nameFirstLetters.clear(); |
| 1094 | auto toIndexList = QStringList(); |
| 1095 | auto appendToIndex = [&](const QString &value) { |
| 1096 | if (!value.isEmpty()) { |
| 1097 | toIndexList.push_back(TextUtilities::RemoveAccents(value)); |
| 1098 | } |
| 1099 | }; |
| 1100 | |
| 1101 | appendToIndex(name()); |
| 1102 | const auto appendTranslit = !toIndexList.isEmpty() |
| 1103 | && cRussianLetters().match(toIndexList.front()).hasMatch(); |
| 1104 | if (appendTranslit) { |
| 1105 | appendToIndex(translitRusEng(toIndexList.front())); |
| 1106 | } |
| 1107 | if (const auto user = asUser()) { |
| 1108 | if (user->nameOrPhone != name()) { |
| 1109 | appendToIndex(user->nameOrPhone); |
| 1110 | } |
| 1111 | appendToIndex(user->username()); |
| 1112 | if (isSelf()) { |
| 1113 | const auto english = u"Saved messages"_q; |
| 1114 | const auto localized = tr::lng_saved_messages(tr::now); |
| 1115 | appendToIndex(english); |
| 1116 | if (localized != english) { |
| 1117 | appendToIndex(localized); |
| 1118 | } |
| 1119 | } else if (isRepliesChat()) { |
| 1120 | const auto english = u"Replies"_q; |
| 1121 | const auto localized = tr::lng_replies_messages(tr::now); |
| 1122 | appendToIndex(english); |
| 1123 | if (localized != english) { |
| 1124 | appendToIndex(localized); |
| 1125 | } |
| 1126 | } else if (isVerifyCodes()) { |
| 1127 | const auto english = u"Verification Codes"_q; |
| 1128 | const auto localized = tr::lng_verification_codes(tr::now); |
| 1129 | appendToIndex(english); |
| 1130 | if (localized != english) { |
| 1131 | appendToIndex(localized); |
| 1132 | } |
| 1133 | } |
| 1134 | } else if (const auto channel = asChannel()) { |
| 1135 | appendToIndex(channel->username()); |
| 1136 | } |
| 1137 | auto toIndex = toIndexList.join(' '); |
| 1138 | toIndex += ' ' + rusKeyboardLayoutSwitch(toIndex); |
| 1139 | |
| 1140 | const auto namesList = TextUtilities::PrepareSearchWords(toIndex); |
| 1141 | for (const auto &name : namesList) { |
| 1142 | _nameWords.insert(name); |
| 1143 | _nameFirstLetters.insert(name[0]); |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | PeerData::~PeerData() = default; |
| 1148 |
nothing calls this directly
no test coverage detected