diff --git a/Telegram/SourceFiles/dialogs/dialogs_row.cpp b/Telegram/SourceFiles/dialogs/dialogs_row.cpp index 2e7412044e..8c84f930a8 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_row.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_row.cpp @@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/ripple_animation.h" #include "ui/text/text_options.h" +#include "ui/text/text_utilities.h" #include "dialogs/dialogs_entry.h" #include "data/data_folder.h" #include "data/data_peer_values.h" @@ -20,10 +21,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Dialogs { namespace { -QString ComposeFolderListEntryText(not_null folder) { +[[nodiscard]] TextWithEntities ComposeFolderListEntryText( + not_null folder) { const auto &list = folder->lastHistories(); if (list.empty()) { - return QString(); + return {}; } const auto count = std::max( @@ -39,11 +41,15 @@ QString ComposeFolderListEntryText(not_null folder) { ); const auto wrapName = [](not_null history) { const auto name = TextUtilities::Clean(history->peer->name); - return (history->unreadCount() > 0) - ? (textcmdStartSemibold() - + textcmdLink(1, name) - + textcmdStopSemibold()) - : name; + return TextWithEntities{ + .text = name, + .entities = (history->unreadCount() > 0) + ? EntitiesInText{ + { EntityType::Semibold, 0, int(name.size()), QString() }, + { EntityType::CustomUrl, 0, int(name.size()), QString() }, + } + : EntitiesInText{} + }; }; const auto shown = int(peers.size()); const auto accumulated = [&] { @@ -57,12 +63,19 @@ QString ComposeFolderListEntryText(not_null folder) { lt_accumulated, result, lt_chat, - wrapName(*i)); + wrapName(*i), + Ui::Text::WithEntities); } return result; }(); return (shown < count) - ? tr::lng_archived_last(tr::now, lt_count, (count - shown), lt_chats, accumulated) + ? tr::lng_archived_last( + tr::now, + lt_count, + (count - shown), + lt_chats, + accumulated, + Ui::Text::WithEntities) : accumulated; } @@ -277,7 +290,7 @@ void Row::validateListEntryCache() const { return; } _listEntryCacheVersion = version; - _listEntryCache.setText( + _listEntryCache.setMarkedText( st::dialogsTextStyle, ComposeFolderListEntryText(folder), Ui::DialogTextOptions()); @@ -288,4 +301,4 @@ FakeRow::FakeRow(Key searchInChat, not_null item) , _item(item) { } -} // namespace Dialogs \ No newline at end of file +} // namespace Dialogs