Removed text commands from dialogs row.
This commit is contained in:
parent
889d7c0c15
commit
10df3dce7c
|
@ -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<Data::Folder*> folder) {
|
||||
[[nodiscard]] TextWithEntities ComposeFolderListEntryText(
|
||||
not_null<Data::Folder*> 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<Data::Folder*> folder) {
|
|||
);
|
||||
const auto wrapName = [](not_null<History*> 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<Data::Folder*> 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());
|
||||
|
|
Loading…
Reference in New Issue